?? umanage_fad.pas
字號:
unit Umanage_Fad;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Grids, StdCtrls, Buttons, XPMenu;
type
Tfrm_Umanage_Fad = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
Cmd_Cancel: TSpeedButton;
Panel3: TPanel;
Label1: TLabel;
Panel4: TPanel;
Edit1: TLabeledEdit;
GroupBox1: TGroupBox;
SpeedButton1: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
Edit3: TLabeledEdit;
Edit_Storage_Name: TLabeledEdit;
Edit5: TLabeledEdit;
Edit6: TLabeledEdit;
Edit7: TLabeledEdit;
Edit8: TLabeledEdit;
Edit9: TLabeledEdit;
Edit2: TLabeledEdit;
Panel5: TPanel;
Panel6: TPanel;
Panel8: TPanel;
Label2: TLabel;
Label3: TLabel;
Panel7: TPanel;
SpeedButton6: TSpeedButton;
SpeedButton10: TSpeedButton;
Edit10: TLabeledEdit;
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;
XPMenu1: TXPMenu;
Panel9: TPanel;
Panel10: TPanel;
Cmd_Delete: TSpeedButton;
Cmd_Add: TSpeedButton;
StringGrid1: TStringGrid;
Edit4: TLabeledEdit;
Edit11: TLabeledEdit;
SpeedButton4: TSpeedButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure Cmd_CancelClick(Sender: TObject);
procedure Edit1DblClick(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit7KeyPress(Sender: TObject; var Key: Char);
procedure Edit7DblClick(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1DblClick(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure Cmd_AddClick(Sender: TObject);
procedure Cmd_DeleteClick(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 Stock_States_Total;
procedure DeleteRow(Row:Integer);
public
{ Public declarations }
end;
var
frm_Umanage_Fad: Tfrm_Umanage_Fad;
iColcount,Total_Count:Integer;
i,Pcol,Prow:integer;
Insert_Sql:String;
ss,tempstr:string;
implementation
uses func, Data, Goods_Check, Public_Don, Storage_Select, Login_Man,
ChildShop_Select;
{$R *.dfm}
procedure Tfrm_Umanage_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_Umanage_Fad.Stock_States_Total;
var
Total_amount,Total_money:String;
i,j: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(Edit5.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('Out_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 Out_amount='''+Trim(Total_amount)+''',Stock_money='''+Trim(Total_money)+''' where Goods_No='''+Trim(StringGrid1.Cells[1,i])+''' and Storage_NO='''+Trim(Edit5.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;
try
//生成報損出庫單
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Insert Into [Out_strip](Copy_Date,Out_No,Gatrher_monad,Transactor,Proposer,Storage_NO,Shop_NO,Condense,Out_Remark,Business_No,Out_Type) values ('''+Trim(Edit1.Text)+''','''+Trim(Edit2.Text)+''',''報損收貨單位'','''+Trim(Edit4.Text)+''','''+Trim(Edit6.Text)+''','''+Trim(Edit3.Text)+''','''+Trim(Edit5.Text)+''',''報損出庫'','''+Trim(Edit8.Text)+''','''+Trim(Edit10.Text)+''',''非運營性出庫'')';
try
ExecUte;
try
for j:=1 to Total_Count do
begin
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Insert Into [Out_strip_Detail](Out_No,Goods_NO,Pass_NO,price,amount,money,Out_Remark) values ('''+Trim(Edit1.Text)+''','''+Trim(StringGrid1.Cells[1,j])+''','''+Trim(StringGrid1.Cells[3,j])+''','''+Trim(StringGrid1.Cells[4,j])+''','''+Trim(StringGrid1.Cells[5,j])+''','''+Trim(StringGrid1.Cells[6,j])+''','''+Trim(StringGrid1.Cells[19,j])+''')';
try
ExecUte;
except
Application.MessageBox('系統在生成[庫存報損出庫單明細]時出現了錯誤,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系統在生成[庫存報損出庫單明細]循環時出現了錯誤,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
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;
//*******************************************
procedure Tfrm_Umanage_Fad.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=Cafree;
end;
procedure Tfrm_Umanage_Fad.FormShow(Sender: TObject);
var
icount,k:integer;
tt,yy,temppos:integer;
begin
frm_Umanage_Fad.Left:=170 * longint(Screen.Width) div 1024;
frm_Umanage_Fad.Top:=40 * longint(Screen.Height) div 768;
frm_Umanage_Fad.Height:=715;
frm_Umanage_Fad.Width:=860;
iColcount:=StringGrid1.ColCount-1; //需要的填充數據的網絡表格的列數
StringGrid1.RowCount:=2; StringGrid1.ColCount:=27;
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.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.ColWidths[20]:=100;
StringGrid1.ColWidths[21]:=50; StringGrid1.ColWidths[22]:=100; StringGrid1.ColWidths[23]:=100;
StringGrid1.ColWidths[24]:=50; StringGrid1.ColWidths[25]:=150;
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]:='柱面度數'; StringGrid1.Cells[20,0]:='顏色名稱';
StringGrid1.Cells[21,0]:='商品條瑪'; StringGrid1.Cells[22,0]:='組冊商品'; StringGrid1.Cells[23,0]:='生產廠家';
StringGrid1.Cells[24,0]:='基本單位'; StringGrid1.Cells[25,0]:='有效日期(月)'; StringGrid1.Cells[26,0]:='商品說明';
if Public_Do='Umanage_0001' then
begin
P_check.Visible:=False;
end;
//草稿單據查看
if ((Public_Do='Business_Storage_Out') 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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -