⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sy_ck_lmp_print.pas

📁 省级集邮品管理ERP
💻 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 + -