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

📄 pm_qry_printpo.pas

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

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, jpeg;

Type
  TFrm_Pm_Qry_PrintPo = Class(TFrm_Base_Outer)
    AdoQry_MainPoNo: TStringField;
    AdoQry_MaInvendorCode: TStringField;
    AdoQry_MainPONO_1: TStringField;
    AdoQry_MainPOLINENo: TIntegerField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainPOLineDATE: TDateTimeField;
    AdoQry_MainPOQTY: TFloatField;
    AdoQry_MainPONoFinishQty: TFloatField;
    AdoQry_MainPOREFERENCEDPRICE: TIntegerField;
    AdoQry_MainPoNoTaxPrice: TFloatField;
    AdoQry_MainPONoTaxAmount: TBCDField;
    AdoQry_MainPoTaxPrice: TFloatField;
    AdoQry_MainPOStArtWorkDate: TDateTimeField;
    AdoQry_MainItemCode_1: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainUomCode: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MaInvendorName: TStringField;
    AdoQry_MainPoType: TIntegerField;
    AdoQry_MainPoTaxAmount: TBCDField;
    AdoQry_Mainlinestatus: TStringField;
    AdoQry_MainEmployeeCode: TStringField;
    AdoQry_MainEmployeeName: TStringField;
    AdoQry_Mainpodate: TDateTimeField;
    AdoQry_Mainpcno: TStringField;
    AdoQry_MainEmployeeflag: TStringField;
    AdoQry_MaInvendorflag: TStringField;
    AdoQry_MainItemflag: TStringField;
    Label3: TLabel;
    dbtxtFinishrate: TDBText;
    dbtxTEmployeeflag: TDBText;
    dbtxtVendorflag: TDBText;
    dbtxtItemflag: TDBText;
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    AdoQry_Mainpotmpflag: TIntegerField;
    procedure FormDestroy(Sender: TObject);
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
    procedure DBGridEhTitleClick(Column: TColumnEh);
  private
    Checked:Boolean;
    { Private declarations }
  public
    { Public declarations }
    pono:string;
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
  end;

var
  Frm_Pm_Qry_PrintPo: TFrm_Pm_Qry_PrintPo;

implementation

uses  Pm_Qry_PrintPo_C, Pm_Qry_PrintPo_P,Sys_Global;
{$R *.DFM}

{ TFrm_Pm_Qry_Po }

procedure TFrm_Pm_Qry_PrintPo.InitForm(AdOConnection: TAdOConnection;
  ReadOnly: Boolean);
begin
  inherited;
  Pnl_Title.Caption :='采购订单组合打印';
  Frm_Pm_Qry_PrintPo.Caption :='采购订单组合打印';
  Pricefields:='potaxPrice,ponotaxPrice,potaxAmount,ponotaxAmount,';
  SelectFromSQL:='Select po.potmpflag,Po.PoNo,po.pcno,po.podate,Po.EmployeeCode,Employee.EmployeeName,Po.VendorCode,Po.PoType,PoLine.*,Item.ItemCode,'+
                ' Item.ItemName,Item.UomCode,Uom.UomName,Vendor.VendorName,'+
                ' Employeeflag=po.EmployeeCode+'' ''+Employee.EmployeeName,'+
                ' Vendorflag=po.VendorCode+'' ''+Vendor.VendorName,'+
                ' Itemflag=poline.ItemCode+'' ''+Item.ItemName,'+
                ' linestatus= case poline.polinestatus  '+
                       '  when 5 then ''5 准备'' '+
                       '  when 6 then ''6 下达'' '+
                       '  when 7 then ''7 关闭'' '+
                       '  when 8 then ''8 永久关闭'' '+
                    '  end  '+
            ' From PoLine'+
                 ' left outer Join Item On PoLine.ItemCode=Item.ItemCode'+
                 ' Join Po On PoLine.PoNo=Po.PoNo'+
                 ' left outer join Employee on Po.EmployeeCode=Employee.EmployeeCode'+
                 ' Left outer Join Vendor On Po.VendorCode=Vendor.VendorCode'+
                 ' Left Outer Join Uom On Item.UomCode=Uom.UomCode';
  Condition:='po.PoSpecial=0 and PoLine.PoNoFinishQty>0 and poline.polinestatus<=6';
  Orderbyfields:='EmployeeCode,Pono,PolineNo';
 // GetData;
  Frm_Sys_Condition:=TFrm_Pm_Qry_PrintPo_C.Create(self);
  Act_Filter.Execute;
  //Frm_Sys_Condition=nil;
  Checked:=False;
end;

procedure TFrm_Pm_Qry_PrintPo.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Pm_Qry_PrintPo:=nil;
end;

procedure TFrm_Pm_Qry_PrintPo.Act_PreviewExecute(Sender: TObject);
var tmpVendorCode:string;
    mArk:string;
begin
tmpVendorCode:='tmpVendorCode';
pono:='';
  mArk:=AdoQry_Main.BookmArk;
  AdoQry_Main.First;
  with AdoQry_Main do
    while not eof do
      begin
       if fieldbyname('potmpflag').asinteger=1  then
         begin
          if tmpVendorCode='tmpVendorCode' then
            begin
             tmpVendorCode:=fieldbyname('VendorCode').asstring ;
             pono:=quotedstr(fieldbyname('pono').asstring+inttostr(fieldbyname('polineno').asinteger));
            end
          else if fieldbyname('VendorCode').asstring<>tmpVendorCode then
               begin
                 DispInfo('您必须选择同一供应商的订单,请重选!',3);
                 exit;
               end
               else pono:=pono+','+quotedstr(fieldbyname('pono').asstring+inttostr(fieldbyname('polineno').asinteger));
         end;
       next;
      end;
  AdoQry_Main.BookmArk:=mArk;
 if pono='' then exit;
 Frm_Pm_Qry_PrintPo_P:=TFrm_Pm_Qry_PrintPo_P.Create(Application);
 Frm_Pm_Qry_PrintPo_P.userCode:=self.UserCode;
  Frm_Pm_Qry_PrintPo_P.GetDataSource(DbConnect,pono,'Preview',MenuId);
end;

procedure TFrm_Pm_Qry_PrintPo.Act_PrintExecute(Sender: TObject);
var tmpVendorCode:string;
    mArk:string;
begin
tmpVendorCode:='tmpVendorCode';
pono:='';
  mArk:=AdoQry_Main.BookmArk;
  AdoQry_Main.First;
  with AdoQry_Main do
    while not eof do
      begin
       if fieldbyname('potmpflag').asinteger=1  then
         begin
          if tmpVendorCode='tmpVendorCode' then
            begin
             tmpVendorCode:=fieldbyname('VendorCode').asstring ;
             pono:=quotedstr(fieldbyname('pono').asstring+inttostr(fieldbyname('polineno').asinteger));
            end
          else if fieldbyname('VendorCode').asstring<>tmpVendorCode then
               begin
                 DispInfo('您必须选择同一供应商的订单,请重选!',3);
                 exit;
               end
               else pono:=pono+','+quotedstr(fieldbyname('pono').asstring+inttostr(fieldbyname('polineno').asinteger));
         end;
       next;
      end;
  AdoQry_Main.BookmArk:=mArk;
    if pono='' then exit;
 Frm_Pm_Qry_PrintPo_P:=TFrm_Pm_Qry_PrintPo_P.Create(Application);
 Frm_Pm_Qry_PrintPo_P.userCode:=self.UserCode;
  Frm_Pm_Qry_PrintPo_P.GetDataSource(DbConnect,pono,'Print',MenuId);
end;


procedure TFrm_Pm_Qry_PrintPo.DBGridEhTitleClick(Column: TColumnEh);
var
  VendorCode1,BookMArk:string;
begin
  inherited;
  VendorCode1:=AdoQry_Main.fieldbyname('VendorCode').asstring ;
  If Trim(Column.Title.Caption)<>'标记' Then
    Abort;
  If AdoQry_Main.RecordCount=0 Then
    Abort;
  BookMArk:=AdoQry_Main.BookmArk;
  If Not Checked Then
  begin
    AdoQry_Main.First;
    While Not AdoQry_Main.Eof Do
    begin
      If (AdoQry_Main.fieldbyname('VendorCode').asstring=VendorCode1) Then
      begin
        AdoQry_Main.Edit;
        AdoQry_Main.fieldbyname('potmpflag').AsInteger:=1;
        AdoQry_Main.Post;
      end;
      AdoQry_Main.Next;
    end;
  end
  Else
  begin
    AdoQry_Main.First;
    While Not AdoQry_Main.Eof Do
    begin
      AdoQry_Main.Edit;
      AdoQry_Main.fieldbyname('potmpflag').AsInteger:=0;
      AdoQry_Main.Post;
      AdoQry_Main.Next;
    end;
  end;
  AdoQry_Main.BookmArk:=BookMArk;
  Checked:=Not Checked;
end;

end.

⌨️ 快捷键说明

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