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

📄 pm_enter_purcharseprice.pas

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

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

Type
  TFrm_Pm_Enter_PurcharsePrice = Class(TFrm_Base_Outer)
    AdoQry_MaInvendorCode: TStringField;
    AdoQry_MaInvendorName: TStringField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MainPcTaxPrice: TFloatField;
    AdoQry_MainPcNoTaxPrice: TFloatField;
    AdoQry_MainPcTaxPrice_Formal: TFloatField;
    AdoQry_MainPcNoTaxPrice_Formal: TFloatField;
    AdoQry_MainReferencePricePass: TIntegerField;
    AdoQry_MainformalPricePass: TIntegerField;
    AdoQry_MainPcPriceType: TIntegerField;
    AdoQry_MainPcStArtDate: TDateTimeField;
    AdoQry_MainPcendDate: TDateTimeField;
    AdoQry_MainPcStArtQty: TFloatField;
    AdoQry_MainPcendQty: TFloatField;
    AdoQry_MainPcTaxRate_Percent: TIntegerField;
    AdoQry_MainCurrencyCode: TStringField;
    AdoQry_MainCurrencyName: TStringField;
    AdoQry_MainPcNo: TStringField;
    AdoQry_MainPcDate: TDateTimeField;
    AdoQry_MainPcLineId: TAutoIncField;
    procedure FormDestroy(Sender: TObject);
    procedure Act_DeleteExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure AdoQry_MainAfterPost(DataSet: TDataSet);
    procedure AdoQry_MainPcTaxPriceChange(Sender: TField);
    procedure AdoQry_MainPcNoTaxPriceChange(Sender: TField);
  private
    { Private declarations }
  public
   procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
    { Public declarations }
  end;

var
  Frm_Pm_Enter_PurcharsePrice: TFrm_Pm_Enter_PurcharsePrice;

implementation

uses  Pm_Enter_PurcharsePrice_D, Sys_Global;

{$R *.DFM}


procedure TFrm_Pm_Enter_PurcharsePrice.InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);
begin
  Application.ProcessMessages;
  inherited;
  Frm_Pm_Enter_PurcharsePrice.Caption:=IIFString(Param1='0','采购价格表--正式价','采购价格表--暂估价');
  Pnl_Head.Caption := self.Caption;
  SelectFromSql := 'select  Pc.VendorCode,              '
                   +'        Vendor.VendorName,         '
                   +'        PcLine.ItemCode,           '
                   +'        Item.ItemName,             '
                   +'        Uom.UomName,               '
                   +'        PcLine.PcTaxPrice,         '
                   +'        PcLine.PcNoTaxPrice,       '
                   +'        PcLine.PcTaxPrice_Formal,  '
                   +'        PcLine.PcNoTaxPrice_Formal,'
                   +'        PcLine.ReferencePricePass, '
                   +'        PcLine.FormalPricePass,    '
                   +'        PcLine.PcPriceType,        '
                   +'        PcLine.PcStArtDate,        '
                   +'        PcLine.PcendDate,          '
                   +'        PcLine.PcStArtQty,         '
                   +'        PcLine.PcendQty,           '
                   +'        Pc.PcTaxRate_Percent,      '
                   +'        Pc.CurrencyCode,           '
                   +'        Currency.CurrencyName,     '
                   +'        PcLine.PcNo,                '
                   +'        PcLine.PcLineId,      '
                   +'        Pc.PcDate                  '
                   +' from PcLine                       '
                   +' join Pc on PcLine.PcNo=Pc.PcNo    '
                   +' left join Vendor on Pc.VendorCode=Vendor.VendorCode   '
                   +' left join Item on PcLine.ItemCode=Item.ItemCode       '
                   +' left join Uom on Item.UomCode=Uom.UomCode             '
                   +' left join Currency on Pc.CurrencyCode=Currency.CurrencyCode ';
  OrderByFields:='VendorCode,ItemCode,PcStArtDate';
  Condition := '1=2';
  GetData;
//  GetData;
  Act_Filter.Execute;
  Frm_Sys_Detail:=TFrm_Pm_Enter_PurcharsePrice_D.Create(Application);
