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

📄 pm_qry_printpo_p.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit Pm_Qry_PrintPo_P;

Interface

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

Type
  TFrm_Pm_Qry_PrintPo_P = Class(TForm)
    QuickRep1: TQuickRep;
    AdoQryMain: TAdoQuery;
    ColumnHeaderBand1: TQRBand;
    DetailBand1: TQRBand;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRDBText1: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRShApe2: TQRShApe;
    QRShApe3: TQRShApe;
    QRShApe4: TQRShApe;
    QRShApe8: TQRShApe;
    QRLabel11: TQRLabel;
    QRShApe9: TQRShApe;
    QRShApe11: TQRShApe;
    QRShApe12: TQRShApe;
    QRShApe14: TQRShApe;
    AdoQry_tmp: TAdoQuery;
    QRLabel6: TQRLabel;
    QRLabel8: TQRLabel;
    QRDBText7: TQRDBText;
    QRLabel9: TQRLabel;
    QRDBText8: TQRDBText;
    QRLabel10: TQRLabel;
    QRDBText9: TQRDBText;
    QRShApe19: TQRShApe;
    QRShApe20: TQRShApe;
    QRShApe21: TQRShApe;
    QRShApe10: TQRShApe;
    QRLabel13: TQRLabel;
    QRShApe24: TQRShApe;
    AdoQryMainpono: TStringField;
    AdoQryMainpoType: TStringField;
    AdoQryMainpodate: TDateTimeField;
    AdoQryMaInvendorCode: TStringField;
    AdoQryMaInvendorName: TStringField;
    AdoQryMainItemCode: TStringField;
    AdoQryMainItemName: TStringField;
    AdoQryMainUomName: TStringField;
    AdoQryMainpoqty: TFloatField;
    AdoQryMainpotaxPrice: TFloatField;
    AdoQryMainpotaxAmount: TBCDField;
    AdoQryMainpolinedate: TDateTimeField;
    AdoQryMainporemArk: TStringField;
    AdoQryMaInvendorowner: TStringField;
    AdoQryMaInvendorAddress: TStringField;
    AdoQryMaInvendorbank: TStringField;
    AdoQryMaInvendorbankaccno: TStringField;
    AdoQryMaInvendortaxno: TStringField;
    AdoQryMaInvendortel: TStringField;
    AdoQryMaindate: TDateTimeField;
    AdoQryMainpolineno: TIntegerField;
    QRDBText2: TQRDBText;
    QRDBText10: TQRDBText;
    AdoQryMainpotaxrate: TIntegerField;
    QRLabel50: TQRLabel;
    QRDBText20: TQRDBText;
    QrLbl_Title: TQRLabel;
    Qrlbl_Caption: TQRLabel;
    Qrlbl_IsoCode: TQRLabel;
    AdoQryMainEmployeeCode: TStringField;
    AdoQryMainEmployeeName: TStringField;
    SummAryBand1: TQRBand;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    PageFooterBand1: TQRBand;
    AdoQryMainItemflag: TStringField;
    AdoQryMaInvendorfax: TStringField;
    QRLabel1: TQRLabel;
    QRDBText11: TQRDBText;
    QRLabel3: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRShApe1: TQRShApe;
    QRDBText5: TQRDBText;
    QRShApe5: TQRShApe;
    QRLabel18: TQRLabel;
    qrlblpageno: TQRLabel;
    QRLabel23: TQRLabel;
    QRLabel22: TQRLabel;
    qrpageCount: TQRLabel;
    QRLabel25: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel24: TQRLabel;
    AdoQryMainPassEmployeeCode: TStringField;
    ChildBand1: TQRChildBand;
    QRLabel29: TQRLabel;
    QRLabel30: TQRLabel;
    QRLabel31: TQRLabel;
    QRLabel32: TQRLabel;
    QRLabel34: TQRLabel;
    QRLabel33: TQRLabel;
    QRLabel35: TQRLabel;
    QRLabel36: TQRLabel;
    QRLabel37: TQRLabel;
    procedure FormDestroy(Sender: TObject);
    procedure QuickRep1endPage(Sender: TCustomQuickRep);
    procedure QuickRep1StArtPage(Sender: TCustomQuickRep);
  private
   function  lookupParam(ParamCode:string):string;
   function  getAmount:double;
   function  getsum(ItemCode:string):real;
   function  getuser(userCode:string):string;
   { Private declarations }
  public
    userCode:string;
    procedure GetDataSource(AdoConnect:TAdoConnection;PoNo:String;Status:String;MenuId:String);
  end;

var
  Frm_Pm_Qry_PrintPo_P: TFrm_Pm_Qry_PrintPo_P;
  int:integer;
implementation

uses Sys_Global;

