123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023 |
- <%
- /**** Pagina de login do site ****/
- Local cLCodLogin := ""
- if type ("cCodLogin") <> "U"
- cLCodLogin := cCodLogin
- Endif
- %>
- <!DOCTYPE html>
- <html class="fixed sidebar-left-collapsed">
- <head>
- <!-- Basic -->
- <meta charset="iso-8859-1">
- <link rel="shortcut icon" href="images/favicon.png" type="image/x-icon" />
-
- <title><%=cTitle%></title>
-
- <meta name="keywords" content="<%=cTitle%>" />
- <meta name="description" content="<%=cTitle%>">
- <meta name="author" content="SMSTI">
- <meta http-equiv="Chache-Control" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <meta http-equiv="Pragma" content="no-cache" />
-
- <!-- 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" />
- <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" />
- <link rel="stylesheet" href="assets/vendor/bootstrap-select/css/bootstrap-select.min.css" />
- <style>
- body .btn {
- white-space: nowrap !important;
- display: inline;
- overflow-y: hidden;
- }
-
- </style>
- <!-- 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/bootstrap-fileupload/bootstrap-fileupload.min.css" />
- <link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />
- <link rel="stylesheet" href="assets/vendor/dropzone/basic.css" />
- <link rel="stylesheet" href="assets/vendor/dropzone/dropzone.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>
- <script src="assets/vendor/style-switcher/style.switcher.localstorage.js"></script>
-
- </head>
- <body>
- <section class="body">
-
- <!-- start: header -->
- <header class="header">
- <%=cHeader%>
- </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>
-
- <div class="sidebar-toggle hidden-xs"data-toggle-class="sidebar-left-collapsed" data-target="html" data-fire-event="sidebar-left-toggle">
- <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">
- <%=cMenus%>
- </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><%=cPagina%></h2>
-
- <div class="right-wrapper pull-right">
- </div>
- </header>
-
- <!-- start: page -->
- <section class="panel">
- <!-- <header class="panel-heading">
- </header> -->
- <div class="panel-body">
- <div class="row">
- <div class="col-lg-12">
- <section class="panel form-wizard" id="w9">
- <form action = "" method="post" class="form-horizontal" id="formOrc">
- <div class="tabs">
- <ul class="nav nav-tabs nav-justify">
- <li class="active">
- <a href="#orc-informar" data-toggle="tab" class="text-center">homologação</a>
- </li>
- <li class="">
- <a href="#orc-anexos" data-toggle="tab" class="text-center">Anexos</a>
- </li>
- </ul>
-
- <div class="tab-content">
- <div id="orc-informar" class="tab-pane active">
- <!--
- <%=cVendedor%>
- -->
- <!-- linha 0: dados da Oportunidade -->
- <%=cCodOpt%>
- <div class="mb-md hidden-lg hidden-xl"></div>
- <div class="mb-md hidden-lg hidden-xl"></div>
- <!-- linha 1: dados da empresa -->
- <div class="row form-group">
- <div class="col-lg-5">
- <span class="required">*</span>
- <label class="control-label">Descrição</label>
- <%=cDescri%>
- </div>
- <div class="col-lg-2">
- <span class="required">*</span>
- <label class="control-label">Início</label>
- <div class="input-group">
- <span class="input-group-addon">
- <i class="fa fa-calendar"></i>
- </span>
- <%=cInicio%>
- </div>
- </div>
- <div class="col-lg-2">
- <span class="required">*</span>
- <label class="control-label">Término</label>
- <div class="input-group">
- <span class="input-group-addon">
- <i class="fa fa-calendar"></i>
- </span>
- <%=cFim%>
- </div>
- </div>
- <!--
- <div class="col-lg-7">
- <label class="control-label">Complemento</label>
- <%=cComplem%>
- </div>
- -->
- </div>
-
-
- <!-- linha 2: input -->
- <div class="row form-group">
-
- <div class="col-lg-4">
- <span class="required">*</span>
- <label class="control-label">Regional</label>
- <%=cRegional%>
- </div>
- <div class="col-lg-5">
- <span class="required">*</span>
- <label class="control-label">Vendedor</label>
- <%=cVendedor%>
- </div>
-
- <div class="col-lg-2">
- <label class="control-label">% RT</label>
- <%=cRT%>
- </div>
- </div>
- <!-- linha 3 input -->
- <div class="row form-group">
-
- <div class="col-lg-5">
- <span class="required">*</span>
- <label class="control-label">Cliente</label>
- <%=cCliente%>
- </div>
- <div class="col-lg-7">
- <span class="required">*</span>
- <label class="control-label">Contato</label>
- <%=cContato%>
- </div>
- </div>
- <!--linha 4 input
- <div class="row form-group">
- <div class="col-lg-6">
- <label class="control-label">Email</label>
- <%=cEmail%>
- </div>
- <div class="col-lg-6">
- <label class="control-label">Parceiro</label>
- <%=cParceiro%>
- </div>
- </div>
- -->
- <!-- linha 5 input -->
- <div class="row form-group">
- <div class="col-lg-2">
- <span class="required">*</span>
- <label class="control-label">UF</label>
- <%=cUF%>
- </div>
- <div class="col-lg-4">
- <span class="required">*</span>
- <label class="control-label">Cidade</label>
- <%=cCidade%>
- </div>
-
- <div class="col-lg-6">
- <label class="control-label">Endereço</label>
- <%=cEndereco%>
- </div>
- </div>
- <!-- linha 6 input -->
- <div class="row form-group">
- <div class="col-lg-6">
- <label class="control-label">Especificadora</label>
- <%=cEspecif%>
- </div>
- <div class="col-lg-6">
- <label class="control-label">Contato</label>
- <%=cContEsp%>
- </div>
- </div>
-
- <!-- linha 7: input -->
- <div class="row form-group">
- <div class="col-lg-3">
- <span class="required">*</span>
- <label class="control-label">Status homologação</label>
- <%=cStatusHom%>
- </div>
-
- <div class="col-lg-3">
- <span class="required">*</span>
- <label class="control-label">Segmento</label>
- <%=cSegmento%>
- </div>
- <div class="col-lg-3">
- <span class="required">*</span>
- <label class="control-label">Nível</label>
- <%=cNivel%>
- </div>
-
- </div>
-
-
- <!-- linha 7 input
- <div class="row form-group">
- <div class="col-md-5">
- <label class="control-label" for="textareaDefault">Notas</label>
- <textarea class="form-control" rows="3" data-plugin-maxlength="" maxlength="240" id="AD1_MEMO" name="AD1_MEMO" <%=Iif(!lEdit,'disabled','')%>><%=cNotas%></textarea>
- </div>
- </div>
- -->
- <!-- linha 7 input -->
- <div class="row form-group">
- <div class="col-lg-3">
- <label class="control-label">Status</label>
- <%=cStatus%>
- </div>
-
- <div class="col-lg-3">
- <label class="control-label">Encerramento</label>
- <%=cEncer%>
- </div>
- <div class="col-md-5">
- <label class="control-label" for="textareaDefault">Motivo</label>
- <%=cMotivo%>
- </div>
- </div>
- <br>
- <br>
-
- <div class="row form-group" align="center">
- <%=cBotoes%>
- </div>
- </div>
- <!-- aba de anexos -->
- <div id="orc-anexos" class="tab-pane">
- <div class="row form-group" align="center">
- <%=cBtAddAnex%>
- </div>
- <div class="row mg-files" data-sort-destination data-sort-id="media-gallery" style="margin: 20px" id="OrcAnexos">
- <%=cAnexos%>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </form>
-
- <div class="modal fade" id="dialogAnex" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h4 class="modal-title" id="myModalLabel">Anexos</h4>
- </div>
- <div class="modal-body">
- <label class="control-label">Anexar Documentos</label>
- <form action="u_uploadfile.apw?PR=<%=cLCodLogin%>" method="POST" enctype="multipart/form-data" id="dropzone-form" class="dropzone dz-square dz-clickable">
- <div class="dz-default dz-message">
- <span>Clique ou arraste e solte os arquivos aqui</span>
- </div>
- </form>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" onclick="javascript:cancDoctos();">Cancelar</button>
- <button type="button" class="btn btn-primary" data-dismiss="modal">Confirmar</button>
- </div>
- </div>
- </div>
- </div>
- </section>
- </div>
- </div>
- </div>
- </section>
- <footer class="panel-footer text-right">
- Desenvolvido por <img src="images/sms.png" />
- </footer>
- </div>
- </section>
- <!-- end: page -->
-
- <!-- Vendor -->
- <script src="assets/vendor/jquery/jquery.js"></script>
- <script src="assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
- <script src="assets/vendor/bootstrap/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>
- <script src="assets/vendor/fuelux/js/spinner.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/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
- <script src="assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
- <script src="assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
- <script src="assets/vendor/bootstrap-maxlength/bootstrap-maxlength.js"></script>
- <script src="assets/vendor/autosize/autosize.js"></script>
- <script src="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.js"></script>
- <script src="assets/vendor/pnotify/pnotify.custom.js"></script>
- <script src="assets/vendor/bootstrap-select/bootstrap-select.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>
-
- <!-- Theme Custom -->
- <script src="assets/javascripts/theme.custom.js"></script>
-
- <script src="custom/js/jquery.maskMoney.js"></script>
- <script src="custom/js/portalMask.js"></script>
- <script type="text/javascript">
- var optModal = '<%=cOptMun%>';
- // Inicialize o Dropzone e adicione a funcionalidade de remoção
- Dropzone.autoDiscover = false; // Evitar que o Dropzone seja automaticamente inicializado.
- var myDropzone = new Dropzone("#dropzone-form", {
- url: "u_uploadfile.apw?PR=<%=cLCodLogin%>", // URL para o envio do arquivo
- addRemoveLinks: true, // Habilita o link de remoção
- dictRemoveFile: "Remover", // Texto do link de remoção
- init: function() {
- this.on("addedfile", function(file) {
- console.log("Arquivo adicionado: " + file.name);
- });
- // Aqui você pode adicionar algum comportamento adicional caso necessário, como
- // controlar o que acontece após o upload de um arquivo, se precisar.
- this.on("removedfile", function(file) {
- console.log("Arquivo removido: " + file.name);
- });
- }
- });
- /**
- Desabilita o enter na página
- **/
- $(function () {
- $('form').bind("keypress", function (e) {
- if (e.keyCode == 13) return false;
- });
- });
- //Remove as opções da tabela e adiciona o scroll
- $(document).ready(function () {
- $('#datatable-editable').DataTable({
- "scrollX": true,
- "ordering": false,
- "searching": false,
- "paging": false,
- "autoWidth": true,
- "info": false
- });
- $('.dataTables_length').addClass('.w-auto'); //ajusta o tamanho das colunas automaticamente
- });
- //Formata campos de moeda
- $(function() {
- //$('#iCK_PRCVEN01').maskMoney({thousands:'.', decimal:','});
- $('.myformato').maskMoney({thousands:'.', decimal:','});
- $('.percentual').maskMoney({thousands:'.', decimal:',', suffix:'%',allowNegative:true});
- })
-
- function formate() {
- $('.myformato').maskMoney({thousands:'.', decimal:','});
- $('.percentual').maskMoney({thousands:'.', decimal:',', suffix:'%',allowNegative:true});
- }
-
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
-
-
- /**
- Valida a data de Término da oportunidade
- **/
- function vldDtFim(){
- var dDtIni = $("#AD1_DTINI").val();
- var dRDtIni = dDtIni.split("/").reverse();
- var dDtFim = $("#AD1_DTFIM").val();
- var dRDtFim = dDtFim.split("/").reverse();
- var dNDtIni = new Date(dRDtIni);
- var dNDtFim = new Date(dRDtFim);
- if(dNDtFim < dNDtIni){
- bootbox.alert('A data final deve ser maior ou igual a data inicial!');
- $("#AD1_DTFIM").focus();
- }
- }
- /**
- Atualiza o select da cidade de acordo com o estado
- **/
- function SetCidade(){
- var estado = $("#AD1_UF").val();
- var dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Localizando os municípios... Aguarde...</p>',
- closeButton: false
- });
- $.ajax({
- url: "U_fSetCidade.apw?PR=<%=cLCodLogin%>",
- data: 'estado='+estado,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
-
- if ( retorno == "" && retorno.indexOf("Expires") == -1 ) {
- bootbox.alert('Falha ao localizar os municípios do estado '+estado+'.');
- }
- else {
-
- //Preenche o select das cidades
- document.getElementById('AD1_CIDADE').innerText = null;
- $("#AD1_CIDADE").append(retorno);
- optMun = retorno;
-
- $("#AD1_CIDADE").removeAttr('disabled');
- }
- }
- });
- dialogTab.modal('hide');
- }
- /**
- Valida a data de Término da oportunidade
- **/
- function vldStatus(){
- var cStatus = $("#AD1_STATUS").val();
-
- //Status perdido ou suspenso
- if(cStatus == '2' || cStatus == '3'){
- $("#AD1_ENCERR").removeAttr('disabled');
- $("#AD1_MTVENC").removeAttr('disabled');
- $("#AD1_ENCERR").focus();
- }else {
- $("#AD1_ENCERR").attr("disabled","");
- $("#AD1_MTVENC").attr("disabled","");
- $("#AD1_ENCERR").val("");
- $("#AD1_MTVENC").val("");
- }
- }
-
- //Salvar o orçamento
- $('#btSalvar').click(function() {
- var lRet = true
- var i = 0;
- var btnSlv = $(this);
- var dialogOrc = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Validando homologação. Aguarde...</p>',
- closeButton: false
- });
- //Desabilita o botão
- btnSlv.attr({ 'disabled': 'disabled' });
-
- $.ajax({
- url: "U_VerSessao.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- if (retorno == "nok"||retorno == ''||retorno.indexOf("Expires") != -1){
- $("#orc-informar").html();
- bootbox.alert('Não foi possível realizar a operação pois a sessão foi fechada. Faça login novamente.');
- lRet = false;
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
- }
- });
-
- /**
- Valida os campos obrigatorios
- **/
- //Cliente
- if ($("#AD1_CODCLI").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Cliente!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_CODCLI").focus();
- }
-
- //Descrição
- if (lRet == true && $("#AD1_DESCRI").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Descrição!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_DESCRI").focus();
- }
-
- //Data de Término
- if (lRet == true && $("#AD1_DTFIM").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Data Término!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_DTFIM").focus();
- }
-
- //Vendedor
- if (lRet == true && $("#AD1_VEND").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Vendedor!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_VEND").focus();
- }
-
- //Regional
- if (lRet == true && $("#AD1_REGION").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Regional!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_REGIONAL").focus();
- }
-
- //Estado
- if (lRet == true & $("#AD1_UF").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Estado!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_UF").focus();
- }
- //Cidade
- if (lRet == true & $("#AD1_CIDADE").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Cidade!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_CIDADE").focus();
- }
-
- if (lRet == true && $("#AD1_CONTCL").val() == "") {
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Contato!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_CONTCL").focus();
- }
- if (lRet == true && $("#AD1_STATUS").val() == "") {
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Status!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_STATUS").focus();
- }
-
- if (lRet == true && $("#AD1_STATUS").val()!= "") {
- //Suspensa/perdida
- if($("#AD1_STATUS").val() == "2" || $("#AD1_STATUS").val() == "3"){
- if ($("#AD1_ENCERR").val().trim()==""){
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Encerramento!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_ENCERR").focus();
- } else {
- if ($("#AD1_MTVENC").val().trim()==""){
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Motivo do Encerramento!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_MTVENC").focus();
- }
- }
- }
- }
- if (lRet == true && $("#AD1_HOMOLO").val() == "") {
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Status da homologação!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_HOMOLO").focus();
- }
- if (lRet == true && $("#AD1_SEGMEN").val() == "") {
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Segmento!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_SEGMEN").focus();
- }
- if (lRet == true && $("#AD1_NIVOPO").val() == "") {
- lRet = false;
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Nível!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#AD1_NIVOPO").focus();
- }
-
- //Valida a condição de pagamento
- if (lRet == true){
- dialogOrc.modal('hide');
- //Submete o formulário
- salvarOport(btnSlv);
-
- }
- })
- $('#btExcluir').click(function() {
- var lRet = true;
- var btnExc = $(this);
-
- //Desabilita o botão
- $('#btExcluir').attr({ 'disabled': 'disabled' });
-
- objDados = {
- AD1_FILIAL: $('#AD1_FILIAL').val(),
- AD1_NROPOR: $('#AD1_NROPOR').val()
- };
-
- $.ajax({
- type: "POST",
- url: "U_ExcOpt.apw?PR=<%=cLCodLogin%>",
- async: false,
- data: objDados
-
- }).fail(function(){
- bootbox.alert({
- title: "Exclusão da homologação",
- message: "Não foi possível excluir a homologação.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- }
- });
- }).done(function(strXml) {
- if (strXml.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(strXml);
- return;
- }
- bootbox.alert({
- title: "Exclusão da homologação",
- message: "A homologação "+$('#AD1_NROPOR').val()+" foi excluída com sucesso.",
- backdrop: true,
- callback: function (result) {
- document.location.href = "U_Oportunidade.apw?PR=<%=cLCodLogin%>";
- }
- });
- });
- })
- /**
- // Função para salvar os arquivos anexados
- **/
- function cancDoctos(){
- //aguardar
- var x = [];
- var cAnexos = "";
-
- $('#dialogAnex').modal('hide');
- $(".dz-filename").each(function() { x.push($(this).text())});
- for (i = 0; i < x.length; i++) {
- cAnexos += x[i]+"|";
- }
- oObjDados = {'anexos':cAnexos};
-
- $.ajax({
- url: "U_DelDoctos.apw?PR=<%=cLCodLogin%>",
- data: oObjDados,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- }
- });
-
- }
-
- //Submete formulario
- function salvarOport(btnSlv){
- var numoport = "";
- var titulo = "Manutenção da homologação";
- var dialogSlv = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Salvando a homologação... Aguarde...</p>',
- closeButton: false
- });
-
-
- objDados = {
- AD1_FILIAL: $('#AD1_FILIAL').val(),
- AD1_NROPOR: $('#AD1_NROPOR').val(),
- AD1_DESCRI: $('#AD1_DESCRI').val(),
- AD1_DESCOP: $('#AD1_DESCOP').val(),
- AD1_CODCLI: $('#AD1_CODCLI').val(),
- AD1_LOJCLI: $('#AD1_LOJCLI').val(),
- AD1_CONTCL: $('#AD1_CONTCL').val(),
-
- AD1_EMAIL1: $('#AD1_EMAIL1').val(),
- AD1_PARC1: $('#AD1_PARC1').val(),
- AD1_UF: $("#AD1_UF").val(),
- AD1_CIDADE: $('#AD1_CIDADE').val(),
- AD1_ENDER: $('#AD1_ENDER').val(),
- AD1_DTINI: $('#AD1_DTINI').val(),
- AD1_DTFIM: $('#AD1_DTFIM').val(),
- AD1_REGION: $('#AD1_REGION').val(),
- AD1_VEND: $('#AD1_VEND').val(),
-
- AD1_PERCEI: $('#AD1_PERCEI').val(),
- AD1_CONTAT: $('#AD1_CONTAT').val(),
- AD1_HOMOLO: $('#AD1_HOMOLO').val(),
- AD1_COMIRT: $('#AD1_COMIRT').val(),
- AD1_SEGMEN: $('#AD1_SEGMEN').val(),
- AD1_NIVOPO: $('#AD1_NIVOPO').val(),
- AD1_MEMO: $('#AD1_MEMO').val(),
- AD1_STATUS: $('#AD1_STATUS').val(),
- AD1_ENCERR: $('#AD1_ENCERR').val(),
- AD1_MTVENC: $('#AD1_MTVENC').val(),
- OPCAO: $('#OPCAO').val()
- };
-
-
- if($("#OPCAO").val() == "3"){
- msg = "A homologação foi incluída com sucesso.";
- titulo = "Inclusão de homologação";
- operacao = "incluir";
- }
- if($("#OPCAO").val() == "4"){
- msg = "A homologação foi alterada com sucesso.";
- titulo = "Alteração de homologação";
- operacao = "alterar";
- }
- if($("#OPCAO").val() == "5"){
- msg = "A homologação foi excluída com sucesso.";
- titulo = "Exclusão de homologação";
- operacao = "excluir";
- }
-
-
- $.ajax({
- type: "POST",
- url: "U_SlvOpt.apw?PR=<%=cLCodLogin%>",
- async: false,
- data: objDados
-
- }).fail(function(){
- bootbox.alert({
- title: titulo,
- message: "Não foi possível "+operacao+" a homologação.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }).done(function(strXml) {
- if (strXml.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(strXml);
- return;
- }
- if (strXml == 'erro'||strXml == ''||strXml.indexOf("Expires") != -1||strXml.indexOf("invalid") != -1){
- if (strXml == ''){
- bootbox.alert({
- title: titulo,
- message: "Aguarde o prazo de 3 minutos para "+operacao+" uma nova homologação.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }else{
- bootbox.alert({
- title: titulo,
- message: "Falha ao "+operacao+" a homologação.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }
- }
- else {
- if($("#OPCAO").val() == "3"){
- numoport = " Foi gerada a homologação nº "+strXml+"."
- }
- bootbox.alert({
- title: titulo,
- message: msg+numoport,
- backdrop: true,
- callback: function (result) {
- document.location.href = "U_Oportunidade.apw?PR=<%=cLCodLogin%>";
- dialogSlv.modal('hide');
- }
- });
-
- }
- });
- }
- /**
- Função para anexar arquivos
- **/
- function Anexar(cCodAD1){
- $("#codAD1").val(cCodAD1);
- $("#dialogAnex").modal('show');
- }
- </script>
- </body>
- </html>
|