portal.ecogenbrasil.com.br
Open in
urlscan Pro
138.0.216.93
Public Scan
URL:
https://portal.ecogenbrasil.com.br/Empresas/Ecogen_Oficial/ModulesTetris/FCL/Custom/Scripts/fclFichaBM.js?version=202408051707546215
Submission: On August 18 via api from US — Scanned from DE
Submission: On August 18 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
var fclFichaBM = { cAcao: '', aItens: [], cNatureza_cliente:'', cNaturezaDesc_cliente:'', } function fclFichaBM_init(cAcao,cNumContrato,cTitulo,cNumBM){ var nDecimal = 4; fclFichaBM.cNatureza_cliente =''; fclFichaBM.cNaturezaDesc_cliente =''; $('[data-toggle="tooltip"]').tooltip(); tpSetVal("PC7_ANO",moment().format('YYYY')); tpSetVal("PC7_REFANO",moment().format('YYYY')); fclFichaBM.cAcao = cAcao; $('#PC7_ANEXOS').TPAnexo(); fclCore_loadDDL('PC5_NUM','select2','FCL040', 's.PC5_NUM','s.PC5_NUM + " - " + s.PC5_TITULO'); fclCore_loadDDL('PC7_PRODUT','select2','FCL034', 's.B1_COD','s.B1_COD + " - " + s.DESCR'); fclCore_loadDDL('PC7_TES','select2','FCL042', 's.F4_CODIGO','s.F4_CODIGO + " - " + s.F4_TEXTO'); fclCore_loadDDL('PC5_CLIENT','select2','FCL033', 's.A1_COD+"/"+ s.A1_LOJA','s.A1_COD+ "/" +s.A1_LOJA + " - " + s.A1_NOME+ " (" +s.A1_CGC+ ")"'); fclCore_loadDDL('PC7_NATURE','select2','FCL052', 's.ED_CODIGO' ,'s.ED_CODIGO + " - " + s.ED_DESCRIC'); if(getCookie('EmpFil').substr(0,2) == "05"){ $('#divPC7_ITEMCT').show(); $('#divPC7_CC').hide(); fclCore_loadDDL('PC7_ITEMCT','select2','FCL049', 's.CTD_ITEM','s.CTD_ITEM + " - " + s.CTD_DESC01'); }else{ $('#divPC7_CC').show(); $('#divPC7_ITEMCT').hide(); fclCore_loadDDL('PC7_CC','select2','FCL035', 's.CUSTO','s.CUSTO + " - " + s.CTT_DESC01'); } fclFichaContratos_carregaGestor(); disableSelect('PC5_CLIENT'); $('#PC5_TITULO').attr("disabled",true); $('#PC5_CLIENT').attr("disabled",true); $('#PC5_DTINI' ).attr("disabled",true); $('#PC5_DTFIM' ).attr("disabled",true); $('#PC5_RENOVA').attr("disabled",true); $('#PC5_DRENOV').attr("disabled",true); $('#PC5_GESTOR').attr("disabled",true); $('#PC5_EMAIL' ).attr("disabled",true); $('#PC5_DIAMED').attr("disabled",true); $('#PC5_DIAFAT').attr("disabled",true); $('#PC5_TIPOPG').attr("disabled",true); $('#PC5_OBGPED').attr("disabled",true); $('#PC5_BUDGET').attr("disabled",true); $('#PC5_EMISSA').attr("disabled",true); $('#PC5_OBS' ).attr("disabled",true); $('.ECMASK9').inputmask({'alias': 'decimal', 'radixPoint': ',', 'groupSeparator': '.', 'digits': 9, 'digitsOptional': false, 'autoGroup': true, 'placeholder': '0'}); if(getCookie('EmpFil').substr(0,2) == "05"){ nDecimal = 8; }else{ nDecimal = 4; } $('.ECMASK4').inputmask({'alias': 'decimal', 'radixPoint': ',', 'groupSeparator': '.', 'digits': nDecimal, 'digitsOptional': false, 'autoGroup': true, 'placeholder': '0'}); if(!empty(cNumContrato) && cAcao == "I"){ tpSetVal("PC5_NUM",cNumContrato,cNumContrato + ' - ' +cTitulo); fclFichaBM_changeNumContrato(); } if(!empty(cNumBM) && cAcao == "A"){ disableSelect('PC5_NUM'); tpSetVal("PC7_NUMBM",cNumBM); fclFichaBM_get(cNumBM); } } function fclFichaBM_changeNumContrato(){ if(fclFichaBM.cAcao == "I"){ showLoader(); setTimeout(function () { fclFichaBM_gravaBM(); fclFichaBM_get(tpGetVal("PC7_NUMBM")); },400); } } function fclFichaBM_changeCliente(){ tpParam.ClearParam(); tpParam.AddParams('CONSULTA', 'FCL053'); tpParam.AddParams('CODIGO' , tpGetVal('PC5_CLIENT').split('/')[0]); tpParam.AddParams('LOJA' , tpGetVal('PC5_CLIENT').split('/')[1]); var oDados = tpParam.SendFormPost('WSGETCONS'); if(oDados.errorcode = '00'){ var data = ajustaraData(oDados)[0]; fclFichaBM.cNatureza_cliente = data.A1_NATUREZ; fclFichaBM.cNaturezaDesc_cliente = data.ED_DESCRIC; tpSetVal("PC7_NATURE",fclFichaBM.cNatureza_cliente,fclFichaBM.cNatureza_cliente+ ' - '+ fclFichaBM.cNaturezaDesc_cliente); } } function fclFichaBM_gravaBM(){ $(tpSelector('.btn')).attr('disabled', true); tpParam.ClearParam(); tpParam.AddParams('ACAO' , "G"); tpParam.AddParams('PC5_NUM' , tpGetVal('PC5_NUM')); var oDados = tpParam.SendFormPost('UPDBM'); if (oDados.errorcode == "00"){ tpSetVal("PC7_NUMBM",oDados.content) $(tpSelector('.btn')).attr('disabled', false); toastr.success('Medição salva'); } else { $(tpSelector('.btn')).attr('disabled', false); toastr.error(`${oDados.errorcode} - ${oDados.errormsg}`); } } function fclFichaBM_get(cNumBM){ tpParam.ClearParam(); tpParam.AddParams('CONSULTA', 'FCL043'); tpParam.AddParams('PC7_NUMBM', cNumBM); tpParam.SendFormPostASync('WSGETCONS', 'fclFichaBM_getCallback(data)'); } function fclFichaBM_getCallback(oDados){ if(oDados.errorcode == '00'){ fclFichaBM.cAcao = "A"; var data = ajustaraData(oDados); if(fclFichaBM.cAcao == "A"){ tpSetVal("PC5_NUM",data[0].PC5_NUM,data[0].PC5_NUM + ' - ' +data[0].PC5_TITULO); } tpSetVal('#PC5_TITULO',data[0].PC5_TITULO); tpSetVal('#PC5_CLIENT',data[0].PC5_CLIENT+'/'+data[0].PC5_LOJA,data[0].PC5_CLIENT+'/'+data[0].PC5_LOJA + ' - '+ data[0].A1_NOME.trim() + '('+data[0].A1_CGC+')'); tpSetVal('#PC5_DTINI',data[0].PC5_DTINI); tpSetVal('#PC5_DTFIM',data[0].PC5_DTFIM); tpSetVal('#PC5_RENOVA',data[0].PC5_RENOVA); tpSetVal('#PC5_DRENOV',data[0].PC5_DRENOV.trim()); tpSetVal('#PC5_GESTOR',data[0].PC5_GESTOR); tpSetVal('#PC5_EMAIL',data[0].PC5_EMAIL); tpSetVal('#PC5_DIAMED',data[0].PC5_DIAMED); tpSetVal('#PC5_DIAFAT',data[0].PC5_DIAFAT); tpSetVal('#PC5_TIPOPG',data[0].PC5_TIPOPG); tpSetVal('#PC5_OBGPED',data[0].PC5_OBGPED); tpSetVal('#PC5_BUDGET',data[0].PC5_BUDGET); tpSetVal('#PC5_EMISSA',data[0].PC5_EMISSA); tpSetVal('#PC5_OBS',data[0].PC5_OBS); tpSetVal('#PC7_MES',data[0].PC7_MES); tpSetVal('#PC7_ANO',data[0].PC7_ANO); tpSetVal('#PC7_REFMES',data[0].PC7_REFMES); tpSetVal('#PC7_REFANO',data[0].PC7_REFANO); tpSetVal('#PC7_STTAPR',data[0].PC7_STTAPR); tpSetVal('#PC7_MENNF',data[0].PC7_MENNF.trim()); tpSetVal('#PC7_OBS',data[0].PC7_OBS.trim()); $(tpSelector('#PC7_ANEXOS')).val(data[0].PC7_ANEXOS).TPAnexo(); fclFichaBM_cargaItensCallback(oDados); } hideLoader(); } // function fclFichaBM_cargaItens(){ // if(fclFichaBM_valida()){ // showLoader(); // $('#divbuttonSave').hide() // setTimeout(function () { // tpParam.ClearParam(); // tpParam.AddParams('CONSULTA', 'FCL041'); // tpParam.AddParams('CONTRATO', tpGetVal("PC5_NUM")); // tpParam.SendFormPostASync('WSGETCONS', 'fclFichaBM_cargaItensCallback(data)'); // },400); // } // } function fclFichaBM_valida(){ return validaDiv('fclFichaContratoMedicao'); } function fclFichaBM_cargaItensCallback(oDados){ var nDecimal = 4; if (oDados.errorcode == "00") { var data = ajustaraData(oDados); fclFichaBM.aItens = data; //COMENTADO POR MAURICIO SEGURA EM 20/09/2022 DEVIDO AO CORE DO GOEVO EM PRODUÇÃO NÃO COMTEMPLAR ROTINA TPDISABLE AINDA. // if(!empty(data[0].PC7_PEDIDO)){ // tpDisable('#PC7_MENNF'); // } oTable = JSTPGrid.BindJDatatable('fclListaItensBM', oDados, 'fclFichaBM_colunas()', 'fclFichaBM_getOTableTools()', false, true, false, false); ajustarColunas('fclListaItensBM', ['5%','15%','5%', '8%' , '12%', '10%', '8%', '8', '8%', '8%', '8%']); if(getCookie('EmpFil').substr(0,2) == "05"){ nDecimal = 8; }else{ nDecimal = 4; } $('.VALOR_MASKQTD').inputmask({'alias': 'decimal', 'radixPoint': ',', 'groupSeparator': '.', 'digits': nDecimal, 'digitsOptional': false, 'autoGroup': true, 'placeholder': '0'}); $('.VALOR_MASKVUNIT').inputmask({'alias': 'decimal', 'radixPoint': ',', 'groupSeparator': '.', 'digits': 9, 'digitsOptional': false, 'autoGroup': true, 'placeholder': '0'}); $('.VALOR_MASKTOTAL').inputmask({'alias': 'decimal', 'radixPoint': ',', 'groupSeparator': '.', 'digits': 2, 'digitsOptional': false, 'autoGroup': true, 'placeholder': '0'}); $(data).each(function () { fclCore_loadDDL(`ddlTES_${tpConvert.encodeObj(this.PC7_NUMBM+this.PC7_ITEM)}`,'select2','FCL042', 's.F4_CODIGO','s.F4_CODIGO + " - " + s.F4_TEXTO'); }); $('#divbuttonSave').show() hideLoader(); } } function fclFichaBM_getOTableTools() { return { "sRowSelect": "single", "aButtons": [] } } function fclFichaBM_colunas() { var colunas = []; colunas.push({ "title": "Item" , "data": "PC7_ITEM" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return Formatar(data, type, full, meta); } }); colunas.push({ "title": "Produto" , "data": "PC7_PRODUT" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return fclFichaBM_formataProduto(data, type, full, meta); } }); colunas.push({ "title": "UM" , "data": "PC7_UM" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return Formatar(data, type, full, meta); } }); if(getCookie('EmpFil').substr(0,2) == "05"){ colunas.push({ "title": "Item Contabil" , "data": "" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return fclFichaBM_formataItemConta(data, type, full, meta); } }); }else{ colunas.push({ "title": "C Custo" , "data": "" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return fclFichaBM_formataCC(data, type, full, meta); } }); } colunas.push({ "title": "TES " , "data":"PC7_TES" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return fclFichaBM_formatarTES(data, type, full, meta); } }); colunas.push({ "title": "Natureza " , "data":"" , "tipoDado": "C", "sClass": "text-left", "render": function (data, type, full, meta) { return fclFichaBM_formatarNatureza(data, type, full, meta); } }); colunas.push({ "title": "Quantidade" , "data": "PC7_QUANT" , "tipoDado": "N", "sClass": "text-right", "render": function (data, type, full, meta) { return fclFichaBM_formatarQuantidade(data, type, full, meta); } }); colunas.push({ "title": "Valor Unitário" , "data": "PC7_VUNIT" , "tipoDado": "N", "sClass": "text-right", "render": function (data, type, full, meta) { return fclFichaBM_formatarVunit(data, type, full, meta); } }); colunas.push({ "title": "Outr. Créditos/Débitos" , "data": "" , "tipoDado": "N", "sClass": "text-right", "render": function (data, type, full, meta) { return fclFichaBM_formatarCreditoDebito(data, type, full, meta); } }); colunas.push({ "title": "Total" , "data": "PC7_TOTAL" , "tipoDado": "N", "sClass": "text-right", "render": function (data, type, full, meta) { return fclFichaBM_formatarTOTAL(data, type, full, meta); } }); return colunas; } function fclFichaBM_formatarTES(data, type, full, meta){ var options = [] if(!empty(full.PC7_PEDIDO)){ return full.PC7_TES }else{ options.cTitulo = ""; options.cIdLink = "linkTES_"; options.cIdDiv = "divTES"; options.cIdDDL = "ddlTES_"; options.cConteudo = `!empty(options.full.PC7_TES) ? options.full.PC7_TES : 'Selecionar'`; options.lFunConteudo = true; options.full = full; options.cChave = "options.full.PC7_NUMBM + options.full.PC7_ITEM"; options.onchange = ``; options.cOption = ``; options.lImputs = false; return fclCore_formatarDDL(options); } } function fclFichaBM_formatarCreditoDebito(data, type, full, meta){ var cDecimal = 2; var cChave = tpConvert.encodeObj(full.PC7_NUMBM+full.PC7_ITEM); var cClass = '' var cdisabled = ''; if(!empty(full.PC7_PEDIDO)){ cdisabled = 'disabled="disabled"' } var cRet = ` <div class="form-group"> <input id="txtInputCredDeb_${cChave}" class="VALOR_MASKTOTAL form-control text-right " onchange="fclFichaBM_changeCreditoDebito(this)" ${cdisabled} value="${formatNumber(full.PC7_CREDEB,parseInt(cDecimal))}" /> </div>` return cRet } function fclFichaBM_changeCreditoDebito(domThis){ var id = domThis.id; var constId = id.substr(id.indexOf('_')+1); var cChave = tpConvert.decodeObj(constId); var nVal = parseFloat(tpGetVal(id).valor()); if(!empty(tpGetVal(id))){ tpSetVal('txtInputTOTAL_'+constId,formatNumber((parseFloat(tpGetVal('txtInputQtde_'+constId).valor(),4)* parseFloat(tpGetVal('txtInputVUnit_'+constId).valor(),9))+nVal,2)) } } function fclFichaBM_formatarQuantidade(data, type, full, meta){ var cDecimal = 4; var cChave = tpConvert.encodeObj(full.PC7_NUMBM+full.PC7_ITEM); var cClass = '' var cdisabled = ''; if(!empty(full.PC7_PEDIDO)){ cdisabled = 'disabled="disabled"' } var cRet = ` <div class="form-group"> <input id="txtInputQtde_${cChave}" class="VALOR_MASKQTD form-control text-right " onchange="fclFichaBM_changeQuantidade(this)" ${cdisabled} value="${formatNumber(full.PC7_QUANT,parseInt(cDecimal))}" /> </div>` return cRet } function fclFichaBM_changeQuantidade(domThis){ var id = domThis.id; var constId = id.substr(id.indexOf('_')+1); var cChave = tpConvert.decodeObj(constId); var nValCredDeb = 0; if(!empty(tpGetVal('txtInputCredDeb_'+constId))){ nValCredDeb = tpGetVal('txtInputCredDeb_'+constId).valor() ; } tpSetVal('txtInputTOTAL_'+constId,formatNumber(((parseFloat(tpGetVal('txtInputQtde_'+constId).valor(),4)* parseFloat(tpGetVal('txtInputVUnit_'+constId).valor(),9)))+(parseFloat(nValCredDeb,4)),2)) } function fclFichaBM_formatarVunit(data, type, full, meta){ var cDecimal = 9; var cChave = tpConvert.encodeObj(full.PC7_NUMBM+full.PC7_ITEM); var cClass = '' var cdisabled = ''; if(!empty(full.PC7_PEDIDO)){ cdisabled = 'disabled="disabled"' } var cRet = ` <div class="form-group"> <input id="txtInputVUnit_${cChave}" onchange="fclFichaBM_changeQuantidade(this)" ${cdisabled} class="VALOR_MASKVUNIT form-control text-right " value="${formatNumber(full.PC7_VLUNIT,parseInt(cDecimal))}" /> </div>` return cRet } function fclFichaBM_formatarTOTAL(data, type, full, meta){ var cDecimal = 2; var cChave = tpConvert.encodeObj(full.PC7_NUMBM+full.PC7_ITEM); var cClass = '' var cRet = ` <div class="form-group"> <input id="txtInputTOTAL_${cChave}" disabled="disabled" class="VALOR_MASKTOTAL form-control text-right " value="${formatNumber(full.PC7_TOTAL,parseInt(cDecimal))}" /> </div>` return cRet } function fclFichaBM_formataProduto(data, type, full, meta){ return `${full.PC7_PRODUT} - ${full.PC7_DESCBM.trim()}`; } function fclFichaBM_formataCC(data, type, full, meta){ return `${full.PC7_CC} - ${full.CTT_DESC01.trim()}`; } function fclFichaBM_formataItemConta(data, type, full, meta){ return `${full.PC7_ITEMCT} - ${full.CTD_DESC01.trim()}`; } function fclFichaBM_formatarNatureza(data, type, full, meta){ return `${full.PC7_NATURE} - ${full.ED_DESCRIC.trim()}`; } function fclFichaBM_salvarBM(){ if(fclFichaBM_valida()) { $(tpSelector('.btn')).attr('disabled', true); showLoader(); setTimeout(function () { var incluir_tpArrayAdvPL = new TPArrayAdvPL(); for(var i = 0, len = fclFichaBM.aItens.length; i < len; i++) { var item = fclFichaBM.aItens[i]; tpParam.ClearParam(); tpParam.AddParams('PC7_ITEM' , item.PC7_ITEM); //tpParam.AddParams('PC7_SEQ' , item.PC8_SEQ); tpParam.AddParams('PC7_TES' , $(tpSelector('#linkTES_' +tpConvert.encodeObj(item.PC7_NUMBM+item.PC7_ITEM))).html()); tpParam.AddParams('PC7_QUANT' , $(tpSelector('#txtInputQtde_' +tpConvert.encodeObj(item.PC7_NUMBM+item.PC7_ITEM))).val().valor()); tpParam.AddParams('PC7_VLUNIT' , $(tpSelector('#txtInputVUnit_'+tpConvert.encodeObj(item.PC7_NUMBM+item.PC7_ITEM))).val().valor()); tpParam.AddParams('PC7_CREDEB' , $(tpSelector('#txtInputCredDeb_'+tpConvert.encodeObj(item.PC7_NUMBM+item.PC7_ITEM))).val().valor()); tpParam.AddParams('PC7_TOTAL' , $(tpSelector('#txtInputTOTAL_'+tpConvert.encodeObj(item.PC7_NUMBM+item.PC7_ITEM))).val().valor()); tpParam.AddParams('PC7_MENNF' , tpGetVal('#PC7_MENNF')); tpParam.AddParams('PC7_MES' , tpGetVal('#PC7_MES')); tpParam.AddParams('PC7_ANO' , tpGetVal('#PC7_ANO')); tpParam.AddParams('PC7_REFMES' , tpGetVal('#PC7_REFMES')); tpParam.AddParams('PC7_REFANO' , tpGetVal('#PC7_REFANO')); tpParam.AddParams('PC7_OBS' , tpGetVal('#PC7_OBS')); tpParam.AddParams('PC7_STTAPR' , tpGetVal('#PC7_STTAPR') ? tpGetVal('#PC7_STTAPR') : 'P' ); tpParam.AddParams('PC7_ANEXOS' , tpGetVal('#PC7_ANEXOS')); incluir_tpArrayAdvPL.add(aParams); } tpParam.ClearParam(); tpParam.AddParams('ACAO' , "A"); tpParam.AddParams('PC5_NUM' , tpGetVal('PC5_NUM')); tpParam.AddParams('PC7_NUMBM' , tpGetVal('PC7_NUMBM')); tpParam.AddParams('ITENS' , incluir_tpArrayAdvPL.toString()); var oDados = tpParam.SendFormPost('UPDBM'); if (oDados.errorcode == "00"){ $(tpSelector('.btn')).attr('disabled', false); toastr.success('Medição salva'); hideLoader(); TPnavclick('fclListaBM.html #conteudo', '#content', 'fclListaBM_init()'); //fclFichaContratos_initGet('VA'); //fclFichaContratosAbaInteracoes_init(); } else { $(tpSelector('.btn')).attr('disabled', false); hideLoader(); toastr.error(`${oDados.errorcode} - ${oDados.errormsg}`); } }, 400); } } function fclFichaBM_cancelarBM(){ TPnavclick('fclListaBM.html #conteudo', '#content', 'fclListaBM_init()'); } function fclFichaBM_novoItem(){ if(empty(fclFichaBM.cNatureza_cliente)){ fclFichaBM_changeCliente(); } $('#fichaItenAvulso').toggle(400); setTimeout(function () { if($('#fichaItenAvulso').is(':visible')){ $('#btnNovoItem').hide(); } }, 500); } function fclFichaBM_cancelarItem(){ $('#fichaItenAvulso').toggle(400); setTimeout(function () { if(!$('#fichaItenAvulso').is(':visible')){ $('#btnNovoItem').show(); } }, 500); } function fclFichaBM_salvarItem(){ showLoader(); setTimeout(function () { $(tpSelector('.btn')).attr('disabled', true); tpParam.ClearParam(); tpParam.AddParams('ACAO' , "I" ); tpParam.AddParams('PC5_NUM' , tpGetVal('PC5_NUM') ); tpParam.AddParams('PC7_NUM' , tpGetVal('PC5_NUM') ); tpParam.AddParams('PC7_NUMBM' , tpGetVal('PC7_NUMBM') ); tpParam.AddParams('PC7_PRODUT' , tpGetVal('PC7_PRODUT')); tpParam.AddParams('PC7_DESCBM' , tpGetVal('PC7_DESCBM').trim()); tpParam.AddParams('PC7_CC' , tpGetVal('PC7_CC')); tpParam.AddParams('PC7_ITEMCT' , tpGetVal('PC7_ITEMCT')); tpParam.AddParams('PC7_UM' , tpGetVal('PC7_UM')); tpParam.AddParams('PC7_TES' , tpGetVal('PC7_TES')); tpParam.AddParams('PC7_NATURE' , tpGetVal('PC7_NATURE')); tpParam.AddParams('PC7_QUANT' , tpGetVal('PC7_QUANT').valor()); tpParam.AddParams('PC7_VLUNIT' , tpGetVal('PC7_VUNIT').valor()); tpParam.AddParams('PC7_TOTAL' , tpGetVal('PC7_TOTAL')); tpParam.AddParams('PC7_MENNF' , tpGetVal('#PC7_MENNF')); tpParam.AddParams('PC7_MES' , tpGetVal('#PC7_MES')); tpParam.AddParams('PC7_ANO' , tpGetVal('#PC7_ANO')); tpParam.AddParams('PC7_REFMES' , tpGetVal('#PC7_REFMES')); tpParam.AddParams('PC7_REFANO' , tpGetVal('#PC7_REFANO')); tpParam.AddParams('PC7_OBS' , tpGetVal('#PC7_OBS')); tpParam.AddParams('PC7_STTAPR' , tpGetVal('#PC7_STTAPR') ? tpGetVal('#PC7_STTAPR') : 'P' ); tpParam.AddParams('PC7_ANEXOS' , tpGetVal('#PC7_ANEXOS')); var oDados = tpParam.SendFormPost('UPDBM'); if (oDados.errorcode == "00"){ $(tpSelector('.btn')).attr('disabled', false); toastr.success('Item Adicionado'); fclFichaBM_limparCamposItens(); fclFichaBM_cancelarItem(); fclFichaBM_get(tpGetVal("PC7_NUMBM")); hideLoader(); //fclFichaContratosAbaInteracoes_init(); } else { $(tpSelector('.btn')).attr('disabled', false); hideLoader(); toastr.error(`${oDados.errorcode} - ${oDados.errormsg}`); } },400); } function fclFichaBM_limparCamposItens(){ tpSetVal('PC7_PRODUT' , ''); tpSetVal('PC7_DESCBM' , ''); tpSetVal('PC7_UM' , ''); tpSetVal('PC7_CC' , ''); tpSetVal('PC7_TES' , ''); tpSetVal("PC7_NATURE",fclFichaBM.cNatureza_cliente,fclFichaBM.cNatureza_cliente+ ' - '+ fclFichaBM.cNaturezaDesc_cliente); tpSetVal('PC7_BUDGET' , 0); tpSetVal('PC7_QUANT' , 0); tpSetVal('PC7_VUNIT' , 0); tpSetVal('PC7_TOTAL' , 0); } function fclFichaBM_changeProduto(){ tpParam.ClearParam(); tpParam.AddParams('CONSULTA', 'FCL038'); tpParam.AddParams('PRODUTO', tpGetVal("PC7_PRODUT")); tpParam.SendFormPostASync('WSGETCONS', 'fclFichaBM_changeProdutoCallback(data)'); } function fclFichaBM_changeProdutoCallback(oDados){ if(oDados.errorcode == '00'){ var data = ajustaraData(oDados); tpSetVal("PC7_UM",data[0].B1_UM); tpSetVal("PC7_DESCBM",data[0].B1_XDESCBM); } } function fclFichaBM_changeVUnit(){ tpSetVal("PC7_TOTAL",parseFloat(tpGetVal("PC7_QUANT").valor(),2) * parseFloat(tpGetVal("PC7_VUNIT").valor(),2) ); } function fclFichaBM_changeTOTAL(){ tpSetVal("PC7_VUNIT",parseFloat(tpGetVal("PC7_TOTAL"),2) / parseFloat(tpGetVal("PC7_QUANT").valor(),2) ); }