📄 demand_fad.pas
字号:
unit Demand_Fad;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, XPMenu, Grids, StdCtrls, Buttons;
type
Tfrm_Demand_Fad = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Panel5: TPanel;
Panel6: TPanel;
XPMenu1: TXPMenu;
P_check: TPanel;
P1: TPanel;
Cmd1: TSpeedButton;
L1: TLabel;
P2: TPanel;
Cmd2: TSpeedButton;
L2: TLabel;
P3: TPanel;
Cmd3: TSpeedButton;
L3: TLabel;
P4: TPanel;
L4: TLabel;
Cmd4: TSpeedButton;
P5: TPanel;
L5: TLabel;
Cmd5: TSpeedButton;
Panel10: TPanel;
SpeedButton6: TSpeedButton;
SpeedButton11: TSpeedButton;
LabeledEdit11: TLabeledEdit;
LabeledEdit12: TLabeledEdit;
LabeledEdit13: TLabeledEdit;
Panel11: TPanel;
Label4: TLabel;
Label5: TLabel;
Panel7: TPanel;
Cmd_Delete: TSpeedButton;
Cmd_Add: TSpeedButton;
StringGrid1: TStringGrid;
Panel3: TPanel;
Label1: TLabel;
Panel4: TPanel;
Edit_Copy_Date: TLabeledEdit;
GroupBox1: TGroupBox;
Cmd_DW: TSpeedButton;
Cmd_CK: TSpeedButton;
Cmd_ZDR: TSpeedButton;
Cmd_JSR: TSpeedButton;
Cmd_DM: TSpeedButton;
Edit_Give_Name: TLabeledEdit;
Edit_Storage_Name: TLabeledEdit;
Edit_Shop_Name: TLabeledEdit;
Edit_Transactor: TLabeledEdit;
Edit_Proposer: TLabeledEdit;
Edit_Condense: TLabeledEdit;
Edit_Submit_Remark: TLabeledEdit;
Edit_Shop_NO: TLabeledEdit;
Edit_Storage_NO: TLabeledEdit;
Edit_Submit_quit_NO: TLabeledEdit;
procedure SpeedButton4Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure Cmd_DeleteClick(Sender: TObject);
procedure Cmd_AddClick(Sender: TObject);
procedure Cmd1Click(Sender: TObject);
procedure Cmd2Click(Sender: TObject);
procedure Cmd3Click(Sender: TObject);
procedure Cmd4Click(Sender: TObject);
procedure Cmd5Click(Sender: TObject);
procedure Cmd_ZDRClick(Sender: TObject);
procedure Cmd_DWClick(Sender: TObject);
procedure Cmd_CKClick(Sender: TObject);
procedure Cmd_DMClick(Sender: TObject);
procedure Cmd_JSRClick(Sender: TObject);
procedure Edit_Copy_DateDblClick(Sender: TObject);
procedure Edit_Copy_DateKeyPress(Sender: TObject; var Key: Char);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1DblClick(Sender: TObject);
private
{ Private declarations }
procedure DeleteRow(Row:Integer);
public
{ Public declarations }
end;
var
frm_Demand_Fad: Tfrm_Demand_Fad;
iColcount,Total_Count:Integer;
ss,tempstr:string;
Pcol,Prow:Integer;
implementation
uses Data, func, Supply_Monad, Storage_Select, ChildShop_Select, Login_Man,
Public_Don, Goods_Check;
{$R *.dfm}
procedure Tfrm_Demand_Fad.DeleteRow(Row:Integer);
var
i : integer;
begin
//最后一列直接删除
if (Row = StringGrid1.RowCount-1) and (row >1) then
StringGrid1.RowCount := StringGrid1.RowCount - 1;
//自动上移
if (Row < StringGrid1.RowCount) and (Row > StringGrid1.FixedRows-1) then
begin
if Row < StringGrid1.RowCount - 1 then
begin
for i := Row to StringGrid1.RowCount-1 do
StringGrid1.Rows[i] := StringGrid1.Rows[i+1];
StringGrid1.RowCount :=StringGrid1.RowCount - 1;
end;
end;
end;
procedure Tfrm_Demand_Fad.SpeedButton4Click(Sender: TObject);
var
i,j,icol:integer;
Check_Flag:string;
begin
frm_Public_Don:=Tfrm_Public_Don.Create(self);
frm_Public_Don.ShowModal;
//直接操作入库界面
if Public_Do='Demand_Fad_Str' then
begin
//直接过帐
if Public_Do_Result='01' then
begin
with frm_data.ClientDataSet_Submit_quit do
begin
Close;
CommandText:='';
Commandtext:='Select * from [V_Submit_quit_View] where Receipt_No='''+Trim(Edit_Submit_quit_NO.Text)+'''';
try
Open;
if frm_data.ClientDataSet_Submit_quit.RecordCount>0 then
begin
Check_Flag:=frm_data.ClientDataSet_Submit_quit.FieldByName('Check_Result').AsString;
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_Submit_quit do
begin
Close;
CommandText:='';
CommandText:='Update [Submit_quit] set Give_Name='''+Trim(Edit_Give_Name.Text)+''',Storage_NO='''+Trim(Edit_Storage_NO.Text)+''',Transactor='''+Trim(Edit_Transactor.Text)+''',Shop_NO='''+Trim(Edit_Shop_NO.Text)+''',Submit_Remark='''+Trim(Edit_Submit_Remark.Text)+''',Condense='''+Trim(Edit_Condense.Text)+''' where Submit_quit_NO='''+Trim(Edit_Submit_quit_NO.Text)+'''';
try
Execute;
try
for i:=1 to StringGrid1.RowCount-1 do
begin
with frm_data.ClientDataSet_Submit_quit_detail do
begin
Close;
frm_data.ClientDataSet_Add.CommandText:='';
CommandText:='update [Submit_quit_detail] set Submit_amount='''+Trim(StringGrid1.Cells[3,i])+''',Submit_price='''+Trim(StringGrid1.Cells[4,i])+''',Submit_money='''+Trim(StringGrid1.Cells[5,i])+''',Submit_Detail_Remark='''+Trim(StringGrid1.Cells[6,i])+''' where Submit_quit_NO='''+Trim(Edit_Submit_quit_NO.Text)+''' and Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
try
Execute;
except
Application.MessageBox('保存【受托代销入库明细】时连接服务器失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
with frm_data.ClientDataSet_Receipt do
begin
Close;
Commandtext:='';
Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(Edit_Submit_quit_NO.Text)+'''';
try
Execute;
Application.MessageBox('恭喜你!【受托代销入库】直接单据过帐操作成功!请确认!',pchar(application.Title),mb_iconwarning);
except
Application.MessageBox('保存【受托代销入库审核表】时失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
except
Application.MessageBox('保存【受托代销入库明细表】时循环失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
except
Application.MessageBox('保存【受托代销入库表】时连接服务器数据库失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
end
else
begin
Application.MessageBox('更本不存在该草稿单据,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
except
Application.MessageBox('打开【受托代销入库视图】时失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
//保存为草稿单据
if Public_Do_Result='02' then
begin
try
if Trim(Edit_Copy_Date.Text)='' then
begin
application.MessageBox('操作错误,【录单日期】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Copy_Date.SetFocus;
Exit;
end;
if Trim(Edit_Submit_quit_NO.Text)='' then
begin
application.MessageBox('操作错误,【单据编号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Submit_quit_NO.SetFocus;
Exit;
end;
if Trim(Edit_Give_Name.Text)='' then
begin
application.MessageBox('操作错误,【供货单位】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Give_Name.SetFocus;
Exit;
end;
if Trim(Edit_Storage_NO.Text)='' then
begin
application.MessageBox('操作错误,【收货仓库】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Storage_NO.SetFocus;
Exit;
end;
if Trim(Edit_Transactor.Text)='' then
begin
application.MessageBox('操作错误,【经手人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Transactor.SetFocus;
Exit;
end;
if Trim(Edit_Proposer.Text)='' then
begin
application.MessageBox('操作错误,【制单人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit_Proposer.SetFocus;
Exit;
end;
for i:=1 to StringGrid1.RowCount-1 do
begin
if StringGrid1.Cells[1,i]='' then
begin
application.MessageBox('操作错误,【商品编号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
if StringGrid1.Cells[3,i]='' then
begin
application.MessageBox('操作错误,【数量】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
with frm_data.ClientDataSet_Submit_quit do
begin
Close;
CommandText:='';
CommandText:='Select * from [Submit_quit] where Copy_Date='''+Trim(Edit_Copy_Date.Text)+''' and Submit_quit_NO='''+Trim(Edit_Submit_quit_NO.Text)+''' ';
try
open;
if frm_data.ClientDataSet_Submit_quit.RecordCount>0 then
begin
Application.MessageBox('添加失败,该记录已经存在,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end
else
begin
try
with frm_data.ClientDataSet_Submit_quit do
begin
Close;
CommandText:='';
CommandText:='Insert into [Submit_quit] (Copy_Date,Submit_quit_NO,Give_Name,Storage_NO,Shop_NO,Transactor,Proposer,Condense,Submit_Remark) values ('''+Trim(Edit_Copy_Date.Text)+''','''+Trim(Edit_Submit_quit_NO.Text)+''','''+Trim(Edit_Give_Name.Text)+''','''+Trim(Edit_Storage_NO.Text)+''','''+Trim(Edit_Shop_NO.Text)+''','''+Trim(Edit_Transactor.Text)+''','''+Trim(Edit_Proposer.Text)+''','''+Trim(Edit_Condense.Text)+''','''+Trim(Edit_Submit_Remark.Text)+''')';
try
Execute;
try
with frm_data.ClientDataSet_Submit_quit do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -