Ir ao conteúdo
  • Cadastre-se

Juju122

Membro Júnior
  • Posts

    5
  • Cadastrado em

  • Última visita

Tudo que Juju122 postou

  1. No relatório funcionário mostra o nome do funcionário, cliente atendido, o produto, o código do produto, porém não mostra a quantidade que o cliente comprou. Já o relatório do cliente, ele mostra o nome do cliente, produto, porém não mostra a quantidade nem o total que a pessoa comprou. O que faço pra resolver esses erros? Program Pzim ; uses crt; type cliente=record nomecli:string; telcli:integer; codcli:integer; End; type funcionario=record codfun:integer; nomefun:string; telfun:integer; End; type produto=record codprod:integer; nomeprod:string; precoprod:real; End; type venda=record codvenda:integer; codclivenda:integer; codfunvenda:integer; codprovenda:integer; quant:integer; total:real; diavenda:integer; mesvenda:integer; horavenda:integer; minutovenda:integer; anovenda:integer; End; var clivet:array[1..5] of cliente; funcvet:array[1..5] of funcionario; prodvet:array[1..5] of produto; vendvet:array[1..5] of venda; Dia, Mes, Ano, Dia_Semana, Hora, Minuto, Segundo, Dec_Segundo : integer; op,op2,op3:integer; i, j,x:integer; resp,resp2,resp3,resp4,resp5,nomefunc,funcinome,cod_cli:string; precotot:real; anorel,mesrel,cod_cliente,funcr:integer; procedure menu; begin clrscr; writeln('----Menu Principal----'); writeln('[1] - Cadastros - '); writeln('[2] - Vendas - '); writeln('[3] - Relatórios - '); writeln('[4] - Sair - '); writeln('Informe a opção de seu interesse'); readln(op); End; procedure menucadastro; begin clrscr; writeln('----Menu de Cadastros----'); writeln('[1] - Cadastrar Cliente - '); writeln('[2] - Cadastrar Funcionário - '); writeln('[3] - Cadastrar Produto - '); writeln('[4] - Volta para o menu principal - '); writeln('Informe a opção de seu interesse'); readln(op2); End; procedure cadcliente; begin clrscr; for i:=1 to 5 do begin clrscr; if clivet[i].nomecli='' then begin writeln('----Cadastro Cliente----'); writeln('Informe o codigo do cliente'); readln(clivet[i].codcli); writeln('Informe o nome do cliente'); readln(clivet[i].nomecli); writeln('Informe o telefone do cliente'); readln(clivet[i].telcli); writeln('Deseja cadastrar um novo cliente?[S/N]'); readln(resp); if UpCase (resp)='N' then begin exit; end; end; end; End; procedure cadfuncionario; begin clrscr; for i:=1 to 5 do begin clrscr; if funcvet[i].nomefun='' then begin writeln('----Cadastro Funcionário----'); writeln('Informe o codigo do funcionário'); readln(funcvet[i].codfun); writeln('Informe o nome do funcionário'); readln(funcvet[i].nomefun); writeln('Informe o telefone do funcionário'); readln(funcvet[i].telfun); writeln('Deseja cadastrar um novo funcionário?[S/N]'); readln(resp2); if UpCase (resp2)='N' then begin exit; end; end; end; End; procedure cadproduto; begin clrscr; for i:=1 to 5 do begin clrscr; if prodvet[i].nomeprod='' then begin writeln('----Cadastro Produto----'); writeln('Informe o codigo do produto'); readln(prodvet[i].codprod); writeln('Informe o nome do produtoo'); readln(prodvet[i].nomeprod); writeln('Informe o preço do produto'); readln(prodvet[i].precoprod); writeln('Deseja cadastrar um novo produto?[S/N]'); readln(resp3); if UpCase (resp3)='N' then begin exit; end; end; end; End; procedure vendas; begin clrscr; for i:=1 to 5 do begin clrscr; if prodvet[i].nomeprod='' then begin writeln('----Vendas----'); writeln('Informe o codigo da venda'); readln(vendvet[i].codvenda); writeln('Informe o codigo do cliente'); readln(vendvet[i].codclivenda); writeln('Informe o codigo do funcionario'); readln(vendvet[i].codfunvenda); for x:=1 to 5 do begin if prodvet[x].nomeprod<>'' then begin writeln(''); writeln('Produto: ',prodvet[x].nomeprod,' Cod produto: ',prodvet[x].codprod,' Preço: ', prodvet[x].precoprod:6:2); writeln(''); end; end; writeln('Informe o codigo do produto'); readln(vendvet[i].codprovenda); writeln('Informe a quantidade'); readln(vendvet[i].quant); GetDate(Ano, Mes, Dia, Dia_Semana); GetTime(Hora, Minuto, Segundo, Dec_Segundo); vendvet[i].horavenda:=hora; vendvet[i].minutovenda:=minuto; vendvet[i].diavenda:=dia; vendvet[i].mesvenda:=mes; vendvet[i].anovenda:=ano; for j:= 1 to 5 do begin if vendvet[i].codprovenda=prodvet[j].codprod then begin precotot:=prodvet[j].precoprod; end; end; vendvet[i].total:=precotot*vendvet[i].quant; writeln ('Total: ',vendvet[i].total:6:2); writeln('Deseja realizar uma nova compra?[S/N]'); readln(resp4); if UpCase (resp4)='N' then begin exit; end; end; end; End; function tot(valor1,valor2:real):real; begin valor1:=valor1+valor2; tot:=valor1; End; procedure menurelatorio; begin writeln('[1] Relatório Mensal'); writeln('[2] Relatório Anual'); writeln('[3] Relatório por Funcionário'); writeln('[4] Relatório por Cliente'); writeln('Digite a opção desejada'); readln(op3); case op3 of 1:begin clrscr; writeln('Digite o ano'); readln(anorel); writeln('Digite o mês'); readln(mesrel); for i:=1 to 5 do begin if anorel=vendvet[i].anovenda then begin if mesrel=vendvet[i].mesvenda then begin writeln('Produto: ',prodvet[i].nomeprod,' Quantidade: ',vendvet[i].quant ,' Total: ',vendvet[i].total:6:2); end; end; end; end; 2:begin clrscr; writeln('Digite o ano'); readln(anorel); for i:=1 to 5 do begin if anorel=vendvet[i].anovenda then begin writeln('Produto: ',prodvet[i].nomeprod,' Quantidade: ',vendvet[i].quant ,' Total: ',vendvet[i].total:6:2); end; end; End; 3:begin clrscr; writeln('Informe o codigo do funcionário em questão'); readln(funcr); for i:=1 to 5 do begin if funcr=vendvet[i].codfunvenda then begin for j:=1 to 5 do begin if funcr= funcvet[j].codfun then begin funcinome:=funcvet[j].nomefun; end; writeln('Funcionário: ',funcinome, ' Cliente Atendido: ',clivet[j].nomecli); writeln('Produto: ',prodvet[j].nomeprod, ' Codigo do produto: ',prodvet[j].codprod, ' Quantidade: ',vendvet[j].quant); break; end; end; end; End; 4:begin clrscr; writeln('Informe o codigo do cliente'); readln(cod_cliente); for i:=1 to 5 do begin if cod_cliente=clivet[i].codcli then begin for j:=1 to 10 do begin if cod_cliente=clivet[j].codcli then begin cod_cli:=clivet[j].nomecli; end; writeln('Nome: ',clivet[j].nomecli,' Produto: ',prodvet[j].nomeprod ,' Quantidade: ',vendvet[j].quant,' Total:R$ ',vendvet[j].total:6:2); break; end; //writeln('Nome: ',clivet[i].nomecli,' Produto: ',prodvet[i].nomeprod ,' Quantidade: ',vendvet[i].quant,' Total:R$ ',vendvet[i].total:6:2); end; end; End; End; End; Begin repeat menu; case op of 1:begin repeat menucadastro; case op2 of 1:begin cadcliente; end; 2:begin cadfuncionario; end; 3:begin cadproduto; end; end; until op2=4; end; 2:begin vendas; end; 3:begin repeat clrscr; menurelatorio; writeln('Deseja ver o relatório novamente?'); readln(resp5); until UpCase (resp5)='N'; end; End; until op=4; End. pasnew.docx
  2. @KXSY jura? ox, o professor pediu pra fazermos isso no pascal . como vou fazer isso mds kkkkk
  3. @Simon Viegas Tipo, eu quero colocar datas pra fazer relatório mensal e anual, ver o que foi comprado em cada mês, a quantidade , cada funcionário que fez a venda, entende?
  4. Program Pzim ; type respostas=record resp:string; op:string; op2:string; op3:string; op4:string; op5:string; op6:string; cod1:string; cod2:string; nome1:string; nome2:string; End; var produtos : array[1..10, 1..3] of string; funcionarios : array[1..10, 1..3] of string; clientes : array[1..10, 1..3] of string; vendas : array[1..10, 1..4] of string; EscUm , EscDois , EscTres , i , x , y : integer; respostas1:respostas; total:array[1..10,1..2] of real; tot:real; Begin repeat clrscr; writeln('----Menu Principal----'); writeln('[1] - Cadastros - '); writeln('[2] - Vendas - '); writeln('[3] - Relatórios - '); writeln('[4] - Sair - '); writeln('Informe a opção de seu interesse'); readln(EscUm); case EscUm of 1:begin clrscr; writeln('----Menu de Cadastros----'); writeln('[1] - Cadastrar Cliente - '); writeln('[2] - Cadastrar Funcionário - '); writeln('[3] - Cadastrar Produto - '); writeln('[4] - Volta para o menu principal - '); writeln('Informe a opção de seu interesse'); readln(EscDois); case EscDois of 1:begin //cadastrar clientes repeat for i:=1 to 10 do begin if clientes[i,1] = '' then begin clrscr; writeln('----Cadastro clientes----'); writeln('Informe o codigo do cliente'); readln(clientes[i,1]); writeln('Informe o nome do cliente'); readln(clientes[i,2]); writeln('Informe o telefone do cliente'); readln(clientes[i,3]); break; end; end; writeln('Deseja realizar outro cadastro?[S/N]'); readln(respostas1.op); until UpCase(respostas1.op) ='N'; end; 2:begin //cadastrar funcionario repeat for i:=1 to 10 do begin if funcionarios[i,1] = '' then begin clrscr; writeln('----Cadastro Funcionario----'); writeln('Informe o codigo do funcionário'); readln(funcionarios[i,1]); writeln('Informe o nome do funcionário'); readln(funcionarios[i,2]); writeln('Informe o telefone do funcionário'); readln(funcionarios[i,3]); break; end; end; writeln('Deseja cadastrar outro funcionário? [S/N]'); readln(respostas1.op2); until UpCase(respostas1.op2) = 'N'; end; 3:begin //cadastrar produto repeat for i:=1 to 10 do begin if produtos[i,1] = '' then begin clrscr; writeln('----Cadastro Produto----'); writeln('Informe o codigo do produto'); readln(produtos[i,1]); writeln('Informe o nome do produto'); readln(produtos[i,2]); writeln('Informe o preço do produto'); readln(total[i,1]); //readln(produtos[i,3]); break; end; end; writeln('Deseja cadastrar outro produto?[S/N]'); readln(respostas1.op3); until UpCase(respostas1.op3)= 'N'; end; 4:begin end; end; end; 2:begin //vendas repeat; for i:=1 to 10 do begin if vendas[i,1] = '' then begin clrscr; writeln('---Vendas---'); writeln(' '); for i:=1 to 10 do begin if produtos[i,2] <> '' then begin writeln(' Produto:',produtos[i,2],' Preço:$',total[i,1]:6:2,' codigo: ', produtos[i,1]); writeln(' '); end; end; writeln(' '); writeln('Informe o codigo da venda'); readln(vendas[i,1]); writeln('Informe o codigo do cliente'); readln(vendas[i,2]); writeln('Informe o codigo do funcionário responsável'); readln(vendas[i,3]); writeln('Informe o codigo do produto'); readln(vendas[i,4]); writeln('Informe a quantidade desejada'); readln(total[i,2]); tot:= total[i,1]*total[i,2]; writeln('total a se pagar:$',tot:6:2); break; end; end; writeln('Deseja realizar outra compra? [S/N]'); readln(respostas1.op4); until UpCase(respostas1.op4)= 'N'; end; 3:begin clrscr; writeln('----Relatórios----'); writeln('[1] - Relatório por clientes - '); writeln('[2] - Relatório por funcionários - '); writeln('[3] - Relatório Anual - '); writeln('[4] - Relatário Mensal - '); writeln('[5] - Voltar para o menu principal -'); writeln('Informe a opção desejada'); readln(EscTres); case EscTres of 1:begin //relatorio clientes repeat clrscr; writeln('Informe o codigo do cliente em questão'); readln(respostas1.cod1); for i:=1 to 10 do begin if respostas1.cod1 = vendas[i,2] then begin for x:=1 to 10 do begin if respostas1.cod1=clientes[x,1] then begin respostas1.nome1:=clientes[x,2]; end; end; clrscr; writeln(' '); writeln(' Nome: ',respostas1.nome1,' Produto: ', vendas[i,4] ,' Quantidade: ', vendas[i,5],' Total:R$ ',tot:6:2); writeln(' '); writeln('Pressione enter para votar ao menu principal.....'); readln(); end; end; break; writeln('testo fantasma , spook spook'); readln(respostas1.op6); until Upcase(respostas1.op6)='S'; end; 2:begin //relatorio funcionarios repeat clrscr; writeln('Informe o codigo do funcionário em questão'); readln(respostas1.cod2); for i:=1 to 10 do begin if respostas1.cod2 = vendas[i,3] then begin for y:=1 to 10 do begin if respostas1.cod2=funcionarios[y,1] then begin respostas1.nome2:=funcionarios[y,2]; end; clrscr; writeln(' '); writeln(' Nome do Funcionário:',respostas1.nome2,' Cliente atendido:',clientes[i,2],' Produto:', vendas[i,4]); writeln(' Nome do produto:',produtos[i,2], ' Quantidade:', vendas[i,5]); writeln(' '); writeln('Pressione enter , para voltar ao menu principal...'); readln(); break; end; end; end; break; writeln('texto fantasma , spooky spooky'); readln(respostas1.op5); until Upcase(respostas1.op5)='S'; end; 3:begin //relatorio anual end; 4:begin //relatorio mensal end; 5:begin end; end; end; 4:begin writeln('Deseja sair do programa? [S/N]'); readln(respostas1.resp); end; end; until Upcase(respostas1.resp)='S'; End.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!