📄 inv_otherin_b.pas
字号:
unit Inv_OtherIn_B;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Body, Db, ActnList, AdODB, Grids, DBGridEh, ExtCtrls,
ComCtrls, ToolWin, Mask, StdCtrls, ExtEdit, DBCtrls, ExtPrintReport, jpeg,
linkedit;
Type
TFrm_Inv_OtherIn_B = Class(TFrm_Base_Entry_Body)
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label7: TLabel;
Label8: TLabel;
Label10: TLabel;
Label13: TLabel;
Label16: TLabel;
Extedt_Billno: TExtEdit;
medt_Date: TMaskEdit;
Extedt_memo: TExtEdit;
cmbbx_WhCode: TComboBox;
cmbbx_WhPositionCode: TComboBox;
cmbbx_BillType2Code: TComboBox;
cmbbx_OutType: TComboBox;
Label3: TLabel;
DBText1: TDBText;
Label6: TLabel;
Label9: TLabel;
lbl_OutName: TEdit;
Extedt_OutCode: TLinkEdit;
lb_Vendortaxrate_Percent: TEdit;
lbl_CurrencyName: TEdit;
procedure FormCreate(Sender: TObject);
procedure Extedt_OutCode1Exit(Sender: TObject);
procedure DateCheck(Sender: TObject);
procedure Act_QuitExecute(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure cmbbx_WhCodeChange(Sender: TObject);
procedure Extedt_OutCode1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure AdoQry_BodyAfterPost(DataSet: TDataSet);
procedure AdoQry_BodyBeforePost(DataSet: TDataSet);
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure cmbbx_BillType2CodeExit(Sender: TObject);
procedure cmbbx_OutTypeExit(Sender: TObject);
procedure Act_InsertLineExecute(Sender: TObject);
procedure Act_ModifyExecute(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Act_NewExecute(Sender: TObject);
procedure Extedt_OutCodeExit(Sender: TObject);
procedure Extedt_OutCodeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Extedt_OutCodeButtonClick(Sender: TObject);
private
Billid,Billmemo,BillwhCode,BillWhPositionCode,Billno,BillTypeCode,
BillBillType2Code,BilloutName,BilloutCode,BilloutType,BillLoginDate,
currencyCode,Vendortaxrate_Percent,ExchRate:string;
IoType:real;
IsAfterprint,issecondinsert:boolean;
outTypeposition:integer;
outCode,outName:string;
procedure checkIOType;
procedure InitCmbbx_WhPositionCode(whCode:string);
procedure InitCmbbx_BillType2Code;
procedure InitCmbbx_OutType;
{ Private declarations }
public
Bill_id:string;
procedure InitControls;Override;
procedure SaveHeadData;Override;
procedure SaveData; Override;//把表头控件写入缓存,不要Post
procedure SetStatus(CurrentStatus:String;var AnswerStatus,
EnableControls:String);Override;
{ Public declarations }
end;
var
Frm_Inv_OtherIn_B: TFrm_Inv_OtherIn_B;
implementation
uses Sys_Global,Inv_OtherIn_D,Inv_Global,Inv_OtherIn_H;
{$R *.DFM}
procedure TFrm_Inv_OtherIn_B.checkIOType;
begin
//录入数据要同时为正,或同时为负
if IoType<>0 then
if AdoQry_Body.fieldbyname('InvBillqty').asfloat*IoType<0 then
begin
DispInfo('同一请领,不能出现正负数量混合的情况!',1);
abort;
end;
end;
procedure TFrm_Inv_OtherIn_B.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;
cmbbx_WhPositionCode.clear;
if not Eof then
begin
First;
while not Eof do
begin
cmbbx_WhPositionCode.Items.Add(fieldbyname('WhPositionCode').asstring+' '+fieldbyname('WhPositionName').asstring);
Next;
end;
cmbbx_WhPositionCode.Itemindex:=0;
end;
end;
end;
procedure TFrm_Inv_OtherIn_B.InitCmbbx_BillType2Code;
begin
//初始化入库类型
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select BillType2Code,BillType2Name '+
' from BillType2 '+
' where io2=0 and isshow=0 and isinuse=0 '+
' and BillType2Code not in (''098'',''116'')');
open;
cmbbx_BillType2Code.clear;
if not Eof then
begin
First;
while not Eof do
begin
cmbbx_BillType2Code.Items.Add(fieldbyname('BillType2Code').asstring+' '+fieldbyname('BillType2Name').asstring);
Next;
end;
end;
end;
end;
procedure TFrm_Inv_OtherIn_B.InitCmbbx_OutType;
begin
//初始化入库对象
cmbbx_OutType.clear;
cmbbx_OutType.Items.Add('供应商');
cmbbx_OutType.Items.Add('部门');
cmbbx_OutType.Itemindex:=1;
end;
procedure TFrm_Inv_OtherIn_B.InitControls;
begin//初始化Form上的控件
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
AmountFields:='InvBillnotaxAmount,InvBillAmount,';
PriceFields:='InvBillnotaxPrice,InvBillPrice,';
//初始化仓库
if Status<>'Add' then
ExtEdt_BillNo.Text:=Billno
else
ExtEdt_BillNo.Text:='';
if (showflag=True) and (status<>'Add') then
exit;
initUsablewhcmbx(AdoQry_tmp,userCode,cmbbx_WhCode,False);
//初始化单据类型
initcmbbx_BillType2Code;
//初始化入库对象
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';
//取得相应的记录显示于DBGIRD
if status='Add' then
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add('select '+
' bl.InvBillid,'+
' bl.InvBilllineno,'+
' bl.InvBillqty,'+
' bl.ItemCode,'+
' i.ItemName,'+
' u.UomName,'+
' bl.BilllineremArk,'+
' bl.Batchno,'+
' bl.InvBillPrice,'+
' bl.InvBillAmount,'+
' bl.InvBillnotaxPrice,'+
' bl.InvBillnotaxAmount,'+
' bl.InvBillPricec,'+
' bl.InvBillAmountc,'+
' bl.InvBillnotaxPricec,'+
' bl.InvBillnotaxAmountc '+
' from InvInBillline bl,Item i,Uom u '+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' and i.UomCode=u.UomCode '+
' 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.InvBillqty,'+
' bl.ItemCode,'+
' i.ItemName,'+
' u.UomName,'+
' bl.BilllineremArk,'+
' bl.Batchno,'+
' bl.InvBillPrice,'+
' bl.InvBillAmount,'+
' bl.InvBillnotaxPrice,'+
' bl.InvBillnotaxAmount '+
' from InvInBillline bl,Item i,Uom u '+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' and i.UomCode=u.UomCode '+
' Order by bl.InvBilllineno ');
open;
end
else
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add('select '+
' bl.InvBillid,'+
' bl.InvBilllineno,'+
' bl.InvBillqty,'+
' bl.ItemCode,'+
' i.ItemName,'+
' u.UomName,'+
' bl.BilllineremArk,'+
' bl.Batchno,'+
' bl.InvBillPricec as InvBillPrice,'+
' bl.InvBillAmountc as InvBillAmount,'+
' bl.InvBillnotaxPricec as InvBillnotaxPrice,'+
' bl.InvBillnotaxAmountc as InvBillnotaxAmount'+
' from InvInBillline bl,Item i,Uom u '+
' where bl.InvBillid='+Bill_id+
' and bl.ItemCode=i.ItemCode '+
' and i.UomCode=u.UomCode '+
' Order by bl.InvBilllineno ');
open;
end;
end;
with AdoQry_Head do
begin
lb_Vendortaxrate_Percent.TEXT:='0'+'%';
if status<>'Add' then
begin
act_insertline.Enabled :=False;
act_Deleteline.Enabled :=False;
act_Modify.Enabled :=False;
if fieldbyname('InvBillno').asstring<>'' then
begin
InitCmBxText(Cmbbx_WhCode,fieldbyname('whCode').asstring);
//初始化货位
cmbbx_WhCodeChange(cmbbx_WhCode);
InitCmBxText(Cmbbx_WhPositionCode,fieldbyname('WhPositionCode').asstring);
InitCmBxText(Cmbbx_BillType2Code,fieldbyname('BillType2Code').asstring);
InitCmBxText(Cmbbx_OutType,fieldbyname('outType').asstring);
Extedt_OutCode.text:=fieldbyname('outCode').asstring;
medt_Date.text:=fieldbyname('InvBilldate').asstring;
lbl_OutName.text:=fieldbyname('outName').asstring;
Extedt_Billno.text:=fieldbyname('InvBillno').asstring;
Extedt_memo.text:=fieldbyname('InvBillremArk').asstring;
lb_Vendortaxrate_Percent.text:=fieldbyname('InvBilltaxrate').asstring+'%';
lbl_CurrencyName.text:=fieldbyname('currencyCode').asstring;
end
else
begin
InitCmBxText(Cmbbx_WhCode,BillwhCode);
//初始化货位
// cmbbx_WhCodeexit(cmbbx_WhCode);
InitCmBxText(Cmbbx_WhPositionCode,BillWhPositionCode);
InitCmBxText(Cmbbx_BillType2Code,BillBillType2Code);
InitCmBxText(Cmbbx_OutType,BilloutType);
Extedt_OutCode.text:=BilloutCode;
lbl_OutName.text:=BilloutName;
Extedt_Billno.text:=Billno;
Extedt_memo.text:=Billmemo;
medt_Date.text:=BillLoginDate;
end;
end
else
begin
//定位仓库
InitCmBxText(Cmbbx_WhCode,fieldbyname('whCode').asstring);
//调用初始化货位
cmbbx_WhCodeChange(cmbbx_WhCode);
//定位货位
InitCmBxText(Cmbbx_WhPositionCode,fieldbyname('WhPositionCode').asstring);
//定位入库类型
InitCmBxText(Cmbbx_BillType2Code,fieldbyname('BillType2Code').asstring);
//定位入库对象
InitCmBxText(Cmbbx_OutType,fieldbyname('outType').asstring);
Extedt_OutCode.text:=fieldbyname('outCode').asstring;
medt_Date.text:=LoginDate;//fieldbyname('InvBilldate').asstring;
lbl_OutName.text:=fieldbyname('outName').asstring;
//medt_Date.text:=fieldbyname('InvBilldate').asstring;
Extedt_memo.text:=fieldbyname('InvBillremArk').asstring;
lb_Vendortaxrate_Percent.text:=fieldbyname('InvBilltaxrate').asstring+'%';
lbl_CurrencyName.text:=fieldbyname('currencyCode').asstring;
if issecondinsert then
begin
cmbbx_OutType.ItemIndex:=outTypeposition;
Extedt_OutCode.Text:=outCode;
lbl_OutName.text:=outName;
end;
Extedt_Billno.text:='';
end;
end;
//如果入库对象为供应商,则入库对象代码一定要为供应商代码,通过调用Extedt_OutCodeExit事件
if (Cmbbx_OutType.text='供应商') and (Extedt_OutCode.Text<>'') then
Extedt_OutCodeExit(Extedt_OutCode)
else
begin
currencyCode:='00';
lbl_CurrencyName.text:='00 人民币';
Vendortaxrate_Percent:='0';
ExchRate:='1';
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -