📄 inv_priceaudit_poblnc_d.pas
字号:
unit Inv_PriceAudit_PoBlnc_D;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Detail, Db, AdODB, ExtCtrls, StdCtrls, ExtEdit;
Type
TFrm_Inv_PriceAudit_PoBlnc_D = Class(TFrm_Base_Entry_Detail)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Extedt_realpotaxPrice: TExtEdit;
Extedt_realpotaxAmount: TExtEdit;
Extedt_realponotaxPrice: TExtEdit;
Extedt_realponotaxAmount: TExtEdit;
Label10: TLabel;
Label11: TLabel;
lbl_ItemName: TLabel;
lbl_UomName: TLabel;
lbl_taxrate: TLabel;
lbl_Poqty: TLabel;
lbl_PoreferencedPrice: TLabel;
lbl_PotaxPrice: TLabel;
lbl_PotaxAmount: TLabel;
procedure Extedt_realpotaxPriceExit(Sender: TObject);
procedure Extedt_realpotaxAmountExit(Sender: TObject);
procedure Extedt_realponotaxPriceExit(Sender: TObject);
procedure Extedt_realponotaxAmountExit(Sender: TObject);
private
oldrealpotaxPrice,oldrealpotaxAmount,oldrealponotaxAmount,oldrealponotaxPrice:string;
{ Private declarations }
public
procedure InitControls; Override;//根据AdoQry_Body当前值,初始化Form的控件
procedure SaveBodyData; Override;//把Form的控件值写入缓存,要Post
{ Public declarations }
end;
var
Frm_Inv_PriceAudit_PoBlnc_D: TFrm_Inv_PriceAudit_PoBlnc_D;
implementation
uses Inv_PriceAudit_PoBlnc_B;
{$R *.DFM}
procedure TFrm_Inv_PriceAudit_PoBlnc_D.InitControls;
begin
lbl_ItemName.Caption:=AdoQry_Body.fieldbyname('ItemName').asstring;
lbl_UomName.Caption:=AdoQry_Body.fieldbyname('UomName').asstring;
lbl_taxrate.Caption:=Frm_Inv_PriceAudit_PoBlnc_B.lbl_taxrate.Caption;
lbl_Poqty.Caption:=AdoQry_Body.fieldbyname('poqty').asstring;
lbl_PoreferencedPrice.Caption:=AdoQry_Body.fieldbyname('poreferencedPrice').asstring;
lbl_PotaxPrice.Caption:=AdoQry_Body.fieldbyname('potaxPrice').asstring;
lbl_PotaxAmount.Caption:=AdoQry_Body.fieldbyname('potaxAmount').asstring;
Extedt_realpotaxPrice.text:=AdoQry_Body.fieldbyname('realpotaxPrice').asstring;
Extedt_realpotaxAmount.text:=AdoQry_Body.fieldbyname('realpotaxAmount').asstring;
Extedt_realponotaxPrice.text:=AdoQry_Body.fieldbyname('realponotaxPrice').asstring;
Extedt_realponotaxAmount.text:=AdoQry_Body.fieldbyname('realponotaxAmount').asstring;
oldrealpotaxPrice:=Extedt_realpotaxPrice.text;
oldrealpotaxAmount:=Extedt_realpotaxAmount.text;
oldrealponotaxAmount:=Extedt_realponotaxAmount.text;
oldrealponotaxPrice:=Extedt_realponotaxPrice.text;
//状态控制-----
Extedt_realpotaxPrice.ReadOnly:=False;
Extedt_realpotaxPrice.TabStop:=True;
Extedt_realpotaxAmount.ReadOnly:=False;
Extedt_realpotaxAmount.TabStop :=True;
Extedt_realponotaxPrice.ReadOnly:=False;
Extedt_realponotaxPrice.TabStop :=True;
Extedt_realponotaxAmount.ReadOnly:=False;
Extedt_realponotaxAmount.TabStop :=True;
//------------
SetFocus_Control:=Extedt_realpotaxPrice;
inherited;
end;
procedure TFrm_Inv_PriceAudit_PoBlnc_D.SaveBodyData;//把Form的控件值写入缓存,要Post
begin
inherited;
with AdoQry_Body do
begin
AdoQry_Body.fieldbyname('realpotaxPrice').asstring:=Extedt_realpotaxPrice.text;
AdoQry_Body.fieldbyname('realpotaxAmount').asstring:=Extedt_realpotaxAmount.text;
AdoQry_Body.fieldbyname('realponotaxPrice').asstring:=Extedt_realponotaxPrice.text;
AdoQry_Body.fieldbyname('realponotaxAmount').asstring:=Extedt_realponotaxAmount.text;
end;
end;
procedure TFrm_Inv_PriceAudit_PoBlnc_D.Extedt_realpotaxPriceExit(
Sender: TObject);
var
taxrate,poqty,realpotaxPrice,realpotaxAmount,realponotaxAmount,realponotaxPrice:real;
begin
floatcheck(sender);
//数量
if oldrealpotaxPrice<>Extedt_realpotaxPrice.text then
begin
taxrate:=strtofloat(lbl_taxrate.Caption);
poqty:=strtofloat(lbl_Poqty.Caption);
{ 如果输入含税单价,则
含税金额=四舍五入保留两位小数(数量*含税单价)
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
//含税单价
realpotaxPrice:=strtofloat(Extedt_realpotaxPrice.text);
//含税金额
realpotaxAmount:=realpotaxPrice*poqty;
//不含税金额
realponotaxAmount:=realpotaxAmount/(1+taxrate/100);
//不含税单价
realponotaxPrice:=realponotaxAmount/poqty;
//所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
Extedt_realpotaxAmount.text:=formatfloat('#.00',realpotaxAmount);
Extedt_realponotaxPrice.text:=floattostr(realponotaxPrice);
Extedt_realponotaxAmount.text:=formatfloat('#.00',realponotaxAmount);
oldrealpotaxPrice:=Extedt_realpotaxPrice.text;
oldrealpotaxAmount:=Extedt_realpotaxAmount.text;
oldrealponotaxAmount:=Extedt_realponotaxAmount.text;
oldrealponotaxPrice:=Extedt_realponotaxPrice.text;
end;
end;
procedure TFrm_Inv_PriceAudit_PoBlnc_D.Extedt_realpotaxAmountExit(
Sender: TObject);
var
taxrate,poqty,realpotaxPrice,realpotaxAmount,realponotaxAmount,realponotaxPrice:real;
begin
inherited;
floatcheck(sender);
//数量
if oldrealpotaxAmount<>Extedt_realpotaxAmount.text then
begin
taxrate:=strtofloat(lbl_taxrate.Caption);
poqty:=strtofloat(lbl_Poqty.Caption);
{ 如果输入含税单价,则
含税金额=四舍五入保留两位小数(数量*含税单价)
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
//含税单价
realpotaxAmount:=strtofloat(Extedt_realpotaxAmount.text);
//含税金额
realpotaxPrice:=realpotaxAmount/poqty;
//不含税金额
realponotaxAmount:=realpotaxAmount/(1+taxrate/100);
//不含税单价
realponotaxPrice:=realponotaxAmount/poqty;
//所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
Extedt_realpotaxPrice.text:=floattostr(realpotaxPrice);
Extedt_realponotaxPrice.text:=floattostr(realponotaxPrice);
Extedt_realponotaxAmount.text:=formatfloat('#.00',realponotaxAmount);
oldrealpotaxPrice:=Extedt_realpotaxPrice.text;
oldrealpotaxAmount:=Extedt_realpotaxAmount.text;
oldrealponotaxAmount:=Extedt_realponotaxAmount.text;
oldrealponotaxPrice:=Extedt_realponotaxPrice.text;
end;
end;
procedure TFrm_Inv_PriceAudit_PoBlnc_D.Extedt_realponotaxPriceExit(
Sender: TObject);
var
taxrate,poqty,realpotaxPrice,realpotaxAmount,realponotaxAmount,realponotaxPrice:real;
begin
floatcheck(sender);
//数量
if oldrealponotaxPrice<>Extedt_realponotaxPrice.text then
begin
taxrate:=strtofloat(lbl_taxrate.Caption);
poqty:=strtofloat(lbl_Poqty.Caption);
{ 如果输入含税单价,则
含税金额=四舍五入保留两位小数(数量*含税单价)
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
//不含税单价
realponotaxPrice:=strtofloat(Extedt_realponotaxPrice.text);
//不含税金额
realponotaxAmount:=realponotaxPrice*poqty;
//含税金额
realpotaxAmount:=realponotaxAmount*(1+taxrate/100);
//含税单价
realpotaxPrice:=realpotaxAmount/poqty;
Extedt_realpotaxPrice.text:=floattostr(realpotaxPrice);
Extedt_realpotaxAmount.text:=formatfloat('#.00',realpotaxAmount);
Extedt_realponotaxAmount.text:=formatfloat('#.00',realponotaxAmount);
//所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
oldrealpotaxPrice:=Extedt_realpotaxPrice.text;
oldrealpotaxAmount:=Extedt_realpotaxAmount.text;
oldrealponotaxAmount:=Extedt_realponotaxAmount.text;
oldrealponotaxPrice:=Extedt_realponotaxPrice.text;
end;
end;
procedure TFrm_Inv_PriceAudit_PoBlnc_D.Extedt_realponotaxAmountExit(
Sender: TObject);
var
taxrate,poqty,realpotaxPrice,realpotaxAmount,realponotaxAmount,realponotaxPrice:real;
begin
floatcheck(sender);
//数量
if oldrealponotaxAmount<>Extedt_realponotaxAmount.text then
begin
taxrate:=strtofloat(lbl_taxrate.Caption);
poqty:=strtofloat(lbl_Poqty.Caption);
{ 如果输入含税单价,则
含税金额=四舍五入保留两位小数(数量*含税单价)
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
//不含税金额
realponotaxAmount:=strtofloat(Extedt_realponotaxAmount.text);
//不含税单价
realponotaxPrice:=realponotaxAmount/poqty;
//含税金额
realpotaxAmount:=realponotaxAmount*(1+taxrate/100);
//含税单价
realpotaxPrice:=realpotaxAmount/poqty;
Extedt_realpotaxAmount.text:=formatfloat('#.00',realpotaxAmount);
Extedt_realponotaxPrice.text:=floattostr(realponotaxPrice);
Extedt_realpotaxPrice.text:=floattostr(realpotaxPrice);
//所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
oldrealpotaxPrice:=Extedt_realpotaxPrice.text;
oldrealpotaxAmount:=Extedt_realpotaxAmount.text;
oldrealponotaxAmount:=Extedt_realponotaxAmount.text;
oldrealponotaxPrice:=Extedt_realponotaxPrice.text;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -