unit p_helpdesk;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  fcButton, fcImgBtn, StdCtrls,db, Buttons, ExtCtrls, RzPanel, IvDictio,
  IvMulti, DBCtrls, RzButton, SUIButton;

type
  Tf_helpdesk = class(TForm)
    RzPanel1: TRzPanel;
    SpeedButton4: tsuiButton;
    SpeedButton3: tsuiButton;
    SpeedButton2: tsuiButton;
    SpeedButton1: tsuiButton;
    SpeedButton8: tsuiButton;
    SpeedButton7: tsuiButton;
    SpeedButton6: tsuiButton;
    SpeedButton5: tsuiButton;
    SpeedButton10: tsuiButton;
    SpeedButton9: tsuiButton;
    RzPanel3: TRzPanel;
    Edit1: TEdit;
    RzPanel2: TRzPanel;
    Edit2: TEdit;
    RzPanel4: TRzPanel;
    Edit3: TEdit;
    SpeedButton11: tsuiButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    IvTranslator1: TIvTranslator;
    RzPanel5: TRzPanel;
    Label4: TLabel;
    Edit4: TEdit;
    SpeedButton12: tsuiButton;
    DBText1: TDBText;
    RzPanel6: TRzPanel;
    RzBitBtn2: TRzBitBtn;
    fcImageBtn1: TsuiButton;
    RzBitBtn1: TRzBitBtn;
    SpeedButton13: tsuiButton;
    SpeedButton14: tsuiButton;
    SpeedButton15: tsuiButton;
    SpeedButton16: tsuiButton;
    SpeedButton17: tsuiButton;
    SpeedButton18: tsuiButton;
    procedure SpeedButton1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure RzBitBtn1Click(Sender: TObject);
    procedure SpeedButton12Click(Sender: TObject);
    procedure RzBitBtn2Click(Sender: TObject);
    procedure Edit1Click(Sender: TObject);
    procedure Edit4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_helpdesk: Tf_helpdesk;iii:integer;

implementation

uses p_posmodule, p_telep;



{$R *.DFM}

procedure Tf_helpdesk.SpeedButton1Click(Sender: TObject);
begin


if iii=1 then
begin
if  trim(edit4.Text)<>'0' then
edit4.Text:=edit4.Text+(sender as tsuiButton).caption
else
edit4.Text:=(sender as tsuiButton).caption;
end
else
if  trim(edit1.Text)<>'0' then
edit1.Text:=edit1.Text+(sender as tsuiButton).caption
else
edit1.Text:=(sender as tsuiButton).caption;


end;

procedure Tf_helpdesk.Edit1Change(Sender: TObject);
var c:currency;s1,s2:string;
begin

try
if trim(edit1.Text)='' then s1:='0'
else
s1:=trim(edit1.Text);
if trim(edit4.Text)='' then s2:='0'
else
s2:=trim(edit4.Text);
c:=strtofloat(s1)-strtofloat(edit3.text)+strtofloat(s2)*p_posmodule.myval2;
edit2.Text:=formatfloat('#,0;-#,0',c);

except
end;


end;

procedure Tf_helpdesk.FormShow(Sender: TObject);
begin
try

edit3.Text:=posmodule.CURRFACTOTAL.AsString;
edit1.Text:='0';
iii:=0;
except
end;
end;

procedure Tf_helpdesk.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
try
if (not(posmodule.CURRFAC.state in [dsedit])) and
    (not(posmodule.CURRFAC.state in [dsinsert])) then
    posmodule.CURRFAC.edit;

    posmodule.CURRFACCASHIN.AsCurrency:=strtofloat(edit1.text);
    posmodule.CURRFACCASHOUT.AsCurrency:=strtofloat(edit2.text);


except
end;
end;

procedure Tf_helpdesk.RzBitBtn1Click(Sender: TObject);
begin
modalresult:=mrok ;
end;

procedure Tf_helpdesk.SpeedButton12Click(Sender: TObject);
begin
Edit1.Text:='0';
edit4.text:='0';

end;

procedure Tf_helpdesk.RzBitBtn2Click(Sender: TObject);
begin

//Application.CreateForm(Tf_telep,f_telep);
       if not assigned(f_telep) then
f_telep:=tf_telep.create(self);
try
if f_telep.ShowModal=mrok then
begin




posmodule.CURRFAC.edit;

posmodule.CURRFACNAME.AsString:=f_telep.Query1name.AsString;
posmodule.CURRFACCONTACT.AsString:=f_telep.Query1id.AsString;



posmodule.CURrFAC.POST;

posmodule.tocontact.close;
posmodule.tocontact.open;

posmodule.items.first;
try
while not posmodule.items.Eof do
begin
posmodule.items.edit;


POSMODULE.itemscontact.AsString:=posmodule.CURRFACCONTACT.AsString;

posmodule.items.post;
posmodule.items.next;
end;

EXCEPT
END;



end;
except
end;
if  assigned(f_telep) then
freeandnil(f_telep);



RzBitBtn1.SetFocus;
end;

procedure Tf_helpdesk.Edit1Click(Sender: TObject);
begin
iii:=0;
end;

procedure Tf_helpdesk.Edit4Click(Sender: TObject);
begin
iii:=1;
end;

end.
