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

📄 sj_fhddy0.pas

📁 省级集邮品管理ERP
💻 PAS
字号:

{*******************************************************}
{                                                       }
{                     发货通知单打印                    }
{                                                       }
{            中软金马公司版权所有。2002.12前            }
{                                                       }
{               编制:中软金马项目开发组                }
{                                                       }
{                                                       }
{*******************************************************}
(*
本模块在省级集邮票管理、省级市场购入票管理、省级集邮品管理、省级零枚票管理、
地市集邮票管理、地市集邮品管理、地市市场购入票管理  七个模块调用
修改记录:
1。将发货单单调整为常用打印纸大小——大小纸打印行数 by jhshao 2003.05.07
*)
unit SJ_FHDDY0;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls, Dialogs, Db, DBTables;
const
  QR_DetailLines_XZ = 6;
  QR_DetailLines_DZ = 24;//26

type
  TFrmK_JYFHDDY0 = class(TQuickRep)
    PageHeaderBand1: TQRBand;
    PageFooterBand1: TQRBand;
    ColumnHeaderBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRLabel22: TQRLabel;
    QRLabel24: TQRLabel;
    QRShape3: TQRShape;
    QRShape4: TQRShape;
    QRShape6: TQRShape;
    QRShape7: TQRShape;
    QRShape8: TQRShape;
    QRLabel25: TQRLabel;
    QRLabel4: TQRLabel;
    DetailBand1: TQRBand;
    QRShape9: TQRShape;
    QRShape10: TQRShape;
    QRShape11: TQRShape;
    QRShape12: TQRShape;
    QRShape13: TQRShape;
    QRRichText2: TQRRichText;
    QRRichText3: TQRRichText;
    QRRichText4: TQRRichText;
    QRRichText5: TQRRichText;
    QRRichText6: TQRRichText;
    QRRichText7: TQRRichText;
    Qry_ckdayin: TQuery;
    Qry_bz: TQuery;
    QRLabel11: TQRLabel;
    QRShape2: TQRShape;
    QRShape5: TQRShape;
    QRShape14: TQRShape;
    QRShape15: TQRShape;
    QRShape16: TQRShape;
    QRShape17: TQRShape;
    QRLabel23: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel7: TQRLabel;
    QRRichText8: TQRRichText;
    QRRichText9: TQRRichText;
    QRRichText10: TQRRichText;
    QRShape27: TQRShape;
    QRShape28: TQRShape;
    QRLabel12: TQRLabel;
    QRSysData1: TQRSysData;
    QRShape1: TQRShape;
    QRShape29: TQRShape;
    QRShape33: TQRShape;
    QRShape34: TQRShape;
    QRLabel13: TQRLabel;
    QRShape18: TQRShape;
    QRShape24: TQRShape;
    QRShape19: TQRShape;
    QRShape25: TQRShape;
    QRShape20: TQRShape;
    QRRichText1: TQRRichText;
    QRShape21: TQRShape;
    QRShape26: TQRShape;
    QRShape22: TQRShape;
    QRRichText11: TQRRichText;
    QRShape23: TQRShape;
    QRShape32: TQRShape;
    QRLabel14: TQRLabel;
    QRLabel27: TQRLabel;
    QRLabel26: TQRLabel;
    QRLabel15: TQRLabel;
    QRShape35: TQRShape;
    QRShape36: TQRShape;
    QRShape37: TQRShape;
    QRShape38: TQRShape;
    QRLabel2: TQRLabel;
    QRShape39: TQRShape;
    QRShape40: TQRShape;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRShape30: TQRShape;
    QRShape31: TQRShape;
    QRShape41: TQRShape;
    QRShape42: TQRShape;
    QRShape43: TQRShape;
    QRShape44: TQRShape;
    QRShape45: TQRShape;
    QRShape46: TQRShape;
    QRShape47: TQRShape;
    QRShape48: TQRShape;
    procedure QuickRepNeedData(Sender: TObject; var MoreData: Boolean);
    procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    procedure QuickRepStartPage(Sender: TCustomQuickRep);
  private

  public
    nheight: integer;
    sumzj: double;
    sumjsj: double;
    TotalPageCount: Integer;
    Tao_Print_Flag: Boolean;
    DetailLines: Integer;
    DataCount: Integer;
    SmallFlag: Boolean;
  end;

var
  FrmK_JYFHDDY0: TFrmK_JYFHDDY0;


implementation
uses SJ_RichEdit;

{$R *.DFM}


procedure TFrmK_JYFHDDY0.QuickRepNeedData(Sender: TObject;
  var MoreData: Boolean);
var
  vlp_i_max, i, j: integer;
  zjje, jsje: double;
begin
  if SmallFlag then
  begin
    if DetailLines = QR_DetailLines_XZ then
      DetailLines := 1;
    if DetailLines <= QR_DetailLines_XZ - 1 then
    begin
      Inc(DetailLines);
      MoreData := True;
    end;
  end
  else
  begin
    if DetailLines = QR_DetailLines_DZ then
      DetailLines := 1;
    if DetailLines <= QR_DetailLines_DZ - 1 then
    begin
      Inc(DetailLines);
      MoreData := True;
    end;
  end;

  if not Qry_ckdayin.Eof then
  begin
    Frm_RichEdit.RichEdit1.Width := QRRichText3.Width;
    Frm_richEdit.RichEdit1.Lines.Clear;
    Frm_richEdit.RichEdit1.Lines.Text := Qry_ckdayin.FieldByName('tmc').AsString;
    QRRichText3.Lines.Text := Frm_richEdit.RichEdit1.Lines.Text;
    if QRRichText3.Lines.Count > 1 then
    begin
      QRRichText3.Font.Size := 9;
      if QRRichText3.Lines.Count > 1 then
        QRRichText3.Top := -2
      else
        QRRichText3.Top := 1;
    end
    else
    begin
      QRRichText3.Font.Size := 11;
      QRRichText3.Top := 1;
    end;

    Frm_RichEdit.RichEdit1.Width := QRRichText2.Width;
    Frm_richEdit.RichEdit1.Lines.Clear;
    Frm_richEdit.RichEdit1.Lines.Text := Qry_ckdayin.FieldByName('zh').AsString;
//    Frm_richEdit.RichEdit1.Width :=
    QRRichText2.Lines.Text := Frm_richEdit.RichEdit1.Lines.Text;
//    if QRRichText2.Lines.Count > 1 then
    if length(QRRichText2.Lines[0]) > 24 then
    begin
      QRRichText2.Font.Size := 9;
      if QRRichText2.Lines.Count > 1 then
        QRRichText2.Top := 1
      else
        QRRichText2.Top := -2;
    end
    else
    begin
      QRRichText2.Font.Size := 11;
      QRRichText2.Top := 1;
    end;

    QRRichText4.Lines.Text := Qry_ckdayin.fieldbyname('dw').asstring;
    QRRichText5.Lines.Text := FormatFloat('#,##', Qry_ckdayin.fieldbyname('sl').asFloat);
    QRRichText6.Lines.Text := FormatFloat('#,##0.00', Qry_ckdayin.fieldbyname('xj').asFloat);
    QRRichText7.Lines.Text := FormatFloat('#,##0.00', Qry_ckdayin.fieldbyname('zjje').asFloat);
    zjje := Qry_ckdayin.fieldbyname('zjje').asfloat;
    QRRichText8.Lines.Text := Qry_ckdayin.fieldbyname('zk').asstring;
    QRRichText9.Lines.Text := FormatFloat('#,##0.00', Qry_ckdayin.fieldbyname('jsje').asFloat);
    QRRichText10.Lines.Text := '';
    if Qry_ckdayin.fieldbyname('fxrq').asstring <> '' then
      QRRichText10.Lines.Text := FormatDateTime('yyyy"/"mm"/"dd', StrToDateTime(Qry_ckdayin.fieldbyname('fxrq').asstring));
    jsje := Qry_ckdayin.fieldbyname('jsje').asfloat;
    sumzj := sumzj + zjje;
    QRRichText1.Lines.Text := FormatFloat('#,##0.00', sumzj);
    sumjsj := sumjsj + jsje;
    QRRichText11.Lines.Text := FormatFloat('#,##0.00', sumjsj);
    DetailBand1.Height := 30;
  end;

  if MoreData and (Qry_ckdayin.Eof) then
  begin
    QRRichText3.Lines.Text := '';
    QRRichText4.Lines.Text := '';
    QRRichText5.Lines.Text := '';
    QRRichText6.Lines.Text := '';
    QRRichText7.Lines.Text := '';
    QRRichText9.Lines.Text := '';
    QRRichText8.Lines.Text := '';
    QRRichText10.Lines.Text := '';
    QRRichText2.Lines.text := '';
    if SmallFlag then
    begin
      if DetailLines = QR_DetailLines_XZ then
        MoreData := False;
    end
    else
    begin
      if DetailLines = QR_DetailLines_DZ then
        MoreData := False;
    end;
  end;

  if (not Qry_ckdayin.Eof) then
  begin
    MoreData := not Qry_ckdayin.eof;
    Qry_ckdayin.Next;
  end;
end;

procedure TFrmK_JYFHDDY0.QuickRepBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
  sumzj := 0;
  sumjsj := 0;
  DetailLines := 0;
  Qry_ckdayin.First;
end;

procedure TFrmK_JYFHDDY0.QuickRepStartPage(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 = 'QRLabel25') or
          (PageHeaderBand1.Controls[I].Name = 'QRLabel11') or
          (PageHeaderBand1.Controls[I].Name = 'QRLabel8') or
          (PageHeaderBand1.Controls[I].Name = 'QRLabel1') 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;
  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 Tao_Print_Flag then
      begin
        TQRLabel(PageFooterBand1.Controls[I]).Enabled := False;
        if (PageFooterBand1.Controls[I].Name = 'QRLabel29') then
          TQRLabel(PageFooterBand1.Controls[I]).Enabled := True;
      end
      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;

    if PageFooterBand1.Controls[i] is TQRRichText then
    begin
      if Printer.PageNumber = TotalPageCount then
        TQRRichText(PageFooterBand1.Controls[I]).Enabled := True
      else
        TQRRichText(PageFooterBand1.Controls[I]).Enabled := False;
    end;
  end;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -