Program na simulaci pokladny, který vypoèítá i daò

Delphi & Pascal (èeská wiki)
Pøejít na: navigace, hledání
Kategorija: KMP (Programy mladòakoch
pokladna.pngZrobil: Luká¹ Hlousek
Program: Pokladna.pas
Subor exe: Pokladna.exe
Mu¹i¹ mac: Hlousek.pas

Program na simulaci pokladny, který vypoèítá i daò.
{ POKLADNA.PAS                          Copyright (c) Lukas Hlousek }
{ Program na simulaci pokladny, který vypoèítá i daò.               }
{                                                                   }
{ Datum:10.01.2007                             http://www.trsek.com }
 
{$M 32000 0 0}
uses crt,dos,hlousek;
 
var
  CenaKs: Real;
  CenaCelk: Real;
  Kusy: Byte;
  DPH: Byte;
  Soucet: Real;
  Soucet5: Real;
  Soucet19: Real;
  PocetPol: Byte;
  Konec: Char;
  Pokrac: Char;
  Dan5: Real;
  Dan19: Real;
  OdecetL: Byte;
  NakupEnd: Char;
  Soucet2Disp: string;
 
begin
  TextBackground(2);
  ClrScr;
  TextColor(4);
  WriteLn('');
  WriteLn('                         ÉËËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËË»');
  Write('                         ººº');
  TextColor(14);
  Write(' POKLADNA v 1.01');
  TextColor(4);
  WriteLn(' ººº');
  WriteLn('                         ÈÊÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊʼ');
  TextColor(15);
  WriteLn('                                by Lukas Hlousek');
  WriteLn('');
  WriteLn('');
  WriteLn('ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ');
  WriteLn('    Cena za kus       Pocet kusu       Cena Celkem       DPH    ');
  WriteLn('ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ');
  GotoXY(1,25);
  TextBackground(LightGray);
  TextColor(Red);
  ClrEol;
  Write(' <+>');
  TextColor(Black);
  Write('Nova polozka  ');
  TextColor(Red);
  Write('<*>');
  TextColor(Black);
  Write('Ukoncit nakup');
  repeat
    { NULOVANI PROMENNYCH }
    CenaKs:= 0;
    Kusy:= 0;
    DPH:= 0;
    Soucet:= 0;
    Soucet5:= 0;
    Soucet19:= 0;
    PocetPol:= 0;
    Dan5:= 0;
    Dan19:= 0;
    OdecetL:= 0;
    CenaKs:= 0;
    Kusy:= 0;
    DPH:= 0;
 
    { CYKLUS ZADAVANI POLOZEK }
    while VyberVolbu('','+*')='+' do
    begin
       GoToXY(80, 11+PocetPol);
       TextBackground(2);
       ClrEol;
       TextColor(0);
      GotoXY(5,11+PocetPol);
      TextColor(14);
       Read(CenaKs);
      WriteLn('');
      TextColor(0);
      TextColor(14);
      GotoXY(23,11+PocetPol);
       Read(Kusy);
      CenaCelk:=CenaKs*Kusy;
      GotoXY(38,11+PocetPol);
      Write(CenaCelk:8:2);
      TextColor(14);
      GoToXY(58,11+PocetPol);
       Read(DPH);
 
    {VYPOCTOVA CAST}   
     if DPH= 5 then Soucet5:=Soucet5+((CenaKs)*Kusy);
     if DPH= 5 then Dan5:= Dan5+((CenaKs*0.05)*Kusy);
     if DPH= 19 then Soucet19:=Soucet19+((CenaKs)*Kusy);
     if DPH= 19 then Dan19:= Dan19+((CenaKs*0.19)*Kusy);
     Soucet:= Soucet-OdecetL;
      PocetPol:=PocetPol+1;
      Soucet:= Soucet+(CenaKs*Kusy);
    end;
    WriteLn('');
 
    {VYPSANI VYPOCTENYCH HODNOT}
     TextBackground(2);
     ClrScr;
    TextColor(12);
    WriteLn('                               Vyuctovani');
    WriteLn('                               ÍÍÍÍÍÍÍÍÍÍ');
    WriteLn('');
    WriteLn('');
    TextColor(14);
     GoToXY(5, WhereY);
    Write('Zaklad 5% dane:     ',Soucet5:8:2,' Kc');
    TextColor(15);
    GoToXY(WhereX +5,WhereY);
    WriteLn('5% dan je:     ',Dan5:8:2,' Kc');
    TextColor(14);
     GoToXY(5, WhereY+1);
    Write('Zaklad 19% dane:    ',Soucet19:8:2,' Kc');
    TextColor(15);
     GoToXY(WhereX +5,WhereY);
    WriteLn('19% dan je:    ',Dan19:8:2,' Kc');
    TextColor(14);
     GoToXY(5, WhereY+1);
    WriteLn('Celkem bez dane:    ',((Soucet5*0.95)+(Soucet19*0.81)):8:2,' Kc');
     GoToXY(5, WhereY+1);
    WriteLn('Odecet za lahve:        ',OdecetL,' Kc');
     GoToXY(5, WhereY+1);
    WriteLn('Celkem k uhrade:    ',Soucet:8:2,' Kc');
     GoToXY(23, WhereY+2);
    TextColor(9);
    Write('Pro pokracovani stiskni klavesu !');
    SwapVectors;
 
     GoToXY(60, WhereY);
    { ZOBRAZENI CENY NA DISPLEJI }
    Str(Soucet:8:2, Soucet2Disp);
    WriteLn(Soucet2Disp);
    Exec('./zobrcenu.exe', Soucet2Disp);
    SwapVectors;
    Pokrac:=ReadKey;
     GoToXY(22, WhereY+1);
  until VyberVolbu('Chcete ukoncit program (A=ano, N=ne)', 'AN')='A';
  TextBackground(0);
  ClrScr;
end.