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.

365 lines
12 KiB
Plaintext

11 months ago
unit u_check_modify;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, DB, ADODB, StdCtrls, Mask,
DBCtrls, wwdblook, RxLookup, RxMemDS;
type
Tfrm_check_modify = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinGroupBox2: TbsSkinGroupBox;
Label47: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
Label52: TLabel;
Label53: TLabel;
Label54: TLabel;
Label55: TLabel;
wwDBLookupCombo4: TwwDBLookupCombo;
wwDBLookupCombo3: TwwDBLookupCombo;
RxDBLookupCombo1: TRxDBLookupCombo;
RxDBLookupCombo2: TRxDBLookupCombo;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
table_new1: TDataSource;
t_bz_balance: TRxMemoryData;
RxMemoryData1: TRxMemoryData;
ywlb: TEdit;
chk_pay: TEdit;
bsSkinButton16: TbsSkinButton;
bsSkinButton17: TbsSkinButton;
p_op_gain: TADOStoredProc;
procedure bsSkinButton16Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure wwDBLookupCombo3Change(Sender: TObject);
procedure wwDBLookupCombo4Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_check_modify: Tfrm_check_modify;
implementation
uses u_main, u_data_share, my_sys_function;
{$R *.dfm}
procedure Tfrm_check_modify.bsSkinButton16Click(Sender: TObject);
var
feestatus,msgs: string ; //<2F><><EFBFBD><EFBFBD>״̬ <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8> <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD>
begin
if chk_pay.Text='FALSE' then feestatus:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'
else if chk_pay.Text='TRUE' then feestatus:='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>'
else if chk_pay.Text='CHKPART' then
feestatus:=isrechk(table_new1.DataSet.fieldbyname('ch_id').asinteger,
table_new1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,
ywlb.text+'Ӧ'+table_new1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring) ;
if (Trim(Edit3.text)='') or (Trim(Edit3.text)='0') then
begin
msgs:='<27><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD>';
end;
if RxDBLookupCombo1.Value='' then
begin
msgs:=msgs+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if RxDBLookupCombo2.Value='' then
begin
msgs:=msgs+#13#10+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if wwDBLookupCombo4.Value='' then
begin
msgs:=msgs+#13#10+'<27><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if wwDBLookupCombo3.Value='' then
begin
msgs:=msgs+#13#10+'<27>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>';
end;
if table_new1.DataSet.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>','Ԫ<><D4AA>(<28><><EFBFBD><EFBFBD>)',[]) then
begin
msgs:=msgs+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>';
end;
if RxDBLookupCombo2.Value<>'Ԫ<><D4AA>(<28><><EFBFBD><EFBFBD>)' then
begin
if MessageDlg('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>(<28><><EFBFBD><EFBFBD>),<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
begin
msgs:=msgs+#13#10+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>';
end;
end;
if msgs<>'' then
begin
MessageDlg(msgs, mtConfirmation, [mbYes],0);
exit;
end;
table_new1.DataSet.Insert;
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=table_new1.DataSet['<27><><EFBFBD><EFBFBD>'];
table_new1.DataSet['<27><>׼']:=wwDBLookupCombo4.Value;
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:='<27><>';
table_new1.DataSet['<27><><EFBFBD><EFBFBD>״̬']:=feestatus;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
table_new1.DataSet['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
table_new1.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
table_new1.DataSet['<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>']:=now;
table_new1.DataSet['<27>ұ<EFBFBD>']:=wwDBLookupCombo3.Value;
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=1;
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit4.text));
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit2.text));
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit3.text));
table_new1.DataSet['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=RxDBLookupCombo2.Value;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=RxDBLookupCombo1.Value;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
table_new1.DataSet['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=0;
table_new1.DataSet['<27><><EFBFBD>뿪Ʊ']:=0;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
table_new1.DataSet['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=0;
table_new1.DataSet['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
table_new1.DataSet['<27>Ƿ<EFBFBD><C7B7>渶']:=0;
table_new1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ']:=0;
table_new1.DataSet['<27><><EFBFBD><EFBFBD>']:=0;
table_new1.DataSet.Post;
p_op_gain.Parameters.ParamByName('@con_no').value:=table_new1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
p_op_gain.ExecProc;
end;
procedure Tfrm_check_modify.FormShow(Sender: TObject);
var
str_list:Tstringlist;
i,k,j:integer;
begin
wwDBLookupCombo3.Text:='USD';
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><E8B4A6>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>
if (ywlb.Text='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>')or(ywlb.Text='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>') then
begin
frm_data_share.t_code_fee_unit.Filtered:=false;
frm_data_share.t_code_fee_unit.Filter:='<27><><EFBFBD><EFBFBD>=1';
frm_data_share.t_code_fee_unit.Filtered:=true;
t_bz_balance.close;
t_bz_balance.open;
t_bz_balance.Append;
t_bz_balance['one']:='1-<2D><>Ʊ';
t_bz_balance['two']:='<27><>Ʊ';
t_bz_balance['three']:=1;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='2-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat/1000);
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='3-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
if table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>1 then
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat
else
t_bz_balance['three']:=1;
t_bz_balance.post;
try
t_bz_balance.Append;
t_bz_balance['one']:='4-<2D>ƷѶ<C6B7>';
t_bz_balance['two']:='<27>ƷѶ<C6B7>';
if s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat/1000)>table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat then
begin
if s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat/1000)>1 then
t_bz_balance['three']:=s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat/1000)
else
t_bz_balance['three']:=1;
end
else
begin
if table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>1 then
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat
else
t_bz_balance['three']:=1;
end;
k:=0;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='5-TEU';
t_bz_balance['two']:='TEU';
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><>TEU').asinteger;
t_bz_balance.post;
str_list:=Tstringlist.Create;
str_list.Text:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27>Ʒѱ<C6B7>׼').asstring;
for i:=0 to str_list.Count-1 do
begin
t_bz_balance.Append;
t_bz_balance['one']:=inttostr(i+k+6)+'-'+copy(str_list[i],1,pos('*',str_list[i])-1);
t_bz_balance['two']:=copy(str_list[i],pos('-',str_list[i])+1,length(str_list[i])+1-pos('-',str_list[i]));
t_bz_balance['three']:=strtofloat(copy(str_list[i],pos('*',str_list[i])+1,pos('-',str_list[i])-pos('*',str_list[i])-1));
t_bz_balance.post;
end;
finally
str_list.free;
end;
frm_data_share.t_code_fee_unit.First;
while not frm_data_share.t_code_fee_unit.eof do begin
t_bz_balance.Append;
t_bz_balance['one']:=frm_data_share.t_code_fee_unit.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'-'+frm_data_share.t_code_fee_unit.fieldbyname('<27><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>').asstring;
t_bz_balance['two']:=frm_data_share.t_code_fee_unit.fieldbyname('<27><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>').asstring;
t_bz_balance['three']:=frm_data_share.t_code_fee_unit.fieldbyname('Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
frm_data_share.t_code_fee_unit.next;
end;
end;
//<2F><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>
if (ywlb.Text='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>')or(ywlb.Text='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>') then
begin
try
frm_data_share.t_code_fee_unit.Filtered:=false;
frm_data_share.t_code_fee_unit.Filter:='<27><><EFBFBD><EFBFBD>=1';
frm_data_share.t_code_fee_unit.Filtered:=true;
t_bz_balance.close;
t_bz_balance.open;
t_bz_balance.Append;
t_bz_balance['one']:='1-<2D><>Ʊ';
t_bz_balance['two']:='<27><>Ʊ';
t_bz_balance['three']:=1;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='2-<2D>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>';
t_bz_balance['three']:=s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>').asfloat);
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='3-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='4-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
frm_data_share.t_code_fee_unit.First;
while not frm_data_share.t_code_fee_unit.eof do begin
t_bz_balance.Append;
t_bz_balance['one']:=frm_data_share.t_code_fee_unit.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'-'+frm_data_share.t_code_fee_unit.fieldbyname('<27><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>').asstring;
t_bz_balance['two']:=frm_data_share.t_code_fee_unit.fieldbyname('<27><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>').asstring;
t_bz_balance['three']:=frm_data_share.t_code_fee_unit.fieldbyname('Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
frm_data_share.t_code_fee_unit.next;
end;
finally
;
end;
end;
//<2F><><EFBFBD>ܳ<EFBFBD>ҵ<EFBFBD><D2B5>
if (ywlb.Text='<27><><EFBFBD>ܳ<EFBFBD>ҵ<EFBFBD><D2B5>') then
begin
try
t_bz_balance.close;
t_bz_balance.open;
t_bz_balance.Append;
t_bz_balance['one']:='1-<2D><>Ʊ';
t_bz_balance['two']:='<27><>Ʊ';
t_bz_balance['three']:=1;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='2-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='3-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
finally
;
end;
end;
//<2F><>·ҵ<C2B7><D2B5>
if (ywlb.Text='<27><>·ҵ<C2B7><D2B5>') then
begin
try
t_bz_balance.close;
t_bz_balance.open;
t_bz_balance.Append;
t_bz_balance['one']:='1-<2D><>Ʊ';
t_bz_balance['two']:='<27><>Ʊ';
t_bz_balance['three']:=1;
t_bz_balance.post;
t_bz_balance.Append;
t_bz_balance['one']:='2-<2D><><EFBFBD><EFBFBD>';
t_bz_balance['two']:='<27><><EFBFBD><EFBFBD>';
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
t_bz_balance.post;
finally
;
end;
end;
end;
procedure Tfrm_check_modify.wwDBLookupCombo3Change(Sender: TObject);
begin
{
IF frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',wwDBLookupCombo3.text,[])THEN
begin
Edit4.text:=FormatFloat('0.00;-0.00;0',frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
end;
}
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',trim(wwDBLookupCombo3.text),[])THEN
begin
if trim(wwDBLookupCombo3.text)='USD' then
begin
Edit4.text:=FormatFloat('0.00;-0.00;0',getUsdExRate(table_new1.DataSet.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring));
end
else
Edit4.text:=FormatFloat('0.00;-0.00;0',frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
end;
end;
procedure Tfrm_check_modify.wwDBLookupCombo4Change(Sender: TObject);
begin
if not wwDBLookupCombo4.LookupTable.IsEmpty then
if wwDBLookupCombo4.LookupTable.Locate('one',wwDBLookupCombo4.text,[])then
begin
Edit1.Text:=FormatFloat('0.00;-0.00;0', wwDBLookupCombo4.LookupTable.fieldbyname('three').asfloat);
end;
end;
procedure Tfrm_check_modify.Edit2Change(Sender: TObject);
var aQty,aPrice:Double;
begin
aQty:=strtoFloat(Edit1.text);
aPrice:=strtoFloat(Edit2.text);
Edit3.Text:=FormatFloat('0.00;-0.00;0',aQty*aPrice);
end;
end.