Você está na página 1de 7

Identification Division.

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

pic x(001) value "+".


pic x(078) value all "-".
pic x(001) value "+".
pic x(007) value "|
pic x(001) value "|".

".

01 Linha-detalhe Type is detail.


05 line plus 1.
10 column 01 pic x(001)
value "|".
10 column 02 pic 99999999 source pro-codigo.
10 column 11 pic x(045)
source pro-descricao.
10 column 57 pic
zzz.zz9,99
source ws-preco.
10 column 68 pic x(009)
source gru-descricao.
10 column 80 pic x(001) value "|".
* 05 line plus 1.
*
10 column 01 pic x(001) value "|".
*
10 column 80 pic x(001) value "|".
01 Type is page footing line 63.
05 column 01 pic x(001) value "+".
05 column 02 pic x(078) value all "-".
05 column 80 pic x(001) value "+".
01 Type is
05 line
10
10
10

control footing final.


plus 1.
column 01 pic x(001) value "+".
column 02 pic x(078) value all "-".
column 80 pic x(001) value "+".

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

Display (23, 00) pro-status with back 1 fore 15


Stop run.
If sgr-status not = "00" and "05"
Display (23, 02) "0000-Erro na abertura do ESTSGR. fs.:"
with back 1 fore 15 bell
Display (23, 00) sgr-status with back 1 fore 15
Stop run.
If gru-status not = "00" and "05"
Display (23, 02) "0000-Erro na abertura do ESTGRU. fs.:"
with back 1 fore 15 bell
Display (23, 00) gru-status with back 1 fore 15
Stop run.
move 1 to par-relkey.
read gerpar.
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.
Display g-est0801.
1000-exit.
exit.
*
2000-processamento.
Perform 2100-parametros thru 2100-exit.
if tecla-esc
go to 2000-exit.
Perform 2200-confirmacao thru 2200-exit.
if ws-ok not = "S" and "s"
go to 2000-exit.
move ws-cod-ini to pro-codigo.
move spaces to pro-descricao.
start estpro key not < pro-descricao.

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.

display (23, 25) "


with back 1.
Terminate rs-est0801.
close impres.

"

if ws-saida = "V" or "v"


move "\util\q.exe" to ws-parte2
move "\tmp\est0801.rel" to ws-parametro
display ws-parametro upon command-line
Call x"91" using ws-resultado ws-numero-funcao ws-comando.
2000-exit.
exit.
*
2100-parametros.
2100-cod-ini.
accept ss-cod-ini.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-exit.
2100-cod-fim.
accept ss-cod-fim.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-cod-ini.

if ws-cod-fim < ws-cod-ini or


ws-cod-fim = zeros
display (23, 10) "Codigo final invalido ou menor que o in
"icial. Tecle <ENTER>"
with back 1 fore 15 bell
accept (23, 00) ws-ok with back 1 fore 1 auto update
display (23, 10) "
"
" with back 1
go to 2100-cod-fim.

2100-saida.
accept ss-saida.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-cod-fim.

inspect ws-saida replacing all "v" by "V" "i" by "I".


if ws-saida not = "V" and "I"
display (23, 15) "Tipo de saida invalido. Deve-se informa
"r 'V' ou 'I'" with back 1 fore 15 bell
accept (23, 00) ws-ok with back 1 fore 1 auto update
display (23, 15) "
"
" with back 1
go to 2100-saida.
if ws-saida = "V"
move zeros to ws-compressao
display ss-compressao
move spaces to ws-controle-1 ws-controle-2
move "\tmp\est0801.rel" to ws-nome-saida
go to 2100-exit
else
move "PRN" TO ws-nome-saida.

2100-compressao.
accept ss-compressao.
accept ws-tecla from escape key.
if tecla-esc
go to 2100-saida.

if ws-compressao < 1 or > 3


display (23, 10) "Nivel de compressao invalido. Informe u
"m numero entre 1 e 3."
with back 1 fore 15 bell
accept (23, 00) ws-ok with back 1 fore 1 auto update
display (23, 10) "
"
" with back 1
go to 2100-compressao.

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).

move pro-grupo to gru-codigo.


read estgru.
if pro-classe = 1 or 4
go to 2300-busca-lancamentos.
if pro-codigo < ws-cod-ini
go to 2300-busca-lancamentos.
if pro-codigo > ws-cod-fim
go to 2300-busca-lancamentos.
Generate linha-detalhe.
go to 2300-busca-lancamentos.
2300-exit.
exit.
*


Você também pode gostar