📄 umanage_fad.pas
字号:
dmmain.CDSexecsql.FieldByName('out_remark').AsString:=trim(stringgrid1.Cells[8,i]);
dmmain.CDSexecsql.Post;
dmmain.CDSexecsql.Next;
end;
try
dmmain.CDSexecsql.ApplyUpdates(-1);
except
application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
exit;
end;
end;
if Public_Do_Result='03' then
begin
Close;
end;
end;
frm_Public_Don.Free;
end;
procedure Tfrm_Umanage_Fad.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
s:string;
r:TRect;
begin
//ydy add 设置显示颜色
with Sender as Tstringgrid do
begin
if gdSelected in State then
Canvas.Brush.Color:= clTeal; //clBlue; //clyellow;//clRed;
Canvas.TextRect(Rect,Rect.Left,Rect.Top,' '+Cells[ACol,ARow]);
if gdFocused in State then
Canvas.DrawFocusRect(Rect);
end;
//不但水平居中,还垂直居中
with Sender as Tstringgrid do
begin
Canvas.FillRect(Rect);
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_Umanage_Fad.StringGrid1DblClick(Sender: TObject);
var
openstr,bmbh:string;
S1,s2,s3:string;
begin
if Trim(Edit2.Text)='' then
begin
Application.MessageBox('操作失败,【单据编号】不能为空!',pchar(application.Title),mb_iconwarning);
Edit2.SetFocus;
Exit;
end;
if Trim(Edit4.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 pcol in [1,2] then
begin
bmbh:=shopid;
shopid:=trim(edit4.Text);
fmgoodCodeSelStr:= TfmgoodCodeSelStr.Create(self);
try
fmgoodcodeselStr.show_mode:='7';
fmgoodcodeselStr.ShowModal;
finally
fmgoodcodeselStr.Free;
shopid:=bmbh;
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_Umanage_Fad.SpeedButton5Click(Sender: TObject);
begin
Check_Storage:='';Check_Storage_Result:='';
Check_Storage:='Storage_Umanage_Fad';
frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
frm_Storage_Select.ShowModal;
Edit_Storage_Name.Text:=Trim(Check_Storage_Result);
edit4.Text:=Check_Storage_Result_NO;
frm_Storage_Select.Free;
end;
procedure Tfrm_Umanage_Fad.SpeedButton9Click(Sender: TObject);
begin
Employe_Check:='';
Employe_Check:='Storage_Umanage_Fad';
Employe_Check_Result:='';
frm_Login_Man:=Tfrm_Login_Man.Create(self);
frm_Login_Man.Caption:='经手人选择';
frm_Login_Man.ShowModal;
Edit5.Text:=Employe_Check_Result;
frm_Login_Man.Free;
end;
procedure Tfrm_Umanage_Fad.SpeedButton8Click(Sender: TObject);
begin
ChildShop_Str:='';
ChildShop_Result_NO:='';
ChildShop_Result_Name:='';
ChildShop_Str:='Storage_Umanage_Fad';
frm_ChildShop_Select:=Tfrm_ChildShop_Select.Create(self);
frm_ChildShop_Select.ShowModal;
frm_ChildShop_Select.Free;
end;
procedure Tfrm_Umanage_Fad.Cmd_AddClick(Sender: TObject);
var
i:integer;
begin
StringGrid1.RowCount:=StringGrid1.RowCount+1;
Total_Count:=StringGrid1.RowCount;
for i:=1 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
end;
end;
procedure Tfrm_Umanage_Fad.Cmd_DeleteClick(Sender: TObject);
begin
deletegridrows(stringgrid1,prow);
end;
procedure Tfrm_Umanage_Fad.SpeedButton2Click(Sender: TObject);
var
user,wldwname,remarks:widestring;
flag,inmethod,intof:olevariant;
totals:double;
bmbh:string;
begin
if trim(stringgrid1.Cells[1,1])='' then exit;
if (Public_Do<>'Business_Storage_Out') then exit; //保存后才修改
no:=trim(edit2.Text);
typed:='非营业性出库单';
user:=trim(Handle_No);
flag:=adisp.receipted(no,typed,user,1,Handle_Part);
if flag='3' then //
begin
//添加财务入库///////////////////////////////////////
for i:=1 to stringgrid1.RowCount-1 do
begin
totals:=totals+strtofloat(stringgrid1.Cells[5,i]); //已结算金额
end;
wldwname:=trim(edtgatrhername.Text);
remarks:='非营业性出库';
bmbh:=shopid;
shopid:=edit4.Text;
try
intof:=ipubtemp.MoneyTable(6,no,totals,user,user,user,wldwno,wldwname,shopid,remarks);
except
application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
exit;
end;
shopid:=bmbh;
if vartostr(intof)='1' then
begin
flag:='3';
end else
begin
flag:='2';
end;
if flag='3' then
begin
/////////////////向对应的商品单价表里添加单价////////
inmethod:=2;
flag:=adisp.inputstorage(no,inmethod,stockid); //数量出入库!!//5-19 edit;
end;
end;
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_Umanage_Fad.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
pcol:=acol;
prow:=arow;
end;
procedure Tfrm_Umanage_Fad.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if trim(stringgrid1.Cells[1,1])='' then exit;
if pcol=3 then
begin
if not (key in ['0'..'9',#8,'.']) then
begin
key:=#0;
end else
begin
if key<>#8 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;
stringgrid1.Cells[5,prow]:=floattostr(strtofloat(stringgrid1.Cells[3,prow])*strtofloat(stringgrid1.Cells[4,prow]));
end else
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;
if trim(stringgrid1.Cells[3,prow])='0' then
begin
stringgrid1.Cells[5,prow]:='0';
end else
begin
stringgrid1.Cells[5,prow]:=floattostr(strtofloat(stringgrid1.Cells[3,prow])*strtofloat(stringgrid1.Cells[4,prow]));
end;
end;
end;
end else
begin
application.MessageBox('只能输入商品数量!',pchar(application.Title),mb_iconinformation);
exit;
end;
end;
procedure Tfrm_Umanage_Fad.SpeedButton1Click(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;
edtgatrhername.Text:=Trim(check_Mond_Result);
edtgatrher.Text:=wldwno;
frm_Supply_Monad.Free;
end;
procedure Tfrm_Umanage_Fad.StringGrid1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
i:integer;
begin
if prow<>0 then
begin
if (trim(StringGrid1.Cells[3,prow])<>'') and (trim(StringGrid1.Cells[8,prow])<>'') then
begin
if strtoint(StringGrid1.Cells[3,prow])> strtoint(StringGrid1.Cells[8,prow]) then
begin
StringGrid1.Cells[3,prow]:='0';
application.MessageBox('数量已超过库存数量!',pchar(application.Title),mb_iconinformation);
exit;
end;
end;
if (trim(StringGrid1.Cells[3,prow])<>'') then
begin
for i:=1 to stringgrid1.RowCount-1 do
begin
if (trim(StringGrid1.Cells[3,i])<>'') then
StringGrid1.Cells[5,i]:=floattostr(strtofloat(StringGrid1.Cells[3,i])*strtofloat(StringGrid1.Cells[4,i]));
end;
end;
end;
end;
procedure Tfrm_Umanage_Fad.SpeedButton3Click(Sender: TObject);
begin
if dmmain.cdsprintmaster.IsEmpty then exit;
fastrepxf:=tfastrepxf.Create(self);
fastrepxf.filenames:='OutStock.ini';
fastrepxf.ShowModal;
fastrepxf.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -