📄 sy_zfhzcx.pas
字号:
Params.ParamByName('RQEnd').Asstring:=Sed_Year.Text + cmb_End.Text;
Open;
end;
end;
procedure TfrmY_ZFHZCX.Qry_SearchAfterOpen(DataSet: TDataSet);
begin
inherited;
with DataSet do
begin
TNumericField(FieldByName('YJZJJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJTJJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJHKJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJZXJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJYE')).DisplayFormat := '#,##0.00##';
end;
end;
procedure TfrmY_ZFHZCX.BBt_PrintClick(Sender: TObject);
begin
if Qry_Search.IsEmpty then
begin
CHQMsgBox('没有可打印的数据!');
exit;
end;
if not Qry_Search.Active then exit;
case SearchState of
ssFHZMX:
begin
PrintDBGrid(DBG_Detail, pCaption[integer(l_typ)] + '分户帐明细');
end;
ssFHZ:
begin
Qry_Print.Sql:=Qry_Search.SQL;
With Qry_Print do
begin
Close;
Params.ParamByName('DWDM').AsString:=PGXDW(cBo_GXDW.Items.Objects[cBo_GXDW.ItemIndex])^.DWDM;
Params.ParamByName('RQFrom').Asstring:=SED_Year.Text + '01';
Params.ParamByName('RQEnd').Asstring:=Sed_Year.Text + '12';
Open;
end;
QRL_fh_wlhm.Caption := cBo_GXDW.Text;
QRL_fh_nd.Caption := SED_Year.Text;;
if not AsSigned(Frm_DialogAfterPrint) then
Frm_DialogAfterPrint:=TFrm_DialogAfterPrint.Create(Application);
try
Qry_Print.First;
LineCount:=0;
QRe_jypfhz.Prepare;
try
TotalPageCount:=QRe_jypfhz.QRPrinter.PageCount;
finally
QRe_jypfhz.QRPrinter.Free;
QRe_jypfhz.QRPrinter := nil;
end;
with Frm_DialogAfterPrint do
begin
SpinEdit1.Value :=1;
SpinEdit2.Value :=TotalPageCount;
Refresh;
ShowModal;
if SpinEdit2.Value >TotalPageCount then
SpinEdit2.Value :=TotalPageCount;
if SpinEdit2.Value <1 then
SpinEdit2.Value:=1;
if Close_Flag then
begin
Tao_Print_Flag:=CheckBox1.Checked =True;
if RadioButton2.Checked then
begin
QRe_jypfhz.PrinterSettings.FirstPage:=SpinEdit1.Value;
QRe_jypfhz.PrinterSettings.LastPage:=SpinEdit2.Value;
end;
end;
end;
LineCount:=0;
Qry_Print.First;
QRe_jypfhz.Preview;
finally
Frm_DialogAfterPrint.Free;
Frm_DialogAfterPrint:=nil;
end;
end;
end;
end;
procedure TfrmY_ZFHZCX.Qry_DetailAfterOpen(DataSet: TDataSet);
begin
inherited;
TNumericField(DataSet.FieldByName('JJ')).DisPlayFormat := '#,##0.00##';
TNumericField(DataSet.FieldByName('XJ')).DisPlayFormat := '#,##0.00##';
end;
procedure TfrmY_ZFHZCX.RGr_BaseClick(Sender: TObject);
begin
inherited;
Case RGr_base.ItemIndex of
0: SearchState:=ssFHZ;
1: SearchState:=ssFHZMX;
end;
end;
procedure TfrmY_ZFHZCX.QRe_jypfhzNeedData(Sender: TObject;
var MoreData: Boolean);
var
EoF_Flag:boolean;
begin
Eof_Flag:=Qry_Print.Eof;
if LineCount <= 21 then
begin
Inc(LineCount);
MoreData:=True;
end;
//为月份信息凑页
if (not Qry_Print.Eof) and (not Qry_Print.Bof) then
begin
Qry_Print.Prior;
if (Qry_Print.FieldByName('zy').AsString<>ZY_temp) and
(Pos('本年累计',Qry_Print.FieldByName('zy').AsString)>0) and ((LineCount mod 20)<>0) then
begin
ZY_temp:=Qry_Print.FieldByName('zy').AsString;
RI:=20-LineCount;
end;
Qry_Print.Next;
end;
//
if (Ri=0) and (not Eof_Flag) then
begin
if (LineCount=20) and (QRRichText6.Lines.Text ='') then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text :='';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRRichText7.Lines.Text := '';
end
else
with Qry_Print do
begin
QRRichText1.Lines.Text:= FieldByName('fsrq').AsString;
QRRichText2.Lines.Text:= FieldByName('zi').AsString;
QRRichText3.Lines.Text:= FieldByName('crkdh').AsString;
QRRichText4.Lines.Text:= FieldByName('zy').AsString;
QRRichText5.Lines.Text:= FormatFloat('#,##0.00',FieldByName('yjzjje').AsFloat);
QRRichText6.Lines.Text:= FormatFloat('#,##0.00',FieldByName('yjtjje').AsFloat+FieldByName('yjzxje').AsFloat);
QRRichText7.Lines.Text:= FormatFloat('#,##0.00',FieldByName('yjye').AsFloat);
MoreData:=not Qry_Print.Eof;
Qry_Print.Next;
end;
end;
if Ri>0 then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text :='';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRRichText7.Lines.Text := '';
Dec(RI);
end;
if MoreData and Eof_Flag then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text :='';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRRichText7.Lines.Text := '';
if LineCount=20 then
MoreData:=False
else MoreData:=True;
end;
if LineCount = 20 then
LineCount:=0;
end;
procedure TfrmY_ZFHZCX.QRe_jypfhzStartPage(Sender: TCustomQuickRep);
var
i:integer;
begin
for I:= 0 to PageHeaderBand1.ControlCount -1 do //设置页头的套打
begin
if PageHeaderBand1.Controls[I] is TQRLabel then
begin
if Tao_Print_Flag then
begin
TQRLabel(PageHeaderBand1.Controls[I]).Enabled := False;
if (PageHeaderBand1.Controls[I].Name = 'QRLabel38') then
TQRLabel(PageHeaderBand1.Controls[I]).Enabled := True;
end
else TQRLabel(PageHeaderBand1.Controls[I]).Enabled:= True;
end;
if PageHeaderBand1.Controls[I] is TQRShape then
if Tao_Print_Flag then TQRShape(PageHeaderBand1.Controls[i]).Enabled:=False
else TQRShape(PageHeaderBand1.Controls[i]).Enabled:=True;
end;
for I := 0 to ColumnHeaderBand1.ControlCount - 1 do //设置表头的套打
begin
if ColumnHeaderBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(ColumnHeaderBand1.Controls[I]).Enabled:= False
else TQRShape(ColumnHeaderBand1.Controls[I]).Enabled := True;
end;
if ColumnHeaderBand1.Controls[I] is TQRLabel then
begin
if Tao_Print_Flag then
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled :=False
else TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled:= True;
end;
if QRe_jypfhz.QRPrinter.PageNumber=1 then
QRLabel1.Enabled:=False
else QRLabel1.Enabled:=True;
end;
for I := 0 to DetailBand1.ControlCount - 1 do //设置表内容的套打
begin
if DetailBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(DetailBand1.Controls[I]).Enabled := False
else TQRShape(DetailBand1.Controls[I]).Enabled := True;
end;
end;
for i:=0 to PageFooterBand1.ControlCount-1 do //设置页尾的套打
begin
if PageFooterBand1.Controls[I] is TQRLabel then
begin
if QRe_jypfhz.QRPrinter.PageNumber =TotalPageCount then
TQRLabel(PageFooterBand1.Controls[I]).Enabled := False
else TQRLabel(PageFooterBand1.Controls[I]).Enabled:=True;
end;
if PageFooterBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(PageFooterBand1.Controls[I]).enabled:=False
else
TQRShape(PageFooterBand1.Controls[I]).Enabled:= True;
end;
end;
end;
procedure TfrmY_ZFHZCX.QRe_jypfhzBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
Qry_Print.First;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -