📄 inv_otherinaudit_d.pas
字号:
unit Inv_OtherInAudit_D;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Detail, Db, AdODB, ExtCtrls, StdCtrls, ExtEdit;
Type
TFrm_Inv_OtherInAudit_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 Extedt_InvBillnotaxPriceKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
private
InvBilltaxrate:real;
outType,outCode:string;
{ Private declarations }
public
procedure InitControls; Override;//根据AdoQry_Body当前值,初始化Form的控件
procedure SaveBodyData; Override;//把Form的控件值写入缓存,要Post
procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,
FrmParam5,FrmParam6:String);Override;
//设置在部分修改状态下,那些控件Enable=True
{ Public declarations }
end;
var
Frm_Inv_OtherInAudit_D: TFrm_Inv_OtherInAudit_D;
implementation
uses Sys_Global,Inv_OtherIn_B, Inv_OtherIn_H, Inv_OtherInAudit_B;
{$R *.DFM}
procedure TFrm_Inv_OtherInAudit_D.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,
FrmParam5,FrmParam6:String);
begin
outType:=frmParam1;
outCode:=frmParam2;
// currencyCode:=frmParam3;
// Vendortaxrate_Percent:=frmParam4;
// ExchRate:=frmParam5;
end;
procedure TFrm_Inv_OtherInAudit_D.InitControls;
begin//根据AdoQry_Body当前值,初始化Form的控件
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;
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_OtherInAudit_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_OtherInAudit_D.FormCreate(Sender: TObject);
begin
inherited;
SetFocus_Control:=ExtEdt_InvBillPrice;//设置新增时要聚焦的控件
end;
procedure TFrm_Inv_OtherInAudit_D.Extedt_InvBillAmountExit(Sender: TObject);
var
InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
floatcheck(sender);
//数量
InvBillqty:=AdoQry_Body.fieldbyname('InvBillqty').asfloat;
//含税金额
{ 如果输入含税金额,则
含税单价=含税金额/数量
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
InvBillAmount:=strtofloat(Extedt_InvBillAmount.text);
//含税单价
InvBillPrice:=InvBillAmount/InvBillqty;
//不含税金额
InvBillnotaxAmount:=round(InvBillAmount/(1+InvBilltaxrate/100)*100)/100;
//不含税单价
InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
Extedt_InvBillnotaxAmount.text:=floattostr(InvBillnotaxAmount);
end;
procedure TFrm_Inv_OtherInAudit_D.Extedt_InvBillPriceExit(Sender: TObject);
var
InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
//数量
floatcheck(sender);
InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
{ 如果输入含税单价,则
含税金额=四舍五入保留两位小数(数量*含税单价)
不含税金额=含税金额/(1+税率/100)
不含税单价=不含税金额/数量}
//含税单价
InvBillPrice:=strtofloat(Extedt_InvBillPrice.text);
//含税金额
InvBillAmount:=round(InvBillPrice*InvBillqty*100)/100;
//不含税金额
InvBillnotaxAmount:=round(InvBillAmount/(1+InvBilltaxrate/100)*100)/100;
//不含税单价
InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
Extedt_InvBillAmount.text:=floattostr(InvBillAmount);
Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
Extedt_InvBillnotaxAmount.text:=floattostr(InvBillnotaxAmount);
end;
procedure TFrm_Inv_OtherInAudit_D.Extedt_InvBillnotaxPriceExit(
Sender: TObject);
var
InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
floatcheck(sender);
//数量
InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
{ 如果输入不含税单价,则
不含税金额=四舍五入保留两位小数(数量*不含税单价)
含税金额=不含税金额*(1+税率/100)
含税单价=含税金额/数量}
//不含税单价
InvBillnotaxPrice:=strtofloat(Extedt_InvBillnotaxPrice.text);
//不含税金额
InvBillnotaxAmount:=round(InvBillnotaxPrice*InvBillqty*100)/100;
//含税金额
InvBillAmount:=round(InvBillnotaxAmount*(1+InvBilltaxrate/100)*100)/100;
//含税单价
InvBillPrice:=InvBillAmount/InvBillqty;
Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
Extedt_InvBillAmount.text:=floattostr(InvBillAmount);
Extedt_InvBillnotaxAmount.text:=floattostr(InvBillnotaxAmount);
end;
procedure TFrm_Inv_OtherInAudit_D.Extedt_InvBillnotaxAmountExit(
Sender: TObject);
var
InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
floatcheck(sender);
//数量
InvBillqty:=strtofloat(lbl_InvBillqty.Caption);
{ 如果输入不含税金额,则
不含税单价=不含税金额/数量
含税金额=不含税金额*(1+税率/100)
含税单价=含税金额/数量}
//不含税金额
InvBillnotaxAmount:=strtofloat(Extedt_InvBillnotaxAmount.text);
//不含税单价
InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
//含税金额
InvBillAmount:=round(InvBillnotaxAmount*(1+InvBilltaxrate/100)*100)/100;
//含税单价
InvBillPrice:=InvBillAmount/InvBillqty;
Extedt_InvBillPrice.text:=floattostr(InvBillPrice);
Extedt_InvBillAmount.text:=floattostr(InvBillAmount);
Extedt_InvBillnotaxPrice.text:=floattostr(InvBillnotaxPrice);
end;
procedure TFrm_Inv_OtherInAudit_D.Extedt_InvBillnotaxPriceKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=vk_f9 then
CommonHint(Sender,AdoQry_tmp,'ItemCodeName',
'物料标识','Price','单价','vw_OtherPrice','VendorCode='''+outCode+'''');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -