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

📄 sfc_mnout_notsave_p.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:

unit Sfc_MnOut_NotSave_P;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Common, ExtCtrls, QuickRpt, Db, AdODB, Grids, DBGrids, StdCtrls,
  Mask, DBCtrls, QrCtrls,printers;

Type
  TFrm_Sfc_MnOut_NotSave_P= Class(TFrm_Base_Common)
    AdoQry_Head: TAdoQuery;
    AdoQry_Line: TAdoQuery;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    QuickRep1: TQuickRep;
    DetailBand1: TQRBand;
    Label3: TLabel;
    QRDBText10: TQRDBText;
    QRDBText12: TQRDBText;
    QRDBText15: TQRDBText;
    QRShApe6: TQRShApe;
    QRShApe8: TQRShApe;
    QRShApe11: TQRShApe;
    QRShApe12: TQRShApe;
    QRDBText2: TQRDBText;
    QRDBText1: TQRDBText;
    QRShApe5: TQRShApe;
    QRShApe7: TQRShApe;
    QRExpr4: TQRExpr;
    QRExpr1: TQRExpr;
    ColumnHeaderBand1: TQRBand;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel18: TQRLabel;
    QRLabel17: TQRLabel;
    QRShApe16: TQRShApe;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel7: TQRLabel;
    QLWHCode: TQRLabel;
    QLWhPositionCode: TQRLabel;
    QLDeptCode: TQRLabel;
    QRLabel23: TQRLabel;
    QLMONo: TQRLabel;
    QLInvBillNo: TQRLabel;
    QLInvBillDate: TQRLabel;
    QRLabel10: TQRLabel;
    QLBillCtrlCode: TQRLabel;
    QLSysParamValueC: TQRLabel;
    QRLabel1: TQRLabel;
    QLMoLineNo: TQRLabel;
    QRLabel5: TQRLabel;
    QLshifttime: TQRLabel;
    QRLabel6: TQRLabel;
    qlWhEmployee: TQRLabel;
    QRLabel9: TQRLabel;
    qlItemCodeName: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    qlmoqty: TQRLabel;
    QRLabel22: TQRLabel;
    qlmemo: TQRLabel;
    PageFooterBand1: TQRBand;
    QRShApe1: TQRShApe;
    QRLabel15: TQRLabel;
    QLWH_EmployeeCodea: TQRLabel;
    QRLabel24: TQRLabel;
    QRLabel25: TQRLabel;
    QLEmployeeCodeA: TQRLabel;
    QRSysData2: TQRSysData;
    QLPageTot1: TQRLabel;
    QRExpr3: TQRExpr;
    QRExpr2: TQRExpr;
    SummAryBand1: TQRBand;
    QRLabel19: TQRLabel;
    QLWH_EmployeeCode: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QLEmployeeCode: TQRLabel;
    QRSysData1: TQRSysData;
    QLPageTot: TQRLabel;
    QRShApe2: TQRShApe;
    QRShApe3: TQRShApe;
    QRShApe4: TQRShApe;
    QRShApe9: TQRShApe;
    QRShApe10: TQRShApe;
    QRShApe13: TQRShApe;
    QRShApe14: TQRShApe;
    QRShApe15: TQRShApe;
   
    procedure QRDBText15Print(sender: TObject; var Value: String);
    procedure QRDBText2Print(sender: TObject; var Value: String);
    procedure QRExpr4Print(sender: TObject; var Value: String);
    procedure QRExpr1Print(sender: TObject; var Value: String);
    procedure DetailBand1AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
  private
    { Private declarations }
    FWHCode,FBillNo:string;
    FBillTypeCode:string;
    FHtot:Double;
    FHNoTaxtot:Double;
    FH:Double;
    FPreview:Boolean;
    FModuleCode:string;
  public
    { Public declarations }
    procedure SetDBConnect(AdOConnection:TAdOConnection); Override;
    procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,
     FrmParam6:String);Override;
  end;

