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

📄 sj_tjddy.pas

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

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

unit SJ_TJDDY;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls, Dialogs, Db, DBTables,
  SqlStrings;


const TJPPSL_D = 25;
TJPPSL_X = 6;
type
  TFrm_TJDDY = class(TQuickRep)
    PageFooterBand1: TQRBand;
    Sqls_tjd: TSqlStrings;
    Qry_tjd: TQuery;
    QRLabel9: TQRLabel;
    QRShape14: TQRShape;
    QRRichText8: TQRRichText;
    QRRichText5: TQRRichText;
    QRRichText1: TQRRichText;
    QRShape15: TQRShape;
    QRShape18: TQRShape;
    QRShape19: TQRShape;
    QRShape20: TQRShape;
    QRLabel14: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel26: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRLabel24: TQRLabel;
    QRShape3: TQRShape;
    QRShape4: TQRShape;
    QRShape7: TQRShape;
    QRShape8: TQRShape;
    QRShape2: TQRShape;
    QRShape16: TQRShape;
    QRLabel23: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel7: TQRLabel;
    QRShape27: TQRShape;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel18: TQRLabel;
    QRLabel22: TQRLabel;
    DetailBand1: TQRBand;
    QRRichText2: TQRRichText;
    QRShape28: TQRShape;
    QRRichText11: TQRRichText;
    QRShape9: TQRShape;
    QRRichText3: TQRRichText;
    QRRichText4: TQRRichText;
    QRRichText6: TQRRichText;
    QRShape13: TQRShape;
    QRRichText7: TQRRichText;
    QRShape17: TQRShape;
    QRRichText9: TQRRichText;
    QRShape23: TQRShape;
    QRRichText10: TQRRichText;
    QRShape1: TQRShape;
    QRShape6: TQRShape;
    QRShape10: TQRShape;
    QRShape11: TQRShape;
    QRShape22: TQRShape;
    QRLabel11: TQRLabel;
    QRLabel27: TQRLabel;
    QRSysData1: TQRSysData;
    QRLabel28: TQRLabel;
    PageHeaderBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel25: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel2: TQRLabel;
    QRShape5: TQRShape;
    QRShape24: TQRShape;
    QRShape30: TQRShape;
    QRShape25: TQRShape;
    QRShape26: TQRShape;
    QRShape29: TQRShape;
    QRShape21: TQRShape;
    QRShape31: TQRShape;
    QRShape12: TQRShape;
    procedure QuickRepNeedData(Sender: TObject; var MoreData: Boolean);
    procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    procedure QuickRepStartPage(Sender: TCustomQuickRep);
  private
    Lio_Typ: TIO_TYPE;
  public
    DetailLines: integer;
    sum_yje, sum_xje, sum_ce: double;
    Tao_Print_Flag: Boolean;
    SmallFlag: Boolean;
  end;

procedure DoPntTJD(const io_typ: TIO_TYPE; const aTJDH, aZBR, aTJRQ: string; const APPSL: Integer);
var
  Frm_TJDDY: TFrm_TJDDY;


implementation

uses pub, SJ_RICHEDIT;

{$R *.DFM}

procedure DoPntTJD(const io_typ: TIO_TYPE; const aTJDH, aZBR, aTJRQ: string; const APPSL: Integer);
begin
 // Frm_TJDDY := TFrm_TJDDY.Create(Application);
  Application.CreateForm(TFrm_TJDDY, Frm_TJDDY);
  Application.CreateForm(TFrm_RichEdit, Frm_richedit);
  with Frm_TJDDY, Frm_RichEdit do
  try
    Lio_Typ := io_typ;
    QRLabel1.Caption := pCaption[integer(io_Typ)] + ' 调 价 单';
    QRLabel1.Left := round((ColumnHeaderBand1.Width - QRLabel1.Width) / 2);
    QRLabel5.Caption := aTJDH;
    QRLabel25.Caption := VG_UnitName;
    SmallFlag := APPSL <= TJPPSL_X;
    if SmallFlag then
    begin
//      Page.Length := 149;
      Page.LeftMargin := 28;
      Page.TopMargin := 19;
      Page.RightMargin := 28;
      Page.Length := 139.7;
      Page.Width := 241.3;
      Page.BottomMargin := 11;
    end
    else
    begin
//      Page.Length := 297;
      Page.LeftMargin := 28;
      Page.TopMargin := 19;
      Page.RightMargin := 28;
      Page.Length := 279.3;
      Page.Width := 241.3;
      Page.BottomMargin := 10;
    end;

    Page.BottomMargin := 10;
    AssignSqlstr(Qry_tjd, format(Sqls_tjd.FSqlText[io_typ].Text, [aTJDH]));
    Qry_tjd.open;
    QRLabel2.Caption := FormatDateTime('yyyy"年"mm"月"d"日" ', StrToDateTime(aTJRQ));
    sum_yje := 0;
    sum_xje := 0;
    sum_ce := 0;
    DetailLines := 0;
    if CHQMsgBox('是否采用套打?', 2) = IDYES then
      Tao_Print_Flag := True
    else
      Tao_Print_Flag := False;
    //
    Prepare;
    try
      QRLabel28.Caption := IntToStr(QRPrinter.PageCount);
    finally
      QRPrinter.Free;
    end;
    QRPrinter := nil;

    Preview;
  finally
    Frm_TJDDY.Destroy;
    Frm_RichEdit.Destroy;
  end;

end;

procedure TFrm_TJDDY.QuickRepNeedData(Sender: TObject;
  var MoreData: Boolean);
var
  i: integer;
  yje, xje, ce: double;
begin
  if SmallFlag then
  begin
    if DetailLines = TJPPSL_X then
      DetailLines := 1;

    if DetailLines <= TJPPSL_X -1 then
    begin
      Inc(DetailLines);
      MoreData := True;
    end;
  end
  else
  begin
    if DetailLines = TJPPSL_D then
      DetailLines := 1;

    if DetailLines <= TJPPSL_D-1 then
    begin
      Inc(DetailLines);
      MoreData := True;
    end;
  end;

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

    Frm_RichEdit.RichEdit1.Width := QRRichText2.Width;
    Frm_richEdit.RichEdit1.Lines.Clear;
    Frm_richEdit.RichEdit1.Lines.Text := Qry_tjd.FieldByName('zh').AsString;
    QRRichText2.Lines.Text := Frm_richEdit.RichEdit1.Lines.Text;
    if QRRichText2.Lines.Count > 1 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;

    QRRichText3.Lines.Text := FormatFloat('#,##', Qry_tjd.fieldbyname('sl').asFloat);
    QRRichText4.Lines.Text := FormatFloat('#,##0.00', Qry_tjd.fieldbyname('ydj').asFloat);
    QRRichText6.Lines.Text := FormatFloat('#,##0.00', Qry_tjd.fieldbyname('yje').asFloat);
    QRRichText7.Lines.Text := FormatFloat('#,##0.00', Qry_tjd.fieldbyname('xdj').asFloat);
    QRRichText9.Lines.Text := FormatFloat('#,##0.00', Qry_tjd.fieldbyname('xje').asFloat);
    QRRichText10.Lines.Text := FormatFloat('#,##0.00', Qry_tjd.fieldbyname('ce').asFloat);

    yje := Qry_tjd.fieldbyname('yje').asfloat;
    xje := Qry_tjd.fieldbyname('xje').asfloat;
    ce := Qry_tjd.fieldbyname('ce').asfloat;
    sum_yje := sum_yje + yje;
    sum_xje := sum_xje + xje;
    sum_ce := sum_ce + ce;

    QRRichText8.Lines.Text := FormatFloat('#,##0.00', sum_yje);
    QRRichText5.Lines.Text := FormatFloat('#,##0.00', sum_xje);
    QRRichText1.Lines.Text := FormatFloat('#,##0.00', sum_ce);

    DetailBand1.Height := 28;
    for I := 0 to DetailBand1.ControlCount - 1 do
    begin
      if DetailBand1.Controls[I] is TQRShape then
      begin
        if DetailBand1.Controls[I].Name = 'QRShape21' then
          TQRShape(DetailBand1.Controls[I]).Height := 1
        else
          TQRShape(DetailBand1.Controls[I]).Height := DetailBand1.Height;
        if Tao_Print_Flag then
          TQRShape(DetailBand1.Controls[I]).Enabled := False
        else
          TQRShape(DetailBand1.Controls[I]).Enabled := True;
      end;
      if DetailBand1.Controls[I] is TQRRichText then
        TQRRichText(DetailBand1.Controls[I]).Height := DetailBand1.Height;
    end;
  end;

  if MoreData and (Qry_tjd.eof) then
  begin
    QRRichText3.Lines.Text := '';
    QRRichText4.Lines.Text := '';
    QRRichText6.Lines.Text := '';
    QRRichText7.Lines.Text := '';
    QRRichText9.Lines.Text := '';
    QRRichText10.Lines.Text := '';
    QRRichText2.Lines.text := '';
    QRRichText11.Lines.text := '';
    if SmallFlag then
    begin
      if DetailLines = TJPPSL_X then
        MoreData := False;
    end
    else
    begin
      if DetailLines = TJPPSL_D then
        MoreData := False;
    end;
  end;

  if not Qry_tjd.eof then
  begin
    MoreData := not Qry_tjd.eof;
    Qry_tjd.next;
  end;
end;

procedure TFrm_TJDDY.QuickRepBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
  sum_yje := 0;
  sum_xje := 0;
  sum_ce := 0;
  Qry_tjd.First;
  DetailLines := 0;
//  QRLabel28.Caption:=IntToStr(Frm_TJDDY.Printer.PageCount);
end;

procedure TFrm_TJDDY.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 = 'QRLabel5') or
          (PageHeaderBand1.Controls[I].Name = 'QRLabel2') 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 ColumnHeaderBand1.Controls[I].Name = 'QRShape31' then
        TQRShape(ColumnHeaderBand1.Controls[I]).Height := 4
      else
        TQRShape(ColumnHeaderBand1.Controls[I]).Height := ColumnHeaderBand1.Height;
      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 PageFooterBand1.ControlCount - 1 do
  begin
    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 TQRLabel then
    begin
      if Tao_Print_Flag then
      begin
        TQRLabel(PageFooterBand1.Controls[I]).Enabled := False;
        if (PageFooterBand1.Controls[I].Name = 'QRLabel28') then
          TQRLabel(PageFooterBand1.Controls[I]).Enabled := True;
      end
      else
        TQRLabel(PageFooterBand1.Controls[I]).Enabled := True;
    end;

    if PageFooterBand1.Controls[i] is TQRRichText then
    begin
      if IntToStr(Printer.PageNumber) = QRLabel28.Caption 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 + -