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

📄 inv_priceaudit_d.pas

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

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Entry_Detail, Db, AdODB, ExtCtrls, StdCtrls, ExtEdit;

Type
  TFrm_Inv_PriceAudit_D = Class(TFrm_Base_Entry_Detail)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    lbl_ItemName: TLabel;
    lbl_InvBillqty: TLabel;
    Extedt_InvBillPrice: TExtEdit;
    Extedt_InvBillAmount: TExtEdit;
    Extedt_InvBillnotaxPrice: TExtEdit;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Extedt_InvBillnotaxAmount: TExtEdit;
    Label9: TLabel;
    lbl_ItemCode: TLabel;
    edt_memo: TEdit;
    Label4: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Extedt_InvBillAmountExit(Sender: TObject);
    procedure Extedt_InvBillPriceExit(Sender: TObject);
    procedure Extedt_InvBillnotaxPriceExit(Sender: TObject);
    procedure Extedt_InvBillnotaxAmountExit(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    InvBilltaxrate:real;
    BillTypeCode,oldInvBillAmount,oldInvBillPrice,oldInvBillnotaxPrice,oldInvBillnotaxAmount:string;
    { Private declarations }
  public
      procedure InitControls; Override;//根据AdoQry_Body当前值,初始化Form的控件
      procedure SaveBodyData; Override;//把Form的控件值写入缓存,要Post

    //设置在部分修改状态下,那些控件Enable=True
    { Public declarations }
  end;

var
  Frm_Inv_PriceAudit_D: TFrm_Inv_PriceAudit_D;

implementation

uses Sys_Global,Inv_OtherIn_B, Inv_OtherIn_H, Inv_OtherInAudit_B;
{$R *.DFM}

procedure TFrm_Inv_PriceAudit_D.InitControls;
begin//根据AdoQry_Body当前值,初始化Form的控件
  BillTypeCode:=Param1;

  with AdoQry_Body do
  begin
    if status='Add' then
    begin
    end
    else
    begin
      InvBilltaxrate:=AdoQry_Head.fieldbyname('InvBilltaxrate').asfloat;
      lbl_ItemCode.Caption:=fieldbyname('ItemCode').asstring;
      Lbl_ItemName.Caption:=fieldbyname('ItemName').asstring;
      lbl_InvBillqty.Caption:=fieldbyname('InvBillqty').asstring;
      ExtEdt_InvBillPrice.Text:=fieldbyname('InvBillPrice').asstring;
      ExtEdt_InvBillAmount.Text:=fieldbyname('InvBillAmount').asstring;
      ExtEdt_InvBillnotaxPrice.Text:=fieldbyname('InvBillnotaxPrice').asstring;
      ExtEdt_InvBillnotaxAmount.Text:=fieldbyname('InvBillnotaxAmount').asstring;
      oldInvBillAmount:=fieldbyname('InvBillAmount').asstring;
      oldInvBillPrice:=fieldbyname('InvBillPrice').asstring;
      oldInvBillnotaxPrice:=fieldbyname('InvBillnotaxPrice').asstring;
      oldInvBillnotaxAmount:=fieldbyname('InvBillnotaxAmount').asstring;
      edt_memo.Text:=fieldbyname('BilllineremArk').asstring;
    end;
  end;

  //状态控制-----
  Extedt_InvBillnotaxAmount.ReadOnly:=False;
  Extedt_InvBillnotaxAmount.TabStop:=True;
  Extedt_InvBillAmount.ReadOnly:=False;
  Extedt_InvBillAmount.TabStop :=True;
  Extedt_InvBillnotaxPrice.ReadOnly:=False;
  Extedt_InvBillnotaxPrice.TabStop :=True;
  Extedt_InvBillPrice.ReadOnly:=False;
  Extedt_InvBillPrice.TabStop :=True;
  //------------
  inherited;
end;

procedure TFrm_Inv_PriceAudit_D.SaveBodyData;
begin//把Form的控件值写入缓存,要Post
  inherited;
  with AdoQry_Body do
  begin
    fieldbyname('InvBillPrice').AsString:=ExtEdt_InvBillPrice.Text;
    fieldbyname('InvBillAmount').AsString:=Extedt_InvBillAmount.text;
    fieldbyname('InvBillnotaxPrice').AsString:=Extedt_InvBillnotaxPrice.text;
    fieldbyname('InvBillnotaxAmount').AsString:=ExtEdt_InvBillnotaxAmount.Text;
    fieldbyname('BilllineremArk').asstring:=edt_memo.text;
    Post;
  end;
end;

procedure TFrm_Inv_PriceAudit_D.FormCreate(Sender: TObject);
begin
  inherited;
  SetFocus_Control:=ExtEdt_InvBillPrice;//设置新增时要聚焦的控件
end;



procedure TFrm_Inv_PriceAudit_D.Extedt_InvBillAmountExit(Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
  //数量
  floatcheck(sender);
  if  oldInvBillAmount<>Extedt_InvBillAmount.text then
  begin
    InvBillqty:=AdoQry_Body.fieldbyname('InvBillqty').asfloat;
      //含税金额
       {  如果输入含税金额,则
       含税单价=含税金额/数量
       不含税金额=含税金额/(1+税率/100)
       不含税单价=不含税金额/数量}
    InvBillAmount:=strtofloat(Extedt_InvBillAmount.text);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;
    //不含税金额
    InvBillnotaxAmount:=InvBillAmount/(1+InvBilltaxrate/100);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;

    Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
    Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
    Extedt_InvBillnotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    oldInvBillPrice:=Extedt_InvBillPrice.text;
    oldInvBillAmount:=Extedt_InvBillAmount.text;
    oldInvBillnotaxPrice:=Extedt_InvBillnotaxPrice.text;
    oldInvBillnotaxAmount:=Extedt_InvBillnotaxAmount.text;

  end;

end;

procedure TFrm_Inv_PriceAudit_D.Extedt_InvBillPriceExit(Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
  floatcheck(sender);
  //数量
  if oldInvBillPrice<>Extedt_InvBillPrice.text then
  begin
    InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
    {  如果输入含税单价,则
       含税金额=四舍五入保留两位小数(数量*含税单价)
       不含税金额=含税金额/(1+税率/100)
       不含税单价=不含税金额/数量}
    //含税单价
    InvBillPrice:=strtofloat(Extedt_InvBillPrice.text);
    //含税金额
    InvBillAmount:=InvBillPrice*InvBillqty;
    //不含税金额
   InvBillnotaxAmount:=InvBillAmount/(1+InvBilltaxrate/100);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
    Extedt_InvBillAmount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
    Extedt_InvBillnotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    oldInvBillPrice:=Extedt_InvBillPrice.text;
    oldInvBillAmount:=Extedt_InvBillAmount.text;
    oldInvBillnotaxPrice:=Extedt_InvBillnotaxPrice.text;
    oldInvBillnotaxAmount:=Extedt_InvBillnotaxAmount.text;
  end;
end;

procedure TFrm_Inv_PriceAudit_D.Extedt_InvBillnotaxPriceExit(
  Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
  //数量
  floatcheck(sender);
  if  oldInvBillnotaxPrice<>Extedt_InvBillnotaxPrice.text then
  begin
    InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
    {   如果输入不含税单价,则
        不含税金额=四舍五入保留两位小数(数量*不含税单价)
        含税金额=不含税金额*(1+税率/100)
        含税单价=含税金额/数量}
    //不含税单价
    InvBillnotaxPrice:=strtofloat(Extedt_InvBillnotaxPrice.text);
      //不含税金额
    InvBillnotaxAmount:=InvBillnotaxPrice*InvBillqty;
    //含税金额
   InvBillAmount:=InvBillnotaxAmount*(1+InvBilltaxrate/100);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;
    Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
    Extedt_InvBillAmount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_InvBillnotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    oldInvBillPrice:=Extedt_InvBillPrice.text;
    oldInvBillAmount:=Extedt_InvBillAmount.text;
    oldInvBillnotaxPrice:=Extedt_InvBillnotaxPrice.text;
    oldInvBillnotaxAmount:=Extedt_InvBillnotaxAmount.text;
  end;
end;

procedure TFrm_Inv_PriceAudit_D.Extedt_InvBillnotaxAmountExit(
  Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
  //数量
  floatcheck(sender);
  if oldInvBillnotaxAmount<>Extedt_InvBillnotaxAmount.text then
  begin
    InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
      {   如果输入不含税金额,则
          不含税单价=不含税金额/数量
          含税金额=不含税金额*(1+税率/100)
          含税单价=含税金额/数量}
    //不含税金额
    InvBillnotaxAmount:=strtofloat(Extedt_InvBillnotaxAmount.text);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
    //含税金额
   // InvBillAmount:=round(InvBillnotaxAmount*(1+InvBilltaxrate/100)*100)/100;
    InvBillAmount:=InvBillnotaxAmount*(1+InvBilltaxrate/100);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;
    Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
    Extedt_InvBillAmount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
    oldInvBillPrice:=Extedt_InvBillPrice.text;
    oldInvBillAmount:=Extedt_InvBillAmount.text;
    oldInvBillnotaxPrice:=Extedt_InvBillnotaxPrice.text;
    oldInvBillnotaxAmount:=Extedt_InvBillnotaxAmount.text;
  end;

end;

procedure TFrm_Inv_PriceAudit_D.FormActivate(Sender: TObject);
begin
  inherited;
  if Param2='暂估价' then
    Caption:='采购入库暂估价单据处理'
  else
    Caption:='采购入库单据核价';
end;

end.

⌨️ 快捷键说明

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