var
  Frm_Sfc_MnOut_NotSave_P: TFrm_Sfc_MnOut_NotSave_P;

implementation

uses Sys_Global, Sfc_MnRequest_B;

{$R *.DFM}
procedure TFrm_Sfc_MnOut_NotSave_P.SetFormParam(FrmParam1, FrmParam2, FrmParam3,
  FrmParam4, FrmParam5, FrmParam6: String);
begin
  inherited;
  FBillNo:=lowercase(FrmParam1);
  FWHCode:=lowercase(FrmParam2);
  FBillTypeCode:=lowercase(FrmParam3);
  FPreview:=(lowercase(FrmParam4)='preview');
  FModuleCode:=lowercase(FrmParam5);
end;

procedure TFrm_Sfc_MnOut_NotSave_P.SetDBConnect(AdOConnection:TAdOConnection);
var
  tmpBillid:string;
  sqltext:string;
begin
  inherited;
  AdoQry_Head.Connection:=AdoConnection;
  AdoQry_Line.Connection:=AdoConnection;

  with AdoQry_Tmp do
  begin
    Close;
    SQL.clear;
    SQL.Text:='Select SysParamValueC from SysParam Where SysParamCode=''Name0''';
    open;
  end;
  QLSysParamValueC.Caption:=AdoQry_Tmp.fieldbyname('SysParamValueC').asstring;

  with AdoQry_Tmp do
  begin
    Close;
    SQL.clear;
    SQL.Text:='Select BillCtrlCode,BillTypeName,BillColorDESC  '+
       'From BillType Where BillTypeCode=:FBillTypeCode';
    Parameters.ParamByName('FBillTypeCode').Value:=FBillTypeCode;
    open;
  end;

  QLBillCtrlCode.Caption:=AdoQry_Tmp.fieldbyname('BillCtrlCode').asstring;
  QLSysParamValueC.Caption:=QLSysParamValueC.Caption+AdoQry_Tmp.fieldbyname('BillTypeName').asstring;

  with AdoQry_Tmp do
  begin
    Close;
    SQL.clear;
    SQL.Text:='Select *  From SfcR_Param Where ParamCode=''RequestReportType'''; 
    open;
  end;

  if  AdoQry_Tmp.fieldbyname('ParamValueN').asinteger=2 then
    QLSysParamValueC.Caption:=StringReplace(QLSysParamValueC.Caption,'领料单','发料单',[rfReplaceAll]);

 { AdoQry_Head.Close;
  AdoQry_Head.sql.text:=
    ' select B.WHCode,W.WHName,B.WhPositionCode,P.WhPositionName, '+
           ' B.InvBillNo,D.DeptCode,D.DeptName, '+
           ' B.InvBillDate,B.InvBillId,B.shiftType,'+
           ' E.EmployeeName,F.EmployeeName as EmployeeName1,'+
           ' B.Mono,B.MoLineNo,ml.ItemCode,ml.moqty,i.ItemName,B.InvBillRemArk,B.InvBillValuation'+
       ' from InvOutBill B '+
         ' left join Employee E on B.WH_EmployeeCode2=E.EmployeeCode '+
         ' left join Employee F on B.EmployeeCode=f.EmployeeCode, '+
         ' Warehouse W,WhPosition P,Dept D,MoLine ml,Item i '+
       ' where B.WHCode=:WHCode and '+
             ' B.InvBillNo=:BillNo and '+
             ' B.WHCode=W.WHCode and '+
             ' B.WHCode=P.WHCode and '+
             ' B.WhPositionCode=P.WhPositionCode and '+
             ' B.DeptCode=D.DeptCode and  '+
             ' B.mono=ml.mono and '+
             ' B.MoLineno=ml.MoLineno and '+
             ' ml.ItemCode=i.ItemCode ';
  AdoQry_Head.Parameters.ParamByName('WHCode').Value:=FWHCode;
  AdoQry_Head.Parameters.ParamByName('BillNo').Value:=FBillNo;
  AdoQry_Head.open;
  TmpBillId:=AdoQry_Head.fieldbyname('InvBillId').asstring;

    sqltext:=' select L.InvBillLineno,L.ItemCode,I.ItemName,i.ItemCode2,L.MoLineNo,U.UomName,'+
            ' M.MOQty,M.MoLineDate,L.InvBillSfcQty, L.InvBillQty,l.BilllineremArk  '+
            ' from InvOutBillLine L,Item I,Uom U,MoLine M  '+
            ' where L.InvBillId='+TmpBillId+' and '+
            ' L.ItemCode=I.ItemCode and '+
            ' I.UomCode=U.UomCode  and'+
            ' L.MOnO=M.Mono  and '+
            ' L.MoLineno=M.MoLineno  '+
            ' Order by L.ItemCode ';


     with  AdoQry_Line do
     begin
       Close;
       SQL.clear;
       SQL.Add(sqltext);
       ExecSQL;
       open;
     end;}


   if FPreview then
   begin
     QuickRep1.Prepare;
     QLPageTot1.Caption:='页 共'+Trim(inttoStr(QuickRep1.QRPrinter.PageCount))+'页' ;
     QLPageTot.Caption:=QLPageTot1.Caption;
     QuickRep1.PreviewModal;
   end
   else
     begin
     QuickRep1.Prepare;
     QLPageTot1.Caption:='页 共'+Trim(inttoStr(QuickRep1.QRPrinter.PageCount))+'页' ;
     QLPageTot.Caption:=QLPageTot1.Caption;
     QuickRep1.print;
     end;
