|
|
unit u_op_Air_Goods;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxClasses, cxControls,
|
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|
|
cxGridDBTableView, cxGrid, ADODB, bsSkinCtrls, cxCalc, cxNavigator,
|
|
|
cxDBNavigator, cxLabel, cxContainer, cxTextEdit, cxMaskEdit,
|
|
|
cxDropDownEdit;
|
|
|
|
|
|
type
|
|
|
Tfrm_op_Air_Goods = class(TForm)
|
|
|
cxGrid1DBTableView1: TcxGridDBTableView;
|
|
|
cxGrid1Level1: TcxGridLevel;
|
|
|
cxGrid1: TcxGrid;
|
|
|
t_op_Air_Goods1: TDataSource;
|
|
|
t_op_Air_Goods: TADOQuery;
|
|
|
cxGrid1DBTableView1DBColumn1: TcxGridDBColumn;
|
|
|
cxGrid1DBTableView1DBColumn2: TcxGridDBColumn;
|
|
|
cxGrid1DBTableView1DBColumn3: TcxGridDBColumn;
|
|
|
cxGrid1DBTableView1DBColumn4: TcxGridDBColumn;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
cxDBNavigator1: TcxDBNavigator;
|
|
|
cxCalcEdit1: TcxCalcEdit;
|
|
|
cxLabel1: TcxLabel;
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure t_op_Air_GoodsAfterInsert(DataSet: TDataSet);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure t_op_Air_GoodsBeforePost(DataSet: TDataSet);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_op_Air_Goods: Tfrm_op_Air_Goods;
|
|
|
|
|
|
implementation
|
|
|
uses u_main,my_sys_function;
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
t_op_Air_Goods.Open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.t_op_Air_GoodsAfterInsert(DataSet: TDataSet);
|
|
|
begin
|
|
|
t_op_Air_Goods['񅧏']:=t_op_Air_Goods.DataSource.DataSet['񅧏'];
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.bsSkinButton1Click(Sender: TObject);
|
|
|
var aAdoQuery:TAdoQuery;
|
|
|
d_Weight,cmb:Double;
|
|
|
qty:Integer;
|
|
|
begin
|
|
|
//
|
|
|
d_Weight:=0;
|
|
|
cmb:=0;
|
|
|
qty:=0;
|
|
|
if cxCalcEdit1.Value=0 then
|
|
|
begin
|
|
|
ShowMessage('¼ÆËã»ùÊý²»ÄÜ0');
|
|
|
exit;
|
|
|
end;
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
with aAdoQuery do
|
|
|
try
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('Select * from t_op_Air_Goods');
|
|
|
sql.Add('where 񅧏=:񅧏');
|
|
|
Parameters.ParamByName('񅧏').Value:=t_op_Air_Goods.DataSource.DataSet['񅧏'];
|
|
|
Open;First;
|
|
|
while not Eof do
|
|
|
begin
|
|
|
qty:=qty+FieldByName('¼þÊý').AsInteger;
|
|
|
cmb:=cmb+FieldByName('³¤').Value*FieldByName('¿í').Value*FieldByName('¸ß').Value*FieldByName('¼þÊý').Value;
|
|
|
d_Weight:=d_Weight+FieldByName('³¤').Value*FieldByName('¿í').Value*FieldByName('¸ß').Value*FieldByName('¼þÊý').Value;
|
|
|
Next;
|
|
|
end;
|
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet.Edit;
|
|
|
t_op_Air_Goods.DataSource.DataSet['¼þÊý']:=qty;
|
|
|
t_op_Air_Goods.DataSource.DataSet['ÖØÁ¿']:=d_Weight/cxCalcEdit1.Value;
|
|
|
t_op_Air_Goods.DataSource.DataSet['¼Æ¼ÛÖØÁ¿']:=d_Weight/cxCalcEdit1.Value;
|
|
|
t_op_Air_Goods.DataSource.DataSet['³ßÂë']:=cmb/1000000;
|
|
|
t_op_Air_Goods.DataSource.DataSet.Post;
|
|
|
{
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('update t_op_Aire set ÖØÁ¿=:ÖØÁ¿');
|
|
|
sql.Add('where 񅧏=:񅧏');
|
|
|
Parameters.ParamByName('񅧏').Value:=t_op_Air_Goods.DataSource.DataSet['񅧏'];
|
|
|
Parameters.ParamByName('ÖØÁ¿').Value:=d_Weight/cxCalcEdit1.Value;
|
|
|
ExecSQL;
|
|
|
}
|
|
|
finally
|
|
|
Free;
|
|
|
end;
|
|
|
Close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.t_op_Air_GoodsBeforePost(DataSet: TDataSet);
|
|
|
begin
|
|
|
if DataSet.FieldByName('³¤').Value=0 then
|
|
|
begin
|
|
|
showmessage('³¤²»ÄÜΪ0£¬²»Äܱ£´æ£¡');
|
|
|
abort;
|
|
|
end;
|
|
|
if DataSet.FieldByName('¿í').Value=0 then
|
|
|
begin
|
|
|
showmessage('¿í²»ÄÜΪ0£¬²»Äܱ£´æ£¡');
|
|
|
abort;
|
|
|
end;
|
|
|
if DataSet.FieldByName('¸ß').Value=0 then
|
|
|
begin
|
|
|
showmessage('¸ß²»ÄÜΪ0£¬²»Äܱ£´æ£¡');
|
|
|
abort;
|
|
|
end;
|
|
|
if DataSet.FieldByName('¼þÊý').Value=0 then
|
|
|
begin
|
|
|
showmessage('¼þÊý²»ÄÜΪ0£¬²»Äܱ£´æ£¡');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|