You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
4.8 KiB
Plaintext
193 lines
4.8 KiB
Plaintext
unit VouItemStlu;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, DBGridEh,DB, DBCtrls, Mask,DBTables,
|
|
bsSkinCtrls, bsdbctrls, DBCtrlsEh;
|
|
|
|
type
|
|
TFrmVouItemStl = class(TForm)
|
|
DBGridVouItems: TDBGridEh;
|
|
lblRmbDr: TLabel;
|
|
Label5: TLabel;
|
|
Label6: TLabel;
|
|
lblRmbCr: TLabel;
|
|
Label7: TLabel;
|
|
lblUsdCr: TLabel;
|
|
lblUsdDr: TLabel;
|
|
Label8: TLabel;
|
|
Label9: TLabel;
|
|
Label10: TLabel;
|
|
Label11: TLabel;
|
|
Label12: TLabel;
|
|
Label13: TLabel;
|
|
Label14: TLabel;
|
|
Label15: TLabel;
|
|
Label16: TLabel;
|
|
Label17: TLabel;
|
|
Label18: TLabel;
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
DBText1: TDBText;
|
|
Label3: TLabel;
|
|
DBEdit1: TDBEdit;
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
Label20: TLabel;
|
|
DBEdit2: TDBEdit;
|
|
BitBtn1: TBitBtn;
|
|
BitBtn2: TBitBtn;
|
|
bsSkinDBNavigator1: TbsSkinDBNavigator;
|
|
Label4: TLabel;
|
|
DBComboBoxEh1: TDBComboBoxEh;
|
|
SpeedButton1: TSpeedButton;
|
|
SpeedButton2: TSpeedButton;
|
|
procedure BitBtn1Click(Sender: TObject);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
procedure DBGridVouItemsEditButtonClick(Sender: TObject);
|
|
procedure Button2Click(Sender: TObject);
|
|
procedure BitBtn2Click(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure SpeedButton1Click(Sender: TObject);
|
|
procedure SpeedButton2Click(Sender: TObject);
|
|
private
|
|
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
FrmVouItemStl: TFrmVouItemStl;
|
|
AddVt:Boolean;
|
|
|
|
implementation
|
|
|
|
uses dmAccu, my_sys_function, u_main, u_data_share;
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TFrmVouItemStl }
|
|
|
|
|
|
|
|
procedure TFrmVouItemStl.BitBtn1Click(Sender: TObject);
|
|
begin
|
|
AddVt:=false;
|
|
ModalResult:=mrOK;
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.FormCloseQuery(Sender: TObject;
|
|
var CanClose: Boolean);
|
|
begin
|
|
CanClose:=(ModalResult<>mrOK) or verVour;
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.DBGridVouItemsEditButtonClick(Sender: TObject);
|
|
var
|
|
fName:String;
|
|
begin
|
|
{
|
|
fName:=UpperCase(DBGridVouItems.SelectedField.FieldName);
|
|
|
|
// if fName='ACCNAMECALC' then begin
|
|
if dmAcc.Query2.FieldByName('AMT').AsFloat>0 then begin
|
|
dmAcc.tblVouItems.Edit;
|
|
dmAcc.tblVouItems.FieldByName('AMTCR').AsFloat:=dmAcc.Query2.FieldByName('AMT').AsFloat;
|
|
dmAcc.tblVouItems.FieldByName('STATUS').Asinteger:=1;
|
|
end else begin
|
|
dmAcc.tblVouItems.Edit;
|
|
dmAcc.tblVouItems.FieldByName('AMTDR').AsFloat:=Abs(dmAcc.Query2.FieldByName('AMT').AsFloat);
|
|
dmAcc.tblVouItems.FieldByName('STATUS').Asinteger:=1;
|
|
end;
|
|
|
|
end;
|
|
}
|
|
|
|
{
|
|
if fName='ACCNAMECALC' then
|
|
SelCorp
|
|
else if fName='ACCID' then
|
|
SelACCID;
|
|
}
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.Button2Click(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.BitBtn2Click(Sender: TObject);
|
|
begin
|
|
ModalResult:=mrCancel;
|
|
close;
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.FormCreate(Sender: TObject);
|
|
begin
|
|
AddVt:=false;
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.SpeedButton1Click(Sender: TObject);
|
|
var
|
|
itemno:Integer;
|
|
begin
|
|
itemno:=dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger;
|
|
if itemno=1 then exit;
|
|
dmAcc.ADOTblVouitems.DisableControls;
|
|
try
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=-1;
|
|
dmAcc.ADOTblVouitems.post;
|
|
if dmAcc.ADOTblVouitems.Locate('ItemNo',itemno-1,[]) then begin
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=itemno;
|
|
dmAcc.ADOTblVouitems.post;
|
|
end;
|
|
if dmAcc.ADOTblVouitems.Locate('ItemNo',-1,[]) then begin
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=itemno-1;
|
|
dmAcc.ADOTblVouitems.post;
|
|
end;
|
|
finally
|
|
dmAcc.ADOTblVouitems.EnableControls;
|
|
end;
|
|
dmAcc.ADOTblVouitems.Requery();
|
|
dmAcc.ADOTblVouitems.Locate('ItemNo',itemno-1,[]);
|
|
|
|
end;
|
|
|
|
procedure TFrmVouItemStl.SpeedButton2Click(Sender: TObject);
|
|
var
|
|
itemno:Integer;
|
|
begin
|
|
itemno:=dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger;
|
|
if not dmAcc.ADOTblVouitems.Locate('ItemNo',itemno+1,[]) then exit;
|
|
dmAcc.ADOTblVouitems.DisableControls;
|
|
try
|
|
dmAcc.ADOTblVouitems.Locate('ItemNo',itemno,[]);
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=-1;
|
|
dmAcc.ADOTblVouitems.post;
|
|
if dmAcc.ADOTblVouitems.Locate('ItemNo',itemno+1,[]) then begin
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=itemno;
|
|
dmAcc.ADOTblVouitems.post;
|
|
end;
|
|
if dmAcc.ADOTblVouitems.Locate('ItemNo',-1,[]) then begin
|
|
dmAcc.ADOTblVouitems.Edit;
|
|
dmAcc.ADOTblVouitems.FieldByName('ItemNo').AsInteger:=itemno+1;
|
|
dmAcc.ADOTblVouitems.post;
|
|
end;
|
|
finally
|
|
dmAcc.ADOTblVouitems.EnableControls;
|
|
end;
|
|
dmAcc.ADOTblVouitems.Requery();
|
|
dmAcc.ADOTblVouitems.Locate('ItemNo',itemno+1,[]);
|
|
|
|
end;
|
|
|
|
end.
|