{$R *.DFM}
procedure TFrm_Pm_Qry_PrintPo_P.GetDataSource(AdoConnect:TAdoConnection;PoNo:String;Status:String;MenuId:String);
var
  SqlText,tmpItemCode,tmpQryItemCode,i:String;
  Count,j:integer;
  printterm:boolean;
  termCode:string;
begin
  j:=0;
  AdoQryMain.Connection:=AdoConnect;
  AdoQry_tmp.Connection:=Adoconnect;
  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;
  sqltext:='create table #tmp'+
            ' (pono   varchAr(45)     null,'+
            '  polineno int           null,'+
            ' poType varchAr(50)      null,'+
            ' podate  datetime        null,'+
            ' potaxRate  int          null,'+
            ' VendorCode varchAr(120)  null,'+
            ' VendorName varchAr(120)  null,'+
            ' EmployeeCode varchAr(160) null,'+
            ' EmployeeName varchAr(160) null,'+
            ' ItemCode   varchAr(120)  null,'+
            ' ItemName   varchAr(120)  null,'+
            ' Itemflag   varchAr(150) null,'+
            ' UomName    varchAr(8)   null,'+
            ' poqty      float     null,'+
            ' potaxPrice    float    null,'+
            ' potaxAmount   float        null,'+
            ' polinedate datetime     null,'+
            ' poRemArk   varchAr(150) null,'+
            ' VendorOwner varchAr(140) null,'+
            ' VendorAddress varchAr(120) null,'+
            ' Vendorbank    varchAr(140) null,'+
            ' Vendorbankaccno varchAr(140) null,'+
            ' Vendortaxno    varchAr(140)  null,'+
            ' Vendortel     varchAr(140)   null,'+
            ' Vendorfax     varchAr(140)  null,'+
            ' PassEmployeeCode varchAr(30) null, '+
            ' date       datetime     null)'+
          //  'cr
            ' declAre @rc int'+
   ' insert into #tmp '+
            ' select t1.pono,'+
            ' t1.polineNo,'+
            ' poType=case t2.poType'+
            '       when 0 then '+'''普通采购'''+
            '       when 1 then '+'''委外加工'''+
            '     end,'+
       't2.podate,    '+
       't2.potaxrate_Percent,'+
       't2.VendorCode,'+
       't3.VendorName,'+
       ' t2.EmployeeCode,'+
       ' t6.EmployeeName,'+
       't1.ItemCode,'+
       't4.ItemName,'+
       'Itemflag=substring((t1.ItemCode+'' ''+t4.ItemName),1,45),'+
       't5.UomName,'+
       ' t1.poqty as poqty, '+
       ' potaxPrice=convert(decimal(14,2),t1.potaxPrice),'+
       ' t1.potaxAmount,'+
       ' t1.polinedate,'+
       ' t2.poremArk,'+
       ' t3.Vendorowner,'+
       ' t3.VendorAddress,'+
       ' t3.Vendorbank,'+
       ' t3.Vendorbankaccno,'+
       ' t3.Vendortaxno,'+
       ' t3.Vendortel,'+
       ' t3.Vendorfax,'+
       ' t1.PassEmployeeCode , '+
       'date=getdate()'+
     'from   poline  t1(nolock),'+
     '  po      t2(nolock),'+
      ' Vendor  t3(nolock),'+
      ' Item    t4(nolock),'+
      ' Uom     t5(nolock),'+
      ' Employee t6(nolock)'+
    ' where  t1.pono=t2.pono'+
    ' and   t1.ItemCode=t4.ItemCode'+
    ' and   t2.VendorCode*=t3.VendorCode'+
    ' and   t4.UomCode=t5.UomCode'+
    ' and   t2.EmployeeCode*=t6.EmployeeCode'+
   // ' and   t2.poType=1'+
    ' and   t1.pono+convert(varchAr,t1.polineno) in ('+PoNo+')';
  Try
  with AdoQryMain do
   begin
     Close;
     sql.clear;
     sql.Add(sqltext);
     try
     execsql;
     except
     end;
     Close;
     sql.clear;
     sql.Add('select * from #tmp Order by ItemCode,polinedate');
     open;
     First;
     tmpItemCode:=fieldbyname('ItemCode').asstring;
     if recordCount=1 then
      begin
             with AdoQry_tmp do
             begin
              Close;
              sql.clear;
              sql.Add('insert into #tmp(VendorCode,VendorName,poType,podate,Vendorfax,date,'
                      +'ItemCode,Itemflag,poqty) Values('
                      +quotedstr(AdoQryMain.fieldbyname('VendorCode').asstring)+','
                      +quotedstr(AdoQryMain.fieldbyname('VendorName').asstring)+','
                      +quotedstr(AdoQryMain.fieldbyname('poType').asstring)+','

⌨️ 快捷键说明

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