?? demand_enter.pas
字號:
unit Demand_Enter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, XPMenu, Grids, StdCtrls, Buttons;
type
Tfrm_Demand_Enter = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Panel3: TPanel;
Label1: TLabel;
Panel4: TPanel;
Edit_Copy_Date: TLabeledEdit;
GroupBox1: TGroupBox;
Cmd_DW: TSpeedButton;
Cmd_CK: TSpeedButton;
Cmd_ZDR: TSpeedButton;
Cmd_JSR: 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_Submit_adopt_NO: TLabeledEdit;
Panel5: TPanel;
Panel6: TPanel;
XPMenu1: TXPMenu;
Panel9: TPanel;
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;
Edit_Shop_NO: TLabeledEdit;
Edit_Storage_NO: TLabeledEdit;
Cmd_DM: TSpeedButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure Cmd_DeleteClick(Sender: TObject);
procedure Cmd_AddClick(Sender: TObject);
procedure Edit_Copy_DateDblClick(Sender: TObject);
procedure Edit_Copy_DateKeyPress(Sender: TObject; var Key: Char);
procedure Cmd_ZDRClick(Sender: TObject);
procedure Edit_ProposerDblClick(Sender: TObject);
procedure Edit_ProposerKeyPress(Sender: TObject; var Key: Char);
procedure Cmd_DWClick(Sender: TObject);
procedure Cmd_CKClick(Sender: TObject);
procedure Cmd_DMClick(Sender: TObject);
procedure Cmd_JSRClick(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1DblClick(Sender: TObject);
procedure Cmd1Click(Sender: TObject);
procedure Cmd2Click(Sender: TObject);
procedure Cmd3Click(Sender: TObject);
procedure Cmd4Click(Sender: TObject);
procedure Cmd5Click(Sender: TObject);
private
{ Private declarations }
procedure DeleteRow(Row:Integer);
procedure Stock_States_Total;
public
{ Public declarations }
end;
var
frm_Demand_Enter: Tfrm_Demand_Enter;
iColcount,Total_Count:Integer;
ss,
tempstr:String;
Pcol,Prow:integer;
implementation
uses func, Supply_Monad, Storage_Select, ChildShop_Select, Login_Man, Data,
Public_Don, Goods_Check;
{$R *.dfm}
//自定義庫存統計過程
procedure Tfrm_Demand_Enter.Stock_States_Total;
var
Total_amount,Total_money:String;
i:Integer;
begin
{try
for i:=1 to StringGrid1.RowCount-1 do
begin
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Select * from [V_Stock_States_View] where Storage_NO='''+Trim(Edit_Storage_NO.Text)+''' and Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
try
open;
//如果該倉庫存在同種商品
if frm_data.ClientDataSet_Add.RecordCount>0 then
begin
Total_amount:=frm_data.ClientDataSet_Add.FieldByName('IN_amount').AsVariant; //統計總的數量
Total_money :=frm_data.ClientDataSet_Add.FieldByName('Stock_money').AsVariant; //統計總的金額
Total_amount:=FloatToStr(StrToFloat(Total_amount)+StrToFloat(StringGrid1.Cells[5,i]));
Total_money :=FloatToStr(StrToFloat(Total_money)+StrToFloat(StringGrid1.Cells[12,i]));
with frm_Data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Update [Stock_States] set IN_amount='''+Trim(Total_amount)+''',Stock_money='''+Trim(Total_money)+''' where Goods_No='''+Trim(StringGrid1.Cells[1,i])+''' and Storge_NO='''+Trim(Edit_Shop_NO.Text)+'''';
try
Execute;
except
Application.MessageBox('修改[庫存]的數量和金額時出現了錯誤,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
//如果該倉庫不存在同種商品
if frm_data.ClientDataSet_Add.RecordCount=0 then
begin
with frm_Data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='insert into [Stock_States](Goods_NO,IN_amount,Stock_money,Storage_NO,Shop_NO) values ('''+Trim(StringGrid1.Cells[1,i])+''','''+StringGrid1.Cells[5,i]+''','''+StringGrid1.Cells[12,i]+''','''+Trim(Edit5.Text)+''','''+Trim(Edit7.Text)+''')';
try
Execute;
except
Application.MessageBox('修改[庫存]的數量和金額時出現了錯誤,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
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;
procedure Tfrm_Demand_Enter.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_Enter.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_Data.ClientDataSet_Submit_adopt_detail.Active:=false;
frm_Data.ClientDataSet_Submit_adopt_detail.Close;
frm_Data.ClientDataSet_Submit_adopt.Active:=false;
frm_Data.ClientDataSet_Submit_adopt.Close;
frm_data.ClientDataSet_Receipt.Active:=False;
frm_data.ClientDataSet_Receipt.Close;
Action:=Cafree;
end;
procedure Tfrm_Demand_Enter.FormShow(Sender: TObject);
var
i,icount,k:integer;
tt,yy,temppos:integer;
begin
frm_Demand_Enter.Left:=170 * longint(Screen.Width) div 1024;
frm_Demand_Enter.Top:=40 * longint(Screen.Height) div 768;
frm_Demand_Enter.Height:=715;
frm_Demand_Enter.Width:=860;
iColcount:=StringGrid1.ColCount-1; //需要的填充數據的網絡表格的列數
StringGrid1.RowCount:=2; StringGrid1.ColCount:=20;
Total_Count:=StringGrid1.RowCount;
for i:=1 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
end;
StringGrid1.ColWidths[0]:=40; StringGrid1.ColWidths[1]:=150; StringGrid1.ColWidths[2]:=150;
StringGrid1.ColWidths[3]:=100; StringGrid1.ColWidths[4]:=100; StringGrid1.ColWidths[5]:=150;
StringGrid1.ColWidths[6]:=50; StringGrid1.ColWidths[7]:=80; StringGrid1.ColWidths[8]:=100;
StringGrid1.ColWidths[9]:=50; StringGrid1.ColWidths[10]:=100; StringGrid1.ColWidths[11]:=100;
StringGrid1.ColWidths[12]:=50; StringGrid1.ColWidths[13]:=150; StringGrid1.ColWidths[14]:=150;
StringGrid1.ColWidths[15]:=100; StringGrid1.ColWidths[16]:=100; StringGrid1.ColWidths[17]:=150;
StringGrid1.ColWidths[18]:=50; StringGrid1.ColWidths[19]:=80;
StringGrid1.Cells[0,0]:='行號'; StringGrid1.Cells[1,0]:='商品編號';
StringGrid1.Cells[2,0]:='商品名稱'; StringGrid1.Cells[3,0]:='受托數量';
StringGrid1.Cells[4,0]:='受托單價'; StringGrid1.Cells[5,0]:='受托金額';
StringGrid1.Cells[6,0]:='受托說明'; StringGrid1.Cells[7,0]:='基本單位';
StringGrid1.Cells[8,0]:='類別名稱'; StringGrid1.Cells[9,0]:='品牌名稱';
StringGrid1.Cells[10,0]:='品種名稱'; StringGrid1.Cells[11,0]:='規格型號';
StringGrid1.Cells[12,0]:='球面度數'; StringGrid1.Cells[13,0]:='柱面度數';
StringGrid1.Cells[14,0]:='顏色名稱'; StringGrid1.Cells[15,0]:='商品條瑪';
StringGrid1.Cells[16,0]:='組冊商標'; StringGrid1.Cells[17,0]:='生產廠家';
StringGrid1.Cells[18,0]:='有效日期(月)'; StringGrid1.Cells[19,0]:='商品說明';
if Public_Do='Demand_Enter_Str' then
begin
P_check.Visible:=False;
end;
//草稿單據查看
if ((Public_Do='Demand_Enter_Business') and (SH_Level<>0)) then
begin
P_check.Visible:=true;
if Trim(ExamineMan1)<>'' then
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -