📄 inv_otheropout_b.pas
字号:
act_Modify.Enabled:=False;
Modify:=True;
Edt_Memo.Enabled:=False;
DBGridEh.ReadOnly:=True;
except
begin
AdoQry_Tmp.Connection.RollBackTrans;
AdoQry_Body.EnableControls ;
if not BeforeSaveError then
DispInfo(' 存盘不成功,请稍后再试! ',1);
end;
end;
end;
procedure TFrm_Inv_OtherOpOut_B.FormClose(Sender: TObject;
var Action: TCloseAction);
var OldSort :String;
begin
// inherited;
if(Act_Save.Enabled)then
begin
if(DispInfo('数据有改动,需要保存吗?',2)='y')then
begin
Act_SaveExecute(Sender);
end
else
begin
if(AdoQry_Head.State in [dsInsert,dsEdit])then
AdoQry_Head.Cancel;
Self.ModalResult:=mrCancel;
end;
end
else
begin
if(AdoQry_Head.State in [dsInsert,dsEdit])then
AdoQry_Head.Cancel;
Self.ModalResult:=mrOk;
end;
OldSort:=AdoQry_Head.Sort;
AdoQry_Head.Close;
AdoQry_Head.open;
AdoQry_Head.Sort:=OldSort;
If Edt_BillNo.Text<>'' then
AdoQry_Head.Locate('InvBillNo',Trim(Edt_BillNo.Text),[loPArtialKey]);
end;
procedure TFrm_Inv_OtherOpOut_B.Act_InsertLineExecute(Sender: TObject);
var i :integer;
Book1:TBookMArk;
begin
//AllCheck;
//此处须调用所有表头控件的存在的EXIT事件,以对表头进行检验!!!!
If not WHClsPeriodCheck(AdoQry_Tmp,GetCode(Cmbx_WhCodeName.text),
Copy(Medt_Date.Text,1,7)) then
begin
if medt_Date.CanFocus then
Medt_Date.SetFocus;
Abort;
end;
disableall(False);
ActiveControl:=ControlBar;
//AdoQry_Body.Prior;
Book1:=AdoQry_Body.GetBookmArk;
// SaveHeadData;
if(Frm_Entry_Detail<>nil)then
begin
Frm_Entry_Detail.SetUserParam(Param1,Param2,Param3,Param4,Param5,copy(Medt_Date.text,1,7));
Frm_Entry_Detail.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
Frm_Entry_Detail.Modified:=Act_Save.Enabled;
Frm_Entry_Detail.InitForm(DBConnect,'Add',AdoQry_Head,AdoQry_Body);
TFrm_Inv_OtherOpOut_D(Frm_Entry_Detail).SetWhPosition(GetCode(Cmbx_WhCodeName.text),GetCode(Cmbx_Position.Text));
Frm_Entry_Detail.ShowModal;
Act_Save.Enabled:=Frm_Entry_Detail.Modified;
end;
AdoQry_Body.GotoBookmArk(Book1);
AdoQry_Body.FreeBookmArk(Book1);
if (not AdoQry_Body.IsEmpty) and (status<>'Add') then
for i:=0 to Pnl_Head.ControlCount-1 do
begin
if(not(Pnl_Head.Controls[i] is TLabel)) then
Pnl_Head.Controls[i].Enabled:=False
end;
Edt_Memo.Enabled:=True;
end;
procedure TFrm_Inv_OtherOpOut_B.Edt_OutCodeExit(Sender: TObject);
begin
inherited;
VendorCodeCheck(Edt_OutCode);
end;
procedure TFrm_Inv_OtherOpOut_B.Act_ModifyExecute(Sender: TObject);
{begin
// inherited;
//AllCheck;
ActiveControl:=ControlBar;
SaveHeadData;
if (Frm_Entry_Detail<>nil)and(not AdoQry_Body.IsEmpty)then
begin
Frm_Entry_Detail.SetUserParam(Param1,Param2,Param3,Param4,Param5,Param6);
Frm_Entry_Detail.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
TFrm_Inv_OtherOut_D(Frm_Entry_Detail).SetWhPosition(GetCode(Cmbx_WhCodeName.text),GetCode(cmBx_Position.Text));
Frm_Entry_Detail.Modified:=Act_Save.Enabled;
if (Status='Add')or(Status='AllEdit') then
Frm_Entry_Detail.InitForm(DBConnect,'AllEdit',AdoQry_Head,AdoQry_Body)
else
Frm_Entry_Detail.InitForm(DBConnect,'PArtEdit',AdoQry_Head,AdoQry_Body);
Frm_Entry_Detail.ShowModal;
Act_Save.Enabled:=Frm_Entry_Detail.Modified;
end;
end;}
var i :integer;
begin
//AllCheck;
//此处须调用所有表头控件的存在的EXIT事件,以对表头进行检验!!!!
if (AdoQry_Body.IsEmpty) or (not act_Modify.Enabled) then abort;
ActiveControl:=ControlBar;
// SaveHeadData;
if(Frm_Entry_Detail<>nil)then
begin
Frm_Entry_Detail.SetUserParam(Param1,Param2,Param3,Param4,Param5,Medt_Date.Text);
Frm_Entry_Detail.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
Frm_Entry_Detail.Modified:=Act_Save.Enabled;
Frm_Entry_Detail.InitForm(DBConnect,'PArtEdit',AdoQry_Head,AdoQry_Body);
TFrm_Inv_OtherOpOut_D(Frm_Entry_Detail).SetWhPosition(GetCode(Cmbx_WhCodeName.text),GetCode(Cmbx_Position.Text));
Frm_Entry_Detail.ShowModal;
Act_Save.Enabled:=Frm_Entry_Detail.Modified;
end;
if (not AdoQry_Body.IsEmpty) and (status<>'Add') then
for i:=0 to Pnl_Head.ControlCount-1 do
begin
if(not(Pnl_Head.Controls[i] is TLabel)) then
Pnl_Head.Controls[i].Enabled:=False
end;
Edt_Memo.Enabled:=True;
end;
procedure TFrm_Inv_OtherOpOut_B.Cmbx_WhCodeNameExit(Sender: TObject);
begin
inherited;
InitCmbx_WhPosition(GetCode(Cmbx_WhCodeName.Text));
InitCmBxText(Cmbx_Position,GetCode(AdoQry_Head.fieldbyname('WhPositionName').asstring));
{ with AdoQry_Tmp do
begin
Close;
sql.text:='select PriceType '+
' from Warehouse '+
' where whCode='''+getCode(Cmbx_WhCodeName.text)+''' ';
Prepared;
open;
if (not eof) and (fieldbyname('PriceType').asinteger=1) then
IsPlanPrice:=True
else IsPlanPrice:=False;
end;}
end;
procedure TFrm_Inv_OtherOpOut_B.SetStatus(CurrentStatus: String;
var AnswerStatus, EnableControls: String);
begin
inherited;
//
end;
procedure TFrm_Inv_OtherOpOut_B.Edt_OutCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
VendorHint(Sender,Key, Shift);
end;
procedure TFrm_Inv_OtherOpOut_B.FormCreate(Sender: TObject);
begin
inherited;
// ToolButton7.Action:=act_Check;
SetFocus_Control:=Cmbx_WhCodeName;
end;
procedure TFrm_Inv_OtherOpOut_B.Act_PreviewExecute(Sender: TObject);
begin
// inherited;
if GetCode(Trim(Cmbx_WhCodeName.text))='' then
begin
DispInfo('仓库为空不能打印预览!',3);
abort;
end;
BillPrint(AdoQry_Tmp.Connection,GetCode(Cmbx_WhCodeName.text),Edt_BillNo.text,Param1,ModuleCode,True,False,True,'');
end;
procedure TFrm_Inv_OtherOpOut_B.Act_PrintExecute(Sender: TObject);
begin
// inherited;
if GetCode(Trim(Cmbx_WhCodeName.text))='' then
begin
DispInfo('仓库为空不能打印!',3);
abort;
end;
BillPrint(AdoQry_Tmp.Connection,GetCode(Cmbx_WhCodeName.text),Edt_BillNo.text,Param1,ModuleCode,False,False,True,'');
end;
procedure TFrm_Inv_OtherOpOut_B.Cmbx_BillType2CodeNameExit(Sender: TObject);
begin
inherited;
if Trim(Cmbx_BillType2CodeName.text)='' then
begin
DispInfo('请选择出库类型!',1);
twincontrol(sender).setfocus;
abort;
end;
end;
procedure TFrm_Inv_OtherOpOut_B.AdoQry_BodyAfterPost(DataSet: TDataSet);
begin
IF AdoQry_Body.fieldbyname('InvBillQty').AsFloat=0 then
begin
DispInfo('出库数量不能等于零',1);
exit;
end;
inherited;
act_Save.Enabled:=True;
end;
procedure TFrm_Inv_OtherOpOut_B.AdoQry_BodyAfterScroll(DataSet: TDataSet);
begin
inherited;
if AdoQry_Body.Eof then AdoQry_Body.Prior;
end;
procedure TFrm_Inv_OtherOpOut_B.FormActivate(Sender: TObject);
begin
inherited;
Checked:=False;
act_Check.Enabled:=False;
if status='Add' then
disableall(True)
else disableall(False);
end;
procedure TFrm_Inv_OtherOpOut_B.Cmbx_WhCodeNameChange(Sender: TObject);
begin
inherited;
act_Save.enabled:=False;
end;
procedure TFrm_Inv_OtherOpOut_B.Cmbx_PositionChange(Sender: TObject);
begin
inherited;
act_Save.enabled:=False;
end;
procedure TFrm_Inv_OtherOpOut_B.Cmbx_BillType2CodeNameChange(
Sender: TObject);
begin
inherited;
act_Save.enabled:=False;
end;
procedure TFrm_Inv_OtherOpOut_B.disableall(flag: boolean);
begin
Cmbx_WhCodeName.Enabled:=flag;
Cmbx_Position.Enabled:=flag;
Cmbx_BillType2CodeName.Enabled:=flag;
Edt_Memo.enabled:=flag;
medt_Date.Enabled :=flag;
// edt_OutCode.Enabled:=flag;
end;
procedure TFrm_Inv_OtherOpOut_B.InitGrid;
begin
DBGridEh.ReadOnly:=False;
DBGridEh.Columns[0].ReadOnly:=True;
DBGridEh.Columns[1].ReadOnly:=True;
DBGridEh.Columns[2].ReadOnly:=True;
DBGridEh.Columns[3].ReadOnly:=True;
DBGridEh.Columns[4].ReadOnly:=True;
DBGridEh.Columns[5].ReadOnly:=False;
DBGridEh.Columns[6].ReadOnly:=False;
DBGridEh.Columns[7].ReadOnly:=True;
DBGridEh.Columns[8].ReadOnly:=True;
DBGridEh.Columns[9].ReadOnly:=True;
end;
procedure TFrm_Inv_OtherOpOut_B.DBGridEhKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
var
BatchStr:string;
begin
inherited;
If Word(Key)=VK_F9 then
with AdoQry_Body do
begin
BatchStr:=BatchHint(AdoQry_Tmp.Connection,fieldbyname('ItemCode').asstring,
'',getCode(Cmbx_WhCodeName.text),getCode(Cmbx_Position.Text));
if not BatchInvCheck(AdoQry_Tmp,BatchStr,'c',
getCode(Cmbx_WhCodeName.text),
getCode(Cmbx_Position.text),
fieldbyname('InvBillQty').asFloat) then Abort;
edit;
fieldbyname('BatchNo').asstring:=BatchStr;
post;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -