📄 ap_enter_noinvoiceinvinorder.pas
字号:
unit Ap_Enter_NoInvoiceInvInOrder;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Body, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg, linkedit;
Type
TFrm_Ap_Enter_NoInvoiceInvInOrder = Class(TFrm_Base_Entry_Body)
Label1: TLabel;
LkEdt_VendorCode: TLinkEdit;
Edt_VendorName: TEdit;
Label3: TLabel;
Edt_InvBillNo: TEdit;
Label4: TLabel;
Edt_InvBillDate: TEdit;
Label6: TLabel;
CmBx_BillTypeCode: TComboBox;
Edt_BillTypeName: TEdit;
Label8: TLabel;
Edt_InvBillTaxRate: TEdit;
Label9: TLabel;
Edt_WhName: TEdit;
Label11: TLabel;
Edt_WhPositionName: TEdit;
Label13: TLabel;
Edt_CurrencyCode: TEdit;
Edt_CurrencyName: TEdit;
Label15: TLabel;
Edt_VendorBillNo: TEdit;
Label16: TLabel;
Label19: TLabel;
Edt_InvBillRemArk: TEdit;
CmBx_WhCode: TComboBox;
Edt_WhPositionCode: TComboBox;
Label2: TLabel;
Edt_ExchRate: TEdit;
procedure FormCreate(Sender: TObject);
procedure LkEdt_VendorCodeExit(Sender: TObject);
procedure LkEdt_VendorCodeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure LkEdt_VendorCodeButtonClick(Sender: TObject);
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure Act_NewExecute(Sender: TObject);
procedure Act_ModifyExecute(Sender: TObject);
procedure CmBx_WhCodeChange(Sender: TObject);
procedure DateCheck(Sender: TObject);
procedure Act_InsertLineExecute(Sender: TObject);
procedure CmBx_BillTypeCodeExit(Sender: TObject);
procedure Edt_WhPositionCodeExit(Sender: TObject);
procedure CmBx_WhCodeExit(Sender: TObject);
private
{ Private declarations }
Billid,Bill_ID,Billmemo,BillwhCode,BillWhPositionCode,Billno,BillTypeCode,
BillBillType2Code,BilloutName,BilloutCode,BilloutType,BillLoginDate,
currencyCode,Vendortaxrate_Percent,ExchRate:string;
IoType:real;
IsAfterprint,issecondinsert:boolean;
CurDate:string;
Function IsMasterCurrency(Currency:string):boolean;//是否本位币 1:为 本位币 0:为非本位币;
procedure InitCmbbx_WhPositionCode(whCode:string);
procedure Initcmbx_BillTypeCode;
public
{ Public declarations }
procedure InitControls;Override;
procedure SaveHeadData;Override;
procedure SaveData; Override;//把表头控件写入缓存,不要Post
procedure SetStatus(CurrentStatus:String;var AnswerStatus,EnableControls:String);Override;
end;
var
Frm_Ap_Enter_NoInvoiceInvInOrder: TFrm_Ap_Enter_NoInvoiceInvInOrder;
implementation
uses Ap_Enter_NoInvoiceInvInOrder_D, Sys_Global, Inv_Global,
Ap_Enter_NoInvoiceInvInOrderH;
{$R *.DFM}
{ TFrm_Ap_Enter_NoInvoiceInvInOrder }
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.InitControls;
begin
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
AmountFields:='InvBillnotaxAmount,InvBillAmount,';
PriceFields:='InvBillnotaxPrice,InvBillPrice,';
//初始化仓库
if Status<>'Add' then
Edt_InvBillNo.Text:=Billno
else
Edt_InvBillNo.Text:='';
if (showflag=True) and (status<>'Add') then
exit;
initUsablewhcmbx(AdoQry_tmp,userCode,CmBx_WhCode,False);
//初始化单据类型
Initcmbx_BillTypeCode;
//初始化入库对象
//initcmbbx_OutType;
//如果是增加,让InvBillNO=-1
if Status<>'Add' then
if showflag=False then
Bill_ID:=AdoQry_Head.fieldbyname('InvBillid').AsString
else
Bill_ID:=Billid
else
Bill_ID:='-1';
//取服务器的日期;
Executesql(AdoQry_tmp,'select convert (varchAr(10),getdate(),102) as a ',0);
curdate:=AdoQry_tmp.fieldbyname('a').asstring;
//取得相应的记录显示于DBGIRD
if status='Add' then
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add('select '+
' bl.InvBillid,'+
' bl.InvBilllineno,'+
' bl.ItemCode,'+
' i.ItemName,'+
' bl.BilllineremArk,'+
' bl.InvBillAmount,'+
' bl.InvBillnotaxAmount,'+
' bl.InvBillAmountc,'+
' bl.InvBillnotaxAmountc '+
' from InvInBillline bl,Item i'+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' Order by bl.InvBilllineno ');
open;
end
else
begin
if AdoQry_Head.fieldbyname('currencyCode').asstring='00' then
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add('select '+
' bl.InvBillid,'+
' bl.InvBilllineno,'+
' bl.ItemCode,'+
' i.ItemName,'+
' bl.BilllineremArk,'+
' bl.InvBillAmount,'+
' bl.InvBillnotaxAmount, '+
' bl.InvBillAmountc ,'+
' bl.InvBillnotaxAmountc '+
' from InvInBillline bl,Item i '+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' Order by bl.InvBilllineno ');
open;
end
else
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add('select '+
' bl.InvBillid,'+
' bl.InvBilllineno,'+
' bl.ItemCode,'+
' i.ItemName,'+
' bl.BilllineremArk,'+
' bl.InvBillAmount,'+
' bl.InvBillnotaxAmount, '+
' bl.InvBillAmountc as InvBillAmount,'+
' bl.InvBillnotaxAmountc as InvBillnotaxAmount'+
' from InvInBillline bl,Item i '+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' Order by bl.InvBilllineno ');
open;
end;
end;
with AdoQry_Head do
begin
if status<>'Add' then
begin
act_insertline.Enabled :=False;
act_Deleteline.Enabled :=False;
if (Status='Edit') or (Status='AllEdit') then
act_Modify.Enabled :=True
else
act_Modify.Enabled :=False;
if fieldbyname('InvBillno').asstring<>'' then
begin
InitCmBxText(CmBx_WhCode,fieldbyname('whCode').asstring);
//初始化货位
CmBx_WhCodeChange(CmBx_WhCode);
InitCmBxText(Edt_WhPositionCode,fieldbyname('WhPositionCode').asstring);
InitCmBxText(CmBx_BillTypeCode,fieldbyname('BillTypeCode').asstring);
//InitCmBxText(Cmbbx_OutType,fieldbyname('outType').asstring);
LkEdt_VendorCode.text:=fieldbyname('VendorCode').asstring;
Edt_VendorName.text:=fieldbyname('VendorName').asstring;
Edt_InvBillNo.text:=fieldbyname('InvBillNo').asstring;
Edt_InvBillDate.text:=fieldbyname('InvBillDate').asstring;
//Edt_InvBillMonth.text:=fieldbyname('InvBillMonth').asstring;
//CmBx_BillTypeCode.text:=fieldbyname('BillTypeCode').asstring;
Edt_BillTypeName.text:=fieldbyname('BillTypeName').asstring;
Edt_InvBillTaxRate.text:=fieldbyname('InvBillTaxRate').asstring;
CmBx_WhCode.text:=fieldbyname('WhCode').asstring;
Edt_WhName.text:=fieldbyname('WhName').asstring;
Edt_WhPositionCode.text:=fieldbyname('WhPositionCode').asstring;
Edt_WhPositionName.text:=fieldbyname('WhPositionName').asstring;
Edt_CurrencyCode.text:=fieldbyname('CurrencyCode').asstring;
Edt_CurrencyName.text:=fieldbyname('CurrencyName').asstring;
Edt_ExchRate.text:=fieldbyname('ExchRate').asstring;
Edt_VendorBillNo.text:=fieldbyname('VendorBillNo').asstring;
//Edt_InvBillCreateTime.text:=fieldbyname('InvBillCreateTime').asstring;
//Edt_Wh_EmployeeCode.text:=fieldbyname('WH_EmployeeCode').asstring;
//Edt_EmployeeName.text:=fieldbyname('EmployeeName').asstring;
Edt_InvBillRemArk.text:=fieldbyname('InvBillRemArk').asstring;
end
else
begin
//InitCmBxText(Cmbx_WhCode,BillwhCode);
//初始化货位
//cmbx_WhCodeexit(cmbbx_WhCode);
//InitCmBxText(Cmbbx_WhPositionCode,BillWhPositionCode);
//InitCmBxText(Cmbbx_BillType2Code,BillBillType2Code);
// InitCmBxText(Cmbbx_OutType,BilloutType);
//LkEdt_VendorCode.text:=BilloutCode;
Edt_VendorName.text:=BilloutName;
Edt_InvBillNo.text:=Billno;
Edt_InvBillRemArk.text:=Billmemo;
Edt_InvBillDate.text:=BillLoginDate;
end;
end
else
begin
initUsablewhcmbx(AdoQry_tmp,userCode,CmBx_WhCode,False);
CmBx_WhCodeExit(CmBx_WhCode);
//初始化单据类型
Initcmbx_BillTypeCode;
CmBx_BillTypeCodeExit(CmBx_BillTypeCode);
//定位仓库
//InitCmBxText(Cmbx_WhCode,fieldbyname('whCode').asstring);
//调用初始化货位
cmbx_WhCodeChange(cmbx_WhCode);
//定位货位
InitCmBxText(Edt_WhPositionCode,fieldbyname('WhPositionCode').asstring);
//定位入库类型
//InitCmBxText(Cmbbx_BillType2Code,fieldbyname('BillType2Code').asstring);
LkEdt_VendorCode.text:='';
Edt_VendorName.text:='';
Edt_InvBillNo.text:='';
Edt_InvBillDate.text:= CurDate;//fieldbyname('InvBillDate').asstring;
// Edt_InvBillMonth.text:=copy(LoginDate,1,7);
//CmBx_BillTypeCode.text:='';
//Edt_BillTypeName.text:='';
//Edt_InvBillTaxRate.text:='';
//CmBx_WhCode.text:='';
//Edt_WhName.text:='';
{Edt_WhPositionCode.text:='';
Edt_WhPositionName.text:='';
Edt_CurrencyCode.text:='';
Edt_CurrencyName.text:='';
Edt_VendorBillNo.text:='';}
// Edt_InvBillCreateTime.text:=formatdatetime('yyyy.mm.dd hh:mm:ss',now);
// Edt_Wh_EmployeeCode.text:=userCode;
{ with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select EmployeeName from Employee where EmployeeCode='''+userCode+'''');
open;
// Edt_EmployeeName.text:=fieldbyname('EmployeeName').asstring;
Close;
end;}
Edt_InvBillRemArk.text:='';
{if issecondinsert then
begin
cmbbx_OutType.ItemIndex:=outTypeposition;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -