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.

653 lines
27 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_ch_piliang_seae;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, BusinessSkinForm, dxExEdtr, dxDBTLCl, dxGrClms,
dxDBGrid, dxTL, dxDBCtrl, dxCntner, DB, ADODB, Grids, DBGrids,
kbmMemTable;
type
Tfrm_ch_piliang_seae = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsBusinessSkinForm1: TbsBusinessSkinForm;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column13: TdxDBGridMaskColumn;
dxDBGrid1Column14: TdxDBGridMaskColumn;
dxDBGrid1Column15: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridDateColumn;
dxDBGrid1Column19: TdxDBGridMaskColumn;
dxDBGrid1Column20: TdxDBGridMaskColumn;
dxDBGrid1TEU: TdxDBGridMaskColumn;
dxDBGrid1Column63: TdxDBGridMaskColumn;
dxDBGrid1Column64: TdxDBGridMaskColumn;
dxDBGrid1Column65: TdxDBGridDateColumn;
dxDBGrid1Column66: TdxDBGridMaskColumn;
dxDBGrid1Column67: TdxDBGridMaskColumn;
t_op_seae1: TDataSource;
t_ch_accept: TADOQuery;
t_ch_accept1: TDataSource;
t_ch_pay: TADOQuery;
t_ch_pay1: TDataSource;
t_sys_report: TADOQuery;
t_sys_report1: TDataSource;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridCheckColumn;
t_op_seae: TADOStoredProc;
t_op_gain: TADOQuery;
t_op_gain1: TDataSource;
bsSkinButton8: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
t_op_fenzhang: TADOQuery;
t_ch_fee_fenzhang2: TADOQuery;
t_ch_fee_fenzhang: TADOQuery;
ds_ch_fee_fenzhang21: TDataSource;
ds_op_fenzhang1: TDataSource;
ds_ch_fee_fenzhang1: TDataSource;
memtblprint1: TDataSource;
memtblprint: TkbmMemTable;
memdd: TkbmMemTable;
memdd1: TDataSource;
memaccept1: TDataSource;
memaccept: TkbmMemTable;
mempay: TkbmMemTable;
mempay1: TDataSource;
at_modify_old: TADOQuery;
at_modify_new: TADOQuery;
dsrmodify_new: TDataSource;
dsrmodify_old: TDataSource;
t_ch_fee_truck: TADOQuery;
t_ch_fee_truck1: TDataSource;
t_print_histry: TADOQuery;
t_print_histry1: TDataSource;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
t_ch_client1: TDataSource;
t_ch_client: TADOQuery;
t_ch_client_sum: TADOQuery;
t_ch_client_sum1: TDataSource;
bsSkinButton1: TbsSkinButton;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
private
procedure prnlirun;
procedure prncustdr;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_piliang_seae: Tfrm_ch_piliang_seae;
implementation
uses u_main, my_sys_function, u_sys_frprint;
{$R *.dfm}
procedure Tfrm_ch_piliang_seae.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_piliang_seae.bsSkinButton8Click(Sender: TObject);
begin
if bsSkinCheckRadioBox2.Checked then
prncustdr
else
prnlirun;
end;
procedure Tfrm_ch_piliang_seae.FormShow(Sender: TObject);
begin
t_sys_report.Parameters[0].value:='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_sys_report.open;
t_ch_accept.open;
t_ch_pay.open;
t_op_gain.open;
end;
procedure Tfrm_ch_piliang_seae.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
if bsSkinCheckRadioBox2.Checked then begin
t_sys_report.close;
t_sys_report.Parameters[0].value:='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ӧ<EFBFBD>տͻ<D5BF><CDBB><EFBFBD><EFBFBD><EFBFBD>';
t_sys_report.open;
end else begin
t_sys_report.close;
t_sys_report.Parameters[0].value:='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_sys_report.open;
end;
end;
procedure Tfrm_ch_piliang_seae.prncustdr;
var
aQuery,aQuery2:TADOQuery;
NewNoteNo:String;
Hstr,HL:String;
print_str:string;
if_first:boolean;
template : TStream;
begin
if t_sys_report.IsEmpty then
begin
showmessage('û<><C3BB><EFBFBD><EFBFBD><EFBFBD>󵥸<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>');
exit;
end;
aQuery:=CreateAdoQuery;
try
if not assigned(frm_sys_frprint) then
frm_sys_frprint:=Tfrm_sys_frprint.Create(application);
frm_sys_frprint.Caption:='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ӧ<EFBFBD>տͻ<D5BF><CDBB><EFBFBD><EFBFBD><EFBFBD>';
with frm_sys_frprint do
begin
begin
t_sys_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where CH_ID=:CH_ID order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_sys_report.Parameters[0].value:=frm_ch_piliang_seae.t_sys_report.fieldbyname('CH_ID').Value;
t_sys_report.open;
end;
one_table_1.DataSource:=t_ch_accept.DataSource;
one_table_2.DataSource:=t_ch_client_sum1;
one_table_3.DataSource:=t_op_gain1;
one_table_4.DataSource:=memdd1;
all_table_1.DataSource:=t_ch_client1;
all_table_2.DataSource:=memaccept1;
all_table_3.DataSource:=mempay1;
all_table_4.DataSource:=nil;
all_table_5.DataSource:=nil;
all_table_6.DataSource:=nil;
all_table_7.DataSource:=nil;
all_table_8.DataSource:=nil;
all_table_9.DataSource:=nil;
t_sys_reporthead.Close;
t_sys_reporthead.sql.Clear;
t_sys_reporthead.sql.Add('select * from t_sys_report_head where <20>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>='''+subComp+'''');
t_sys_reporthead.Open;
if t_sys_reporthead.IsEmpty then begin
t_sys_reporthead.Close;
t_sys_reporthead.sql.Clear;
t_sys_reporthead.sql.Add('select * from t_sys_report_head ');
t_sys_reporthead.Open;
end;
print_head.DataSource:=ds_sys_reporthead1
end;
if_first:=true;
t_op_seae.first;
while not t_op_seae.eof do
begin
if not t_ch_accept.IsEmpty then begin
aQuery.Close;
aQuery.SQL.Text:='select distinct <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'''';
aQuery.Open;
aQuery.first;
while not aQuery.Eof do begin
t_ch_client.close;
t_ch_client.sql.clear;
t_ch_client.sql.add('select * from t_ch_fee '
+'where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>'
+' order by ˳<><CBB3> ');
t_ch_client.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').value;
t_ch_client.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value:=aQuery.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value;
t_ch_client.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:='<27><>';
t_ch_client.open;
t_ch_client_sum.close;
t_ch_client_sum.sql.clear;
t_ch_client_sum.sql.add('select isnull(SUM(CASE <20>ұ<EFBFBD> WHEN '+''''+'USD'+''''
+' THEN ISNULL(<28><><EFBFBD><EFBFBD>,0) ELSE 0 END) ,0) AS <20>ϼ<EFBFBD>USD,'
+'isnull(SUM(CASE <20>ұ<EFBFBD> WHEN '+''''+'USD'+''''
+' THEN 0 ELSE ISNULL(<28><><EFBFBD><EFBFBD>,0)*ISNULL(<28><><EFBFBD><EFBFBD>,0) END) ,0) AS <20>ϼ<EFBFBD>RMB,sum(ISNULL(<28><><EFBFBD><EFBFBD>,0)*ISNULL(<28><><EFBFBD><EFBFBD>,0)) AS <20>ۺ<EFBFBD>RMB FROM t_ch_fee '
+'where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
t_ch_client_sum.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=t_ch_accept.fieldbyname('<27><><EFBFBD><EFBFBD>').value;
t_ch_client_sum.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value:=aQuery.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value;
t_ch_client_sum.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:='<27><>';
t_ch_client_sum.open;
frm_sys_frprint.t_sys_cust.Close;
frm_sys_frprint.t_sys_cust.sql.Clear;
frm_sys_frprint.t_sys_cust.sql.Add('select * from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+aQuery.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+'''');
frm_sys_frprint.t_sys_cust.open;
if if_first then
begin
frm_sys_frprint.t_sys_reportfile.Close;
frm_sys_frprint.t_sys_reportfile.SQL.Clear;
frm_sys_frprint.t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(frm_sys_frprint.t_sys_report['CH_ID']));
frm_sys_frprint.t_sys_reportfile.Open;
try
template := frm_sys_frprint.t_sys_reportfile.CreateBlobStream(frm_sys_frprint.t_sys_reportfile.FieldByName('report'), bmRead);
template.Position := 0;
frm_sys_frprint.frxReport1.LoadFromStream(template);
finally
template.Free;
end;
frm_sys_frprint.frxReport1.PrepareReport;
frm_sys_frprint.frxReport1.PrintOptions.ShowDialog:=true;
frm_sys_frprint.frxReport1.Print;
print_str:=frm_sys_frprint.frxReport1.PrintOptions.Printer;
if_first:=false;
end
else
begin
frm_sys_frprint.frxReport1.PrintOptions.ShowDialog:=false;
frm_sys_frprint.frxReport1.PrintOptions.Printer:=print_str;
frm_sys_frprint.frxReport1.PrepareReport;
frm_sys_frprint.frxReport1.Print;
end;
aQuery.Next;
end;
end;
t_op_seae.next;
end;
finally
frm_sys_frprint.free;
frm_sys_frprint:=nil;
freeandnil(aQuery);
end;
end;
procedure Tfrm_ch_piliang_seae.prnlirun;
var
Frt:String;
aQuery:TADOQuery;
print_str:string;
if_first:boolean;
template : TStream;
begin
if t_sys_report.IsEmpty then
begin
showmessage('û<><C3BB><EFBFBD><EFBFBD><EFBFBD>󵥸<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>');
exit;
end;
if strtobool(get_parameters_value(2,'false'))then
begin
t_op_seae.first;
while not t_op_seae.eof do
begin
t_ch_accept.first;
while not t_ch_accept.eof do
begin
if (t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='¼<><C2BC>״̬')
or(t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>')
or(t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>')
or(t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>') then
begin
showmessage('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>󷽿<EFBFBD><F3B7BDBF>Դ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>󵥣<EFBFBD><F3B5A5A3><EFBFBD>');
exit;
end;
t_ch_accept.next;
end;
t_ch_pay.first;
while not t_ch_pay.eof do
begin
if (t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='¼<><C2BC>״̬')
or(t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>')
or(t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>')
or(t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>') then
begin
showmessage('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>󷽿<EFBFBD><F3B7BDBF>Դ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>󵥣<EFBFBD><F3B5A5A3><EFBFBD>');
exit;
end;
t_ch_pay.next;
end;
t_op_seae.next;
end;
end;
try
if not assigned(frm_sys_frprint) then
frm_sys_frprint:=Tfrm_sys_frprint.Create(application);
frm_sys_frprint.Caption:='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
with frm_sys_frprint do
begin
begin
t_sys_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where CH_ID=:CH_ID order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_sys_report.Parameters[0].value:=frm_ch_piliang_seae.t_sys_report.fieldbyname('CH_ID').Value;
t_sys_report.open;
end;
if strtobool(get_parameters_value(81,'false')) then begin
one_table_1.DataSource:=t_op_seae1;
one_table_2.DataSource:=t_op_gain1;
one_table_3.DataSource:=ds_op_fenzhang1;
one_table_4.DataSource:=t_ch_fee_truck1;
all_table_1.DataSource:=t_ch_accept1;
all_table_2.DataSource:=t_ch_pay1;
all_table_3.DataSource:=ds_ch_fee_fenzhang21;
all_table_4.DataSource:=ds_ch_fee_fenzhang1;
all_table_5.DataSource:=dsrmodify_new;
all_table_6.DataSource:=dsrmodify_old;
all_table_7.DataSource:=memdd1;
all_table_8.DataSource:=nil;
all_table_9.DataSource:=nil;
end else begin
if strtobool(get_parameters_value(111,'false')) then begin
one_table_1.DataSource:=t_op_seae1;
one_table_2.DataSource:=t_op_gain1;
one_table_3.DataSource:=ds_op_fenzhang1;
one_table_4.DataSource:=t_ch_fee_truck1;
all_table_1.DataSource:=memtblprint1;
all_table_2.DataSource:=t_ch_pay1;
all_table_3.DataSource:=ds_ch_fee_fenzhang21;
all_table_4.DataSource:=ds_ch_fee_fenzhang1;
all_table_5.DataSource:=dsrmodify_new;
all_table_6.DataSource:=dsrmodify_old;
all_table_7.DataSource:=t_print_histry1;
all_table_8.DataSource:=nil;
all_table_9.DataSource:=nil;
end else begin
one_table_1.DataSource:=t_op_seae1;
one_table_2.DataSource:=t_op_gain1;
one_table_3.DataSource:=ds_op_fenzhang1;
one_table_4.DataSource:=t_ch_fee_truck1;
all_table_1.DataSource:=t_ch_accept1;
all_table_2.DataSource:=t_ch_pay1;
all_table_3.DataSource:=ds_ch_fee_fenzhang21;
all_table_4.DataSource:=ds_ch_fee_fenzhang1;
all_table_5.DataSource:=dsrmodify_new;
all_table_6.DataSource:=dsrmodify_old;
all_table_7.DataSource:=t_print_histry1;
all_table_8.DataSource:=nil;
all_table_9.DataSource:=nil;
end;
end;
t_sys_reporthead.Close;
t_sys_reporthead.sql.Clear;
t_sys_reporthead.sql.Add('select * from t_sys_report_head where <20>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>='''+subComp+'''');
t_sys_reporthead.Open;
if t_sys_reporthead.IsEmpty then begin
t_sys_reporthead.Close;
t_sys_reporthead.sql.Clear;
t_sys_reporthead.sql.Add('select * from t_sys_report_head ');
t_sys_reporthead.Open;
end;
print_head.DataSource:=ds_sys_reporthead1
end;
if_first:=true;
t_op_seae.first;
while not t_op_seae.eof do
begin
if t_ch_accept.IsEmpty and t_ch_pay.IsEmpty then begin
end else begin
t_ch_fee_fenzhang.close;
t_ch_fee_fenzhang.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_fenzhang.open;
t_ch_fee_fenzhang2.close;
t_ch_fee_fenzhang2.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_fenzhang2.open;
t_op_fenzhang.close;
t_op_fenzhang.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_op_fenzhang.open;
at_modify_new.close;
at_modify_new.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
at_modify_new.open;
at_modify_old.close;
at_modify_old.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
at_modify_old.open;
if strtobool(get_parameters_value(111,'false')) then begin
memtblprint.close;
memtblprint.Open;
t_ch_accept.First;
while not t_ch_accept.Eof do begin
Frt:=GetFrt(t_ch_accept.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
if memtblprint.Locate('Frt;ACCNAME;OBJDR',vararrayof([Frt,t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,t_ch_accept.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
memtblprint.Edit;
if t_ch_accept.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
memtblprint.FieldByName('USDDR').AsFloat:=memtblprint.FieldByName('USDDR').AsFloat+t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=memtblprint.FieldByName('TTLDR').AsFloat+(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end else if t_ch_accept.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then begin
memtblprint.FieldByName('RMBDR').AsFloat:=memtblprint.FieldByName('RMBDR').AsFloat+t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=memtblprint.FieldByName('TTLDR').AsFloat+(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else
begin
memtblprint.FieldByName('OTDR').AsFloat:=memtblprint.FieldByName('OTDR').AsFloat+t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=memtblprint.FieldByName('TTLDR').AsFloat+(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
if memtblprint.FieldByName('REMARKDR').AsString='' then begin
memtblprint.FieldByName('REMARKDR').AsString:=t_ch_accept.fieldbyName('<27><>ע').AsString;
end else begin
memtblprint.FieldByName('REMARKDR').AsString:=memtblprint.FieldByName('REMARKDR').AsString+' '+t_ch_accept.fieldbyName('<27><>ע').AsString;
end;
memtblprint.Post;
end else begin
memtblprint.Insert;
memtblprint.FieldByName('ORDNO').AsInteger:=0;
memtblprint.FieldByName('FRT').AsString:=GetFrt(t_ch_accept.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
memtblprint.FieldByName('ACCNAME').AsString:=t_ch_accept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
memtblprint.FieldByName('OBJDR').AsString:=t_ch_accept.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
memtblprint.FieldByName('OBJCR').AsString:='';
memtblprint.FieldByName('REMARKCR').AsString:='';
memtblprint.FieldByName('USDCR').AsFloat:=0;
memtblprint.FieldByName('RMBCR').AsFloat:=0;
memtblprint.FieldByName('TTLCR').AsFloat:=0;
memtblprint.FieldByName('DR').AsString:='T';
memtblprint.FieldByName('CR').AsString:='F';
if t_ch_accept.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
memtblprint.FieldByName('USDDR').AsFloat:=t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
ELSE if t_ch_accept.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then
begin
memtblprint.FieldByName('RMBDR').AsFloat:=t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else
begin
memtblprint.FieldByName('OTDR').AsFloat:=t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLDR').AsFloat:=(t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_accept.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
memtblprint.FieldByName('REMARKDR').AsString:=memtblprint.FieldByName('REMARKDR').AsString+' '+t_ch_accept.fieldbyName('<27><>ע').AsString;
memtblprint.Post;
end;
t_ch_accept.Next;
end;
t_ch_pay.First;
while not t_ch_pay.Eof do begin
Frt:=GetFrt(t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
if memtblprint.Locate('Frt;ACCNAME;CR',vararrayof([Frt,t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,'F']),[]) then begin
memtblprint.Edit;
memtblprint.FieldByName('OBJCR').AsString:=t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
memtblprint.FieldByName('USDCR').AsFloat:=memtblprint.FieldByName('USDCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end else if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then begin
memtblprint.FieldByName('RMBCR').AsFloat:=memtblprint.FieldByName('RMBCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else
begin
memtblprint.FieldByName('OTCR').AsFloat:=memtblprint.FieldByName('OTCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
if memtblprint.FieldByName('REMARKCR').AsString='' then begin
memtblprint.FieldByName('REMARKCR').AsString:=t_ch_pay.fieldbyName('<27><>ע').AsString;
end else begin
memtblprint.FieldByName('REMARKCR').AsString:=memtblprint.FieldByName('REMARKCR').AsString+' '+t_ch_pay.fieldbyName('<27><>ע').AsString;
end;
memtblprint.FieldByName('CR').AsString:='T';
memtblprint.Post;
end else begin
if memtblprint.Locate('Frt;ACCNAME;OBJCR',vararrayof([Frt,t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
memtblprint.Edit;
if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
memtblprint.FieldByName('USDCR').AsFloat:=memtblprint.FieldByName('USDCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end else else if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then begin
memtblprint.FieldByName('RMBCR').AsFloat:=memtblprint.FieldByName('RMBCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else
begin
memtblprint.FieldByName('OTCR').AsFloat:=memtblprint.FieldByName('OTCR').AsFloat+t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=memtblprint.FieldByName('TTLCR').AsFloat+(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
if memtblprint.FieldByName('REMARKCR').AsString='' then begin
memtblprint.FieldByName('REMARKCR').AsString:=t_ch_pay.fieldbyName('<27><>ע').AsString;
end else begin
memtblprint.FieldByName('REMARKCR').AsString:=memtblprint.FieldByName('REMARKCR').AsString+' '+t_ch_pay.fieldbyName('<27><>ע').AsString;
end;
memtblprint.FieldByName('CR').AsString:='T';
memtblprint.Post;
end else begin
memtblprint.Insert;
memtblprint.FieldByName('ORDNO').AsInteger:=0;
memtblprint.FieldByName('FRT').AsString:=GetFrt(t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
memtblprint.FieldByName('ACCNAME').AsString:=t_ch_pay.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
memtblprint.FieldByName('OBJCR').AsString:=t_ch_pay.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
memtblprint.FieldByName('OBJDR').AsString:='';
memtblprint.FieldByName('REMARKCR').AsString:='';
memtblprint.FieldByName('USDDR').AsFloat:=0;
memtblprint.FieldByName('RMBDR').AsFloat:=0;
memtblprint.FieldByName('TTLDR').AsFloat:=0;
memtblprint.FieldByName('DR').AsString:='F';
memtblprint.FieldByName('CR').AsString:='T';
if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
memtblprint.FieldByName('USDCR').AsFloat:=t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else if t_ch_pay.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then begin
memtblprint.FieldByName('RMBCR').AsFloat:=t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end
else
begin
memtblprint.FieldByName('OTCR').AsFloat:=t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
memtblprint.FieldByName('TTLCR').AsFloat:=(t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*t_ch_pay.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
memtblprint.FieldByName('REMARKCR').AsString:=memtblprint.FieldByName('REMARKCR').AsString+' '+t_ch_pay.fieldbyName('<27><>ע').AsString;
memtblprint.Post;
end;
end;
t_ch_pay.Next;
end;
memtblprint.SortOn('FRT;ACCNAME',[]);
end;
if strtobool(get_parameters_value(81,'false')) then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select * from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> not in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_fee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+get_parameters_value(82,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')+''') order by ˳<><CBB3>');
Open;
memaccept.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
Close;SQL.Clear;
SQL.Add('Select * from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> not in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_fee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+get_parameters_value(82,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')+''') order by ˳<><CBB3>');
Open;
mempay.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
Close;SQL.Clear;
SQL.Add('Select * from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_fee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+get_parameters_value(82,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')+''') order by ˳<><CBB3>');
Open;
memdd.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
end;
finally
FreeAndNil(aQuery);
end;
if strtobool(get_parameters_value(30,'false')) then
begin
t_ch_fee_truck.close;
t_ch_fee_truck.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_truck.open;
end;
end else begin
with t_print_histry do begin
Close;SQL.Clear;
SQL.Add('Select * from t_sys_printhistry where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>'' and <20><><EFBFBD><EFBFBD>='''+t_ch_accept.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'''');
Open;
if IsEmpty then begin
Insert;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>';
FieldByName('<27><>ӡ<EFBFBD><D3A1>').AsString:=employee;
FieldByName('ʱ<><CAB1>').AsDateTime:=Date;
Post;
end;
end;
if strtobool(get_parameters_value(30,'false')) then
begin
t_ch_fee_truck.close;
t_ch_fee_truck.Parameters[0].value:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_truck.open;
end;
end;
if if_first then
begin
frm_sys_frprint.t_sys_reportfile.Close;
frm_sys_frprint.t_sys_reportfile.SQL.Clear;
frm_sys_frprint.t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(frm_sys_frprint.t_sys_report['CH_ID']));
frm_sys_frprint.t_sys_reportfile.Open;
try
template := frm_sys_frprint.t_sys_reportfile.CreateBlobStream(frm_sys_frprint.t_sys_reportfile.FieldByName('report'), bmRead);
template.Position := 0;
frm_sys_frprint.frxReport1.LoadFromStream(template);
finally
template.Free;
end;
frm_sys_frprint.frxReport1.PrepareReport;
frm_sys_frprint.frxReport1.PrintOptions.ShowDialog:=true;
frm_sys_frprint.frxReport1.Print;
print_str:=frm_sys_frprint.frxReport1.PrintOptions.Printer;
if_first:=false;
end
else
begin
frm_sys_frprint.frxReport1.PrintOptions.ShowDialog:=false;
frm_sys_frprint.frxReport1.PrintOptions.Printer:=print_str;
frm_sys_frprint.frxReport1.PrepareReport;
frm_sys_frprint.frxReport1.Print;
end;
end;
t_op_seae.Next;
end;
finally
frm_sys_frprint.free;
frm_sys_frprint:=nil;
end;
end;
end.