Escolar Documentos
Profissional Documentos
Cultura Documentos
Program-Id. Est0801.
Author.
Security. *
*
Environment Division.
Special-Names.
Decimal-Point is comma.
Input-Output Section.
File-Control.
Copy Gerpar.sel.
Copy Estgru.sel.
Copy Estsgr.sel.
Copy Estpro.sel.
Copy Estcsd.sel.
Select impres assign to WS-NOME-SAIDA.
*
Data Division.
File Section.
Copy
Copy
Copy
Copy
Copy
Gerpar.bok.
Estgru.bok.
Estsgr.bok.
Estpro.bok.
Estcsd.bok.
Fd impres
label record is omitted
report is rs-est0801.
Working-Storage Section.
01 Area-de-trabalho.
05 ws-dados
pic x(001)
88 nao-existe-dados
05 ws-preco
pic 9(008)v99
05 ws-cod-ini
pic 9(010)
05 ws-cod-fim
pic 9(010)
05 ws-saida
pic a(001)
05 ws-compressao
pic 9(001)
05 ws-nome-saida
pic x(016)
05 ws-horas
pic x(008)
05 filler redefines ws-horas.
10 ws-hora
pic 9(006).
05 ws-data-hoje
pic 9(008)
05 filler redefines ws-data-hoje.
10 ws-dia-hoje
pic 9(002).
10 ws-mes-hoje
pic 9(002).
10 ws-sec-hoje
pic 9(002).
10 ws-ano-hoje
pic 9(002).
05 ws-dia-aux
pic 9(002)
05 ws-controle-1
pic x(004)
05 ws-controle-2
pic x(004)
05 ws-ok
pic x(001)
05 ws-tecla
88 tecla-esc
88 F2
01 Area-de-status.
05 pro-status
value
value
value
value
value
value
value
value
value
spaces.
"N".
zeros.
zeros.
zeros.
spaces.
zeros.
spaces.
spaces.
value zeros.
value
value
value
value
zeros.
spaces.
spaces.
spaces.
pic x(002)
value "00".
value "01".
value "03".
pic x(002)
value spaces.
05
05
05
05
05
csd-status
gru-status
sgr-status
par-status
par-relkey
pic
pic
pic
pic
pic
x(002)
value spaces.
x(002)
value spaces.
x(002)
value spaces.
x(002)
value "xx".
9(005) comp value zeros.
Copy Chamadas.bok.
Copy dtw.bok.
Linkage Section.
Copy Usuario.bok.
*
Report Section.
Rd rs-est0801
Controls are final sgr-chave
Page limit is 66 lines
Heading
01
First Detail 08
Last Detail 61
Footing
62.
01 Type is page heading.
05 line 01.
10 column 01 pic x(004) source ws-controle-1.
10 column 05 pic x(004) source ws-controle-2.
05 line 02.
10 column 01 pic x(001) value "+".
10 column 02 pic x(078) value all "-".
10 column 80 pic x(001) value "+".
05 line 03.
10 column 01 pic x(001) value "|".
10 column 02 pic x(040) source par-cliente.
10 column 48 pic x(008) value "Usuario:".
10 column 66 pic x(007) value "Pagina:".
10 column 75 pic z.zz9 source page-counter.
10 column 80 pic x(001) value "|".
05 line 04.
10 column 01 pic x(037) value
"|EST - Sistema de Controle de Estoque".
10 column 66 pic x(004) value "Dta:".
10 column 70 pic zz/zz/zzzz source ws-data-hoje.
10 column 80 pic x(001) value "|".
05 line 05.
10 column 01 pic x(029) value
"|EST0801 - RELACAO DO ESTOQUE".
10 column 66 pic x(004) value "Hra:".
10 column 70 pic zz.zz.zz source ws-hora.
10 column 80 pic x(001) value "|".
05 line 06.
10 column 01 pic x(001) value "+".
10 column 02 pic x(078) value all "-".
10 column 80 pic x(001) value "+".
05 line 07.
10 column 01 pic x(080) value
"| Codigo *-------- Descricao --------------* Vlr. Venda *---*
- "
Marca
|".
01 Type is control heading sgr-chave.
05 line plus 1.
10 column 01
10 column 02
10 column 80
05 line plus 1.
10 column 01
10 column 80
".
Screen Section.
Copy EST0801.ss.
Procedure Division using area-de-usuarios.
0000-inicio.
Perform 1000-abre-arquivos thru 1000-exit.
Perform 2000-processamento thru 2000-exit.
Close gerpar estpro estsgr estgru estcsd.
0000-exit.
exit program.
*
1000-abre-arquivos.
Open INPUT Gerpar Estpro Estsgr Estgru estcsd.
If par-status not = "00" and "05"
Display (23, 02) "0000-Erro na abertura do ESTPAR. fs.:"
with back 1 fore 15 bell
Display (23, 00) par-status with back 1 fore 15
Stop run.
If csd-status not = "00" and "05"
Display (23, 02) "0000-Erro na abertura do ESTcsd. fs.:"
with back 1 fore 15 bell
Display (23, 00) csd-status with back 1 fore 15
Stop run.
If pro-status not = "00" and "05"
Display (23, 02) "0000-Erro na abertura do ESTPRO. fs.:"
with back 1 fore 15 bell
if pro-status = "23"
display (23, 11) "Nao ha produtos cadastrados neste inter
"valo. Tecle <ENTER>"
with back 1 fore 15 bell
accept (23, 00) ws-ok with back 1 fore 1 auto update
display (23, 11) "
"
" with back 1
go to 2000-exit.
Open output impres.
Initiate rs-est0801.
display (23, 25) "Gerando relatorio... Aguarde..."
with back 1 fore 15 bell.
perform 2300-busca-lancamentos thru 2300-exit.
"
2100-saida.
accept ss-saida.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-cod-fim.
2100-compressao.
accept ss-compressao.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-saida.
evaluate ws-compressao
when 1
move us-12-cpp
when 2
move us-10-cpp
move us-condensado
when 3
move us-12-cpp
move us-condensado
end-evaluate.
2100-exit.
exit.
(1) to ws-controle-1
(1) to ws-controle-1
(1) to ws-controle-2
(1) to ws-controle-1
(1) to ws-controle-2
*
2200-confirmacao.
move "S" to ws-ok.
display (23, 20) "Confirme a emissao do relatorio (S/N): "
with back 1 fore 15 bell.
accept (23, 00) ws-ok with back 1 fore 15 auto update.
if ws-ok not = "S" and "s" and "N" and "n"
go to 2200-confirmacao.
display (23, 20) "
"
with back 1.
2200-exit.
exit.
*
2300-busca-lancamentos.
read estpro next at end go to 2300-exit.
move pro-grupo to gru-codigo sgr-grupo.
read estgru.
if gru-status = "23"
move "** Nao cadatrado **" to gru-descricao.
move pro-subgrupo to sgr-codigo.
read estsgr.
if sgr-status = "23"
move "** Nao cadastrado **" to sgr-descricao.
accept ws-horas from time.
compute ws-preco =
(pro-custo-repos * pro-perc-lucro / 100) + pro-custo-repos.
move 1 to sgr-grupo sgr-codigo.
move "Alfabetico Geral" to gru-descricao sgr-descricao.
move pro-codigo
to csd-codigo.
move ws-data-geral to csd-data.
read estcsd.
if csd-status = "23"
start estcsd key < csd-chave
if csd-status = "23"
move zeros to csd-qtde (1) csd-qtde (2) csd-qtde (3)
csd-valor(1) csd-valor(2) csd-valor(3)
csd-custo-medio(1) csd-custo-medio (2)
csd-custo-medio(3)
else
read estcsd next
if csd-codigo not = pro-codigo
move pro-codigo to csd-codigo
move ws-data-ini to csd-data
move zeros to csd-qtde (1) csd-qtde (2)
csd-qtde (3)
csd-valor(1) csd-valor(2)
csd-valor(3)
csd-custo-medio(1)
csd-custo-medio (2)
csd-custo-medio(3).