str:=str+' and t.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '+''''+'%'+Edit1.text+'%'+'''';
if if_open('422') then begin
end else if if_open('420') then begin
str:=str+' and (t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+department+''')';
str:=str+' or t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD>ž<EFBFBD><C5BE><EFBFBD>='+''''+employee+'''))) ';
end else if if_open('421') then begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
end else begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+employee+'''';
end;
if Edit2.text<>''then
str:=str+' and t.<2E><><EFBFBD>ĵ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit2.text+'%'+'''';
if wwDBComboBox44.text<>'' then
str:=str+' and t.״̬='+''''+wwDBComboBox44.Text+'''';
if wwDBDateTimePicker1.text<>''then
begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
end;
if wwDBDateTimePicker2.text<>''then
begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
end;
if wwDBDateTimePicker3.text<>''then
begin
str:=str+' and a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
end;
if wwDBDateTimePicker4.text<>''then
begin
str:=str+' and a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
end;
if (Edit4.Text<>'') and (wwDBComboBox7.Text<>'') then begin
if (wwDBComboBox7.Text='<27><><EFBFBD><EFBFBD>') then begin
str:=str+' and g.ë<><C3AB><EFBFBD><EFBFBD>>'+floattostr(strtofloatdef(Edit4.Text,0));
end;
if (wwDBComboBox7.Text='С<><D0A1>') then begin
str:=str+' and g.ë<><C3AB><EFBFBD><EFBFBD><'+floattostr(strtofloatdef(Edit4.Text,0));
end;
if (wwDBComboBox7.Text='<27><><EFBFBD><EFBFBD>') then begin
str:=str+' and g.ë<><C3AB><EFBFBD><EFBFBD>='+floattostr(strtofloatdef(Edit4.Text,0));
end;
if (wwDBComboBox7.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then begin
str:=str+' and g.ë<><C3AB><EFBFBD><EFBFBD><>'+floattostr(strtofloatdef(Edit4.Text,0));
end;
end;
t_op_letter_pc.close;
t_op_letter_pc.sql.clear;
t_op_letter_pc.sql.add('select t.*,g.<2E><><EFBFBD><EFBFBD>RMB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB,g.<2E><><EFBFBD><EFBFBD>USD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,g.ë<><C3AB><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,a.ί<>е<EFBFBD>λ,(SELECT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,tt.<2E><><EFBFBD><EFBFBD>RMB <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>RMB,tt.<2E><><EFBFBD><EFBFBD>USD <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>USD,tt.ë<><C3AB><EFBFBD><EFBFBD><20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> ');
t_op_letter_pc.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_letter_pc.sql.add('left join t_op_seae a on (a.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_letter_pc.sql.add('left join (select <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,sum(<28><><EFBFBD><EFBFBD>RMB) <20><><EFBFBD><EFBFBD>RMB,sum(<28><><EFBFBD><EFBFBD>USD) <20><><EFBFBD><EFBFBD>USD,sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard group by <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>)tt on (tt.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=t.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>) ');
t_op_letter_pc.sql.add(str);
t_op_letter_pc.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_letter_pc.open;
{
t_op_letter_pc.close;
t_op_letter_pc.sql.clear;
t_op_letter_pc.sql.add('select t.*,''RMB:''+CONVERT(VARCHAR(19),g.<2E><><EFBFBD><EFBFBD>RMB)+'' USD:''+CONVERT(VARCHAR(19),g.<2E><><EFBFBD><EFBFBD>USD) <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD> from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) '+str);
t_op_letter_pc.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_letter_pc.open;
}
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
str:=str+' where t.״̬<>''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ';
if if_open('422') then begin
end else if if_open('420') then begin
str:=str+' and (t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+department+''')';
str:=str+' or t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD>ž<EFBFBD><C5BE><EFBFBD>='+''''+employee+'''))) ';
end else if if_open('421') then begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
end else begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+employee+'''';
end;
{
t_op_letter_pc.close;
t_op_letter_pc.sql.clear;
t_op_letter_pc.sql.add('select top 100 t.*,''RMB:''+CONVERT(VARCHAR(19),g.<2E><><EFBFBD><EFBFBD>RMB)+'' USD:''+CONVERT(VARCHAR(19),g.<2E><><EFBFBD><EFBFBD>USD) <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD> from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) '+str);
t_op_letter_pc.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_letter_pc.open;
}
t_op_letter_pc.close;
t_op_letter_pc.sql.clear;
t_op_letter_pc.sql.add('select top 100 t.*,g.<2E><><EFBFBD><EFBFBD>RMB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB,g.<2E><><EFBFBD><EFBFBD>USD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,g.ë<><C3AB><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,a.ί<>е<EFBFBD>λ,(SELECT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,tt.<2E><><EFBFBD><EFBFBD>RMB <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>RMB,tt.<2E><><EFBFBD><EFBFBD>USD <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>USD,tt.ë<><C3AB><EFBFBD><EFBFBD><20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> ');
t_op_letter_pc.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_letter_pc.sql.add('left join t_op_seae a on (a.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_letter_pc.sql.add('left join (select <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,sum(<28><><EFBFBD><EFBFBD>RMB) <20><><EFBFBD><EFBFBD>RMB,sum(<28><><EFBFBD><EFBFBD>USD) <20><><EFBFBD><EFBFBD>USD,sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard group by <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>)tt on (tt.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=t.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>) ');
t_op_letter_pc.sql.add(str);
t_op_letter_pc.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_letter_pc.open;
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_op_seaeAmend.Open;
if if_open('422') then begin
t_sys_employee.Close;
t_sys_employee.SQL.Clear;
t_sys_employee.SQL.Add(' select <20><><EFBFBD>ž<EFBFBD><C5BE><EFBFBD> as <20><><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD>ž<EFBFBD><C5BE><EFBFBD><>''''');
t_sys_employee.SQL.Add(' union select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=''<27><>'' ');
t_sys_employee.SQL.Add(' union select ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.SQL.Add(' union select ''<27><><EFBFBD>괺'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.SQL.Add(' union select ''<27>Ծ<EFBFBD>'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.Open;
end else if if_open('421') then begin
t_sys_employee.Close;
t_sys_employee.SQL.Clear;
t_sys_employee.SQL.Add(' select ''<27><><EFBFBD>괺'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.Open;
end else begin
t_sys_employee.Close;
t_sys_employee.SQL.Clear;
t_sys_employee.SQL.Add(' select <20><><EFBFBD>ž<EFBFBD><C5BE><EFBFBD> as <20><><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+department+'''');
t_sys_employee.SQL.Add(' union select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+department+'''');
t_sys_employee.SQL.Add(' union select ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.SQL.Add(' union select ''<27>Ծ<EFBFBD>'' as <20><><EFBFBD><EFBFBD> ');
t_sys_employee.Open;
end;
end;
procedure Tfrm_op_truck.Edit1KeyPress(Sender: TObject; var Key: Char);
if (not fra_fee1.t_ch_accept.Active) then LoadFee();
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_op_seaeAmend.SQL.Text:='select top 0 * from t_op_seae';
t_op_seaeAmend.Open;
if (not fra_fee1.t_ch_accept.Active) then LoadFee();
bsSkinTabSheet2.Show;
end;
procedure Tfrm_op_truck.DBEdit10KeyPress(Sender: TObject; var Key: Char);
var aAdoQuery:TAdoQuery;
begin
if key=#13 then
begin
key:=#0;
if not t_op_letter_pc.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ').AsBoolean then
begin
if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then
t_op_letter_pc.Post;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select * from t_op_seae');
SQL.Add('where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=:<3A><><EFBFBD>ᵥ<EFBFBD><E1B5A5> and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' and (<28><><EFBFBD><EFBFBD>״̬=''<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>'' or <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'') ');
SQL.Add(' SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then <20><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as Ӧ<><D3A6>USD');
SQL.Add(',');
SQL.Add(' SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then <20><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as Ӧ<><D3A6>RMB');
SQL.Add(',');
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then <20><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as Ӧ<><D3A6>USD');
SQL.Add(',');
SQL.Add(' SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then <20><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as Ӧ<><D3A6>RMB');
SQL.Add('from t_ch_fee');
SQL.Add('where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_op_seae where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>='+''''+t_op_letter_pc.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString+''')');
t_ch_fee.SQL.Text:='select * from t_ch_fee where (<28>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=1 or <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>0 or <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><>0 or <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>0 or <20><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><>0) and <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
sql.add('delete from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
ExecSQL;
Close;sql.clear;
sql.add('delete from t_op_gain_cx where LE_ID='+t_op_letter_pc.fieldbyname('LE_ID').AsString);
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
t_op_letter_pc.Close;
t_op_letter_pc.Open;
if t_op_letter_pc.IsEmpty then begin
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 0 * from t_op_seae ';
t_op_seaeAmend.Open;
end else begin
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
function getamendBsNo(wtbsno:string;mblno:string):string;
var aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;sql.clear;
sql.add('select top 1 ί<>б<EFBFBD><D0B1><EFBFBD> from t_op_seae where ί<>б<EFBFBD><D0B1><EFBFBD> like '''+wtbsno+'%'' and <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>='''+mblno+''' order by ί<>б<EFBFBD><D0B1><EFBFBD> desc ');
t_op_seae.SQL.Text:='select top 1 * from t_op_seae where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.FieldByName('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
if (t_op_letter_pc.FieldByName('״̬').AsString<>'<27>½<EFBFBD>') and (t_op_letter_pc.FieldByName('״̬').AsString<>'<27><><EFBFBD><EFBFBD><EFBFBD>ύ') then
if (fra_fee1.t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0) or (fra_fee1.t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0) or (fra_fee1.t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0)
or ((fra_fee1.t_ch_accept.fieldbyname('<27>ұ<EFBFBD>').asstring='RMB') and (fra_fee1.t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat<>1))
or ((fra_fee1.t_ch_accept.fieldbyname('<27>ұ<EFBFBD>').asstring<>'RMB') and (fra_fee1.t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=1))
or ((fra_fee1.t_ch_accept.fieldbyname('<27>ұ<EFBFBD>').asstring<>'RMB') AND (fra_fee1.t_ch_accept.fieldbyname('<27>ұ<EFBFBD>').asstring<>'USD') )
if aAdoQuery2.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', VarArrayOf([fra_fee1.t_ch_accept.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,fra_fee1.t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring]), []) then
if (fra_fee1.t_ch_pay.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0) or (fra_fee1.t_ch_pay.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0) or (fra_fee1.t_ch_pay.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=0)
or ((fra_fee1.t_ch_pay.fieldbyname('<27>ұ<EFBFBD>').asstring='RMB') and (fra_fee1.t_ch_pay.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat<>1))
or ((fra_fee1.t_ch_pay.fieldbyname('<27>ұ<EFBFBD>').asstring<>'RMB') and (fra_fee1.t_ch_pay.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat=1))
or ((fra_fee1.t_ch_pay.fieldbyname('<27>ұ<EFBFBD>').asstring<>'RMB') AND (fra_fee1.t_ch_pay.fieldbyname('<27>ұ<EFBFBD>').asstring<>'USD') )
if aAdoQuery2.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', VarArrayOf([fra_fee1.t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,fra_fee1.t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring]), []) then
aAdoQuery2.SQL.Add(' SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (<28><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD>) ELSE -(<28><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD>) END ) as TTLPR');
aAdoQuery2.SQL.Add('from t_ch_fee');
aAdoQuery2.SQL.Add('where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_op_seae where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>='+''''+t_op_letter_pc.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString+''')');
aAdoQuery2.Open;
if (aAdoQuery2.fieldbyname('TTLPR').asfloat<0) then begin
SQL.Add('Update t_op_gain_cx set ״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+formatdatetime('YYYY-MM-DD',date)+'''');
if (t_op_letter_pc.FieldByName('״̬').AsString<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and (t_op_letter_pc.FieldByName('״̬').AsString<>'<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>') then
if (t_op_seae2.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>') or (t_op_seae2.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>') then begin
if t_op_letter_pc.FieldByName('״̬').AsString='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then begin
Close;sql.Clear;
SQL.Add('Update t_op_seae set ҵ<><D2B5>״̬=''<27><><EFBFBD><EFBFBD>ί<EFBFBD><CEAF>'',<2C><><EFBFBD><EFBFBD>״̬=''¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
SQL.Add('where (<28>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0 or <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> is null) and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=0 and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>=0 and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=0 and <20><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>=0 and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
if (not fra_fee1.t_ch_accept.Active) then LoadFee();
t_op_seaeAmend.Close;
t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_letter_pc.fieldbyname('<27><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
var
ttllr:Double;
begin
if (Trim(ANode.Strings[dxDBGrid1Column22.Index])='<27><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>') or (Trim(ANode.Strings[dxDBGrid1Column22.Index])='<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>1<EFBFBD><31>') or (Trim(ANode.Strings[dxDBGrid1Column22.Index])='<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>2<EFBFBD><32>') then begin