|
|
unit u_rp_chfree_total;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, ExtCtrls, ComCtrls, bsSkinTabs, DB, ADODB,
|
|
|
dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner,
|
|
|
RxLookup, StdCtrls, RxMemDS, Menus, XPMenu, Grids, DBGrids, DBGridEh;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_chfree_total = class(TForm)
|
|
|
Panel1: TPanel;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
SaveDialog: TSaveDialog;
|
|
|
bsSkinPageControl4: TbsSkinPageControl;
|
|
|
bsSkinTabSheet4: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet5: TbsSkinTabSheet;
|
|
|
p_accept_bill1: TDataSource;
|
|
|
bsSkinButton12: TbsSkinButton;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label15: TLabel;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
t_ch_dui_format: TADOQuery;
|
|
|
t_ch_dui_format1: TDataSource;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
t_bill_fee_dong: TRxMemoryData;
|
|
|
t_bill_fee_dong1: TDataSource;
|
|
|
PopupMenu2: TPopupMenu;
|
|
|
N10: TMenuItem;
|
|
|
N11: TMenuItem;
|
|
|
N14: TMenuItem;
|
|
|
N13: TMenuItem;
|
|
|
N16: TMenuItem;
|
|
|
XPMenu1: TXPMenu;
|
|
|
bsSkinTabSheet3: TbsSkinTabSheet;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
|
|
|
dxDBGrid3: TdxDBGrid;
|
|
|
dxDBGridColumn1: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
t_bill_fee_group: TRxMemoryData;
|
|
|
t_bill_fee_group1: TDataSource;
|
|
|
t_fee_sum: TRxMemoryData;
|
|
|
t_fee_sum1: TDataSource;
|
|
|
bstab5: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet6: TbsSkinTabSheet;
|
|
|
t_bill_fee_drdetail1: TDataSource;
|
|
|
t_bill_fee_drdetail: TADOQuery;
|
|
|
t_bill_fee_crdetail1: TDataSource;
|
|
|
t_bill_fee_crdetail: TADOQuery;
|
|
|
DBGridEh1: TDBGridEh;
|
|
|
DBGridEh2: TDBGridEh;
|
|
|
N1: TMenuItem;
|
|
|
N2: TMenuItem;
|
|
|
p_accept_sum: TADOQuery;
|
|
|
p_accept_sum1: TDataSource;
|
|
|
p_accept_bill: TADOStoredProc;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure dxDBGrid5DblClick(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton12Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
procedure N2Click(Sender: TObject);
|
|
|
procedure bsSkinPageControl4Change(Sender: TObject);
|
|
|
procedure dxDBGrid3ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
procedure dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
private
|
|
|
procedure mem_freetable(t_bill: TRxMemoryData;str:widestring;table_bill:TDataSet;DM_ID:Integer);
|
|
|
procedure dui_freegrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
procedure dui_groupgrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
procedure dui_totalgrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
procedure dxDBGridfeeCustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean;
|
|
|
var ADone: Boolean);
|
|
|
procedure dxDBGridstatusCustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean;
|
|
|
var ADone: Boolean);
|
|
|
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_chfree_total: Tfrm_rp_chfree_total;
|
|
|
rp_free_total_open,md:boolean;
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_rp_no_seae_query,my_sys_function, u_rp_total_query,SmpExprCalc,
|
|
|
u_rp_dui_formatrpt, u_rp_dui_freeformatrpt, u_sys_progress;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
procedure Tfrm_rp_chfree_total.dxDBGridfeeCustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
begin
|
|
|
AColor:=dxgrid_color_fee(ANode.strings[TdxDBGridColumn(Sender).Index]);
|
|
|
AFont.Color:=clblack;
|
|
|
|
|
|
end;
|
|
|
procedure Tfrm_rp_chfree_total.dxDBGridstatusCustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
begin
|
|
|
AColor:=dxgrid_color('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>',ANode.strings[TdxDBGridColumn(Sender).Index]);
|
|
|
AFont.Color:=clblack;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dui_groupgrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
var
|
|
|
Column :TdxDBTreeListColumn;
|
|
|
i,j:integer;
|
|
|
str_list:Tstringlist;
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt;
|
|
|
try
|
|
|
aQuery.Close;aQuery.SQL.Clear;
|
|
|
aQuery.SQL.Add('Select * from t_ch_dui_freefeefield where DM_ID='+inttostr(DM_ID));
|
|
|
aQuery.Open;
|
|
|
|
|
|
str_list:=Tstringlist.create();
|
|
|
while dxDBGrid2.columncount>0 do
|
|
|
begin
|
|
|
dxDBGrid2.Columns[0].Destroy;
|
|
|
end;
|
|
|
|
|
|
if t_ch_dui_format.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString<>'' then begin
|
|
|
str_list.Text:=trim(t_ch_dui_format.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString);
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn) ;
|
|
|
Column.Caption:=str_list.Strings[i];
|
|
|
Column.FieldName:=str_list.Strings[i];
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=100;
|
|
|
dxDBGrid2.KeyField:=str_list.Strings[i];
|
|
|
end;
|
|
|
|
|
|
str_list.Text:=trim(str);
|
|
|
j:=0;
|
|
|
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
if j=0 then begin
|
|
|
Column.SummaryFooterType:=cstcount;
|
|
|
j:=j+1;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn) ;
|
|
|
Column.Caption:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.FieldName:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.eof do begin
|
|
|
|
|
|
if (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>ֵ') or (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn);
|
|
|
Column.Caption:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.FieldName:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end else begin
|
|
|
end;
|
|
|
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
str_list.free;
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dui_totalgrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
var
|
|
|
Column :TdxDBTreeListColumn;
|
|
|
i:integer;
|
|
|
str_list:Tstringlist;
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt;
|
|
|
// try
|
|
|
aQuery.Close;aQuery.SQL.Clear;
|
|
|
aQuery.SQL.Add('Select * from t_ch_dui_freefeefield where DM_ID='+inttostr(DM_ID));
|
|
|
aQuery.Open;
|
|
|
|
|
|
str_list:=Tstringlist.create();
|
|
|
while dxDBGrid2.columncount>0 do
|
|
|
begin
|
|
|
dxDBGrid2.Columns[0].Destroy;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
str_list.Text:=trim(str);
|
|
|
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn) ;
|
|
|
Column.Caption:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.FieldName:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.eof do begin
|
|
|
|
|
|
if (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>ֵ') or (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn);
|
|
|
Column.Caption:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.FieldName:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end else begin
|
|
|
end;
|
|
|
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
// finally
|
|
|
str_list.free;
|
|
|
FreeAndNil(aQuery);
|
|
|
// end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dui_freegrid(str:widestring;dxdbgrid2:TdxdbGrid;DM_ID:integer;aAllTable:TDataSet);
|
|
|
var
|
|
|
Column :TdxDBTreeListColumn;
|
|
|
i,j:integer;
|
|
|
str_list:Tstringlist;
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt;
|
|
|
try
|
|
|
aQuery.Close;aQuery.SQL.Clear;
|
|
|
aQuery.SQL.Add('Select * from t_ch_dui_freefeefield where DM_ID='+inttostr(DM_ID));
|
|
|
aQuery.Open;
|
|
|
|
|
|
str_list:=Tstringlist.create();
|
|
|
str_list.Text:=trim(str);
|
|
|
while dxDBGrid2.columncount>0 do
|
|
|
begin
|
|
|
dxDBGrid2.Columns[0].Destroy;
|
|
|
end;
|
|
|
j:=0;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn) ;
|
|
|
Column.Caption:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.FieldName:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=100;
|
|
|
if pos('<27><><EFBFBD><EFBFBD>״̬',str_list[i])>0 then
|
|
|
Column.OnCustomDraw:=dxDBGridfeeCustomDraw;
|
|
|
if pos('ҵ<><D2B5>״̬',str_list[i])>0 then
|
|
|
Column.OnCustomDraw:=dxDBGridstatusCustomDraw;
|
|
|
if j=0 then begin
|
|
|
Column.SummaryFooterType:=cstcount;
|
|
|
j:=j+1;
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn) ;
|
|
|
Column.Caption:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.FieldName:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.eof do begin
|
|
|
|
|
|
if (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>ֵ') or (aQuery.FieldByName('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn);
|
|
|
Column.Caption:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.FieldName:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=80;
|
|
|
Column.SummaryFooterType:=cstSum;
|
|
|
end else begin
|
|
|
Column:=dxDBGrid2.CreateColumn(TdxDBGridColumn);
|
|
|
Column.Caption:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.FieldName:=aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString;
|
|
|
Column.ReadOnly:=true;
|
|
|
Column.Width:=100;
|
|
|
end;
|
|
|
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
str_list.free;
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.mem_freetable(t_bill: TRxMemoryData;str:widestring;table_bill:TDataSet;DM_ID:Integer);
|
|
|
var
|
|
|
i,j,m:integer;
|
|
|
str_list,str_Field:Tstringlist;
|
|
|
aQuery,aQuery2,aQuery3:TADOQuery;
|
|
|
str_tmp,strfield,sortfield:String;
|
|
|
calc: TSmpExprCalc;
|
|
|
A:variant;
|
|
|
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery_rpt;
|
|
|
aQuery2:=CreateAdoQuery_rpt;
|
|
|
aQuery3:=CreateAdoQuery_rpt;
|
|
|
try
|
|
|
|
|
|
aQuery.Close;aQuery.SQL.Clear;
|
|
|
aQuery.SQL.Add('Select * from t_ch_dui_freefeefield where DM_ID='+inttostr(DM_ID));
|
|
|
aQuery.Open;
|
|
|
aQuery3.Close;aQuery3.SQL.Clear;
|
|
|
aQuery3.SQL.Add('Select * from t_ch_dui_freefeefield where <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' and DM_ID='+inttostr(DM_ID));
|
|
|
aQuery3.Open;
|
|
|
|
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>';
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=table_bill.RecordCount*2+2;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
str_list:=Tstringlist.create();
|
|
|
str_Field:=Tstringlist.create();
|
|
|
t_bill.close;
|
|
|
t_bill.FieldDefs.Clear;
|
|
|
|
|
|
t_bill_fee_group.close;
|
|
|
t_bill_fee_group.FieldDefs.Clear;
|
|
|
|
|
|
// t_fee_sum.close;
|
|
|
// t_fee_sum.FieldDefs.Clear;
|
|
|
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
t_bill.FieldDefs.Add('BILLID',ftInteger);
|
|
|
t_bill.FieldDefs.Add('<27><><EFBFBD><EFBFBD>',ftString,12);
|
|
|
|
|
|
t_bill_fee_group.FieldDefs.Add('BILLID',ftInteger);
|
|
|
// t_fee_sum.FieldDefs.Add('BILLID',ftInteger);
|
|
|
|
|
|
|
|
|
str_Field.Text:=trim(t_ch_dui_format.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString);
|
|
|
strfield:='';
|
|
|
for i:=0 to str_Field.Count-1 do
|
|
|
begin
|
|
|
if strfield='' then
|
|
|
strfield:=str_Field.Strings[i]
|
|
|
else
|
|
|
strfield:=strfield+';'+str_Field.Strings[i];
|
|
|
|
|
|
t_bill_fee_group.FieldDefs.Add(str_Field.Strings[i],ftString,80);
|
|
|
end;
|
|
|
|
|
|
|
|
|
str_list.Text:=trim(str);
|
|
|
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if i=0 then begin
|
|
|
sortfield:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
end;
|
|
|
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
t_bill.FieldDefs.Add(copy(str_list[i],2,length(str_list[i])-1),ftString,80);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill.FieldDefs.Add(copy(str_list[i],2,length(str_list[i])-1),ftFloat);
|
|
|
t_bill_fee_group.FieldDefs.Add(copy(str_list[i],2,length(str_list[i])-1),ftFloat);
|
|
|
// t_fee_sum.FieldDefs.Add(copy(str_list[i],2,length(str_list[i])-1),ftFloat);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.eof do begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
t_bill.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftFloat);
|
|
|
t_bill_fee_group.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftFloat);
|
|
|
// t_fee_sum.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftFloat);
|
|
|
end else if aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>' then
|
|
|
t_bill.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftdate)
|
|
|
else if aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27>ַ<EFBFBD>' then
|
|
|
t_bill.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftString,80)
|
|
|
else if aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>' then
|
|
|
t_bill.FieldDefs.Add(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'],ftBoolean);
|
|
|
|
|
|
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
t_bill.open;
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
table_bill.first;
|
|
|
j:=0;
|
|
|
while not table_bill.eof do
|
|
|
begin
|
|
|
inc(j);
|
|
|
t_bill.insert;
|
|
|
t_bill['BILLID']:=j;
|
|
|
t_bill['<27><><EFBFBD><EFBFBD>']:=table_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
t_bill[copy(str_list[i],2,length(str_list[i])-1)]:=
|
|
|
table_bill.fieldbyname(copy(str_list[i],2,length(str_list[i])-1)).asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill[copy(str_list[i],2,length(str_list[i])-1)]:=0;
|
|
|
try
|
|
|
if table_bill.fieldbyname(copy(str_list[i],2,length(str_list[i])-1)).isnull or
|
|
|
(table_bill.fieldbyname(copy(str_list[i],2,length(str_list[i])-1)).asstring='') then
|
|
|
t_bill[copy(str_list[i],2,length(str_list[i])-1)]:=0
|
|
|
else
|
|
|
t_bill[copy(str_list[i],2,length(str_list[i])-1)]:=
|
|
|
table_bill.fieldbyname(copy(str_list[i],2,length(str_list[i])-1)).asFloat;
|
|
|
except
|
|
|
t_bill[copy(str_list[i],2,length(str_list[i])-1)]:=0;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.eof do begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).AsFloat:=0;
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') then begin
|
|
|
try
|
|
|
aQuery2.Close;aQuery2.SQL.Clear;
|
|
|
aQuery2.SQL.Add(aQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
aQuery2.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=table_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
aQuery2.Open;
|
|
|
if (not aQuery2.IsEmpty) then begin
|
|
|
if aQuery2.Fields[0].IsNull then
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=0
|
|
|
else
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=aQuery2.Fields[0].Value;
|
|
|
end else begin
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=0;
|
|
|
end;
|
|
|
except
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=0;
|
|
|
end;
|
|
|
end;
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27>ַ<EFBFBD>') then begin
|
|
|
try
|
|
|
aQuery2.Close;aQuery2.SQL.Clear;
|
|
|
aQuery2.SQL.Add(aQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
aQuery2.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=table_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
aQuery2.Open;
|
|
|
if (not aQuery2.IsEmpty) then begin
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=aQuery2.Fields[0].Value;
|
|
|
end else begin
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:='';
|
|
|
end;
|
|
|
except
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:='';
|
|
|
end;
|
|
|
end;
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
try
|
|
|
aQuery2.Close;aQuery2.SQL.Clear;
|
|
|
aQuery2.SQL.Add(aQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
aQuery2.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=table_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
aQuery2.Open;
|
|
|
if (not aQuery2.IsEmpty) then begin
|
|
|
t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=aQuery2.Fields[0].Value;
|
|
|
end else begin
|
|
|
end;
|
|
|
except
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery3.IsEmpty then begin
|
|
|
aQuery3.First;
|
|
|
while not aQuery3.eof do begin
|
|
|
if (aQuery3['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
try
|
|
|
Str_tmp:=aQuery3.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
for m:=0 to t_bill.FieldCount-1 do begin
|
|
|
str_tmp:=StringReplace(str_tmp,'['+t_bill.Fields[m].FieldName+']',t_bill.Fields[m].AsString,[]);
|
|
|
end;
|
|
|
{
|
|
|
aQuery.First;
|
|
|
while not aQuery.Eof do begin
|
|
|
str_tmp:=StringReplace(str_tmp,'['+aQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString+']',t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).AsString,[]);
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
}
|
|
|
calc := TSmpExprCalc.Create(TRUE);
|
|
|
try
|
|
|
try
|
|
|
if copy(str_tmp,1,1)='-' then str_tmp:='0'+str_tmp;
|
|
|
calc.Expression := str_tmp;
|
|
|
// calc.FormatStr := Edit2.Text;
|
|
|
t_bill.fieldbyname(aQuery3['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=strtofloat(calc.AsString);
|
|
|
except
|
|
|
t_bill.fieldbyname(aQuery3['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=0;
|
|
|
end;
|
|
|
finally
|
|
|
calc.Free;
|
|
|
end;
|
|
|
except
|
|
|
t_bill.fieldbyname(aQuery3['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=0;
|
|
|
end;
|
|
|
end;
|
|
|
aQuery3.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
t_bill.post;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
table_bill.next;
|
|
|
end;
|
|
|
t_bill_fee_group.open;
|
|
|
{
|
|
|
t_fee_sum.open;
|
|
|
t_fee_sum.Insert;
|
|
|
j:=0;
|
|
|
for i:=0 to t_fee_sum.FieldCount-1 do begin
|
|
|
t_fee_sum.Fields[i].Value:=0;
|
|
|
end;
|
|
|
}
|
|
|
t_bill.SortOnFields(trim(strfield));
|
|
|
t_bill.First;
|
|
|
|
|
|
A := VarArrayCreate([0,str_Field.Count-1], varVariant);
|
|
|
while not t_bill.eof do begin
|
|
|
|
|
|
//
|
|
|
// ShowMessage(copy(str_list[i],2,length(str_list[i])-1));
|
|
|
for i:=0 to str_Field.Count-1 do
|
|
|
begin
|
|
|
A[i]:=t_bill.FieldByName(str_Field.Strings[i]).value;
|
|
|
end;
|
|
|
|
|
|
// if t_bill_fee_group.Locate(strfield,VarArrayOf([t_bill.FieldByName(str_Field.Strings[0]).value]),[]) then begin
|
|
|
if str_Field.Count>1 then
|
|
|
begin
|
|
|
if t_bill_fee_group.Locate(strfield,A,[]) then
|
|
|
begin
|
|
|
t_bill_fee_group.Edit;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value:=t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value+t_bill.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.Eof do begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value+t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value;
|
|
|
end;
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
t_bill_fee_group.Post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.Insert;
|
|
|
j:=j+1;
|
|
|
t_bill_fee_group['BILLID']:=j;
|
|
|
for i:=0 to str_Field.Count-1 do
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(str_Field.Strings[i]).AsString:=trim(t_bill.FieldByName(str_Field.Strings[i]).AsString);
|
|
|
end;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value:=t_bill.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then
|
|
|
begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.Eof do
|
|
|
begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then
|
|
|
begin
|
|
|
t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value;
|
|
|
end;
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
t_bill_fee_group.Post;
|
|
|
end;
|
|
|
end
|
|
|
else if str_Field.Count=1 then
|
|
|
begin
|
|
|
if t_bill_fee_group.Locate(strfield,t_bill.FieldByName(str_Field.Strings[0]).value,[]) then
|
|
|
begin
|
|
|
t_bill_fee_group.Edit;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value:=t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value+t_bill.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.Eof do begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value+t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value;
|
|
|
end;
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
t_bill_fee_group.Post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.Insert;
|
|
|
j:=j+1;
|
|
|
t_bill_fee_group['BILLID']:=j;
|
|
|
for i:=0 to str_Field.Count-1 do
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(str_Field.Strings[i]).AsString:=trim(t_bill.FieldByName(str_Field.Strings[i]).AsString);
|
|
|
end;
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_bill_fee_group.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value:=t_bill.FieldByName(copy(str_list[i],2,length(str_list[i])-1)).value;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not aQuery.IsEmpty then
|
|
|
begin
|
|
|
aQuery.First;
|
|
|
while not aQuery.Eof do
|
|
|
begin
|
|
|
if (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><>ֵ') or (aQuery['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']='<27><><EFBFBD><EFBFBD>') then
|
|
|
begin
|
|
|
t_bill_fee_group.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value:=t_bill.fieldbyname(aQuery['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']).value;
|
|
|
end;
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
end;
|
|
|
t_bill_fee_group.Post;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
t_bill.Next;
|
|
|
end;
|
|
|
finally
|
|
|
str_list.free;
|
|
|
frm_sys_progress.close;
|
|
|
frm_sys_progress:=nil;
|
|
|
FreeAndNil(aQuery);
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
|
|
|
rp_free_total_open:=false;
|
|
|
frm_rp_chfree_total.Hide;
|
|
|
frm_rp_chfree_total.ManualFloat(frm_rp_chfree_total.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_chfree_total');
|
|
|
action:=cafree;
|
|
|
frm_rp_chfree_total:=nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
str_list:tstrings;
|
|
|
begin
|
|
|
md:=false;
|
|
|
try
|
|
|
frm_rp_total_query:=tfrm_rp_total_query.Create (self);
|
|
|
rp_seae_query_num:=5;
|
|
|
rp_seae_query_type:=4;
|
|
|
rp_seae_query_limited:='0037';
|
|
|
rp_seae_query_str:='ҵ<><D2B5><EFBFBD>ۺ<EFBFBD><DBBA><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>';
|
|
|
frm_rp_total_query.ShowModal;
|
|
|
finally
|
|
|
frm_rp_total_query.Free;
|
|
|
end;
|
|
|
if not md then exit;
|
|
|
|
|
|
if p_accept_bill.IsEmpty then
|
|
|
exit;
|
|
|
if t_ch_dui_format.IsEmpty then
|
|
|
exit;
|
|
|
if RxDBLookupCombo3.Text='' then Exit;
|
|
|
|
|
|
if not p_accept_bill.IsEmpty then begin
|
|
|
dui_freegrid(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,dxDBGrid3,t_ch_dui_format.fieldbyname('DM_ID').asInteger,t_ch_dui_format);
|
|
|
dui_groupgrid(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,dxDBGrid1,t_ch_dui_format.fieldbyname('DM_ID').asInteger,t_ch_dui_format);
|
|
|
loadreggrid(dxdbgrid3,true,caption+'3-'+t_ch_dui_format.fieldbyname('DM_ID').asstring);
|
|
|
loadreggrid(dxdbgrid1,true,caption+'1-'+t_ch_dui_format.fieldbyname('DM_ID').asstring);
|
|
|
if not t_ch_dui_format.FieldByName('<27>Ƿ<C7B7><F1B0B4B7>ÿͻ<C3BF><CDBB>ϼ<EFBFBD>').AsBoolean then begin
|
|
|
mem_freetable(t_bill_fee_dong,t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,p_accept_bill,t_ch_dui_format.fieldbyname('DM_ID').asInteger);
|
|
|
t_bill_fee_dong1.DataSet:=t_bill_fee_dong;
|
|
|
end else begin
|
|
|
str_list:=TStringList.Create;
|
|
|
try
|
|
|
str_list.Text:=trim(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
p_accept_bill.Sort:=copy(str_list[0],2,length(str_list[0])-1);
|
|
|
t_bill_fee_dong1.DataSet:=p_accept_bill;
|
|
|
finally
|
|
|
freeandnil(str_list);
|
|
|
end;
|
|
|
end;
|
|
|
if trim(t_ch_dui_format.fieldbyname('<27><>ϸһ<CFB8><D2BB><EFBFBD><EFBFBD>').asstring)<>'' then begin
|
|
|
|
|
|
t_bill_fee_drdetail.Close;
|
|
|
t_bill_fee_drdetail.sql.Clear;
|
|
|
t_bill_fee_drdetail.sql.Add(t_ch_dui_format.fieldbyname('<27><>ϸһ<CFB8><D2BB><EFBFBD><EFBFBD>').asstring);
|
|
|
t_bill_fee_drdetail.Open
|
|
|
end;
|
|
|
if trim(t_ch_dui_format.fieldbyname('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)<>'' then begin
|
|
|
t_bill_fee_crdetail.Close;
|
|
|
t_bill_fee_crdetail.sql.Clear;
|
|
|
t_bill_fee_crdetail.sql.Add(t_ch_dui_format.fieldbyname('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
t_bill_fee_crdetail.Open
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dxDBGrid5DblClick(Sender: TObject);
|
|
|
begin
|
|
|
fee_view(p_accept_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
if not t_ch_dui_format.Active then
|
|
|
t_ch_dui_format.open;
|
|
|
rp_free_total_open:=true;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.bsSkinButton12Click(Sender: TObject);
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
if not assigned(frm_rp_dui_freeformatrpt) then
|
|
|
frm_rp_dui_freeformatrpt:=tfrm_rp_dui_freeformatrpt.Create (self);
|
|
|
dui_format_type:=109;
|
|
|
frm_rp_dui_freeformatrpt.showmodal;
|
|
|
finally
|
|
|
frm_rp_dui_freeformatrpt.free;
|
|
|
frm_rp_dui_freeformatrpt:=nil;
|
|
|
t_ch_dui_format.requery;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.bsSkinButton2Click(Sender: TObject);
|
|
|
var
|
|
|
str:string;
|
|
|
i:integer;
|
|
|
begin
|
|
|
if p_accept_bill.IsEmpty then
|
|
|
exit;
|
|
|
if t_ch_dui_format.IsEmpty then
|
|
|
exit;
|
|
|
|
|
|
if not t_ch_dui_format['<27>Ƿ<C7B7><F1B0B4B7>ÿͻ<C3BF><CDBB>ϼ<EFBFBD>'] then begin
|
|
|
|
|
|
if (not t_bill_fee_dong.IsEmpty) and (dxDBGrid3.GroupColumnCount<>0)then begin
|
|
|
str:='';
|
|
|
for i:=0 to dxDBGrid3.GroupColumnCount-1 do begin
|
|
|
if i=0 then
|
|
|
str:=dxDBGrid3.GroupColumns[i].FieldName
|
|
|
else
|
|
|
str:=str+';'+dxDBGrid3.GroupColumns[i].FieldName;
|
|
|
end;
|
|
|
t_bill_fee_dong.SortOnFields(str);
|
|
|
end;
|
|
|
|
|
|
if (not t_bill_fee_group.IsEmpty) and (dxDBGrid1.GroupColumnCount<>0)then begin
|
|
|
str:='';
|
|
|
for i:=0 to dxDBGrid1.GroupColumnCount-1 do begin
|
|
|
if i=0 then
|
|
|
str:=dxDBGrid1.GroupColumns[i].FieldName
|
|
|
else
|
|
|
str:=str+';'+dxDBGrid1.GroupColumns[i].FieldName;
|
|
|
end;
|
|
|
t_bill_fee_group.SortOnFields(str);
|
|
|
end;
|
|
|
end else begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
sys_print('ҵ<><D2B5><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ӡ',2,nil,nil,nil,nil,t_bill_fee_dong1,t_bill_fee_group1,t_bill_fee_drdetail1,t_bill_fee_crdetail1,nil,t_fee_sum1,nil);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.N16Click(Sender: TObject);
|
|
|
begin
|
|
|
if bsSkinTabSheet4.showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid3);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet3.showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid1);
|
|
|
exit;
|
|
|
end;
|
|
|
{
|
|
|
if bstab4.showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid2);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.N2Click(Sender: TObject);
|
|
|
begin
|
|
|
if bsSkinTabSheet4.showing then
|
|
|
begin
|
|
|
savereggrid(dxdbgrid3,caption+'3-'+t_ch_dui_format.fieldbyname('DM_ID').asstring);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet3.showing then
|
|
|
begin
|
|
|
savereggrid(dxdbgrid1,caption+'1-'+t_ch_dui_format.fieldbyname('DM_ID').asstring);
|
|
|
exit;
|
|
|
end;
|
|
|
{
|
|
|
if bstab4.showing then
|
|
|
begin
|
|
|
savereggrid(dxdbgrid2,caption+'2-'+t_ch_dui_format.fieldbyname('DM_ID').asstring);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.bsSkinPageControl4Change(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
str_get:widestring;
|
|
|
str_list,str_Field:Tstringlist;
|
|
|
strfield,sortfield:String;
|
|
|
i:integer;
|
|
|
begin
|
|
|
{
|
|
|
if not rp_free_total_open then exit;
|
|
|
if not p_accept_bill.Active then exit;
|
|
|
if p_accept_bill.IsEmpty then exit;
|
|
|
if not bsSkinTabSheet3.Showing then exit;
|
|
|
str_list:=Tstringlist.create();
|
|
|
str_Field:=Tstringlist.create();
|
|
|
str:=new_query(p_accept_bill);
|
|
|
str_get:='';
|
|
|
if trim(t_ch_dui_format.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString)<>'' then begin
|
|
|
str_Field.Text:=trim(t_ch_dui_format.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').AsString);
|
|
|
strfield:='';
|
|
|
for i:=0 to str_Field.Count-1 do
|
|
|
begin
|
|
|
if strfield='' then
|
|
|
strfield:=str_Field.Strings[i]
|
|
|
else
|
|
|
strfield:=strfield+','+str_Field.Strings[i];
|
|
|
end;
|
|
|
strfield:=strfield+',';
|
|
|
end;
|
|
|
|
|
|
str_list.Text:=trim(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
|
for i:=0 to str_list.Count-1 do
|
|
|
begin
|
|
|
if i=0 then begin
|
|
|
sortfield:=copy(str_list[i],2,length(str_list[i])-1);
|
|
|
end;
|
|
|
|
|
|
if copy(str_list[i],1,1)='0' then
|
|
|
begin
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if str_get<>'' then
|
|
|
str_get:=str_get+',sum('+copy(str_list[i],2,length(str_list[i])-1)+') as '+copy(str_list[i],2,length(str_list[i])-1)
|
|
|
else
|
|
|
str_get:='sum('+copy(str_list[i],2,length(str_list[i])-1)+') as '+copy(str_list[i],2,length(str_list[i])-1);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
p_accept_sum.Close;
|
|
|
p_accept_sum.SQL.Clear;
|
|
|
p_accept_sum.SQL.add('select ');
|
|
|
p_accept_sum.SQL.add(strfield);
|
|
|
p_accept_sum.SQL.Add(str_get);
|
|
|
p_accept_sum.SQL.Add(' from v_op_bscard ');
|
|
|
p_accept_sum.SQL.Add(str);
|
|
|
p_accept_sum.SQL.Add(' group by '+strfield);
|
|
|
// p_accept_sum.SQL.Add(' order by '+sortfield);
|
|
|
p_accept_sum.open;
|
|
|
|
|
|
FreeAndNil(str_list);
|
|
|
FreeAndNil(str_Field);
|
|
|
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dxDBGrid3ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
if not t_ch_dui_format['<27>Ƿ<C7B7><F1B0B4B7>ÿͻ<C3BF><CDBB>ϼ<EFBFBD>'] then begin
|
|
|
Column_sort_RxMemoryData(Column,t_bill_fee_dong,'<27><><EFBFBD><EFBFBD>');
|
|
|
end else begin
|
|
|
Column_sort_pro(Column,p_accept_bill,'<27><><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_chfree_total.dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort_RxMemoryData(Column,t_bill_fee_group,'BILLID');
|
|
|
end;
|
|
|
|
|
|
end.
|