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

📄 sal_enter_saleorder_p.pas

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

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Common, Db, AdODB, QrCtrls, QuickRpt, ExtCtrls, StdCtrls;

Type
  TFrm_Sal_Enter_SaleOrder_P = Class(TFrm_Base_Common)
    QR: TQuickRep;
    ColumnHeaderBand1: TQRBand;
    QRShApe1: TQRShApe;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRSysData1: TQRSysData;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QLbl_CreateDate: TQRLabel;
    QLbl_CustomerCode: TQRLabel;
    QLbl_SloNo: TQRLabel;
    QLbl_CustomerName: TQRLabel;
    Qlbl_SaleType: TQRLabel;
    Qlbl_RemArk: TQRLabel;
    QLbl_Pages: TQRLabel;
    QRLabel11: TQRLabel;
    QRSysData2: TQRSysData;
    QRShApe3: TQRShApe;
    QRShApe4: TQRShApe;
    QRShApe5: TQRShApe;
    QRShApe6: TQRShApe;
    QRShApe7: TQRShApe;
    QRShApe8: TQRShApe;
    QRLbl_Title: TQRLabel;
    Qrlbl_Caption: TQRLabel;
    QrLbl_IsoCode: TQRLabel;
    PrinterSetupDialog1: TPrinterSetupDialog;
    AdoQry_Main: TAdoQuery;
    DetailBand1: TQRBand;
    QRDBText1: TQRDBText;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRShApe2: TQRShApe;
    QRShApe10: TQRShApe;
    QRShApe9: TQRShApe;
    QRShApe11: TQRShApe;
    QRShApe12: TQRShApe;
    QRShApe13: TQRShApe;
    QRShApe14: TQRShApe;
  private
    { Private declarations }
  public
    procedure SetDBConnect(AdOConnection:TAdOConnection);Override;
    procedure GetHeadData(AdoQuery:TAdoQuery;Edt_SloNo,Status:String);
    { Public declarations }
  end;

var
  Frm_Sal_Enter_SaleOrder_P: TFrm_Sal_Enter_SaleOrder_P;

implementation

{$R *.DFM}

{ TFrm_Sal_Enter_SaleOrder_P }

procedure TFrm_Sal_Enter_SaleOrder_P.GetHeadData(AdoQuery: TAdoQuery; Edt_SloNo,Status: String);
var
  SqlText:String;
begin
  SqlText:=' Select Sa_SaleOrder.CustomerCode,'
          +' Customer.CustomerName, '
          +' Sa_SaleOrder.CustomerCode+'' ''+Customer.CustomerName As CustomerFalg, '
          +' CreateDate, '
          +' Sa_SaleOrder.SloNo,Sa_SaleOrder.SaleTypeCode,SaleTypeName,'
          +' Sa_SaleOrder.SaleDeptCode,Dept.DeptName, '
          +' Sa_SaleOrder.SaleDeptCode+'' ''+Dept.DeptName As SaleDeptFalg,'
          +' Sa_SaleOrder.SaleEmployeeCode,Employee1.EmployeeName,  '
          +' Sa_SaleOrder.SaleEmployeeCode+'' ''+Employee1.EmployeeName As SaleEmployeeFalg,'
          +' Sa_SaleOrder.CurrencyCode,Currency.CurrencyName,'
          +' Sa_SaleOrder.CurrencyCode+'' ''+Currency.CurrencyName As CurrencyFalg,  '
          +' sa_SaleOrder.TaxRate_Percent,Sa_SaleOrder.PayTermCode,PayTerm.PayTermName,   '
          +' Sa_SaleOrder.PayTermCode+'' ''+PayTerm.PayTermName AS SaleTermFlag, '
          +' sa_SaleOrder.CreateEmployeeCode,Employee.EmployeeName, '
          +' sa_SaleOrder.CreateEmployeeCode+'' ''+Employee.EmployeeName as createEmployeefalg, '
          +' sa_SaleOrder.ShipModeCode,ShipMode.ShipModeName, '
          +' sa_SaleOrder.ShipModeCode+'' ''+ShipMode.ShipModeName as ShipModefalg, '
          +' sa_SaleOrder.ShipAddresSCode,customerShipAddress.ShipAddressName, '
          +' sa_SaleOrder.ShipAddresSCode+'' ''+customerShipAddress.ShipAddressName as ShipAddressfalg ,'
          +' Sa_SaleOrder.remArk,TotalNoTaxAmount,TotalTaxAmount,EditDate,EdItEmployeeCode ,RemArk1'
          +' From  Sa_SaleOrder Left Join PayTerm  On Sa_SaleOrder.PayTermCode=PayTerm.PayTermCode'
                  +' left Join Customer  On Sa_SaleOrder.CustomerCode=Customer.CustomerCode   '
                  +' Left Join Dept On Sa_SaleOrder.SaleDeptCode=Dept.DeptCode   '
                  +' Left Join Employee Employee1 On Sa_SaleOrder.SaleEmployeeCode=Employee1.EmployeeCode  '
                  +' Left Join Currency On Sa_SaleOrder.CurrencyCode=Currency.CurrencyCode  '
                  +' Left Join Employee On  Sa_SaleOrder.CreateEmployeeCode=Employee.EmployeeCode  '
                  +' Left Join ShipMode On Sa_SaleOrder.ShipModeCode=ShipMode.ShipModeCode    '
                  +' Left Join SaleType On Sa_SaleOrder.SaleTypeCode=SaleType.SaleTypeCode '
                  +' Left Join CustomerShipAddress On Sa_SaleOrder.ShipAddresSCode=CustomerShipAddress.ShipAddresSCode '
       +' where  Sa_SaleOrder.SloNo= '''+Edt_SloNo+'''';

  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='select SysParamValueC  From SysParam Where Upper(SysParamCode)='''+UpperCase('Name0')+'''';
  AdoQry_Tmp.Open;
  QrLbl_Title.Caption:=AdoQry_Tmp.fieldbyname('SysParamValueC').AsString;
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='Select ReportName1,ISOCode1 From ReportCtrl Where  SysMenuID='''+MenuId+'''';
  AdoQry_Tmp.Open;
  QrLbl_Caption.Caption:=AdoQry_Tmp.fieldbyname('ReportName1').AsString;
  QrLbl_IsoCode.Caption:=AdoQry_Tmp.fieldbyname('ISOCode1').AsString;

  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := SqlText;
  AdoQry_Tmp.Open;
  QLbl_CreateDate.Caption := AdoQry_Tmp.fieldbyname('CreateDate').AsString;
  QLbl_SloNo.Caption := AdoQry_Tmp.fieldbyname('SloNo').AsString;
  Qlbl_SaleType.Caption := AdoQry_Tmp.fieldbyname('SaleTypeName').AsString;
  QLbl_CustomerCode.Caption:=AdoQry_Tmp.fieldbyname('CustomerCode').AsString;
  QLbl_CustomerName.Caption:=AdoQry_Tmp.fieldbyname('CustomerName').AsString;
  Qlbl_RemArk.Caption:=AdoQry_Tmp.fieldbyname('RemArk').AsString;

  SqlText:='Select Sa_SaleOrderLine.*,Item.ItemName ,Uom.UomName'
            +' Into #TmPmoQrep From Sa_SaleOrderLine '
            +' Join Item On Sa_SaleOrderLine.ItemCode=Item.ItemCode '
            +' And  Sa_SaleOrderLine.SloNo='''+Trim(Edt_SloNo)+''''
            +' left Join Uom On Item.UomCode=Uom.UomCode';

  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:=SqlText;
  AdoQry_Tmp.ExecSQL; //建立临时表
  SqlText:=' Select * From  #TmPmoQrep '
          +' union '
          +' select ''zzzzzzzzzzzzzzz'',null,''合计'',null,null,null,null,null,null,null, '
          +'        null,sum(isnull(TaxPrice,0)),sum(isnull(TaxAmount,0)),null,'
          +'        null,null,null,null,null,Null,Null,null,'' '','' '' from #TmPmoQrep      ';
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:=SqlText;
  AdoQry_Tmp.Open;
  Qr.Prepare;
  QLbl_Pages.Caption:=IntToStr(Qr.PageNumber);
  SqlText:=' Drop Table #TmPmoQrep ';
  try
    AdoQry_Main.Close;
    AdoQry_Main.SQL.Text:=SqlText;
    AdoQry_Main.ExecSQL;
  except
  end;

  If Status='Preview' Then
    Qr.PreviewModal
  Else
    Qr.Print;
  Qr.Free;
end;


procedure TFrm_Sal_Enter_SaleOrder_P.SetDBConnect(
  AdOConnection: TAdOConnection);
begin
  inherited;
  AdoQry_Main.Connection:=AdoConnection;
end;

end.

⌨️ 快捷键说明

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