📄 stock_pay.pas
字号:
dmmain.cdspaydetail.FieldByName('Account_Remark').AsString:=trim(StringGrid1.Cells[3,i]);
dmmain.cdspaydetail.Post;
try
dmmain.cdspay.ApplyUpdates(-1);
dmmain.cdspaydetail.ApplyUpdates(-1);
except
application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
exit;
end;
end;
end;
if Public_Do_Result='03' then
begin
dmmain.cdspaydetail.Close;
dmmain.cdspay.Close;
Close;
end;
end;
frm_Public_Don.Free;
setnull(SELF);
init;
end;
procedure Tfrm_Stock_Pay.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DMMAIN.CDSquery2.Close;
dmmain.CDSquery2.Data:=null;
dmmain.cdsprintmaster.Close;
dmmain.cdsprintmaster.Data:=null;
Action:=cafree;
end;
procedure Tfrm_Stock_Pay.FormShow(Sender: TObject);
var
i,icount,k:integer;
tt,yy,temppos:integer;
sql:widestring;
begin
//草稿单据查看
INIT;
if (Public_Do='Business_Draft_0004') then
begin
edit7.Enabled:=false;
sql:= 'Select a.*,b.* from PayReciveBill as a,PayReciveBill_detail as b where a.stock_no=b.stock_no and A.stock_No='+''''+List_No+'''';
dmmain.CDSquery2.Close;
dmmain.CDSquery2.Data:=null;
dmmain.CDSquery2.Data:=adisp.resultrecord(sql);
dmmain.CDSquery2.Open;
k:=dmmain.CDSquery2.RecordCount;
StringGrid1.RowCount:=k+1;
//自动加载STRINGGRID的行数
//Edit1.Text:=dmmain.CDSquery2.FieldValues['Copy_Date'];
Edit1.Text:=dmmain.CDSquery2.FieldByName('Copy_Date').AsString;
Edit2.Text:=dmmain.CDSquery2.FieldByName('STOCK_No').AsVariant;
Edit6.Text:=dmmain.CDSquery2.FieldByName('Contract_NO').Asstring; //付款方式
Edit4.Text:=dmmain.CDSquery2.FieldByName('Bill_NO').AsString;
wldwno:=dmmain.CDSquery2.FieldByName('Join_NO').AsString;
Edit6.Text:=dmmain.CDSquery2.FieldByName('Type').AsString; //wg edit;
Edit7.Text:=dmmain.CDSquery2.FieldByName('Balance_Modal').AsString;
Edit5.Text:=dmmain.CDSquery2.FieldByName('Gather_Name').AsString;
Edit9.Text:=dmmain.CDSquery2.FieldByName('Transactor').AsString;
Edit10.Text:=dmmain.CDSquery2.FieldByName('Proposer').AsString;
Edit11.Text:=dmmain.CDSquery2.FieldByName('Condense').AsString;
Edit12.Text:=dmmain.CDSquery2.FieldByName('Remark').AsString;
for k:=1 to StringGrid1.RowCount -1do
begin
StringGrid1.Cells[0,K]:=trim(dmmain.CDSquery2.FieldByName('ord').AsString);
StringGrid1.Cells[1,k]:=trim(dmmain.CDSquery2.FieldByName('Account_NO').AsString);//商品编号
StringGrid1.Cells[2,k]:=trim(dmmain.CDSquery2.FieldByName('Account_Name').AsString);//商品名称
StringGrid1.Cells[3,k]:=trim(dmmain.CDSquery2.FieldByName('Account_Money').AsString);//数量
StringGrid1.Cells[4,k]:=trim(dmmain.CDSquery2.FieldByName('Settlemented_money').AsString);//单价
StringGrid1.Cells[5,k]:=trim(floattostr(dmmain.CDSquery2.FieldByName('Account_Money').Asfloat-dmmain.CDSquery2.FieldByName('NonSettlemented_money').Asfloat-dmmain.CDSquery2.FieldByName('Settlemented_money').Asfloat));//已结算
StringGrid1.Cells[6,k]:=floattostr(dmmain.CDSquery2.FieldByName('ACCOUNT_money').Asfloat-strtofloat(StringGrid1.Cells[5,k]));//未结算;
dmmain.CDSquery2.Next;
end;
GetDataPrint(dmmain.cdsprintmaster,dmmain.CDsquery2);
end;
end;
procedure Tfrm_Stock_Pay.Cmd_AddClick(Sender: TObject);
begin
addgridrows(stringgrid1);
end;
procedure Tfrm_Stock_Pay.SpeedButton2Click(Sender: TObject);
var
user,wldwname,remarks:widestring;
flag,intof:olevariant;
i:integer;
totals:double;
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);
totals:=0;
for i:=1 to stringgrid1.RowCount-1 do
begin
totals:=totals+strtofloat(stringgrid1.Cells[5,i]); //本次结算金额
end;
wldwname:=trim(edit4.Text);
remarks:='对财务入库单编号为:'+trim(edit5.Text)+'进行采购付款';
intof:=ipubtemp.MoneyTable(12,no,totals,user,user,user,wldwno,wldwname,shopid,remarks);
if vartostr(intof)='1' then
begin
flag:='3';
end else
begin
flag:='2';
end;
ipubtemp.Gether(wldwno,totals,1,0);
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_Stock_Pay.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
pcol:=acol;
prow:=arow;
end;
procedure Tfrm_Stock_Pay.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if trim(stringgrid1.Cells[1,1])='' then exit;
if (pcol=4) and (prow>0) then
begin
if key in ['0'..'9',#8,#13,'.'] then
begin
stringgrid1.Options:=stringgrid1.Options+[goediting];
end else
begin
key:=#0;
end;
end else
begin
application.MessageBox('只能输入商品结算金额!',pchar(application.Title),mb_iconinformation);
stringgrid1.Options:=stringgrid1.Options-[goediting];
key:=#0;
exit;
end;
end;
procedure Tfrm_Stock_Pay.StringGrid1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
jsmoney,wjmoney:double;
i:integer;
begin
jsmoney:=0;
wjmoney:=0;
if trim(stringgrid1.Cells[1,1])='' then exit;
for i:=1 to stringgrid1.RowCount-1 do
begin
if trim(stringgrid1.Cells[3,i])<>'' then
begin
if (Public_Do<>'Business_Draft_0004') then
begin
stringgrid1.Cells[6,i]:=floattostr(strtofloat(stringgrid1.Cells[3,i])-strtofloat(stringgrid1.Cells[4,i])-strtofloat(stringgrid1.Cells[5,i]));
IF (strtofloat(stringgrid1.Cells[3,i])-strtofloat(stringgrid1.Cells[5,i]))<strtofloat(stringgrid1.Cells[4,i]) THEN
BEGIN
APPLICATION.MessageBox('本次结算不能大于应付费用!',pchar(application.Title),mb_iconinformation);
stringgrid1.Cells[4,i]:='0';
exit;
END;
end else
begin
// if strtofloat(stringgrid1.Cells[5,i])<>strtofloat(stringgrid1.Cells[4,i]) then
// begin
//stringgrid1.Cells[5,i]:=floattostr(strtofloat(stringgrid1.Cells[3,i])-strtofloat(stringgrid1.Cells[4,i]));
//end else
// begin
//stringgrid1.Cells[5,i]:='0';
// end;
stringgrid1.Cells[6,i]:=floattostr(strtofloat(stringgrid1.Cells[3,i])-strtofloat(stringgrid1.Cells[5,i]));
end;
jsmoney:=jsmoney+strtofloat(stringgrid1.Cells[4,i])+strtofloat(stringgrid1.Cells[5,i]);
wjmoney:=wjmoney+strtofloat(stringgrid1.Cells[3,i])-strtofloat(stringgrid1.Cells[4,i])-strtofloat(stringgrid1.Cells[5,i]);
end;
end;
lbjs.Caption:=format('%11.'+inttostr(len)+'f',[jsmoney]);
lbwj.Caption:=format('%11.'+inttostr(len)+'f',[wjmoney]);
end;
procedure Tfrm_Stock_Pay.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;
end;
procedure Tfrm_Stock_Pay.SpeedButton9Click(Sender: TObject);
begin
Employe_Check:='';
Employe_Check:='Stock_Fad_str';
Employe_Check_Result:='';
frm_Login_Man:=Tfrm_Login_Man.Create(self);
frm_Login_Man.Caption:='经手人选择';
frm_Login_Man.ShowModal;
Edit9.Text:=Employe_Check_Result;
frm_Login_Man.Free;
end;
procedure Tfrm_Stock_Pay.SpeedButton7Click(Sender: TObject);
begin
Employe_Check:='';
Employe_Check:='Stock_Fad_str';
Employe_Check_Result:='';
frm_Login_Man:=Tfrm_Login_Man.Create(self);
frm_Login_Man.Caption:='制单人选择';
frm_Login_Man.ShowModal;
Edit10.Text:=Employe_Check_Result;
frm_Login_Man.Free;
end;
procedure Tfrm_Stock_Pay.Cmd_DeleteClick(Sender: TObject);
begin
deletegridrows(stringgrid1,prow);
end;
procedure Tfrm_Stock_Pay.StringGrid1DblClick(Sender: TObject);
var
b:boolean;
begin
if trim(edit5.Text)='' then
begin
application.MessageBox('请选择往来单位!',pchar(application.Title),mb_iconinformation);
exit;
end;
if pcol in [1,2] then
begin
frmselect:=tfrmselect.Create(self);
frmselect.flag:=2;
frmselect.ShowModal;
frmselect.Free;
if edit7.ItemIndex =0 then b:=false;
if edit7.ItemIndex =1 then b:=true;
READGoodsORBill(stockinput,b);
end;
end;
procedure Tfrm_Stock_Pay.Edit7Change(Sender: TObject);
var
b:boolean;
begin
if edit7.ItemIndex =0 then b:=false;
if edit7.ItemIndex =1 then b:=true;
ChangGRID(b);
end;
procedure Tfrm_Stock_Pay.SpeedButton6Click(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;
edit5.Text:=Trim(check_Mond_Result);
frm_Supply_Monad.Free;
end;
procedure Tfrm_Stock_Pay.SpeedButton3Click(Sender: TObject);
begin
if dmmain.cdsprintmaster.IsEmpty then exit;
fastrepxf:=tfastrepxf.Create(self);
fastrepxf.filenames:='payment.ini';
fastrepxf.ShowModal;
fastrepxf.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -