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.
DONGSHENG6/财务管理/u_ch_piliang_zhuprnfee.~pas

282 lines
9.3 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_zhuprnfee;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, BusinessSkinForm, dxExEdtr, dxDBTLCl, dxGrClms,
dxDBGrid, dxTL, dxDBCtrl, dxCntner, DB, ADODB, StdCtrls, Grids, DBGrids;
type
Tfrm_ch_piliang_zhuprnfee = 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;
v_op_bscard1: TDataSource;
v_op_bscard: TADOQuery;
tv_bscard_all1: TDataSource;
t_ch_pay: TADOQuery;
t_ch_pay1: TDataSource;
t_sys_report: TADOQuery;
t_sys_report1: TDataSource;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridCheckColumn;
tv_bscard_all: TADOStoredProc;
t_op_gain: TADOQuery;
t_op_gain1: TDataSource;
bsSkinButton8: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
t_op_gain_main1: TDataSource;
t_op_gain_main: TADOQuery;
qrytmp: TADOQuery;
t_pin_accept: TADOStoredProc;
t_pin_accept1: TDataSource;
t_pin_pay: TADOStoredProc;
t_pin_pay1: TDataSource;
t_pin_gain: TADOStoredProc;
t_pin_gain1: TDataSource;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure tv_bscard_allAfterScroll(DataSet: TDataSet);
private
op:boolean;
{ Private declarations }
procedure setprntrue ;
procedure sys_frprint_piliang(sx:string;report_str:string;table:TDataSet;one_1:TDataSource;one_2:TDataSource;one_3:TDataSource;one_4:TDataSource;all_1:TDataSource;all_2:TDataSource;all_3:TDataSource;all_4:TDataSource;all_5:TDataSource;all_6:TDataSource;all_7:TDataSource);//<2F><>ӡ
public
{ Public declarations }
end;
var
frm_ch_piliang_zhuprnfee: Tfrm_ch_piliang_zhuprnfee;
implementation
uses u_main, my_sys_function, u_sys_frprint;
{$R *.dfm}
procedure Tfrm_ch_piliang_zhuprnfee.sys_frprint_piliang(sx:string;report_str:string;table:TDataSet;one_1:TDataSource;one_2:TDataSource;one_3:TDataSource;one_4:TDataSource;all_1:TDataSource;all_2:TDataSource;all_3:TDataSource;all_4:TDataSource;all_5:TDataSource;all_6:TDataSource;all_7:TDataSource);//<2F><>ӡ
var
print_str:string;
if_first:boolean;
template : TStream;
begin
try
if not assigned(frm_sys_frprint) then
frm_sys_frprint:=Tfrm_sys_frprint.Create(application);
frm_sys_frprint.Caption:=sx;
with frm_sys_frprint do
begin
begin
// t_sys_report.close;
// t_sys_report.sql.clear;
// t_sys_report.sql.add('select * from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// t_sys_report.Parameters[0].value:=sx;
// t_sys_report.open;
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;
tv_bscard_all.first;
if_first:=true;
while not tv_bscard_all.eof do
begin
v_op_bscard.close;
v_op_bscard.open;
t_pin_accept.close;
t_pin_accept.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_accept.open;
t_pin_pay.close;
t_pin_pay.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_pay.open;
t_pin_gain.close;
t_pin_gain.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_gain.open;
t_op_gain_main.Close;
t_op_gain_main.open;
frm_sys_frprint.one_table_1.DataSource:=v_op_bscard1;
frm_sys_frprint.one_table_2.DataSource:=one_2;
frm_sys_frprint.one_table_3.DataSource:=one_3;
frm_sys_frprint.one_table_4.DataSource:=one_4;
frm_sys_frprint.all_table_1.DataSource:=t_pin_accept1;
frm_sys_frprint.all_table_2.DataSource:=t_pin_pay1;
frm_sys_frprint.all_table_3.DataSource:=t_pin_gain1;
frm_sys_frprint.all_table_4.DataSource:=t_op_gain_main1;
frm_sys_frprint.all_table_5.DataSource:=all_5;
frm_sys_frprint.all_table_6.DataSource:=all_6;
frm_sys_frprint.all_table_7.DataSource:=all_7;
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 := t_sys_report.CreateBlobStream(t_sys_report.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
{
try
template := t_sys_report.CreateBlobStream(t_sys_report.FieldByName('report'), bmRead);
template.Position := 0;
frm_sys_frprint.frxReport1.LoadFromStream(template);
finally
template.Free;
end;
}
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;
frm_sys_frprint.one_table_1.DataSource:=nil;
frm_sys_frprint.one_table_2.DataSource:=nil;
frm_sys_frprint.one_table_3.DataSource:=nil;
frm_sys_frprint.one_table_4.DataSource:=nil;
frm_sys_frprint.all_table_1.DataSource:=nil;
frm_sys_frprint.all_table_2.DataSource:=nil;
frm_sys_frprint.all_table_3.DataSource:=nil;
frm_sys_frprint.all_table_4.DataSource:=nil;
frm_sys_frprint.all_table_5.DataSource:=nil;
frm_sys_frprint.all_table_6.DataSource:=nil;
frm_sys_frprint.all_table_7.DataSource:=nil;
tv_bscard_all.next;
end;
finally
frm_sys_frprint.free;
frm_sys_frprint:=nil;
end;
end;
procedure Tfrm_ch_piliang_zhuprnfee.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_piliang_zhuprnfee.bsSkinButton8Click(Sender: TObject);
begin
if t_sys_report.IsEmpty then
begin
showmessage('û<><C3BB><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>');
exit;
end;
setprntrue;
op:=true;
sys_frprint_piliang('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><E3B5A5>ӡ',t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,
tv_bscard_all,v_op_bscard1,nil,nil,nil,
t_pin_accept1,t_pin_pay1,t_pin_gain1,t_op_gain_main1,nil,nil,nil);
end;
procedure Tfrm_ch_piliang_zhuprnfee.FormShow(Sender: TObject);
begin
t_sys_report.Parameters[0].value:='<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><E3B5A5>ӡ';
t_sys_report.open;
t_op_gain_main.Open ;
op:=false;
end;
procedure Tfrm_ch_piliang_zhuprnfee.setprntrue;
var tblname:string ;
begin
with tv_bscard_all do
begin
First ;
while not eof do
begin
tblname:='' ;
if tv_bscard_all.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>' then tblname:='t_op_seae'
else
if tv_bscard_all.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>' then tblname:='t_op_seai'
else
if tv_bscard_all.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>' then tblname:='t_op_aire'
else
if tv_bscard_all.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>' then tblname:='t_op_airi'
else raise exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ֪<D4A4><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') ;
qrytmp.Close ;
qrytmp.sql.clear ;
qrytmp.sql.add('update '+tblname+' set <20>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ=1 ');
if strtobool(get_parameters_value(63,'false'))then
qrytmp.sql.add(' ,<2C><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>''');
qrytmp.sql.add('where <20><><EFBFBD><EFBFBD>=:bianhao');
qrytmp.parameters.parambyname('bianhao').value:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring ;
qrytmp.execsql ;
next ;
end ;
first ;
end ;
end;
procedure Tfrm_ch_piliang_zhuprnfee.tv_bscard_allAfterScroll(
DataSet: TDataSet);
begin
if not op then exit;
{
t_pin_accept.close;
t_pin_accept.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_accept.open;
t_pin_pay.close;
t_pin_pay.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_pay.open;
t_pin_gain.close;
t_pin_gain.Parameters[1].value:=tv_bscard_all.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_pin_gain.open;
}
end;
end.