var pri_artigos = []; function montaTela if (HbtCampos == true){ - - _botoes2 = ''; //_botoes2 = '
' + _botoes3 = '
' + else{ - - _botoes2 = '';/* function pegaBotoesVer(){ _botoes3 = '
'; if (testaPermissao(pri_Permissoes,'Alterar') == true) _botoes3 = _botoes3 + ''; _botoes3 = _botoes3 + '' + //'
' + '
' + '' + ' ' + '
' + '
'; return _botoes3; } function pegaOpcoesCombo if (componente == 'artigos'){ _sql = 'SELECT ARTIGOS.ID_ARTIGO, CONCAT(ARTIGOS.ID_ARTIGO," - ",ARTIGOS.DESCRICAODOARTIGO) AS DESCRICAODOARTIGO, ARTIGOS.PGCOMISSAO, ARTIGOS.VLCUSTO, SUM(ARTIGOSCENTROESTOQUE.ESTOQUEDEPOSITO) AS ESTOQUEDEPOSITO, ARTIGOSPRECOS.VLVENDA, ARTIGOSPRECOS.COMISSAOFIXA, GRUPOSARTIGOS.DESCRICAODOGRUPO ' + 'FROM ARTIGOS LEFT JOIN ARTIGOSCENTROESTOQUE ON ARTIGOSCENTROESTOQUE.ID_ARTIGO = ARTIGOS.ID_ARTIGO LEFT JOIN ARTIGOSPRECOS ON ARTIGOSPRECOS.ID_ARTIGO = ARTIGOS.ID_ARTIGO AND ARTIGOSPRECOS.ID_TABELA = ' + strToIntDef(document.getElementById('edid_tabela').value,1) + ' LEFT JOIN GRUPOSARTIGOS ON GRUPOSARTIGOS.ID_GRUPO = ARTIGOS.ID_GRUPO ' + 'WHERE ARTIGOS.STATUS = "ATIVO" ' + 'GROUP BY ARTIGOS.ID_ARTIGO, ARTIGOS.DESCRICAODOARTIGO, ARTIGOS.PGCOMISSAO, ARTIGOS.VLCUSTO, ARTIGOSPRECOS.VLVENDA '; } function pegaDadosArtigo(){ _artigo = document.getElementById('eddescricaodoartigo').value; if (_artigo != ''){ for (i=0;i' + ''+ '' + '' + function atribuiValorPesquisadoListaArtigo(componente,lista,soDescricao=false){ _valorID = document.getElementById(componente).value; if (_valorID == '') return false;//exit if (pri_configuracoes[0]['ESTOQUEPORTAMANHO'] != 'SIM' && pri_configuracoes[0]['TIPOCODBARRAS'] != 'PROPRIO' && pri_configuracoes[0]['TIPOCODBARRAS'] != 'CODE128'){ //se for EAN8 if (_valorID.length == 8){ if (pri_configuracoes[0]['REFERENCIAPOSINICODBARRA'] == '1'){ _tam = strToIntDef(pri_configuracoes[0]['REFERENCIAPOSFIMCODBARRA'],0) - strToIntDef(pri_configuracoes[0]['REFERENCIAPOSINICODBARRA'],0) + 1; if (_tam > 0) _valorID = _valorID.substr(_valorID, 0, _tam); } else _valorID = strToIntDef(_valorID.substr(_valorID, 1, 5),0); } else{ //EAN13 if (_valorID.length == 13 || _valorID.length == 12){ if (_valorID.length == 12) _valorID = '0' + _valorID; _tam = strToIntDef(pri_configuracoes[0]['REFERENCIAPOSFIMCODBARRA'],0) - strToIntDef(pri_configuracoes[0]['REFERENCIAPOSINICODBARRA'],0) + 1; if (_tam > 0) _valorID = strToIntDef(_valorID.substr(strToIntDef(pri_configuracoes[0]['REFERENCIAPOSINICODBARRA'],0), _tam),0); } } } //filtra artigo do id informado _valorID2 = document.getElementById(componente).value; if (atribuiValorPesquisadoLista(componente,lista,soDescricao,false) == false){ if (_valorID != ''){ document.getElementById(componente).value = _valorID; if (atribuiValorPesquisadoLista(componente,lista,soDescricao,false) == true) return true;//exit } if (/*pri_configuracoes[0]['ESTOQUEPORTAMANHO'] != 'SIM' &&*/ (_valorID.length > 7 && strToIntDef(_valorID[0],0) > 0) || (_valorID2.length > 7 && strToIntDef(_valorID2[0],0) > 0)){ if (_valorID == '') _valorID = '-1'; _filtro = 'SELECT ARTIGOS.ID_ARTIGO, CONCAT(ARTIGOS.ID_ARTIGO," - ",ARTIGOS.DESCRICAODOARTIGO) AS DESCRICAODOARTIGO, ARTIGOS.PGCOMISSAO, ARTIGOS.VLCUSTO, ARTIGOSCENTROESTOQUE.TAMANHO, ARTIGOSCENTROESTOQUE.ESTOQUEDEPOSITO, ARTIGOSPRECOS.VLVENDA, ARTIGOSPRECOS.COMISSAOFIXA, ARTIGOSPRECOS.VLACERTOVENDEDOR, ARTIGOSPRECOS.ACEITADEVOLUCAO, COALESCE(GRUPOSARTIGOS.DESCRICAODOGRUPO,"SEM GRUPO") AS DESCRICAODOGRUPO ' + 'FROM ARTIGOS LEFT JOIN ARTIGOSCENTROESTOQUE ON ARTIGOSCENTROESTOQUE.ID_ARTIGO = ARTIGOS.ID_ARTIGO LEFT JOIN ARTIGOSPRECOS ON ARTIGOSPRECOS.ID_ARTIGO = ARTIGOS.ID_ARTIGO AND ARTIGOSPRECOS.ID_TABELA = 1 LEFT JOIN GRUPOSARTIGOS ON GRUPOSARTIGOS.ID_GRUPO = ARTIGOS.ID_GRUPO ' + 'WHERE (ARTIGOSCENTROESTOQUE.CODIGOBARRAS = "' + _valorID + '" OR ARTIGOSCENTROESTOQUE.CODIGOBARRAS = "' + _valorID2 + '") AND ARTIGOS.STATUS = "ATIVO"'; pri_OperacaoBanco = 'CodigoBarras'; Pega(_filtro); } else{ //document.getElementById(componente).focus(); //mensagemTemporaria('Produto não encontrado!','Atenção','error'); Pri_campoFocoPosMsg = componente; showmessage('Atenção','Produto não encontrado!'); } } } function btnovo document.getElementById('tituloform').innerHTML = 'Incluindo Carga' + _botoes3; function testaArtigoProcurado(obj){ -document.getElementById('edtamanho').innerHTML = _tamanhos; if (obj.length == 1) document.getElementById('edtamanho').value = obj[0]['TAMANHO']; if (pri_configuracoes[0]['ESTOQUEPORTAMANHO'] != 'SIM') testaArtigoJaDigitado(); //SetaRegLookup(pri_ObjProc[0]['ID_ARTIG function testaartigojadigitado if (pri_IDDetail != '' && document.getElementById('edtamanho').value != '')//28/06/2024 return false;//exit if (pri_ArtigosA[i]['ID_ARTIGO'] == Artigo && pri_ArtigosA[i]['TAMANHO'] == Tamanho && pri_ArtigosA[i]['A'] != 'E'){ function btfecharMsg if (pri_OperacaoMensagem == 'Artigos' || pri_OperacaoMensagem == 'Alterar Artigos'){ if (Resposta == 'Alterar' || Resposta == 'Sim')//'Sim') pri_OperacaoMensagem = ''; return false;//exit } if validacao pegaIdCombo(document.getElementById('edid_praca').value) function btcancelar btConsulta(_filtro); document.getElementById('tituloform').innerHTML = 'Devoluções'; } else{ MontaTela(false); document.getElementById('tituloform').innerHTML = 'Devoluções' + pegaBotoesVer(); function btconsulta - - document.getElementById('tituloform').innerHTML = 'Cargas'; function jaExiste() pegaIdCombo(document.getElementById('edid_praca').value) xmlhttp.onreadystatechange = function() { //carregaopçoes if (pri_componenteCombo == 'artigos') pri_artigos = pri_ObjProc; //procura lookup if (pri_OperacaoBanco == 'Lookup'){ if (_retorno != 'null' && _retorno != '' && _retorno != null){//28/06/2024 testaArtigoProcurado(pri_ObjProc);//28/06/2024 /* - - - */ if (pri_OperacaoBanco == 'Gravação' || pri_OperacaoBanco == 'Filtro' || pri_OperacaoBanco == 'Procura'){ - - document.getElementById('eddescricaodoartigo').focus(); document.getElementById('tituloform').innerHTML = 'Alterando Carga' + _botoes3; - - } else{ MontaTela(false); document.getElementById('tituloform').innerHTML = 'Cargas' + pegaBotoesVer(); } if (x == null){ - - //btConsulta(pri_filtro); MontaTela(false); document.getElementById('tituloform').innerHTML = 'Cargas' + pegaBotoesVer(); if (pri_consulta == true){ if (pri_OperacaoBanco == 'Filtro') montaGridConsulta(''); else{ ** //btConsulta(loc_sqlini); ** btConsulta(pri_filtro); } if (pri_OperacaoBanco == 'CodigoBarras'){ if (_retorno != 'null' && _retorno != '') { pri_ObjProc = JSON.parse(_retorno); document.getElementById('eddescricaodoartigo').value = pri_ObjProc[0]['DESCRICAODOARTIGO']; document.getElementById('edtamanho').value = pri_ObjProc[0]['TAMANHO']; pegaDadosArtigo(); } else{ //mensagemTemporaria('Produto não encontrado!','Atenção','error'); //document.getElementById('eddescricaodoartigo').focus(); Pri_campoFocoPosMsg = componente; showmessage('Atenção','Produto não encontrado!'); } return false;//exit; } erros impressão trocas brindes nao edita artigo digitando novamente