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.

176 lines
5.5 KiB
Plaintext

11 months ago
unit u_fee_baoganadd;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, DB, ADODB, StdCtrls, Mask,
DBCtrls, wwdblook, RxLookup;
type
Tfrm_fee_baoganadd = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinGroupBox1: TbsSkinGroupBox;
Label1: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
bsSkinGroupBox2: TbsSkinGroupBox;
Label10: TLabel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
wwDBLookupCombo1: TwwDBLookupCombo;
wwDBLookupCombo2: TwwDBLookupCombo;
wwDBLookupCombo4: TwwDBLookupCombo;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
Edit3: TEdit;
table1: TDataSource;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
procedure t_ch_acceptdjoncharge(Sender: TField);//<2F>շѽ<D5B7><D1BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{ Private declarations }
public
CFFeeName,CFCURR:string;
CFAMOUNT,CFEXCHANGE:Double;
{ Public declarations }
end;
var
frm_fee_baoganadd: Tfrm_fee_baoganadd;
implementation
uses u_main, u_data_share, my_sys_function;
{$R *.dfm}
procedure Tfrm_fee_baoganadd.bsSkinButton1Click(Sender: TObject);
var
afield : variant;
i: Integer;
amount:double;
begin
if (table1.DataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD') THEN BEGIN
amount:=StrToFloat(Edit1.Text);
table1.DataSet.Edit;
table1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=wwDBLookupCombo1.Text;
table1.DataSet['<27>ұ<EFBFBD>']:=wwDBLookupCombo4.Text;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=StrToFloat(Edit2.Text);
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount/table1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
table1.DataSet['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>']:=amount;
table1.DataSet['<27><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=CFFeeName;
table1.DataSet['<27><><EFBFBD>ֱұ<D6B1>']:=CFCURR;
if (table1.DataSet.FieldByName('<27>ұ<EFBFBD>').AsString=CFCURR) then begin
table1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=StrToFloat(Edit1.Text);
table1.DataSet['<27><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>']:=StrToFloat(Edit2.Text);
end else begin
table1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=StrToFloat(Edit1.Text)*StrToFloat(Edit2.Text);
table1.DataSet['<27><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>']:=StrToFloat(Edit2.Text);
end;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount;
table1.DataSet.post;
afield := vararraycreate([0,table1.DataSet.fieldcount-1],varvariant);
for i := 0 to (table1.DataSet.fieldcount-1) do
begin
afield[i] :=table1.DataSet.fields[i].value ;
end;
table1.DataSet.append;
for i := 1 to (table1.DataSet.fieldcount-1) do
begin
if table1.DataSet.fields[i].FieldName<>'CH_ID' then
table1.DataSet.fields[i].value := afield[i] ;
end;
table1.DataSet['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
table1.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
table1.DataSet['˳<><CBB3>']:=table1.DataSet.RecordCount+1;
table1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=wwDBLookupCombo2.Text;
table1.DataSet['<27>ұ<EFBFBD>']:='RMB';
amount:=StrToFloat(Edit3.Text);
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount/table1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
table1.DataSet['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>']:=amount;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=1;
table1.DataSet['<27><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=CFFeeName;
table1.DataSet['<27><><EFBFBD>ֱұ<D6B1>']:=CFCURR;
table1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=CFAMOUNT-StrToFloat(Edit1.Text);
table1.DataSet['<27><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>']:=StrToFloat(Edit2.Text);
table1.DataSet.post;
end else begin
amount:=StrToFloat(Edit3.Text);
table1.DataSet.Edit;
table1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=wwDBLookupCombo2.Text;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount/table1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
table1.DataSet['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>']:=amount;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=StrToFloat(Edit3.Text);
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=1;
table1.DataSet['<27><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=CFFeeName;
table1.DataSet['<27><><EFBFBD>ֱұ<D6B1>']:=CFCURR;
table1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=StrToFloat(Edit3.Text);
table1.DataSet['<27><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>']:=1;
table1.DataSet.post;
afield := vararraycreate([0,table1.DataSet.fieldcount-1],varvariant);
for i := 0 to (table1.DataSet.fieldcount-1) do
begin
afield[i] :=table1.DataSet.fields[i].value ;
end;
table1.DataSet.append;
for i := 1 to (table1.DataSet.fieldcount-1) do
begin
if table1.DataSet.fields[i].FieldName<>'CH_ID' then
table1.DataSet.fields[i].value := afield[i] ;
end;
amount:=StrToFloat(Edit1.Text);
table1.DataSet['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
table1.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
table1.DataSet['˳<><CBB3>']:=table1.DataSet.RecordCount+1;
table1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=wwDBLookupCombo1.Text;
table1.DataSet['<27>ұ<EFBFBD>']:=wwDBLookupCombo4.Text;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=amount/table1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
table1.DataSet['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>']:=amount;
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=StrToFloat(Edit1.Text);
table1.DataSet['<27><><EFBFBD><EFBFBD>']:=StrToFloat(Edit2.Text);
table1.DataSet['<27><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=CFFeeName;
table1.DataSet['<27><><EFBFBD>ֱұ<D6B1>']:=CFCURR;
table1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=CFAMOUNT-StrToFloat(Edit3.Text);
table1.DataSet['<27><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>']:=StrToFloat(Edit2.Text);
table1.DataSet.post;
end;
close;
end;
procedure Tfrm_fee_baoganadd.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_fee_baoganadd.t_ch_acceptdjoncharge(Sender: TField);
begin
end;
procedure Tfrm_fee_baoganadd.Edit1Change(Sender: TObject);
VAR
amount:Double;
begin
if (CFCURR='USD') THEN begin
amount:=CFAMOUNT-strtofloatdef(Edit1.Text,0);
amount:=amount*strtofloatdef(Edit2.Text,0);
Edit3.Text:=FloatToStr(amount);
end ELSE BEGIN
amount:=strtofloatdef(Edit1.Text,0)*strtofloatdef(Edit2.Text,0);
Edit3.Text:= FloatToStr(CFAMOUNT-amount);
end;
end;
end.