📄 goods_write.pas
字号:
s:=Cells[ACol,ARow];
r:=Rect;
DrawText(Canvas.Handle,PChar(s),Length(s),r,DT_CENTER or DT_SINGLELINE or DT_VCENTER);
end;
with sender as TStringGrid do
begin
if (GDFocused in state) then
begin
Pcol:=Acol;
Prow:=ARow;
func.String_Col:=ARow;
end;
end;
end;
procedure Tfrm_Goods_Write.Edit8KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
Edit8.Text:=Handle_Man;
end;
procedure Tfrm_Goods_Write.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
Edit1.Text:=ForMatdateTime('yyyy''-''mm''-''dd',now);
end;
procedure Tfrm_Goods_Write.Cmd_HTClick(Sender: TObject);
var
sqlsub:widestring;
begin
Contract_Check_Result_Str:='';
Contract_Check_Str:='Goods_Writestr';
frm_Contract_Check:=Tfrm_Contract_Check.Create(self);
frm_Contract_Check.ShowModal;
Edit3.Text:=Contract_Check_Result_Str;
if stringgrid1.RowCount<2 then
begin
stringgrid1.RowCount:=2;
stringgrid1.FixedRows:=1;
end;
cmd_dw.Enabled:=false;
end;
procedure Tfrm_Goods_Write.SpeedButton5Click(Sender: TObject);
begin
Check_Storage:='';
Check_Storage_Result:='';
Check_Storage:='Goods_Write';
frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
frm_Storage_Select.ShowModal;
Edit5.Text:=Trim(Check_Storage_Result_NO);
Edit_Storage_Name.Text:=Trim(Check_Storage_Result);
frm_Storage_Select.Free;
end;
procedure Tfrm_Goods_Write.SpeedButton9Click(Sender: TObject);
begin
Employe_Check:='';
Employe_Check:='Goods_Write_Str';
Employe_Check_Result:='';
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_Write.SpeedButton8Click(Sender: TObject);
begin
ChildShop_Str:='';
ChildShop_Result_NO:='';
ChildShop_Result_Name:='';
ChildShop_Str:='Goods_Write_Str';
frm_ChildShop_Select:=Tfrm_ChildShop_Select.Create(self);
frm_ChildShop_Select.ShowModal;
Edit7.Text:=ChildShop_Result_NO;
frm_ChildShop_Select.Free;
end;
procedure Tfrm_Goods_Write.SpeedButton7Click(Sender: TObject);
begin
frm_Login_Man:=Tfrm_Login_Man.Create(self);
frm_Login_Man.Caption:='制单人选择';
frm_Login_Man.ShowModal;
Edit8.Text:=Employe_Check_Result;
frm_Login_Man.Free;
end;
procedure Tfrm_Goods_Write.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DMMAIN.CDSquery2.Close;
dmmain.CDSquery2.Data:=null;
dmmain.CDSexecsql.close;
dmmain.CDSexecsql.Data:=null;
dmmain.cdsprintmaster.Close;
dmmain.cdsprintmaster.Data:=null;
dmmain.cdsStock_Write_detail.Close;
dmmain.cdsStock_Write_detail.Data:=null;
dmmain.csdStock_Write.Close;
dmmain.csdStock_Write.Data:=null;
action:=cafree;
end;
procedure Tfrm_Goods_Write.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.write_amount as amount from Stock_write as a ,Stock_write_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_Write.Edit3Change(Sender: TObject);
var
sql:widestring;
i:integer;
begin
if Public_Do='Business_Draft_0005' then exit;
if trim(edit3.Text)<>'' then
begin
sql:='Select b.*,a.*,C.* from [Stock_contract_detail] as a,stock_contract as B,GOODS_CODE AS C where A.GOODS_NO=C.GOODS_NO AND a.contract_no=B.contract_no and a.Contract_No='+''''+Trim(Edit3.Text)+'''';
dmmain.CDSquery2.Close;
dmmain.CDSquery2.Data:=adisp.resultrecord(sql);
dmmain.CDSquery2.Open;
if dmmain.CDSquery2.IsEmpty then exit;
i:=1;
Edit4.Text:=dmmain.CDSquery2.FieldByName('wldw').AsString;
Edit9.Text:=dmmain.CDSquery2.FieldByName('resume').AsString;
Edit10.Text:=dmmain.CDSquery2.FieldByName('Remark').AsString;
wldwno:=dmmain.CDSquery2.FieldByName('wldw_no').AsString;
StringGrid1.RowCount:=dmmain.CDSquery2.RecordCount+1;
while not dmmain.CDSquery2.Eof do
begin
StringGrid1.Cells[0,i]:=inttostr(i);
StringGrid1.Cells[1,I]:=trim(dmmain.CDSquery2.FieldByName('Goods_NO').AsString);//商品编号
StringGrid1.Cells[2,I]:=trim(dmmain.CDSquery2.FieldByName('Goods_Name').AsString);//商品名称
StringGrid1.Cells[3,I]:=trim(dmmain.CDSquery2.FieldByName('GOODS_Amount').AsString);//数量
StringGrid1.Cells[5,I]:=trim(dmmain.CDSquery2.FieldByName('type').AsString); //类别名称
StringGrid1.Cells[7,I]:=trim(dmmain.CDSquery2.FieldByName('remark').AsString); //类别名称
StringGrid1.Cells[StringGrid1.ColCount-1,I]:=trim(dmmain.CDSquery2.FieldByName('orders').AsString); //预定订单编号
inc(i);
dmmain.CDSquery2.Next;
end;
end;
end;
procedure Tfrm_Goods_Write.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
pcol:=acol;
prow:=arow;
end;
procedure Tfrm_Goods_Write.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if trim(StringGrid1.Cells[1,Stringgrid1.Row])='' then exit;
if pcol=7 then
begin
stringgrid1.Options:=stringgrid1.Options+[goediting];
exit;
end
else stringgrid1.Options:=stringgrid1.Options-[goediting];
if pcol in [3,4] then
begin
if not (key in ['0'..'9',#8]) then
begin
key:=#0;
end else
begin
if key<>#8 then
begin
if pcol=3 then
begin
if StringGrid1.Cells[3,prow]<>'0' then
begin
StringGrid1.Cells[3,prow]:=StringGrid1.Cells[3,prow]+key;
end else
begin
StringGrid1.Cells[3,prow]:=key;
end;
end;
if pcol=4 then
begin
if StringGrid1.Cells[4,prow]<>'0' then
begin
StringGrid1.Cells[4,prow]:=StringGrid1.Cells[4,prow]+key;
end else
begin
StringGrid1.Cells[4,prow]:=key;
end;
end;
end else
begin
if pcol=3 then
begin
StringGrid1.Cells[3,prow]:=copy(StringGrid1.Cells[3,prow],1,length(StringGrid1.Cells[3,prow])-1); //减去最后数字
if StringGrid1.Cells[3,prow]='' then
begin
StringGrid1.Cells[3,prow]:='0';
end;
end;
if pcol=4 then
begin
StringGrid1.Cells[4,prow]:=copy(StringGrid1.Cells[4,prow],1,length(StringGrid1.Cells[4,prow])-1); //减去最后数字
if StringGrid1.Cells[4,prow]='' then
begin
StringGrid1.Cells[4,prow]:='0';
end;
end;
end;
end;
end else
begin
application.MessageBox('只能输入采购数量,登记数量,备注说明!',pchar(application.Title),mb_iconinformation);
exit;
end;
end;
procedure Tfrm_Goods_Write.Cmd_DWClick(Sender: TObject);
begin
Check_Mond:='';
wldwno:='';
Check_Mond:='DW-0001';
frm_Supply_Monad:=Tfrm_Supply_Monad.Create(self);
frm_Supply_Monad.Caption:='【供货单位】';
frm_Supply_Monad.ShowModal;
Edit4.Text:=check_Mond_Result;
frm_Supply_Monad.Free;
end;
procedure Tfrm_Goods_Write.SpeedButton3Click(Sender: TObject);
begin
if dmmain.cdsprintmaster.IsEmpty then exit;
fastrepxf:=tfastrepxf.Create(self);
fastrepxf.filenames:='Write.ini';
fastrepxf.ShowModal;
fastrepxf.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -