?? sy_ck_lmp_print.pas
字號:
{*******************************************************}
{ }
{ 零枚出庫計劃單——打印模塊 }
{ }
{ 中軟金馬公司版權所有。2002.06 }
{ }
{ 編制: }
{ }
{ }
{*******************************************************}
(*==============================================================================
程序說明:
1. 數據來源:零枚票出庫計劃單表TYS_TXPCKJHDB
零枚票出庫計劃單票品表TYS_TXCKJHDPPB
2. band Height : 80、 57、25、25
3. 本模塊在省級零枚票管理模塊 計劃管理部分 由單品種多去向出庫計劃單制定菜單調用的 零枚出庫計劃單制定模塊 調用
修改記錄
修改,銷價結算價結算金額顯示小數點后3位 原來的#,##0.00替換為#,##0.000 jhshao 2003.05.09
===============================================================================*)
unit SY_CK_LMP_Print;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, QuickRpt, Qrctrls, Db, DBTables;
type
TFrm_SY_CK_LMP_Print = class(TForm)
qr_Print: TQuickRep;
PageHeaderBand1: TQRBand;
QRLabel1: TQRLabel;
qrl_CkDH: TQRLabel;
qrl_ZDRQ: TQRLabel;
QRShape2: TQRShape;
ColumnHeaderBand1: TQRBand;
QRLabel5: TQRLabel;
qrl_ZH: TQRLabel;
QRLabel7: TQRLabel;
qrl_PPMC: TQRLabel;
QRLabel9: TQRLabel;
qrl_MZ: TQRLabel;
QRLabel11: TQRLabel;
qrl_SJ: TQRLabel;
QRShape1: TQRShape;
QRLabel15: TQRLabel;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
QRLabel18: TQRLabel;
QRLabel19: TQRLabel;
QRLabel20: TQRLabel;
QRShape3: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape21: TQRShape;
QRShape24: TQRShape;
DetailBand1: TQRBand;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRShape18: TQRShape;
QRShape19: TQRShape;
QRShape20: TQRShape;
QRShape22: TQRShape;
QRShape23: TQRShape;
PageFooterBand1: TQRBand;
qrl_ZBR: TQRLabel;
qrl_PZR: TQRLabel;
qrl_PageNo: TQRLabel;
QRShape25: TQRShape;
QRShape26: TQRShape;
QRShape27: TQRShape;
QRShape28: TQRShape;
QRShape29: TQRShape;
QRShape30: TQRShape;
QRShape31: TQRShape;
QRShape32: TQRShape;
qry_Print: TQuery;
qrl_DWMC: TQRLabel;
qrl_FPSL: TQRLabel;
qrl_ZK: TQRLabel;
qrl_JSJ: TQRLabel;
qrl_JE: TQRLabel;
qrl_Xh: TQRLabel;
procedure qr_PrintNeedData(Sender: TObject; var MoreData: Boolean);
procedure qr_PrintBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
procedure qr_PrintStartPage(Sender: TCustomQuickRep);
procedure PageFooterBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure SetParams(A_CKJHDH: String; A_ModalPrint: Boolean;
A_PageCount: Integer = 1); {從主模塊傳入的行總數,是否套打,報表頁數}
{ Public declarations }
end;
var
Frm_SY_CK_LMP_Print: TFrm_SY_CK_LMP_Print;
implementation
{$R *.DFM}
var
VL_CKJHDH: String;
VL_DetailNo: Integer; {記錄序號} {}
VL_CurrentRow: Integer; {當前頁的當前行}
VL_ModalPrint: Boolean; {是否套打}
VL_PageCount: Integer;
VL_PrintState: Integer; {打印狀態,0-prepare , 1 previewmodal, 2 -print }
{TFrm_SY_CK_LMP_Print}
{-------------------------------------------------------------------------------}
{從主模塊傳入的計劃單號,是否套打,報表頁數}
procedure TFrm_SY_CK_LMP_Print.SetParams(A_CKJHDH: String;
A_ModalPrint: Boolean; A_PageCount: Integer = 1);
begin
VL_CurrentRow := 30;
VL_CKJHDH := A_CKJHDH;
VL_ModalPrint := A_ModalPrint;
VL_PageCount := A_PageCount;
end;
{-------------------------------------------------------------------------------}
{初始化}
procedure TFrm_SY_CK_LMP_Print.FormCreate(Sender: TObject);
begin
VL_PrintState := -1;
end;
{-------------------------------------------------------------------------------}
{打印初始化}
procedure TFrm_SY_CK_LMP_Print.qr_PrintBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
VL_DetailNo := 0;
VL_CurrentRow := 0;
Inc(VL_PrintState);
{零枚票出庫計劃單表TYS_TXPCKJHDB、零枚票出庫計劃單票品表TYS_TXCKJHDPPB}
with qry_Print do
begin
Close;
SQL.Text := 'select a.CKJHDH, a.ZBR, a.PZR, a.ZDRQ, c.ZH, b.PPMC, c.TPMZ/100 MZ , b.XJ/100 XJ, ' +
' b.ZK, b.JSJ/100 JSJ , b.FPSL, d.DWJC DWMC, decode(b.JSJ,null, ( b.ZK/100) * b.XJ* b.FPSL , 0, ( b.ZK/100) * b.XJ* b.FPSL ,b.JSJ* b.FPSL)/100 JE ' +
' from TYS_TXPCKJHDB a, TYS_TXCKJHDPPB b, TB_YZPPXXB c,TGS_GXDWSJB D ' +
' where a.CKJHDH = b.CKJHDH and b.PPDM = c.TDM and b.DWDM = d.DWDM ' +
' and a.CKJHDH =' + QuotedStr(VL_CKJHDH) + ' order by d.PXM ';
Open;
qrl_ZH.Caption := FieldByName('ZH').AsString;
qrl_PPMC.Caption := FieldByName('PPMC').AsString;
qrl_MZ.Caption := FormatFloat('¥#,##0.00', Qry_Print.fieldbyname('MZ').AsFloat);
{修改,銷價顯示小數點后3位 原來的#,##0.00替換為#,##0.000 jhshao 2003.05.09}
qrl_SJ.Caption := FormatFloat('¥#,##0.000', Qry_Print.fieldbyname('XJ').AsFloat);
if VL_ModalPrint and (VL_PrintState = 2) then {套打}
begin
qrl_CkDH.Caption := ' ' + FieldByName('CKJHDH').AsString;
qrl_ZDRQ.Caption := ' ' + FormatDateTime('yyyy"年"mm"年"dd"日"', FieldByName('ZDRQ').AsDateTime);
qrl_ZBR.Caption := ' ' + FieldByName('ZBR').AsString;
qrl_PZR.Caption := ' ' + FieldByName('PZR').AsString;
{預覽時顯示所有內容,打印時按照是否套打的要求打印}
qr_Print.OnStartPage := qr_PrintStartPage;
end
else
begin
qrl_CkDH.Caption := '分配單號:' + FieldByName('CKJHDH').AsString;
qrl_ZDRQ.Caption := '制單日期:' + FormatDateTime('yyyy"年"mm"年"dd"日"', FieldByName('ZDRQ').AsDateTime);
qrl_ZBR.Caption := '制表人:' + FieldByName('ZBR').AsString;
qrl_PZR.Caption := '負責人:' + FieldByName('PZR').AsString;
{預覽時顯示所有內容,打印時按照是否套打的要求打印}
qr_Print.OnStartPage := nil;
end;
end;
end;
{-------------------------------------------------------------------------------}
{打印出庫計劃明細}
procedure TFrm_SY_CK_LMP_Print.qr_PrintNeedData(Sender: TObject;
var MoreData: Boolean);
begin
Inc(VL_DetailNo);
if VL_CurrentRow <= 33 then
begin
Inc(VL_CurrentRow);
MoreData := True;
end;
if not Qry_Print.Eof then
begin
qrl_XH.Caption := IntToStr(VL_DetailNo);
qrL_DWMC.Caption := qry_Print.fieldbyname('DWMC').AsString;
qrl_FPSL.Caption := FormatFloat('#,##', Qry_Print.fieldbyname('FPSL').AsFloat);
qrl_ZK.Caption := Qry_Print.FieldByName('ZK').AsString;
{修改,結算價結算金額顯示小數點后3位 原來的#,##0.00替換為#,##0.000 jhshao 2003.05.08}
if Qry_Print.FieldByName('JSJ').AsInteger <> 0 then
qrl_JSJ.Caption := FormatFloat('¥#,##0.000', Qry_Print.FieldByName('JSJ').AsFloat)
else
qrl_JSJ.Caption := '';
qrl_JE.Caption := FormatFloat('¥#,##0.000', Qry_Print.fieldbyname('JE').AsFloat);
end;
if MoreData and (Qry_Print.Eof) then
begin
qrl_XH.Caption := '';
qrL_DWMC.Caption := '';
qrl_FPSL.Caption := '';
qrl_ZK.Caption := '';
qrl_JSJ.Caption := '';
qrl_JE.Caption := '';
if VL_CurrentRow = 34 then
MoreData := False;
end;
if (not Qry_Print.Eof) then
begin
MoreData := not Qry_Print.eof;
Qry_Print.Next;
end;
if VL_CurrentRow = 34 then
VL_CurrentRow := 0;
end;
{-------------------------------------------------------------------------------}
{設置頁眉、頁腳的套打方式}
procedure TFrm_SY_CK_LMP_Print.qr_PrintStartPage(Sender: TCustomQuickRep);
var
I: Integer;
begin
for I := 0 to PageHeaderBand1.ControlCount - 1 do //設置頁頭的套打
begin
if PageHeaderBand1.Controls[I] is TQRShape then
if VL_ModalPrint 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 VL_ModalPrint then
TQRShape(ColumnHeaderBand1.Controls[I]).Enabled := False
else
TQRShape(ColumnHeaderBand1.Controls[I]).Enabled := True;
end;
if ColumnHeaderBand1.Controls[I] is TQRLabel then
begin
if VL_ModalPrint then
begin
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled := False;
if (ColumnHeaderBand1.Controls[I].Name = 'qrl_ZH') or
(ColumnHeaderBand1.Controls[I].Name = 'qrl_PPMC') or
(ColumnHeaderBand1.Controls[I].Name = 'qrl_SJ') or
(ColumnHeaderBand1.Controls[I].Name = 'qrl_MZ') then
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled := True;
end
else
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled := True;
end;
end;
for I := 0 to DetailBand1.ControlCount - 1 do //設置表內容的套打
begin
if DetailBand1.Controls[I] is TQRShape then
begin
if VL_ModalPrint 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 TQRShape then
if VL_ModalPrint then
TQRShape(PageFooterBand1.Controls[i]).Enabled := False
else
TQRShape(PageFooterBand1.Controls[i]).Enabled := True;
end;
end;
{-------------------------------------------------------------------------------}
{打印頁碼}
procedure TFrm_SY_CK_LMP_Print.PageFooterBand1BeforePrint(
Sender: TQRCustomBand; var PrintBand: Boolean);
begin
if VL_ModalPrint and (VL_PrintState = 2) then {套打}
qrl_PageNo.Caption := ' ' + IntToStr(VL_PageCount) + ' ' +
IntToStr(qr_Print.QRPrinter.PageNumber) + ' '
else
qrl_PageNo.Caption := '共 ' + IntToStr(VL_PageCount) + ' 頁 第 ' +
IntToStr(qr_Print.QRPrinter.PageNumber) + ' 頁';
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -