📄 ap_enter_noinvoiceinvinorder.pas
字号:
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.SetStatus(
CurrentStatus: String; var AnswerStatus, EnableControls: String);
begin
inherited;
if CurrentStatus='Add' then
begin
AnswerStatus:='Add';
EnableControls:='Edt_InvBillRemArk,';
end
else if CurrentStatus='ReadOnly' then
begin
AnswerStatus:='ReadOnly';
EnableControls:='';
end;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.FormCreate(Sender: TObject);
begin
inherited;
Frm_Entry_Detail:=TFrm_Ap_Enter_NoInvoiceInvInOrder_D.Create(Self);//设置弹出Detail
SetFocus_Control:=LkEdt_VendorCode ;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.LkEdt_VendorCodeExit(
Sender: TObject);
begin
inherited;
if activecontrol.Name='ToolButton4' then
abort;
if Trim(LkEdt_VendorCode.text)='' then
begin
DispInfo('供应商代码不能为空',3);
LkEdt_VendorCode.setfocus;
abort;
end;
UsableVendorCodecheck(sender);
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add(' select Vendor.currencyCode,Vendor.VendorName,'+
' currency.currencyCode,currency.currencyName,'+
' Vendortaxrate_Percent '+
' from Vendor '+
' left join currency '+
' on Vendor.currencyCode=currency.currencyCode '+
' where Vendor.VendorCode='''+Trim(LkEdt_VendorCode.text)+'''');
open;
if recordCount<>0 then
begin
currencyCode:=fieldbyname('currencyCode').asstring;
Vendortaxrate_Percent:=fieldbyname('Vendortaxrate_Percent').asstring;
Edt_VendorName.text:=fieldbyname('VendorName').asstring;
Edt_InvBillTaxRate.text:=fieldbyname('Vendortaxrate_Percent').asstring;
Edt_CurrencyCode.text:=fieldbyname('currencyCode').asstring;
Edt_CurrencyName.text:=fieldbyname('currencyName').asstring;
if IsMasterCurrency(Edt_CurrencyCode.text)then
begin
ExchRate:='1';
Edt_ExchRate.text:='1';
Edt_ExchRate.Enabled :=False;
end
else
begin
Close;
sql.clear;
sql.Add('select ExchRate from ExchRate where exchMonth='''+copy(Trim(Edt_InvBillDate.text),1,7)+''' and currencyCode='''+currencyCode+'''');
open;
if not eof then
begin
ExchRate:=fieldbyname('ExchRate').asstring;
Edt_ExchRate.Text:=fieldbyname('ExchRate').asstring;
Edt_ExchRate.Enabled :=False;
end
else
begin
//这里将存在一个问题,暂不考虑
//DispInfo('该供应商主控货币'+currencyCode+' '+'在'+copy(Edt_InvBillDate.text,1,7)+' 月没有定义!',3);
Edt_ExchRate.setfocus;
end;
end;
end
else
begin
DispInfo('此供应商代码不存在或没有生效!,请重新输入!',3);
LkEdt_VendorCode.setfocus;
abort;
end;
end;
Edt_WhPositionCodeExit(Edt_WhPositionCode);
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.LkEdt_VendorCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if(Key=120)then
CommonHint(Sender,AdoQry_Tmp,'VendorName','供应商名称','VendorCode',
'供应商代码','Vendor','VendorUsable=1');
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.LkEdt_VendorCodeButtonClick(
Sender: TObject);
begin
inherited;
CommonHint(Sender,AdoQry_Tmp,'VendorName','供应商名称','VendorCode',
'供应商代码','Vendor','VendorUsable=1');
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Act_PreviewExecute(
Sender: TObject);
begin
//inherited;
IsAfterprint:=True;
BillPrint(AdoQry_Tmp.Connection,GetCode(CmBx_WhCode.text),Edt_InvBillNo.text,getCode(CmBx_BillTypeCode.text),'Stk',True,False,True,'');
IsAfterprint:=False;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Act_PrintExecute(
Sender: TObject);
begin
inherited;
IsAfterprint:=True;
BillPrint(AdoQry_Tmp.Connection,GetCode(CmBx_WhCode.text),Edt_InvBillNo.text,getCode(CmBx_BillTypeCode.text),'Stk',False,False,True,'');
IsAfterprint:=False;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Act_NewExecute(
Sender: TObject);
begin
IsAfterprint:=False;
issecondinsert:=True;
inherited;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Act_ModifyExecute(
Sender: TObject);
begin
//把Detail中要用到的参数从BODY传过去
LkEdt_VendorCodeExit(LkEdt_VendorCode);
Frm_Entry_Detail.SetFormParam('','',currencyCode,Vendortaxrate_Percent,ExchRate,'');
TFrm_Ap_Enter_NoInvoiceInvInOrder_D(Frm_Entry_Detail).setformParam1(getCode(CmBx_WhCode.text),getCode(Edt_WhPositionCode.text));
inherited;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.InitCmbbx_WhPositionCode(
whCode: string);
begin
//初始化货位,根据当前传入的仓库号码,选出不是待检货位及不是拉式货位的货位
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select WhPositionCode,WhPositionName '+
' from WhPosition '+
' where whCode='''+whCode+''''+
' and WhPositionType<>1 '+
' and BackFlushWhP=0 '+
' Order by WhPositionCode ');
open;
Edt_WhPositionCode.clear;
if not Eof then
begin
First;
while not Eof do
begin
Edt_WhPositionCode.Items.Add(fieldbyname('WhPositionCode').asstring+' '+fieldbyname('WhPositionName').asstring);
Next;
end;
Edt_WhPositionCode.Itemindex:=0;
end;
end;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.CmBx_WhCodeChange(
Sender: TObject);
begin
inherited;
initcmbbx_WhPositionCode(getCode(CmBx_WhCode.text));
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.DateCheck(Sender: TObject);
begin
inherited;
//Edt_InvBillMonth.text:=copy(Edt_InvBillDate.text,1,7);
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Act_InsertLineExecute(
Sender: TObject);
begin
LkEdt_VendorCodeExit(LkEdt_VendorCode);
Billno:=getno(AdoQry_Body.Connection,getCode(CmBx_WhCode.text)+'R'+copy(Edt_InvBillDate.text,3,2)+copy(Edt_InvBillDate.text,6,2),'InvBill');
Edt_InvBillNo.text:=Billno;
Edt_InvBillNo.enabled:=False;
Frm_Entry_Detail.SetFormParam('','',currencyCode,Vendortaxrate_Percent,ExchRate,'');
TFrm_Ap_Enter_NoInvoiceInvInOrder_D(Frm_Entry_Detail).setformParam1(getCode(CmBx_WhCode.text),getCode(Edt_WhPositionCode.text));
inherited;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Initcmbx_BillTypeCode;
begin
with AdoQry_Tmp do
begin
Close;
Sql.clear;
sql.text:=' select BillTypeCode from BillType where io=0';
open;
CmBx_BillTypeCode.clear;
First;
while not eof do
begin
CmBx_BillTypeCode.Items.Add (fieldbyname('BillTypeCode').asstring);
next;
end;
end;
CmBx_BillTypeCode.ItemIndex :=0;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.CmBx_BillTypeCodeExit(
Sender: TObject);
begin
inherited;
with AdoQry_Tmp do
begin
Close;
Sql.clear;
sql.text:=' select BillTypeName from BillType '
+' where BillTypeCode='''+Trim(CmBx_BillTypeCode.text)+''''+' and io=0 ';
open;
if not eof then
Edt_BillTypeName.text:=fieldbyname('BillTypeName').asstring;
end;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.Edt_WhPositionCodeExit(
Sender: TObject);
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add(' select WhPositionName '+
' from WhPosition '+
' where WhPositionCode='''+getCode(Edt_WhPositionCode.text)+'''');
open;
if not eof then
Edt_WhPositionName.text:=fieldbyname('WhPositionName').asstring;
Close;
end;
end;
procedure TFrm_Ap_Enter_NoInvoiceInvInOrder.CmBx_WhCodeExit(
Sender: TObject);
begin
inherited;
with AdoQry_Tmp do
begin
Close;
sql.clear;
sql.Add('select whName from Warehouse where whCode='''+getCode(CmBx_WhCode.text)+'''');
open;
Edt_WhName.text:=fieldbyname('whName').asstring;
Close;
end;
end;
function TFrm_Ap_Enter_NoInvoiceInvInOrder.IsMasterCurrency(
Currency: string): boolean;
begin
Result:=False;
Executesql(AdoQry_tmp,'select isMaster from Currency where CurrencyCode='''+Currency+'''',0);
if AdoQry_tmp.fieldbyname('isMaster').asinteger=1 then
Result:=True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -