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

📄 inv_saleprice2.pas

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

Interface

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

Type
  TFrm_Inv_SalePrice2 = Class(TFrm_Base_Outer)
    AdoQry_MainSP2Id: TAutoIncField;
    AdoQry_MainCustomerCode: TStringField;
    AdoQry_MainCustomerName: TStringField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainSP2StArtDate: TDateTimeField;
    AdoQry_MainSP2endDate: TDateTimeField;
    AdoQry_MainSP2Price: TFloatField;
    AdoQry_MainSP2NoTaxPrice: TFloatField;
    AdoQry_MainTaxRate: TFloatField;
    Label1: TLabel;
    DBText1: TDBText;
    procedure Act_DeleteExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations } 
    function  SetDeleteSql:String;Override;
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:boolean);Override;
  end;

var
  Frm_Inv_SalePrice2: TFrm_Inv_SalePrice2;

implementation

uses Inv_SalePrice2_D,Sys_Global;

{$R *.DFM}

procedure TFrm_Inv_SalePrice2.InitForm(AdOConnection:TAdOConnection;ReadOnly:boolean);
begin
  inherited;
  FreeFields:='SP2Price,SP2NoTaxPrice,';
  SelectFromSQL:='Select SalePrice2.SP2Id'
    +',SalePrice2.CustomerCode'
    +',Customer.CustomerName'
    +',SalePrice2.ItemCode'
    +',Item.ItemName'
    +',SalePrice2.SP2StArtDate'
    +',SalePrice2.SP2endDate'
    +',SalePrice2.SP2Price'
    +',SalePrice2.SP2NoTaxPrice'
    +',SalePrice2.TaxRate'
    +' From SalePrice2'
    +' Join Customer On SalePrice2.CustomerCode=Customer.CustomerCode'
    +' Join Item On SalePrice2.ItemCode=Item.ItemCode';
  OrderByFields:='CustomerCode,ItemCode,SP2StArtDate';
  GetData;
  Frm_Sys_Detail:=TFrm_Inv_SalePrice2_D.Create(Application);
end;

function TFrm_Inv_SalePrice2.SetDeleteSql: String;
begin
  Result:='Delete SalePrice2'
    +' Where CustomerCode='''+AdoQry_Main.fieldbyname('CustomerCode').AsString+''''
    +' And ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').AsString+''''
    +' And SP2StArtDate='''+AdoQry_Main.fieldbyname('SP2StArtDate').AsString+''''
    +' And SP2endDate='''+AdoQry_Main.fieldbyname('SP2endDate').AsString+'''';
end;

procedure TFrm_Inv_SalePrice2.Act_DeleteExecute(Sender: TObject);
begin
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='Select Max(SP2endDate) As SP2endDate'
    +' From SalePrice2'
    +' Where ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').AsString+''''
    +' And CustomerCode='''+AdoQry_Main.fieldbyname('CustomerCode').asstring+'''';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.fieldbyname('SP2endDate').AsDateTime=
    AdoQry_Main.fieldbyname('SP2endDate').AsDateTime then
    inherited
  else
    DispInfo('不允许删除中间记录!',1);
end;

end.

⌨️ 快捷键说明

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