Jdi na obsah Jdi na menu
 


unit Unit1;
 
interface
 
uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, Buttons, StdCtrls;
 
type
 TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    ComboBox1: TComboBox;
    Label4: TLabel;
    Label3: TLabel;
    BitBtn1: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
 private
    { Private declarations }
 public
    { Public declarations }
 end;
 
var
 Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
 
var cena, cenasdph, dph: double;
       sazba: integer;
 
 
begin
 
 try
 cena:=strtofloat(edit1.Text);
 except
 showmessage('Špatně zadané číslo');
 edit1.SetFocus;
 edit1.SelectAll;
 exit;
 end;
 
 begin
 if combobox1.ItemIndex = 0 then sazba:=9………….. pokud bude ve výběru 0, je 9%
                                                    else if combobox1.ItemIndex = 1 then sazba:=19.. pokud bude 1, je 19%
                                                                                                                          else begin showmessage('Vyberte si v nabídce sazbu');…………. nebylo ani 0 ani 1 , tak se navybrala sazba,musí se znova
                                                                                                                                   Combobox1.SetFocus;
                                                                                                                        exit;
                                                                                                                        end;
 
 end;
 
 cenasdph:=cena+(cena/100*sazba);……………………………. výpočet
 dph:=Cena1/100*sazba;……………………………..výpočet
 edit2.Text:=FloatToStr(dph);………………………………….. výsledný dph vložený do editu
 edit3.Text:=FloatToStr(Cenasdph);…………………………….výsledná cena s dph vložena do editu
 
 
 
 end;
 
end.