123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338 |
- <%
- /**** Pagina de login do site ****/
- // Local cLSite := "./" // Site
- Local cLTitle := "" // Titulo da pagina
- Local cLPagina := "" // Nome da página
- // Local cLHeader := ""
- Local cLTopo := ""
- Local cLMenus := ""
- Local cLWidgets := ""
- Local cLColunas := ""
- Local cLItens := ""
- Local cLJavaScr := ""
- Local aLStatGrid := {}
- local lLSidebar := .t.
- Local cLCodLogin := ""
- Local nInd
- if type("cSite") <> "U"
- cLSite := cSite
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cSite")
- Endif
- if type("cTitle") <> "U"
- cLTitle := cTitle
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cTitle")
- Endif
- if type("cPagina") <> "U"
- cLPagina := cPagina
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cPagina")
- Endif
- if type("cMenus") <> "U"
- cLMenus := cMenus
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cMenus")
- Endif
- if type("cWidgets") <> "U"
- cLWidgets := cWidgets
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cWidgets")
- Endif
- if type("cTopo") <> "U"
- cLTopo := cTopo
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cTopo")
- Endif
- if type("cColunas") <> "U"
- cLColunas := cColunas
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cColunas")
- Endif
- if type("cItens") <> "U"
- cLItens := cItens
- else
- conout(dtoc(date())+" " + time() + " Portal "+procname(1)+"("+cValToChar(procline(1))+") Faltou cItens")
- Endif
- if type("lSidebar") = "L"
- lLSidebar := lSidebar
- endif
- if type("aStatGrid") = "A"
- aLStatGrid := aclone(aStatGrid)
- Endif
- if type ("cCodLogin") <> "U"
- cLCodLogin := cCodLogin
- Endif
- if type("cJavaScr") <> "U"
- cLJavaScr := cJavaScr
- endif
- if type("cPerda") == "U"
- cPerda:= ""
- endif
- if type("cConcorrente") == "U"
- cConcorrente:= ""
- endif
- %>
- <!DOCTYPE html>
- <%if lLSidebar%>
- <html class="fixed">
- <%else%>
- <html class="fixed sidebar-left-collapsed">
- <%endif%>
- <head>
- <!-- Basic -->
- <meta charset="iso-8859-1">
- <link rel="shortcut icon" href="images/favicon.png" type="image/x-icon" />
- <title><%=cLTitle%></title>
- <meta name="keywords" content="<%=cLTitle%>" />
- <meta name="description" content="Portal <%=cLTitle%>">
- <meta name="author" content="SMSTI">
- <!-- Mobile Metas -->
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
- <!-- Web Fonts -->
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
- <!-- Vendor CSS -->
- <!-- <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" /> -->
- <!-- 20210106 -->
- <link rel="stylesheet" href="ndtb/Bootstrap-3.3.7/css/bootstrap.css" />
- <link rel="stylesheet" href="ndtb/datatables.css" />
- <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
- <link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
- <link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker3.css" />
- <!-- Specific Page Vendor CSS -->
- <link rel="stylesheet" href="assets/vendor/select2/css/select2.css" />
- <link rel="stylesheet" href="assets/vendor/select2-bootstrap-theme/select2-bootstrap.min.css" />
- <link rel="stylesheet" href="assets/vendor/jquery-datatables-bs3/assets/css/datatables.css" />
- <link rel="stylesheet" href="assets/vendor/dropzone/basic.css" />
- <link rel="stylesheet" href="assets/vendor/dropzone/dropzone.css" />
- <!-- 20210106 -->
- <link rel="stylesheet" href="ndtb/DataTables-1.10.23/css/dataTables.bootstrap.min.css" />
- <link rel="stylesheet" href="ndtb/Buttons-1.6.5/css/buttons.dataTables.min.css" />
- <!-- Theme CSS -->
- <link rel="stylesheet" href="assets/stylesheets/theme.css" />
- <!-- Skin CSS -->
- <link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
- <!-- Theme Custom CSS -->
- <link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
- <!-- Head Libs -->
- <script src="assets/vendor/modernizr/modernizr.js"></script>
- </head>
- <section class="body">
- <!-- start: header -->
- <header class="header">
- <div class="logo-container">
- <a href="<%= cLSite %>" class="logo pull-left">
- <img src="images/<%='logo'+cEmpAnt%>.png" alt="<%= cLTitle %>" height="45"/>
- </a>
- </div>
- <div class="header-right">
- <span class="separator"></span>
- <div id="userbox" class="userbox">
- <a href="#" data-toggle="dropdown">
- <div class="profile-info" data-lock-name="<%= HttpSession->Nome %>">
- <span class="name"><%= HttpSession->NomeFull %></span>
- <span class="role"><%= HttpSession->Perfil %></span>
- <span class="role"><%= HttpSession->NomeEmpresa %></span>
- </div>
- <i class="fa custom-caret"></i>
- </a>
- <div class="dropdown-menu">
- <ul class="list-unstyled">
- <li>
- <a role="menuitem" tabindex="-1" href="U_PortalLogin.apw"><i class="fa fa-power-off"></i>Sair</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </header>
- <!-- end: header -->
- <div class="inner-wrapper">
- <!-- start: sidebar -->
- <aside id="sidebar-left" class="sidebar-left">
-
- <div class="sidebar-header">
- <div class="sidebar-title">
- Menu
- </div>
- <%if lLSidebar%>
- <div class="sidebar-toggle" data-toggle-class="sidebar-left-opened" data-target="html" data-fire-event="sidebar-left-opened">
- <%else%>
- <div class="sidebar-toggle hidden-xs"data-toggle-class="sidebar-left-collapsed" data-target="html" data-fire-event="sidebar-left-toggle">
- <%endif%>
- <i class="fa fa-bars" aria-label="Toggle sidebar"></i>
- </div>
- </div>
-
- <div class="nano">
- <div class="nano-content">
- <nav id="menu" class="nav-main" role="navigation">
-
- <ul class="nav nav-main">
- <%=cLMenus%>
- </ul>
- </nav>
- </div>
-
- <script>
- // Maintain Scroll Position
- if (typeof localStorage !== 'undefined') {
- if (localStorage.getItem('sidebar-left-position') !== null) {
- var initialPosition = localStorage.getItem('sidebar-left-position'),
- sidebarLeft = document.querySelector('#sidebar-left .nano-content');
-
- sidebarLeft.scrollTop = initialPosition;
- }
- }
- </script>
- </div>
-
- </aside>
- <!-- end: sidebar -->
- <section role="main" class="content-body">
- <header class="page-header">
- <h2><%=cLPagina%></h2>
- <div class="right-wrapper pull-right">
- </div>
- </header>
- <!-- start: page -->
- <section class="panel">
- <!--
- <header class="panel-heading">
- <div class="panel-actions">
- <a href="#" class="panel-action panel-action-toggle" data-panel-toggle></a>
- <a href="#" class="panel-action panel-action-dismiss" data-panel-dismiss></a>
- </div>
-
- <h2 class="panel-title">Basic with Table Tools</h2>
- </header>
-
- -->
- <div class="panel-body">
- <%=cLTopo%>
- <br>
- <br>
- <%if lTableTools%>
- <table class="table table-bordered table-striped mb-none table-hover" id="datatable-tabletools" style="width: 100%;">
- <%else%>
- <table class="table table-bordered mb-none" style="width: 100%;">
- <%endif%>
- <thead>
- <tr>
- <%=cLColunas%>
- </tr>
- </thead>
- <tbody>
- <%=cLItens%>
- </tbody>
- </table>
- </div>
- <%if len(aLStatGrid) > 0 %>
- <div class="panel-footer">
- <table class="table">
- <tr>
- <% for nInd := 1 to len(aLStatGrid)
- if (nInd % 2) = 1 %>
- <th align="right"><span class="smcircle sm<%= aLStatGrid[nInd, 1] %>"></span></th><th><%= aLStatGrid[nInd, 2] %></th>
- <% else %>
- <th><span class="smcircle sm<%= aLStatGrid[nInd, 1] %>"></span></th><th><%= aLStatGrid[nInd, 2] %></th>
- <% endif
- next %>
- </tr>
- </table>
- </div>
- <% endif %>
- </section>
- <!-- end: page -->
-
- </section>
- <footer class="panel-footer text-right">
- Desenvolvido por <img src="images/sms.png" />
- </footer>
- </div>
- </section>
- <!-- Vendor -->
- <script src="assets/vendor/jquery/jquery.js"></script>
- <!-- 20210106 -->
- <script src="ndtb/jQuery-3.5.1/jquery-3.5.1.js"></script>
- <script src="ndtb/datatables.js"></script>
- <script src="assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
- <script src="assets/vendor/bootstrap/js/bootstrap.js"></script>
- <!-- 20210106 -->
- <script src="ndtb/Bootstrap-3.3.7/js/bootstrap.js"></script>
- <script src="assets/vendor/nanoscroller/nanoscroller.js"></script>
- <script src="assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
- <script src="assets/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.pt-BR.min.js"></script>
- <script src="assets/vendor/magnific-popup/jquery.magnific-popup.js"></script>
- <script src="assets/vendor/jquery-placeholder/jquery-placeholder.js"></script>
-
- <!-- Custom -->
- <script src="custom/js/bootbox.js"></script>
- <script src="custom/js/moeda.js"></script>
-
- <!-- Specific Page Vendor -->
- <script src="assets/vendor/select2/js/select2.js"></script>
- <script src="assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
- <script src="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.js"></script>
- <!-- 20210106 -->
- <script src="ndtb/DataTables-1.10.23/js/jquery.dataTables.js"></script>
- <script src="assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
- <script src="assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
- <!-- 20210106 -->
- <script src="ndtb/DataTables-1.10.23/js/dataTables.bootstrap.js"></script>
- <script src="ndtb/Buttons-1.6.5/js/dataTables.buttons.min.js"></script>
- <script src="ndtb/JSZip-3.1.3/jszip.min.js"></script>
- <script src="ndtb/pdfmake-0.1.53/pdfmake.min.js"></script>
- <script src="ndtb/pdfmake-0.1.53/vfs_fonts.js"></script>
- <script src="ndtb/Buttons-1.6.5/js/buttons.html5.js"></script>
- <script src="ndtb/Buttons-1.6.5/js/buttons.print.min.js"></script>
- <script src="assets/vendor/dropzone/dropzone.js"></script>
- <script src="custom/js/dropzone.js"></script>
- <!-- Theme Base, Components and Settings -->
- <script src="assets/javascripts/theme.js"></script>
-
- <!-- Theme Initialization Files -->
- <script src="assets/javascripts/theme.init.js"></script>
- <!--
- <script src="assets/javascripts/tables/examples.datatables.default.js"></script>
- <script src="assets/javascripts/tables/examples.datatables.row.with.details.js"></script>
- <script src="js/examples/examples.advanced.form.js"></script>
- <%if lTableTools%>
- <script src="assets/javascripts/tables/examples.datatables.tabletools.js"></script>
- <%else%>
- <script src="assets/javascripts/tables/examples.datatables.tabletools.nd.js"></script>
- <%endif%>
- -->
- <!-- Theme Custom -->
- <script src="assets/javascripts/theme.custom.js"></script>
- <script src="custom/js/datebr.js"></script>
-
- <script>
- $(document).ready( function() {
- $("#datatable-tabletools").attr("role","button");
- // Antigamente
- // var oTable = $('#datatable-tabletools').dataTable();
-
- // Criacao da datatable
- var oTable = $('#datatable-tabletools').dataTable( {
- dom: 'lBfrtip',
- buttons: [
- 'excel', 'pdf', 'print'
- ]
- <%if ! lTableTools%>
- , "ordering": false
- , "searching": false
- <%endif%>
- , "scrollX": true
- });
- var url_atual = window.location.href;
-
- //Ordenacao da tabela
- oTable.fnSort( [ ] );
-
- if( url_atual.match('orcamento.apw') || url_atual.match('Orcamento.apw'))
- {
- oTable.fnSort( [1, 'desc' ] );
- }else if( url_atual.match('pedidos.apw') || url_atual.match('Pedidos.apw') ){
- oTable.fnSort( [1, 'desc' ] );
- }
-
- //Valida os percentuais no bot�o filtrar para curva ABC
- $('#btFiltroP').click(function() {
- var nPercA = parseFloat($("#PERC_A").val());
- var nPercB = parseFloat($("#PERC_B").val());
- var nPercC = parseFloat($("#PERC_C").val());
-
- if (nPercA+nPercB+nPercC != 100){
- bootbox.alert("A soma dos percentuais de A, B e C deve ser 100!");
- $(this).removeAttr('disabled');
- return false;
- }
- });
- $(window).on('sidebar-left-toggle', function() {
- $($.fn.dataTable.tables(true)).DataTable().columns.adjust();
- })
- /*
- Modal Dismiss
- */
- // $(document).on('click', '.modal-dismiss', function (e) {
- // $('.modal-dismiss').on('click touch touchstart', function (e) {
- // e.preventDefault();
- // $.magnificPopup.close();
- // });
- /*
- Modal Confirm
- */
- // $(document).on('click', '.modal-confirm', function (e) {
- // e.preventDefault();
- // $.magnificPopup.close();
- // var cemail = $("input[name='email']").val();
- // var cdoc = $("input[name='nrdoc']").val();
- // var cform = $("input[name='formDest']").val();
- //
- // var dialogMail = bootbox.dialog({
- // message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Enviando e-mail... Aguarde...</p>',
- // closeButton: false
- // });
- //
- // //Envio de e-mail
- // $.ajax({
- // url: "U_"+cform+"?PR=<%=cLCodLogin%>",
- // data: 'email='+cemail+'&pagina='+cform+'&doc='+cdoc,
- // type: "POST",
- // async: false,
- // success:
- // function(retorno) {
- // dialogMail.modal('hide');
- // if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- // $("html").html(retorno);
- // return;
- // }
- // bootbox.alert(retorno);
- // }
- // });
- //});
-
- /*
- Form
- */
- $('.modal-email').magnificPopup({
- type: 'inline',
- preloader: false,
- focus: '#email',
- modal: true,
-
- // When elemened is focused, some mobile browsers in some cases zoom in
- // It looks not nice, so we disable it:
- callbacks: {
- beforeOpen: function() {
- if($(window).width() < 700) {
- this.st.focus = false;
- } else {
- this.st.focus = '#email';
- }
- },
- elementParse: function(item) {
- // Function will fire for each target element
- // "item.el" is a target DOM element (if present)
- // "item.src" is a source that you may modify
- console.log('Parsing content. Item object that is being parsed:', item);
- if (item.el && item.el.attr("id")) {
- $("input[name='nrdoc']").val(item.el.attr("id").substr(2));
- }
- }
- }
- });
-
- });
-
- function abreEmail(cParm,cEmail) {
- $("input[name='nrdoc']").val(cParm);
- $("input[name='email']").val(cEmail);
-
- $('.modal-email').magnificPopup({
- items: {
- src: '#modalEmail'
- },
- type: 'inline',
- preloader: false,
- focus: '#email',
- modal: true
- }).magnificPopup('open');
- }
- function fecharEmail() {
- $.magnificPopup.close();
- return false;
- };
- function enviarEmail() {
- $.magnificPopup.close();
- var cemail = $("input[name='email']").val();
- var cdoc = $("input[name='nrdoc']").val();
- var cform = $("input[name='formDest']").val();
-
- var dialogMail = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Enviando e-mail... Aguarde...</p>',
- closeButton: false
- });
-
- //Envio de e-mail
- $.ajax({
- url: "U_"+cform+"?PR=<%=cLCodLogin%>",
- data: 'email='+cemail+'&pagina='+cform+'&doc='+cdoc,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- dialogMail.modal('hide');
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- bootbox.alert(retorno);
- }
- });
- return false;
- }
-
- /*
- Efetivação do orçamento
- */
- function efetivaOrc(cNumOrc,cRecOrc) {
- bootbox.dialog({
- title: "Efetivar Orçamento",
- message: "Confirma a efetivação do orçamento "+cNumOrc+"?",
- buttons: {
- cancel: {
- label: 'Não'
- },
- sucess: {
- label: 'Sim',
- callback: function () {
- $('.bootbox.modal').modal('hide');
- var dialogEftv = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Efetivando orçamento. Aguarde...</p>',
- closeButton: false
- });
- //Efetiva o orçamento
- $.ajax({
- url: "U_GeraEfetiva.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: 'recorc='+cRecOrc,
- cache: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- dialogEftv.modal('hide');
- $("html").html(retorno);
- return;
- }
- if (retorno == "") {
- dialogEftv.modal('hide');
- bootbox.alert('Falha ao efetivar o orçamento. Tente novamente mais tarde.');
- }else{
- dialogEftv.modal('hide');
-
- bootbox.confirm({
- title: "Efetivação do Orçamento",
- message: retorno,
- buttons: {
- cancel: {
- label: 'Cancelar'
- },
- confirm: {
- label: 'OK'
- }
- },
- callback: function (result) {
- if (result){
- location.href='u_Orcamento.apw?PR=<%=cLCodLogin%>'
- }
- }
- });
- }
- }
- });
- }
- }
- }
- });
- }
- /*
- Cancelamento do orçamento
- */
- function cancelaOrc(cNumOrc,cRecOrc){
- $("#numOrc").val(cNumOrc);
- $("#recOrc").val(cRecOrc);
- montaModal(cNumOrc,cRecOrc);
- }
- /*
- Monta a modal do cancelamento
- */
- function montaModal(numOcto,recOcto){
- msg = '<div class="row form-group">'
- msg +=' <header class="panel-heading">'
- msg +=' <h2 class="panel-title">Cancelar Orçamento '+numOcto+'</h2>'
- msg +=' </header>'
- msg +=' <br>'
- //Código perda
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-9">'
- msg +=' <label class="control-label">Motivo da perda</label>'
- msg +=' <div class="input-group">'
- msg +=' <select data-plugin-selectTwo class="form-control populate placeholder mb-md" data-plugin-options='+"'"
- msg +=' { "placeholder": "Selecione...", "allowClear": false }'+"'"+' name="CJ_CODPERD'+numOcto+'" id="CJ_CODPERD'+numOcto+'"'
- msg +=' required="" aria-required="true">'
- msg +=' <%=cPerda%>'
- msg +=' </select>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
-
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-9">'
- msg +=' <label class="control-label">Concorrente</label>'
- msg +=' <div class="input-group">'
- msg +=' <select data-plugin-selectTwo class="form-control populate placeholder mb-md" data-plugin-options='+"'"
- msg +=' { "placeholder": "Selecione...", "allowClear": false }'+"'"+' name="CJ_CDCONCO'+numOcto+'" id="CJ_CDCONCO'+numOcto+'"'
- msg +=' required="" aria-required="true">'
- msg +=' <%=cConcorrente%>'
- msg +=' </select>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
-
- msg +='</div>'
-
- if(msg != ""){
- bootbox.dialog({
- title: '',
- message: "<p>"+msg+"</p>",
- backdrop: true,
- buttons: {
- cancel: {
- label: "Cancelar"
- },
- sucess:{
- label: "Confirmar",
- callback: function () {
- var codPerda = $("#CJ_CODPERD"+numOcto).val();
- var codConc = $("#CJ_CDCONCO"+numOcto).val();
- if(codPerda==""){
- bootbox.alert("Informe o motivo da perda!")
- $("#CJ_CODPERD"+numOcto).focus();
- return false;
- }
- if(codPerda.substr(0,1)=="S" && codConc =="" ){
- bootbox.alert("Para esse motivo de cancelamento é obrigatório informar o concorrente!")
- $("#CJ_CDCONCO"+numOcto).focus();
- return false;
- }
- $('.bootbox.modal').modal('hide');
- var dialogCanc = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Cancelando o orçamento. Aguarde...</p>',
- closeButton: false
- });
- //Cancela o orçamento
- $.ajax({
- url: "U_GeraCancela.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: 'recorc='+recOcto+'&codperda='+codPerda+'&concorrente='+codConc,
- cache: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- $('.bootbox.modal').modal('hide');
- return;
- }
- if (retorno == "") {
- bootbox.alert('Falha ao cancelar o orçamento. Tente novamente mais tarde.');
- }else{
- $('.bootbox.modal').modal('hide');
- //bootbox.alert("Orçamento cancelado com sucesso!");
-
- bootbox.dialog({
- title: '',
- message: "Orçamento cancelado com sucesso!",
- backdrop: true,
- buttons: {
- sucess:{
- label: "OK",
- callback: function () {
- location.href='u_Orcamento.apw?PR=<%=cLCodLogin%>'
- }
-
- }
- }
- });
- }
- }
- });
- }
- }
- }
- });
- }
- }
- //ViewDanfe
- function ViewDanfe(notaFiscal,tipo){
- $.ajax({
- url: "U_MailNF.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: 'email=&doc='+notaFiscal+'&tipo='+tipo,
- cache: false,
- success:
- function(docDanfe) {
- if (docDanfe.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(docDanfe);
- return;
- }
- if (docDanfe == "" || docDanfe.indexOf('Falha') >= 0 ) {
- bootbox.alert('Falha ao gerar o arquivo. Tente novamente mais tarde.');
- }
- if (docDanfe.substr(0,5) == "DANFE") {
- window.open('/anexos/danfe/'+docDanfe,"_blank")
- }
- }
- });
- }
-
- //Impressão do Orçamento
- function PrtOrc(orcto){
- $.ajax({
- url: "U_MailOrc.apw?PR=<%=cLCodLogin%>&opc=print",
- type: "POST",
- data: 'opc=print&doc='+orcto,
- cache: false,
- success:
- function(docOrcto) {
- if (docOrcto.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(docOrcto);
- return;
- }
- if (docOrcto == "" ) {
- bootbox.alert('Falha ao gerar o arquivo. Tente novamente mais tarde.');
- }
- if (docOrcto.substr(0,9) == "orcamento") {
- window.open('/anexos/orcamentos/'+docOrcto,"_blank")
- }
- }
- });
- }
-
-
- function Filtro(){
-
- if( window.location.href.match('estoque.apw') || window.location.href.match('Estoque.apw')){
-
- var cliSel = $("#CLIENTE").val();//Cliente
- var tpCli = $("#TPCLI").val();//Tipo Cliente
- var estFat = $("#EST_FAT").val();//Estado faturamento
- var estEntre = $("#EST_ENTRE").val();//Estado entrega
- var munEntre = $("#MUN_ENTRE").val()//Municipio entrega
- //var grupoSel = $("#GRUP_PROD").val();//Grupo produto
- var _oportun = $("#OPORTUN").val();//Oportunidade
- var btFiltro = document.getElementById("btFiltro");
- var lRetFil = true;
- if(cliSel == '' && (estFat == "" || tpCli == "")) {
- bootbox.alert("Campos Tipo/Estado de faturamento vazios.");
- lRetFil = false;
- btFiltro.value="Consultar";
- $("#CLIENTE").focus();
- return;
-
- }
- if (tpCli == ""){
- bootbox.alert("Campo Tipo Vazio.");
- lRetFil = false;
- btFiltro.value="Consultar";
- return;
- }
- if (estFat == ""){
- bootbox.alert("Campo Estado Faturamento Vazio.");
- $("#EST_FAT").focus();
- btFiltro.value="Consultar";
- lRetFil = false;
- return;
- }
- if (estEntre == ""){
- bootbox.alert("Campo Estado Entrega Vazio.");
- $("#EST_ENTRE").focus();
- btFiltro.value="Consultar";
- lRetFil = false;
- return;
- }
- if (munEntre == ""){
- bootbox.alert("Campo Municipio Entrega Vazio.");
- $("#MUN_ENTRE").focus();
- btFiltro.value="Consultar";
- lRetFil = false;
- return;
- }
- //if (grupoSel == ""){
- // bootbox.alert("Campo Grupo V�zio.");
-
- // lRetFil = false;
- // return;
- // }
- if (_oportun == ""){
- bootbox.alert("Campo Oportunidade Vazio.");
- $("#OPORTUN").focus();
- btFiltro.value="Consultar";
- lRetFil = false;
- return;
- }
- if (lRetFil){
- //$("#GRUPOP").val(grupoSel);
- $("#FILTROP").val('001');
- $("#formGrid").submit();
- }
- } else {
- //Submete formulario
- $("#formGrid").submit();
- }
- }
-
- function GerarBoletos(){
- var noCheckedBox = true;
- var oBtnBol = $("#btBoleto");
- if (document.querySelectorAll("input[type=checkbox]").length>1){
- oBtnBol.attr("disabled","");
- document.querySelectorAll("input[type=checkbox]").forEach(e=> {
- if (e.checked) {
- noCheckedBox = false;
- }
- })
- if (noCheckedBox){
- bootbox.alert("Selecione pelo menos 1 título!");
- oBtnBol.removeAttr("disabled");
- } else {
- document.querySelectorAll("input[type=checkbox]").forEach(e=> {
- if (e.checked) {
- ViewBoleto(e.value);
- e.checked=false;
- }
- })
- bootbox.alert("Aguarde... Os boletos serão gerados em breve!");
- oBtnBol.removeAttr("disabled");
- }
- } else {
- bootbox.alert("Sem títulos para geração de boleto!");
- oBtnBol.removeAttr("disabled");
- }
- }
- /*
- function Filtro(obBtn){
- // this.value= '+"'"+'Aguarde...'+"'"+';this.disabled= '+"'"+'disabled'+"'"+';
- obBtn.disabled = true;
- //Submete formulario
- $("#formGrid").submit();
- } */
-
- function Filtrar(obBtn){
- // this.value= '+"'"+'Aguarde...'+"'"+';this.disabled= '+"'"+'disabled'+"'"+';
- obBtn.disabled = true;
- //Submete formulario
- $("#formGrid").submit();
- console.log("Formulário enviado!");
- }
-
-
-
- /**
- // Função para ver detalhes do limite
- **/
- function detLimite(cCliente){
- var msg = "";
- var total = "";
- var pedlib = "";
- var pedidos = "";
- var titulos = "";
- var saldo = "";
- var vencto = "";
- var risco = "";
- var orcprev = "";
- var orcfirme = "";
- var atraso = "";
- var utilizado = "";
-
- $.ajax({
- url: "U_ConsLmt.apw?PR=<%=cLCodLogin%>",
- data: 'cliente='+cCliente,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- aRet = retorno.split('|');
- total = aRet[0];
- pedlib = aRet[1];
- titulos = aRet[2];
- saldo = aRet[3];
- vencto = aRet[4];
- risco = aRet[5];
- pedidos = aRet[6];
- orcprev = aRet[7];
- orcfirme = aRet[8];
- atraso = aRet[9];
- utilizado = aRet[10];
- }
- });
-
- msg = '<div class="row form-group">'
- msg +=' <br>'
- //Limite Total
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-5">'
- msg +=' <label class="control-label">Limite Total</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+total+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' <div class="col-lg-5">'
- msg +=' <label class="control-label">Limite Disponível</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+saldo+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
-
- //CREDITO
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-5">'
- msg +=' <label class="control-label">Limite Utilizado</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+utilizado+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' <div class="col-lg-5">'
- msg +=' <label class="control-label">Saldo em títulos</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+titulos+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-5">'
- msg +=' <label class="control-label">Valor em atraso</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+atraso+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- // msg +=' <div class="col-lg-3">'
- // msg +=' <label class="control-label">Vencimento Limite</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+vencto+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' <div class="col-lg-2">'
- // msg +=' <label class="control-label">Risco</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+risco+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' </div>'
-
- //Pedidos
- // msg +=' <div class="row form-group">'
- // msg +=' <div class="col-lg-1"></div>'
- // msg +=' <div class="col-lg-5">'
- // msg +=' <label class="control-label">Pedidos em Aberto</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+pedidos+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' <div class="col-lg-5">'
- // msg +=' <label class="control-label">Pedidos Liberados</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+pedlib+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' </div>'
-
- //Orçamentos
- // msg +=' <div class="row form-group">'
- // msg +=' <div class="col-lg-1"></div>'
- // msg +=' <div class="col-lg-5">'
- // msg +=' <label class="control-label">Orçamentos Previstos</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+orcprev+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' <div class="col-lg-5">'
- // msg +=' <label class="control-label">Orçamentos Firmes</label>'
- // msg +=' <div class="input-group">'
- // msg +=' <input class="form-control text-right" value="'+orcfirme+'" disabled>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +=' </div>'
- // msg +='</div>'
-
-
- if(msg != ""){
- bootbox.dialog({
- title: 'Limite de Crédito',
- message: "<p>"+msg+"</p>",
- backdrop: true,
- buttons: {
- ok: {
- label: "OK"
- }
- }
- });
- }
- }
-
- /**
- // Função para enviar msg ao financeiro
- **/
- function mensagemFin(cRecCli){
- $("#recCliente").val(cRecCli);
- $("#dialogMsgFin").modal('show');
- }
-
- /**
- // Função para envio de e-mail ao financeiro
- **/
- function emailFin(cRecCli){
-
- //aguardar
- var x = [];
- var cAnexos = "";
- var cMensagem = $("#textoMensagem").val();
- var dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Enviando e-mail... Aguarde...</p>',
- closeButton: false
- });
- $('#dialogMsgFin').modal('hide');
- $(".dz-filename").each(function() { x.push($(this).text())});
- for (i = 0; i < x.length; i++) {
- cAnexos += x[i]+"|";
- }
- oObjDados = {'cliente': cRecCli, 'mensagem': cMensagem, 'anexos':cAnexos};
-
- $.ajax({
- url: "U_EnvMsgFin.apw?PR=<%=cLCodLogin%>",
- //data: 'cliente='+cRecCli+'&mensagem='+cMensagem+'&anexos='+cAnexos,
- data: oObjDados,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- } else {
- //remove aguarde
- dialogTab.modal('hide');
- $('.bootbox.modal').modal('hide');
- bootbox.alert("Mensagem enviada com sucesso!");
- //document.location.href = "U_LimiteCredito.apw?PR=<%=cLCodLogin%>" ;
- }
- }
- });
-
- }
-
- /**
- // Função para buscar as filiais que o vendedor tem acesso
- **/
- function getFilVend(){
- var msg = "";
- var cFilVend = "";
- var lRet = false;
- var tipoTit = "Orçamento"
- $.ajax({
- url: "U_FilVend.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- if(retorno != "" && retorno.indexOf("Expires") == -1) {
- url_atual = window.location.href;
- if (url_atual.match('pedidos.apw') || url_atual.match('Pedidos.apw')) {
- tipoTit = "Pedido"
- }
- msg = '<div class="row form-group">'
- msg +=' <br>'
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-9">'
- msg +=' <label class="control-label">Selecione a filial para geração do '+tipoTit+'</label>'
- msg +=' <div class="input-group">'
- msg +=' <select data-plugin-selectTwo class="form-control populate placeholder mb-md" data-plugin-options='+"'"
- msg +=' { "placeholder": "Selecione...", "allowClear": false }'+"'"+' name="FILVEND" id="FILVEND" '
- msg +=' required="" aria-required="true">'
- msg += retorno
- msg +=' </select>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- msg +='</div>'
-
-
- if(msg != ""){
- bootbox.dialog({
- title: 'Filial Para '+tipoTit,
- message: "<p>"+msg+"</p>",
- backdrop: true,
- closeButton: false,
- onEscape: false,
- buttons: {
- cancel: {
- label: "Cancelar"
- },
- sucess: {
- label: "OK",
- callback: function () {
- cFilVend = $("#FILVEND").val();
- $('.bootbox.modal').modal('hide');
-
-
- //Chama função para trocar de filial
- $.ajax({
- url: "U_TrocaFil.apw?PR=<%=cLCodLogin%>",
- data: 'filial='+cFilVend,
- type: "POST",
- async: false,
- success:
- function(retfil) {
- if (retfil.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retfil);
- return;
- }
- if(retfil != "" && retfil.indexOf("Expires") == -1) {
- url_atual = window.location.href;
- if( url_atual.match('orcamento.apw') || url_atual.match('Orcamento.apw')){
- //if(location.pathname.indexOf('U_orcamento')>0){
- location.href='u_AddOrc.apw?PR=<%=cLCodLogin%>'
- } else if (url_atual.match('pedidos.apw') || url_atual.match('Pedidos.apw')) {
- location.href='u_AddPed.apw?PR=<%=cLCodLogin%>'
- } else {
- location.href='u_AddCF.apw?PR=<%=cLCodLogin%>'
- }
- } else {
- bootbox.alert("Falha ao logar na filial "+cFilVend+".");
- }
- }
- });
- }
- }
- },
- });
- }
- } else {
- $('.bootbox.modal').modal('hide');
- bootbox.alert("Falha ao localizar as filiais que o vendedor tem acesso.");
- }
- }
- });
-
-
- }
-
- /**
- // Função para buscar a filial para inclusão da venda agregada
- **/
- function getFilial(){
- var msg = "";
- var cFilVend = "";
- var lRet = false;
-
- $.ajax({
- url: "U_FilVend.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- if(retorno != "" && retorno.indexOf("Expires") == -1) {
-
- msg = '<div class="row form-group">'
- msg +=' <br>'
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-9">'
- msg +=' <label class="control-label">Selecione a filial para inclusão da venda</label>'
- msg +=' <div class="input-group">'
- msg +=' <select data-plugin-selectTwo class="form-control populate placeholder mb-md" data-plugin-options='+"'"
- msg +=' { "placeholder": "Selecione...", "allowClear": false }'+"'"+' name="FILVEND" id="FILVEND" '
- msg +=' required="" aria-required="true">'
- msg += retorno
- msg +=' </select>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- msg +='</div>'
-
-
- if(msg != ""){
- bootbox.dialog({
- title: 'Filial Venda Agregada',
- message: "<p>"+msg+"</p>",
- backdrop: true,
- closeButton: false,
- onEscape: false,
- buttons: {
- sucess: {
- label: "OK",
- callback: function () {
- cFilVend = $("#FILVEND").val();
- $('.bootbox.modal').modal('hide');
-
-
- //Chama função para trocar de filial
- $.ajax({
- url: "U_TrocaFil.apw?PR=<%=cLCodLogin%>",
- data: 'filial='+cFilVend,
- type: "POST",
- async: false,
- success:
- function(retfil) {
- if (retfil.indexOf('HTTP-EQUIV') >= 0 ) {
- $("html").html(retfil);
- return;
- }
- if(retfil != "" && retfil.indexOf("Expires") == -1) {
- location.href='u_AgregarVenda.apw?PR=<%=cLCodLogin%>'
- } else {
- bootbox.alert("Falha ao logar na filial "+cFilVend+".");
- }
- }
- });
- }
- }
- },
- });
- }
- } else {
- $('.bootbox.modal').modal('hide');
- bootbox.alert("Falha ao localizar as filiais que o vendedor tem acesso.");
- }
- }
- });
-
-
- }
- function SelectCli() {
- var clienteSelect = document.getElementById("CLIENTE");
- var tipoCliSel = document.getElementById("TPCLI");
- var estCliSel = document.getElementById("EST_FAT");
- var estEntSel = document.getElementById("EST_ENTRE");
- var munCliSel = document.getElementById("MUN_ENTRE");
- //var grupoCliSel = document.getElementById("GRUP");
-
- var selectedOption = clienteSelect.options[clienteSelect.selectedIndex];
- var tipoCliVal = selectedOption.getAttribute("TIPO");
- var estadoCliVal = selectedOption.getAttribute("EST");
- var entregaCliVal = selectedOption.getAttribute("ESTE");
- var munCliVal = selectedOption.getAttribute("MUN");
- //var grupoCliVal = selectedOption.getAttribute("GRUPO");
- tipoCliSel.value = tipoCliVal;
- estCliSel.value = estadoCliVal;
- estEntSel.value = entregaCliVal;
- munCliSel.value = munCliVal;
- //grupoCliSel.value = grupoCliVal;
- $("select[name=TPCLI]").change();
- $("select[name=EST_FAT]").change();
- $("select[name=EST_ENTRE]").change();
- $("select[name=MUN_ENTRE]").change();
- }
- function retMunicipios(cMunE) {
- var cEst = document.getElementById('EST_ENTRE').value;//element.value;
- var cCli = document.getElementById('CLIENTE').value;
- var cMun = cMunE//document.getElementById('MUN_ENTRE').value;
- $.ajax({
- url: "U_RetMun.apw?PR=<%=cLCodLogin%>",
- data: 'cEst='+cEst + '&cCli='+cCli,
- type: "POST",
- async: false,
- success:
- function(municipios) {
- if (municipios.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(municipios);
- return;
- }
- if ( municipios == "" ) {
- bootbox.alert('Nenhum Mucicipio Listado!');
- $("#EST_FAT").focus();
- }else{
- $('#MUN_ENTRE').empty();
- $("#MUN_ENTRE").append(municipios);
- $("select[name=MUN_ENTRE]").change();
- }
- }
- });
-
- }
-
- <%=cLJavaScr%>
-
-
- </script>
-
- </body>
- </html>
|