end;

procedure TFrm_Pm_Enter_PurcharsePrice.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Pm_Enter_PurcharsePrice:=nil;
end;

procedure TFrm_Pm_Enter_PurcharsePrice.Act_DeleteExecute(Sender: TObject);
var
  SqlText:String;
  tmPmpsid:integer;
begin
  If AdoQry_Main.RecordCount=0 Then
    Exit;
  IF DispInfo('真的要删除这条记录吗?',2)='y' Then
  begin
    Dbconnect.beginTrans;
    Try
      If (AdoQry_Main.fieldbyname('ReferencePricePass').AsInteger=10 )
       or (AdoQry_Main.fieldbyname('FormalPricePass').AsInteger=1)  then 
      begin
        DispInfo('采购价格已批准,不可删除!',1);
        Abort;
      end;
      SqlText:='Delete PcLine '
              +' where PcNo='+''''+AdoQry_Main.fieldbyname('PcNo').AsString+''''
              +'   and PcLineId='+IntToStr(AdoQry_Main.fieldbyname('PcLineId').AsInteger);
      AdoQry_Tmp.Close;
      AdoQry_Tmp.SQL.Text:=SqlText;
      AdoQry_Tmp.ExecSQL;
      DbConnect.CommitTrans;
      AdoQry_Main.Delete;
    Except
      if dbconnect.InTransaction then
      DbConnect.RollBackTrans;
      DispInfo('删除数据过程中出错,记录未删除!',1);
      Abort;
    end;
  end;
end;

procedure TFrm_Pm_Enter_PurcharsePrice.FormCreate(Sender: TObject);
begin
  inherited;
  ExtendCaption:=False;
end;


procedure TFrm_Pm_Enter_PurcharsePrice.AdoQry_MainAfterPost(
  DataSet: TDataSet);
var SQlTExt : String;
begin
  inherited;
{    SqlText := 'Update PcLine '
             +'    set PcTaxPrice='+AdoQry_Main.fieldbyname('PcTaxPrice').AsString+','
             +'        PcNoTaxPrice='+AdoQry_Main.fieldbyname('PcNoTaxPrice').AsString+','
             +'        PcTaxPrice_Formal='+AdoQry_Main.fieldbyname('PcTaxPrice_Formal').AsString+','
             +'        PcNoTaxPrice_Formal='+AdoQry_Main.fieldbyname('PcNoTaxPrice_Formal').AsString+','
             +'        PcStArtDate='+QuotedStr(AdoQry_Main.fieldbyname('PcStArtDate').AsString)+','
             +'        PcendDate='+QuotedStr(AdoQry_Main.fieldbyname('PcendDate').AsString)+','
             +'        PcStArtQty='+AdoQry_Main.fieldbyname('PcStArtQty').AsString+','
             +'        PcendQty='+AdoQry_Main.fieldbyname('PcendQty').AsString
             +'  where PcNo='+QuotedStr(AdoQry_Main.fieldbyname('PcNo').AsString)
             +'   and PcLineId='+IntToStr(AdoQry_Main.fieldbyname('PcLineId').AsInteger);
    ExecuteSql(AdoQry_Tmp,SqlText,1) ;
}
end;

procedure TFrm_Pm_Enter_PurcharsePrice.AdoQry_MainPcTaxPriceChange(
  Sender: TField);
begin
  inherited;
//  AdoQry_Main.fieldbyname('PcNoTaxPrice').AsString := FormatFloat('0.000000',(AdoQry_Main.fieldbyname('PcTaxPrice').AsFloat)/(1+
//        AdoQry_Main.fieldbyname('PCTaxRate_Percent').AsFloat/100)));

end;

procedure TFrm_Pm_Enter_PurcharsePrice.AdoQry_MainPcNoTaxPriceChange(
  Sender: TField);
begin
  inherited;
//  Edt_PcTaxPrice.Text:=FloatToStr((StrToFloat(Edt_PcNoTaxPrice.Text)*
 //       (1+AdoQry_Maintain.fieldbyname('PCTaxRate_Percent').AsFloat/100)));

end;

end.

⌨️ 快捷键说明

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