📄 goods_requirement.pas
字号:
end;
end;
if pcol = 3 then //复制数量
begin
for i := prow+1 to STRINGGRID1.rowcount -1 do
begin
STRINGGRID1.cells[3,i]:= STRINGGRID1.cells[3,prow];
//同时要计算金额
end;
end;
end;
procedure Tfrm_Goods_Requirement.SpeedButton4Click(Sender: TObject);
var
i:integer;
sqlpub:widestring;
flag:olevariant;
begin
//wyedit
frm_Public_Don:=Tfrm_Public_Don.Create(self);
frm_Public_Don.no:=trim(edit2.Text);
frm_Public_Don.ShowModal;
{ if Public_Do_Result='01' then //单据过帐
begin
end; }
if Public_Do_Result='02' then //存入草稿
begin
if Trim(Edit1.Text)='' then
begin
Application.MessageBox('操作错误,【录单日期】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit1.SetFocus;
Exit;
end;
if Trim(Edit3.Text)='' then
begin
Application.MessageBox('操作错误,【需求仓库】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit3.SetFocus;
Exit;
end;
{if Trim(Edit_Shop_Name.Text)='' then
begin
Application.MessageBox('操作错误,【需求店面】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit4.SetFocus;
Exit;
end;}
if Trim(Edit5.Text)='' then
begin
Application.MessageBox('操作错误,【经手人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit5.SetFocus;
Exit;
end;
if Trim(Edit6.Text)='' then
begin
Application.MessageBox('操作错误,【制单人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit6.SetFocus;
Exit;
end;
for i:=1 to StringGrid1.RowCount-1 do
begin
if trim(StringGrid1.Cells[3,i])='' then
begin
Application.MessageBox(pchar('操作错误,第<'+inttostr(i)+'>行【需求数量】为空!,请确认!'),pchar(application.Title),mb_iconwarning);
stringgrid1.Row:=i;
stringgrid1.Col:=3;
Exit;
end;
end;
if fl='edit' then
begin
///////先删除数据再重新保存,如当修改操作
//删除商品需求单
if bedit then
begin
sqlpub:='delete from [Goods_Requirement] where Copy_Date='''+Trim(Edit1.Text)+''' and Stock_NO='''+Trim(Edit2.Text)+'''';
flag:=adisp.updatesql(sqlpub);
if vartostr(flag)<>'1' then
begin
Application.MessageBox('修改数据表时出错'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
exit;
end;
//删除商品需求单明细表
sqlpub:='delete from [Goods_Requirement_Detail] where Stock_NO='''+Trim(Edit2.Text)+'''';
flag:=adisp.updatesql(sqlpub);
if vartostr(flag)<>'1' then
begin
Application.MessageBox('修改数据表时出错'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
exit;
end;
end else
begin
if trim(Handle_Man)<>trim(edit6.Text) then
begin
Application.MessageBox('不能修改数据!',pchar(application.Title),mb_iconinformation);
exit;
end;
end;
end;
sqlpub:='Select * from [Goods_Requirement] where Copy_Date='''+Trim(Edit1.Text)+''' and Stock_NO='''+Trim(Edit2.Text)+'''';
dmmain.CDSquery2.Close;
dmmain.CDSquery2.Data:=adisp.resultrecord(sqlpub);
try
dmmain.CDSquery2.Open;
except
Application.MessageBox('数据初始出错'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
if not dmmain.CDSquery2.IsEmpty then
begin
Application.MessageBox('操作失败,该【需求合同】记录在数据库中已经存在,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end else
begin
dmmain.cdsGoods_Requirement.Close;
dmmain.cdsGoods_Requirement.Open;
dmmain.cdsGoods_Requirement.Append;
dmmain.cdsGoods_Requirement.FieldByName('Copy_Date').AsString:=edit1.Text; //录单日期
dmmain.cdsGoods_Requirement.FieldByName('Stock_NO').AsString:=edit2.Text; //单据编号
// dmmain.cdsGoods_Requirement.FieldByName('Requirment_Name').AsString:= //单据名称
dmmain.cdsGoods_Requirement.FieldByName('Storage_NO').AsString:=edit3.Text; //仓库编号
dmmain.cdsGoods_Requirement.FieldByName('Shop_NO').AsString:=Edit_Storage_Name.Text; //店面名称
dmmain.cdsGoods_Requirement.FieldByName('Transactor').AsString:=edit5.Text; //经手人
dmmain.cdsGoods_Requirement.FieldByName('Proposer').AsString:=edit6.Text; //制单人
dmmain.cdsGoods_Requirement.FieldByName('Condense').AsString:=edit7.Text; //摘要
dmmain.cdsGoods_Requirement.FieldByName('R_Remark').AsString:=edit8.Text; //说明
dmmain.cdsGoods_Requirement.FieldByName('Part_no').AsString:=Handle_Part; //部门编号
dmmain.cdsGoods_Requirement.Post;
if fl<>'edit' then
begin
dmmain.cdsReceipt.Close;
dmmain.cdsReceipt.Open;
dmmain.cdsReceipt.Append;
dmmain.cdsReceipt.FieldByName('Receipt_NO').AsString:=trim(edit2.Text);
dmmain.cdsReceipt.FieldByName('Receipt_Name').AsString:='商品需求单';
dmmain.cdsReceipt.FieldByName('Copy_Date').AsString:=trim(edit1.Text);
dmmain.cdsReceipt.FieldByName('Proposer').AsString:=trim(edit6.Text);
dmmain.cdsReceipt.FieldByName('Condense').AsString:=trim(edit7.Text);
dmmain.cdsReceipt.FieldByName('Check_Result').Asinteger:=0;
dmmain.cdsReceipt.FieldByName('Flag_Sign').AsString:='草稿';
dmmain.cdsReceipt.FieldByName('Re_part').AsString:=trim(Handle_Part);
dmmain.cdsReceipt.Post;
try
dmmain.cdsReceipt.ApplyUpdates(-1);
except
Application.MessageBox('保存数据表时出错'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
dmmain.cdsGoods_Requirement_Detail.Close;
dmmain.cdsGoods_Requirement_Detail.Open;
for i:=1 to stringgrid1.RowCount-1 do
begin
dmmain.cdsGoods_Requirement_Detail.Append;
dmmain.cdsGoods_Requirement_Detail.FieldByName('Stock_NO').AsString:=edit2.Text; //单据编号
dmmain.cdsGoods_Requirement_Detail.FieldByName('Goods_NO').AsString:=trim(stringgrid1.Cells[1,i]); //商品编号
dmmain.cdsGoods_Requirement_Detail.FieldByName('R_Amount').AsString:=trim(stringgrid1.Cells[3,i]); //需求数量
dmmain.cdsGoods_Requirement_Detail.FieldByName('Remark').AsString:=trim(stringgrid1.Cells[15,i]); //需求说明
dmmain.cdsGoods_Requirement_Detail.Post;
end;
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
edit5.Clear;
edit6.Clear;
edit7.Clear;
edit8.Clear;
Edit_Storage_Name.Clear;
Edit_Shop_Name.Clear;
for i:=1 to stringgrid1.RowCount-1 do
stringgrid1.Rows[i].Text:='';
stringgrid1.RowCount:=2;
init;
try
dmmain.cdsGoods_Requirement.ApplyUpdates(-1);
dmmain.cdsGoods_Requirement_Detail.ApplyUpdates(-1);
except
Application.MessageBox('保存数据表时出错'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
frm_Main.Panel_Title.Caption:='[连锁管理系统]->[采购信息管理]';
end;
if Public_Do_Result='03' then
begin
dmmain.CDSquery2.Close;
if fl='edit' then frm_Business_Draft.FormShow(nil); //刷新业务草稿中的数据
Close;
end;
end;
procedure Tfrm_Goods_Requirement.Cmd_Select_LoginClick(Sender: TObject);
begin
// Edit6.Text:=Handle_Man;
frm_Login_Man:=Tfrm_Login_Man.Create(self);
frm_Login_Man.Caption:='制单人选择';
frm_Login_Man.ShowModal;
Edit6.Text:=Employe_Check_Result;
frm_Login_Man.Free;
end;
procedure Tfrm_Goods_Requirement.Edit6KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
Edit6.Text:=Handle_Man;
end;
procedure Tfrm_Goods_Requirement.StringGrid1SelectCell(Sender: TObject;
ACol, ARow: Integer; var CanSelect: Boolean);
begin
if ARow>0 then //wyedit;
if ACol=3 then stringgrid1.Options:=stringgrid1.Options+[goediting] else stringgrid1.Options:=stringgrid1.Options-[goediting];
pcol:=acol;
prow:=arow;
edtgoodsremark.Text:=trim(stringgrid1.Cells[15,prow]);
end;
procedure Tfrm_Goods_Requirement.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if pcol in [3] then
begin
if not (key in ['0'..'9',#8]) then
begin
key:=#0;
end
else
begin
if key<>#8 then
begin
if pcol=4 then StringGrid1.Cells[4,prow]:=StringGrid1.Cells[4,prow]+key;
end
else
begin
if pcol=4 then
begin
StringGrid1.Cells[4,prow]:=''; //不加退格符号;
end;
exit;
end;
end;
end;
end;
procedure Tfrm_Goods_Requirement.SpeedButton2Click(Sender: TObject);
var
user,tablename:widestring;
flag:olevariant;
begin
if trim(stringgrid1.Cells[1,1])='' then exit;
no:=trim(edit2.Text);
typed:='商品需求单';
user:=trim(Handle_No);
flag:=adisp.receipted(no,typed,user,1,Handle_Part);
tablename:='select a.storage_no,b.goods_no,b.stock_no,b.r_amount as amount from Goods_Requirement as a ,Goods_Requirement_detail as b where a.stock_no=b.stock_no and a.stock_no='+''''+trim(No)+'''';
flag:=inttostr(adisp.UpdateOrder(tablename) );
if flag='1' then
begin
application.MessageBox('审核成功!',pchar(application.Title),mb_iconinformation);
close;
exit;
end;
if flag='2' then
begin
application.MessageBox('无权进行进行审核',pchar(application.Title),mb_iconinformation);
exit;
end;
if flag='3' then
begin
application.MessageBox('审核完毕!',pchar(application.Title),mb_iconinformation);
close;
exit;
end;
if flag='4' then
begin
application.MessageBox('反审核完毕!',pchar(application.Title),mb_iconinformation);
exit;
end;
if flag='5' then
begin
application.MessageBox('反审核成功!',pchar(application.Title),mb_iconinformation);
exit;
end;
if flag='6' then
begin
application.MessageBox('单据过帐后,不能进行审核或反审核!',pchar(application.Title),mb_iconinformation);
exit;
end;
end;
procedure Tfrm_Goods_Requirement.SpeedButton10Click(Sender: TObject);
begin
Stock_Contract_NO:='';
Stock_Contract_Str:='';
frm_Goods_Requipment_Search:=Tfrm_Goods_Requipment_Search.Create(self);
frm_Goods_Requipment_Search.ShowModal;
frm_Goods_Requipment_Search.Free;
end;
procedure Tfrm_Goods_Requirement.spbprintClick(Sender: TObject);
begin
if dmmain.cdsprintmaster.IsEmpty then exit;
fastrepxf:=tfastrepxf.Create(self);
fastrepxf.filenames:='Requirement.ini';
fastrepxf.ShowModal;
fastrepxf.Free;
end;
procedure Tfrm_Goods_Requirement.edtgoodsremarkChange(Sender: TObject);
begin
if prow<>0 then
stringgrid1.Cells[15,prow]:=trim(edtgoodsremark.Text);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -