Procedure Division using area-de-usuarios ws-cod-orc.
0000-inicio. Perform 1000-abre-arquivos thru 1000-exit. Perform 3200-lanca-estoque-nf thru 3200-exit. Close vndcnf seqest estpro estcnf estinf estcop vndcli. 0000-exit. exit program. * 1000-abre-arquivos. open input estpro vndcnf vndinf estcop vndcli. open i-o estcnf estinf seqest. If cnf2-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do vndcnf. fs.:" with back 4 fore 15 bell Display (25, 00) cnf-status with back 4 fore 15 Stop run. If cnf-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do ESTcnf. fs.:" with back 4 fore 15 bell Display (25, 00) cnf-status with back 4 fore 15 Stop run. If cli-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do VNDCLI. fs.:" with back 4 fore 15 bell Display (25, 00) cli-status with back 4 fore 15 Stop run. If cop-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do ESTCOP. fs.:" with back 4 fore 15 bell Display (25, 00) cop-status with back 4 fore 15 Stop run. If inf-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do ESTinf. fs.:" with back 4 fore 15 bell Display (25, 00) inf-status with back 4 fore 15 Stop run. If est-status not = "00" and "05" Display (25, 02) "0000-Erro na abertura do seqest. fs.:" with back 4 fore 15 bell Display (25, 00) est-status with back 4 fore 15 Stop run. Accept ws-data-hoje from date. if ws-mes-hoje > 88 move 19 to ws-dia-hoje else move 20 to ws-dia-hoje. move ws-data-hoje to ws-data-geral. move ws-dia-geral to ws-dia-hoje. move ws-mes-geral to ws-mes-hoje. move ws-ano-geral to ws-ano-hoje. move ws-sec-geral to ws-sec-hoje. 1000-exit. exit. * * 2200-confirmacao. move "S" to ws-ok. display (25, 20) "Confirme a emissao do orcamento (S/N): " with back 4 fore 15 bell. accept (25, 00) ws-ok with back 4 fore 15 auto update. if ws-ok not = "S" and "s" and "N" and "n" go to 2200-confirmacao. display (25, 20) " " with back 4. 2200-exit. exit. * 2300-busca-lancamentos. move ws-cod-orc to cnf-codigo2. read vndcnf. move zeros to est-chave. move cnf-codigo2 to inf-chave est-numero-nf. read seqest with no lock. move est-seq-estoque to cnf-codigo inf-codigo. read estcnf with no lock. if cnf-status not = "00" and "23" display (25, 01) "errroooooooo" with back 4 fore 15 accept (25, 00) cnf-status with back 4 fore 15 update. if cnf-status = "23" continue else if cnf-status = "00" Perform 3300-elimina-recalculo thru 3300-exit. 2300-exit. exit. 3100-busca-seq-estoque. if us-prot = 1 move 50000000 to cnf-codigo else move 99999999 to cnf-codigo. start estcnf key < cnf-chave. if cnf-status = "23" if us-prot = 1 move zeros to cnf-codigo else move 50000000 to cnf-codigo. read estcnf next with no lock. if us-prot = 2 and cnf-codigo < 50000000 move 50000000 to cnf-codigo go to 3100-exit. add 1 to cnf-codigo. move cnf-codigo to inf-codigo. 3100-exit. exit. 3200-lanca-estoque-nf. read vndcnf next at end go to 3200-exit. if cnf-cliente not = 582 go to 3200-lanca-estoque-nf. if cnf-codigo2 < 443 go to 3200-lanca-estoque-nf. if cnf-situacao = "C" or "c" go to 3200-lanca-estoque-nf. Perform 3100-busca-seq-estoque thru 3100-exit. move cop-clas-fiscal to cnf-nat-op. move cnf-especie to cnf-especie2. move "2" to cnf-serie. move cnf-codigo2 to cnf-numero inf-codigo-nf. move cnf-tipo to cnf-cli-for. move cnf-cliente to cnf-destrem cli-codigo. read vndcli. move cnf-data-emissao to cnf-data cnf-data-entrada move CLI-ESTADO to cnf-uf. move zeros to cnf-cod-cont. move cnf-valor-mercadorias to cnf-vlr-prods. move cnf-total-nota to cnf-vlr-tot-nf. move cnf-base-calculo-icms to cnf-base-icms. compute cnf-vlr-tot-icms rounded = cnf-base-icms * cnf-aliquota-icms / 100. move zero to cnf-vlr-tot-ipi. move "N" to cnf-inclui-od. move zeros to cnf-vlr-tot-od. move "N" to cnf-inclui-embal. move zeros to cnf-vlr-tot-embal. move "N" to cnf-inclui-frete. move cnf-frete to cnf-vlr-frete. move cnf-descontos to cnf-vlr-desconto. move 102 to cnf-cod-operacao. MOVE zeros TO cnf-nat-origem. move cnf-cod-operacao to cnf-nat-op. move 1 to cnf-centro-custo. move 1 to inf-sequencia-nf inf-seq. 3200-lanca-estoque-inf. read vndinf. if inf-status = "23" go to 3200-grava-estoque. move inf-produto to inf-cod-prod. move cnf-data-emissao to inf-data-entrada. move inf-quantidade to inf-qtde. move inf-preco-unitario to inf-vlr-unit. compute inf-vlr-total = inf-vlr-unit * inf-qtde. move cnf-aliquota-icms to inf-aliq-icms. move inf-vlr-total to inf-base-icms. *> inf-base-ipi. compute inf-vlr-icms = inf-aliq-icms * inf-base-icms / 100. move inf-perc-ipi to inf-aliq-ipi. compute inf-vlr-ipi = inf-base-ipi * inf-aliq-ipi / 100. move zeros to inf-embalagem inf-outras-despesas inf-frete inf-desconto inf-cod-contabil. compute ws-perc-rateio-frete = cnf-vlr-frete / cnf-vlr-prods. compute ws-perc-rateio-od = cnf-vlr-tot-od / cnf-vlr-prods. compute ws-perc-rateio-embal = cnf-vlr-tot-embal / cnf-vlr-prods. compute ws-perc-rateio-desc = cnf-vlr-desconto / cnf-vlr-prods. compute inf-frete ROUNDED = inf-vlr-total * ws-perc-rateio-frete. compute inf-embalagem ROUNDED = inf-vlr-total * ws-perc-rateio-embal. compute inf-outras-despesas ROUNDED = inf-vlr-total * ws-perc-rateio-od. compute inf-desconto ROUNDED = inf-vlr-total * ws-perc-rateio-desc. compute inf-vlr-contabil = inf-vlr-total + inf-vlr-ipi + inf-embalagem + inf-outras-despesas + inf-frete. compute inf-liq-aquis = inf-vlr-contabil - inf-vlr-icms - inf-vlr-ipi - inf-desconto. write rg-estinf. if cnf-status = "22" rewrite rg-estinf. if cnf-status not = "00" and "02" display (25, 02) "3200-Erro na gravacao do ESTINF. fs:" Display (25, 00) cnf-status with back 0 fore 15 go to 0000-exit. add 1 to inf-sequencia-nf inf-seq. go to 3200-lanca-estoque-inf. 3200-grava-estoque. move cnf-codigo2 to est-seq-estoque. move cnf-codigo to est-nf-vnd est-numero-nf. write rg-estcnf. if cnf-status2 = "22" rewrite rg-estcnf. write rg-seqest. if est-status = "22" rewrite rg-seqest. if cnf-status2 not = "00" and "02" display (25, 02) "3200-Erro na gravacao do ESTCNF. fs:" Display (25, 00) CNF-status2 with back 0 fore 15 go to 0000-exit. if est-status not = "00" and "02" display (25, 02) "3200-Erro na gravacao do SEQEST. fs:" Display (25, 00) est-status with back 0 fore 15 go to 0000-exit. Display (25, 24) "Aguarde... lancando no ESTOQUE..." with back 4 fore 15. * call "est9999.exe" using area-de-usuarios cnf-data. * cancel "est9999.exe". Display (25, 22) " " with back 4 fore 4. 3200-exit. exit. 3300-elimina-recalculo. delete estcnf record. if cnf-status not = "00" and "02" display (25, 02) "3300-Erro na gravacao do ESTcnf. fs:" Display (25, 00) cnf-status with back 0 fore 15 stop run. move cnf-codigo to inf-codigo. move zeros to inf-seq. start estinf key not < inf-chave. if inf-status = "23" go to 3300-exit. 3300-elimina-inf. read estinf next with no lock at end go to 3300-exit. if inf-codigo not = cnf-codigo go to 3300-exit. delete estinf record. if inf-status not = "00" and "02" display (25, 02) "3300-Erro na gravacao do ESTinf. fs:" Display (25, 00) cnf-status with back 0 fore 15 stop run. go to 3300-elimina-inf. 3300-exit. exit.
You're reading a free preview. Pages 4 to 68 are not shown in this preview. Leer la versión completa You're Reading a Free Preview Page 4 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 5 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 6 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 7 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 8 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 9 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 10 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 11 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 12 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 13 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 14 is not shown in this preview. DESCARGA You're Reading a Free Preview Page 15 is not