end;

procedure TFrm_Sfc_MnOut_NotSave_P.QRDBText15Print(sender: TObject;
  var Value: String);
begin
  inherited;
  if Value='0' then  Value:='';
end;


procedure TFrm_Sfc_MnOut_NotSave_P.QRDBText2Print(sender: TObject;
  var Value: String);
begin
  inherited;
  if Value='0' then Value:='';
end;

procedure TFrm_Sfc_MnOut_NotSave_P.QRExpr4Print(sender: TObject;
  var Value: String);
begin
  inherited;
  Value:=Trim(QRDBText2.DataSet.fieldbyname('ItemName').AsString);
end;

procedure TFrm_Sfc_MnOut_NotSave_P.QRExpr1Print(sender: TObject;
  var Value: String);
var
  bExit : boolean;
  iLen : integer;
  strSource, strTemp : string;
begin
  Inherited;
  //32是栏宽。
  Value:=Trim(QRDBText2.DataSet.fieldbyname('BomRemArk').AsString)+'/'
        +Trim(QRDBText2.DataSet.fieldbyname('BillLineRemArk').AsString);
  If Value='/' Then
    Value:='';
  if Length(Value) <= 30 then
    exit;

  strSource := Value;
  Value := '';
  //防止截断汉字。
  while True do
  begin
    iLen := 1;
    while iLen < 30 do
    begin
      if ord(strSource[iLen]) > 128 then
        inc(iLen, 2)
      else
        inc(iLen);
    end;
    dec(iLen);
    strTemp := Copy(strSource, 1, iLen);
    //加回车。
    if Value = '' then
      Value := strTemp
    else
      Value := Value +#13+strTemp;
    strSource := Copy(strSource, iLen + 1, Length(strSource) - iLen);
    if Length(strSource) <= 30 then
    begin
      Value := Value +#13+strSource;
      exit;
    end;
  end;
end;


procedure TFrm_Sfc_MnOut_NotSave_P.DetailBand1AfterPrint(
  Sender: TQRCustomBand; BandPrinted: Boolean);
var
  I:Integer;
begin
  inherited;
  For I:=0 To DetailBand1.ControlCount-1 Do
  begin
    If DetailBand1.Controls[I] IS TQRShApe Then
      TQRShApe(DetailBand1.Controls[I]).Height:=DetailBand1.ClientHeight+40;
  end;
end;

end.

⌨️ 快捷键说明

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