📄 stock_pay.pas
字号:
Close;
end;
end;
//草稿单据的操作
if Public_Do='Business_Draft_0004' then
begin
if Public_Do_Result='01' then //保存单据
begin
with frm_data.ClientDataSet2 do
begin
try
Close;
CommandText:='';
Commandtext:='Select * from [V_Stock_Pay_View] where Receipt_No='''+Trim(Edit2.Text)+'''';
Open;
Check_Flag:=frm_data.ClientDataSet2.FieldValues['Check_Result'];
if Check_Flag='0' then //单据没有完全审核
begin
Application.MessageBox('单据还没有完全审核,不能过帐',pchar(application.Title),mb_iconwarning);
Exit;
end;
if Check_Flag='1' then //单据完全审核
begin
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Update [Stock_Pay] set Contract_NO='''+Trim(Edit3.Text)+''',Bill_NO='''+Trim(Edit4.Text)+''',Join_NO='''+Trim(Edit5.Text)+''',Pay_Type='''+Trim(Edit6.Text)+''',Balance_Modal='''+Trim(Edit7.Text)+''',Gather_Name='''+Trim(Edit8.Text)+''',Transactor='''+Trim(Edit9.Text)+''',Condense='''+Trim(Edit11.Text)+''' where Stock_No='''+Trim(List_No)+'''';
Execute;
for i:=1 to Total_Count-1 do
begin
try
begin
with frm_data.ClientDataSet_Add do
begin
Close;
frm_data.ClientDataSet_Add.CommandText:='';
CommandText:='update [Stock_Pay_detail] set Account_NO='''+Trim(StringGrid1.Cells[1,i])+''',Account_Name='''+Trim(StringGrid1.Cells[2,i])+''',Account_Money='''+Trim(StringGrid1.Cells[3,i])+''',Account_Remark='''+Trim(StringGrid1.Cells[4,i])+''' where Stock_NO='''+Trim(List_NO)+''' and Goods='''+Trim(StringGrid1.Cells[1,i])+'''';
Execute;
end;
end;
except
Application.MessageBox('保存单据明细时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
Application.MessageBox('单据过帐完毕!',pchar(application.Title),mb_iconwarning);
try
with frm_data.ClientDataSet_Add do
begin
Close;
Commandtext:='';
Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(List_NO)+'''';
Execute;
end;
except
Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系统错误,不能过帐',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
if Public_Do_Result='02' then //保存审核后的草稿
begin
with frm_data.ClientDataSet2 do
begin
try
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Update [Stock_Pay] set Contract_NO='''+Trim(Edit3.Text)+''',Bill_NO='''+Trim(Edit4.Text)+''',Join_NO='''+Trim(Edit5.Text)+''',Pay_Type='''+Trim(Edit6.Text)+''',Balance_Modal='''+Trim(Edit7.Text)+''',Gather_Name='''+Trim(Edit8.Text)+''',Transactor='''+Trim(Edit9.Text)+''',Condense='''+Trim(Edit11.Text)+''' where Stock_No='''+Trim(List_No)+'''';
Execute;
for i:=1 to Total_Count-1 do
begin
try
begin
with frm_data.ClientDataSet_Add do
begin
Close;
frm_data.ClientDataSet_Add.CommandText:='';
CommandText:='update [Stock_Pay_detail] set Account_NO='''+Trim(StringGrid1.Cells[1,i])+''',Account_Name='''+Trim(StringGrid1.Cells[2,i])+''',Account_Money='''+Trim(StringGrid1.Cells[3,i])+''',Account_Remark='''+Trim(StringGrid1.Cells[4,i])+''' where Stock_NO='''+Trim(List_NO)+''' and Goods='''+Trim(StringGrid1.Cells[1,i])+'''';
Execute;
end;
end;
except
Application.MessageBox('保存草稿明细时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系统错误,不能过帐',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
if Public_Do_Result='03' then
begin
frm_data.ClientDataSet_Add.Active:=False;
frm_data.ClientDataSet_Add.Close;
frm_data.ClientDataSet2.Active:=False;
frm_data.ClientDataSet2.Close;
Close;
end;
end;
frm_Public_Don.Free;
end;
procedure Tfrm_Stock_Pay.Edit1DblClick(Sender: TObject);
begin
Edit1.Text:=ForMatDatetime('yyyy''-''mm''-''dd',now);
end;
procedure Tfrm_Stock_Pay.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=cafree;
end;
procedure Tfrm_Stock_Pay.FormShow(Sender: TObject);
var
i,icount,k:integer;
tt,yy,temppos:integer;
begin
frm_Stock_Pay.Left:=170 * longint(Screen.Width) div 1024;
frm_Stock_Pay.Top:=40 * longint(Screen.Height) div 768;
frm_Stock_Pay.Width:=860;
frm_Stock_Pay.Height:=715;
iColcount:=StringGrid1.ColCount-1; //需要的填充数据的网络表格的列数
StringGrid1.RowCount:=2; StringGrid1.ColCount:=5;
Total_Count:=StringGrid1.RowCount;
StringGrid1.ColWidths[0]:=40; StringGrid1.ColWidths[1]:=150;
StringGrid1.ColWidths[2]:=150; StringGrid1.ColWidths[3]:=100;
StringGrid1.ColWidths[4]:=100;
StringGrid1.Cells[0,0]:='行号'; StringGrid1.Cells[1,0]:='付款帐户编号';
StringGrid1.Cells[2,0]:='付款帐户名称'; StringGrid1.Cells[3,0]:='金额';
StringGrid1.Cells[4,0]:='备注';
if Public_Do='Stock_0005' then
begin
P_check.Visible:=False;
end;
//草稿单据查看
if ((Public_Do='Business_Draft_0004') and (SH_Level<>0)) then
begin
P_check.Visible:=true;
if Trim(ExamineMan1)<>'' then
begin
tempstr:=ExamineMan1;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P1.Visible:=True; L1.Caption:=LevelName1+':'+ss;
if ee1='' then
begin
L1.Caption:=LevelName1+':'+ss;
Flag1:=1;
end;
if ee1<>'' then
begin
L1.Caption:=LevelName1+':';
Flag1:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan2)<>'' then
begin
tempstr:=ExamineMan2;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P2.Visible:=True; L2.Caption:=LevelName2+':'+ss;
if ee2='' then
begin
L2.Caption:=LevelName2+':'+ss;
Flag2:=1;
end;
if ee2<>'' then
begin
L2.Caption:=LevelName2+':';
Flag2:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan3)<>'' then
begin
tempstr:=ExamineMan3;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P3.Visible:=True; L3.Caption:=LevelName3+':'+ss;
if ee3='' then
begin
L3.Caption:=LevelName3+':'+ss;
Flag3:=1;
end;
if ee3<>'' then
begin
L3.Caption:=LevelName3+':';
Flag3:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan4)<>'' then
begin
tempstr:=ExamineMan4;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P4.Visible:=True; L4.Caption:=LevelName4+':'+ss;
if ee4='' then
begin
L4.Caption:=LevelName4+':'+ss;
Flag4:=1;
end;
if ee1<>'' then
begin
L4.Caption:=LevelName4+':';
Flag4:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan5)<>'' then
begin
tempstr:=ExamineMan5;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P5.Visible:=True; L5.Caption:=LevelName5+':'+ss;
if ee1='' then
begin
L5.Caption:=LevelName5+':'+ss;
Flag5:=1;
end;
if ee5<>'' then
begin
L5.Caption:=LevelName5+':';
Flag5:=2;
end;
end;
end;
Next;
end;
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Select * from [V_Stock_Pay_View] where Receipt_No='''+List_No+'''';
Open;
k:=frm_data.ClientDataSet_Add.RecordCount;
StringGrid1.RowCount:=k+1;
//自动加载STRINGGRID的行数
for K:=1 to StringGrid1.RowCount do
begin
StringGrid1.Cells[0,K]:=IntTostr(k); //表示第0列第i行的名称
end;
//Edit1.Text:=frm_data.ClientDataSet_Add.FieldValues['Copy_Date'];
Edit1.Text:=frm_data.ClientDataSet_Add.FieldByName('Copy_Date').AsString;
Edit2.Text:=frm_data.ClientDataSet_Add.FieldByName('Receipt_No').AsVariant;
Edit3.Text:=frm_data.ClientDataSet_Add.FieldByName('Contract_NO').AsVariant;
Edit4.Text:=frm_data.ClientDataSet_Add.FieldByName('Bill_NO').AsVariant;
Edit5.Text:=frm_data.ClientDataSet_Add.FieldByName('Join_NO').AsVariant;
Edit6.Text:=frm_data.ClientDataSet_Add.FieldByName('Pay_Type').AsVariant;
Edit7.Text:=frm_data.ClientDataSet_Add.FieldByName('Balance_Modal').AsVariant;
Edit8.Text:=frm_data.ClientDataSet_Add.FieldByName('Gather_Name').AsVariant;
Edit9.Text:=frm_data.ClientDataSet_Add.FieldByName('Transactor').AsVariant;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -