Y
yirong
Unregistered / Unconfirmed
GUEST, unregistred user!
各位师傅,我的DELPHI程序录入记录后第二次运行就出错:的'cannot focus a disab led or invisible window'.(0分)<br />我用INTERBASE6.0数据库开发一个进出口公司的管理软件,其中的合同管理资料有两个版本,我用PAGECONTROL分成两个格式,前几天本来我已调试好程序没有出错,还录入了几个合同试,因为今天想把合同的MARK头图片及标题图片加进去,可是没修改运行就已经出错"..exe raised exception class einvalidoperation with message 'cannot focus a disab led or invisible window'. process stopped....."后来我用DROP把相关的合同数据表删除重建,重新运行程序,这时合同相关数据表为空,运行倒正常,新加入记录,退出,再一次运行又出现前面的'cannot focus a disab led or invisible window'.
哪位师傅以前碰到过这种情况,帮我看看究竟怎么回事? 我弄了两个钟,还没弄清楚怎么回事?(我剩下才几十分,我只能拿以前自己解决的贴子100分相送)
源码如下:
unit CONTRACT;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, StdCtrls, Mask, ComCtrls, Buttons, Grids,
DBGrids, DB, IBDatabase, IBCustomDataSet, IBTable, IBQuery;
type
TMcontract = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
GroupBox1: TGroupBox;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
Label4: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Label5: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label9: TLabel;
DBEdit7: TDBEdit;
BitBtn1: TBitBtn;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
DBEdit1: TDBEdit;
Label1: TLabel;
DBEdit16: TDBEdit;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
DBEdit17: TDBEdit;
DBEdit18: TDBEdit;
DBEdit19: TDBEdit;
DBEdit20: TDBEdit;
DBEdit21: TDBEdit;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
DBEdit24: TDBEdit;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
GroupBox5: TGroupBox;
cmdadd: TBitBtn;
cmdsave: TBitBtn;
GroupBox6: TGroupBox;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DBEdit8: TDBEdit;
DBLookupComboBox3: TDBLookupComboBox;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBEdit11: TDBEdit;
QUANTITY: TDBEdit;
PRICE: TDBEdit;
AMOUNT: TDBEdit;
DBGrid1: TDBGrid;
IBTransaction1: TIBTransaction;
T_product: TIBTable;
T_applyer: TIBTable;
IBDatabase1: TIBDatabase;
DS_applyer: TDataSource;
DS_product: TDataSource;
T_customer: TIBTable;
T_cont_titl1: TIBTable;
T_cont1: TIBTable;
DS_cont_titl1: TDataSource;
DS_cont1: TDataSource;
DS_customer: TDataSource;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
GroupBox7: TGroupBox;
Label33: TLabel;
DBEdit14: TDBEdit;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
DBEdit27: TDBEdit;
DBEdit28: TDBEdit;
Image2: TImage;
Image3: TImage;
DBComboBox1: TDBComboBox;
DBComboBox2: TDBComboBox;
DBComboBox3: TDBComboBox;
Label34: TLabel;
Label28: TLabel;
DBEdit12: TDBEdit;
BitBtn2: TBitBtn;
GroupBox8: TGroupBox;
GroupBox9: TGroupBox;
CMADD2: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
BitBtn6: TBitBtn;
DBEdit39: TDBEdit;
DBEdit40: TDBEdit;
DBEdit41: TDBEdit;
DBComboBox4: TDBComboBox;
CONT2_ID: TDBEdit;
DBEdit43: TDBEdit;
DBEdit44: TDBEdit;
Label52: TLabel;
Label53: TLabel;
Label54: TLabel;
Label55: TLabel;
Label56: TLabel;
Label57: TLabel;
Label58: TLabel;
Label59: TLabel;
Label60: TLabel;
Label61: TLabel;
Label62: TLabel;
Label63: TLabel;
Label64: TLabel;
Label65: TLabel;
Label66: TLabel;
DBEdit46: TDBEdit;
DBEdit47: TDBEdit;
DBMemo1: TDBMemo;
DBMemo2: TDBMemo;
DBEdit45: TDBEdit;
DBEdit48: TDBEdit;
DBEdit49: TDBEdit;
DBEdit50: TDBEdit;
DBEdit51: TDBEdit;
DBEdit52: TDBEdit;
DBEdit53: TDBEdit;
DBEdit54: TDBEdit;
DBEdit55: TDBEdit;
DBEdit56: TDBEdit;
DBEdit57: TDBEdit;
GroupBox10: TGroupBox;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
DBGrid2: TDBGrid;
DBEdit13: TDBEdit;
DBEdit30: TDBEdit;
DBEdit31: TDBEdit;
DBEdit32: TDBEdit;
DBEdit33: TDBEdit;
QUANTITY02: TDBEdit;
price02: TDBEdit;
DBEdit36: TDBEdit;
appl_tel: TDBEdit;
DBEdit58: TDBEdit;
DBEdit59: TDBEdit;
Label67: TLabel;
T_cont2: TIBTable;
T_cont_titl2: TIBTable;
DBLookupComboBox4: TDBLookupComboBox;
SELL1: TDBLookupComboBox;
DS_cont_titl2: TDataSource;
DS_cont2: TDataSource;
DBLookupComboBox6: TDBLookupComboBox;
procedure cmdaddClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure DBLookupComboBox3Click(Sender: TObject);
procedure QUANTITYExit(Sender: TObject);
procedure PRICEExit(Sender: TObject);
procedure DBEdit1Exit(Sender: TObject);
procedure DBComboBox3Exit(Sender: TObject);
procedure DBEdit4Exit(Sender: TObject);
procedure DBEdit20Exit(Sender: TObject);
procedure DBEdit12Exit(Sender: TObject);
procedure DBLookupComboBox1Click(Sender: TObject);
procedure DBLookupComboBox2Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure CMADD2Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure cmdsaveClick(Sender: TObject);
procedure CONT2_IDExit(Sender: TObject);
procedure DBLookupComboBox4Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure SELL1Click(Sender: TObject);
procedure DBLookupComboBox6Click(Sender: TObject);
procedure QUANTITY02Exit(Sender: TObject);
procedure price02Exit(Sender: TObject);
procedure DBEdit49Change(Sender: TObject);
procedure DBEdit52Change(Sender: TObject);
procedure DBEdit55Change(Sender: TObject);
procedure DBEdit51Change(Sender: TObject);
procedure DBEdit53Change(Sender: TObject);
procedure DBLookupComboBox5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Mcontract: TMcontract;
CON_ID:STRING;
I:INTEGER;
TMP_AMOUNT,TMP_VOL:double;
implementation
{$R *.dfm}
procedure TMcontract.cmdaddClick(Sender: TObject);
begin
TMP_AMOUNT:=0.0;
I:=0;
T_cont_titl1.Append;
T_cont_titl1.Edit;
T_cont_titl1['CONTRACT_DATE']:=NOW;
T_cont_titl1['ETD_DATE']:=NOW;
T_cont_titl1['ETA_DATE']:=NOW;
T_cont_titl1['ETD']:='SHENZHEN';
T_cont_titl1['FOB_ADDRESS']:=T_cont_titl1.FIELDBYNAME('ETD').ASSTRING;
dbedit1.SetFocus;
end;
procedure TMcontract.BitBtn1Click(Sender: TObject);
begin
T_CONT1.Append;
I:=I+1;
T_CONT1.Edit;
T_CONT1['SNO']:=I;
T_CONT1['CONTRACT_ID']:=CON_ID;
end;
procedure TMcontract.DBLookupComboBox3Click(Sender: TObject);
var
TMP_NAME,tmp_COLOR:STRING;
begin
T_PRODUCT.Open;
TMP_NAME:=T_PRODUCT.fieldbyname('E_PRODUCT_NAME').asstring;
TMP_COLOR:=T_PRODUCT.fieldbyname('E_COLOR').asstring;
TMP_VOL:=T_PRODUCT.fieldbyname('VOLUME').ASFLOAT;
T_CONT1.EDIT;
T_CONT1['E_PRODUCT_NAME']:=TMP_NAME;
T_CONT1['E_COLOR']:=TMP_COLOR;
QUANTITY.SetFocus;
end;
procedure TMcontract.QUANTITYExit(Sender: TObject);
var
TMP_CBM:double;
begin
T_CONT1.Edit;
TMP_CBM:=TMP_VOL*(T_CONT1.FIELDBYNAME('QUANTITY').ASFLOAT);
T_CONT1['TOTAL_VOLUME']:=TMP_CBM;
PRICE.SetFocus;
end;
procedure TMcontract.PRICEExit(Sender: TObject);
begin
T_CONT1.Edit;
T_CONT1['AMOUNT']:= T_CONT1.FIELDBYNAME('QUANTITY').ASFLOAT*T_CONT1.FIELDBYNAME('PRICE').ASFLOAT ;
TMP_AMOUNT:=TMP_AMOUNT+T_CONT1.FIELDBYNAME('AMOUNT').ASFLOAT;
T_cont_titl1.Edit;
T_cont_titl1['SUB_TOTAL_AMOUNT']:=TMP_AMOUNT;
DBComboBox3.SETFOCUS;
end;
procedure TMcontract.DBEdit1Exit(Sender: TObject);
begin
T_cont_titl1.Edit;
CON_ID:=T_cont_titl1.FIELDBYNAME('CONTRACT_ID').AsString;
end;
procedure TMcontract.DBComboBox3Exit(Sender: TObject);
var
txt:string;
begin
//GRID1.Refresh;
txt:=dbcombobox3.text;
if txt='USD' THEN
BEGIN
T_cont_titl1.EDIT;
T_cont_titl1['EXCHANGE_RATE']:=1;
END;
end;
procedure TMcontract.DBEdit4Exit(Sender: TObject);
begin
T_cont_titl1.edit;
T_cont_titl1['FOB_ADDRESS']:=T_cont_titl1.FIELDBYNAME('ETD').AsString;
end;
procedure TMcontract.DBEdit20Exit(Sender: TObject);
var
amt1,amt2,amt3:double;
begin
T_cont_titl1['HANDLING_CHARGE']:=T_cont_titl1.FieldByName('HANDLING_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt1:=T_cont_titl1.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl1.FieldByName('OTHER_BANK_CHARGE').AsFloat;
amt3:=T_cont_titl1.FieldByName('HANDLING_CHARGE').AsFloat ;
T_cont_titl1['TOTAL_AMOUNT']:=TMP_AMOUNT+amt1+amt2+amt3;
DBEDIT12.SetFocus;
END;
procedure TMcontract.DBEdit12Exit(Sender: TObject);
begin
T_cont_titl1['TOTAL_CHARGE_USD']:= T_cont_titl1.fieldbyname('TOTAL_AMOUNT').ASFLOAT* T_cont_titl1.fieldbyname('EXCHANGE_RATE').ASFLOAT;
end;
procedure TMcontract.DBLookupComboBox1Click(Sender: TObject);
var
TXT1,TXT2,TXT3:STRING;
begin
T_APPLYER.Edit;
TXT1:=T_APPLYER.FieldByName('E_PUB_BANK').AsSTRING;
TXT2:=T_APPLYER.FieldByName('E_PUB_ACCOUNT').AsSTRING;
TXT3:=T_APPLYER.FieldByName('PUB_ACCOUNTS').AsSTRING ;
T_cont_titl1.edit;
T_cont_titl1['E_BANK']:=txt1;
T_cont_titl1['E_ACCOUNT']:=txt2;
T_cont_titl1['E_ACCOUNTS']:=txt3;
end;
procedure TMcontract.DBLookupComboBox2Click(Sender: TObject);
begin
T_CUSTOMER.Edit;
T_cont_titl1.edit;
{_cont_titl1['E_BANK']:=txt1;
T_cont_titl1['E_ACCOUNT']:=txt2;
T_cont_titl1['E_ACCOUNTS']:=txt3;}
//"CUSTOMER_OBVERSEMARK" BLOB SUB_TYPE 0 SEGMENT SIZE 80,
//"CUSTOMER_FLANKMARK" BLOB SUB_TYPE 0 SEGMENT SIZE 80,
end;
procedure TMcontract.BitBtn2Click(Sender: TObject);
begin
CLOSE;
end;
procedure TMcontract.CMADD2Click(Sender: TObject);
begin
TMP_AMOUNT:=0.0;
I:=0;
T_cont_titl2.Append;
T_cont_titl2.Edit;
T_cont_titl2['CONTRACT_DATE']:=NOW;
CONT2_ID.SetFocus;
end;
procedure TMcontract.BitBtn4Click(Sender: TObject);
begin
T_CONT2.Post;
T_cont_titl2.Post;
end;
procedure TMcontract.cmdsaveClick(Sender: TObject);
begin
T_CONT1.Post;
T_cont_titl1.Post;
end;
procedure TMcontract.CONT2_IDExit(Sender: TObject);
begin
T_cont_titl2.Edit;
CON_ID:=T_cont_titl2.FIELDBYNAME('CONTRACT_ID').AsString;
T_CONT_TITL2.Post;
end;
procedure TMcontract.DBLookupComboBox4Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6,TXT7,TXT8,TXT9:STRING;
begin
T_customer.Edit;
TXT1:=T_customer.FieldByName('CUSTOMER_ID').AsSTRING;
TXT2:=T_customer.FieldByName('C_CUSTOMER_NAME').AsSTRING;
TXT3:=T_customer.FieldByName('E_CUSTOMER_NAME').AsSTRING ;
TXT4:=T_customer.FieldByName('C_COMEIN_PORT').AsSTRING ;
TXT5:=T_customer.FieldByName('E_COMEIN_PORT').AsSTRING;
TXT6:=T_customer.FieldByName('C_CUSTOMER_ADDRESS').AsSTRING;
TXT7:=T_customer.FieldByName('E_CUSTOMER_ADDRESS').AsSTRING ;
TXT8:=T_customer.FieldByName('CUSTOMER_TEL').AsSTRING ;
TXT9:=T_customer.FieldByName('CUSTOMER_FAX').AsSTRING ;
T_cont_titl2.edit;
T_cont_titl2['CUSTOMER_ID']:=txt1;
//T_cont_titl2['C_CUSTOMER_NAME']:=txt2;
T_cont_titl2['E_CUSTOMER_NAME']:=txt3;
T_cont_titl2['C_COMEIN_PORT']:=txt4;
T_cont_titl2['E_COMEIN_PORT']:=txt5;
T_cont_titl2['C_CUSTOMER_ADDRESS']:=txt6;
T_cont_titl2['E_CUSTOMER_ADDRESS']:=txt7;
T_cont_titl2['CUSTOMER_TEL']:=txt8;
T_cont_titl2['CUSTOMER_FAX']:=txt9;
END;
procedure TMcontract.BitBtn6Click(Sender: TObject);
begin
T_CONT2.Append;
I:=I+1;
T_CONT2.Edit;
T_CONT2['SNO']:=I;
T_CONT2['CONTRACT_ID']:=CON_ID;
T_CONT2['PRICE_UNIT']:='RMB';
SELL1.SetFocus;
end;
procedure TMcontract.SELL1Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6:STRING;
begin
T_APPLYER.Edit;
TXT1:=T_APPLYER.FieldByName('APPLYER_ID').AsSTRING ;
TXT2:=T_APPLYER.FieldByName('C_APPLYER_FORSHORT').AsSTRING ;
TXT3:=T_APPLYER.FieldByName('E_APPLYER_FORSHORT').AsSTRING;
TXT4:=T_APPLYER.FieldByName('FACTORY_TEL').AsSTRING;
TXT5:=T_APPLYER.FieldByName('C_PRINCIPAL').AsSTRING ;
TXT6:=T_APPLYER.FieldByName('E_PRINCIPAL').AsSTRING ;
T_cont2.edit;
T_cont2['APPLYER_ID']:=txt1;
T_cont2['C_APPLYER_FORSHORT']:=txt2;
T_cont2['E_APPLYER_FORSHORT']:=txt3;
T_cont2['FACTORY_TEL']:=txt4;
T_cont2['C_PRINCIPAL']:=txt5;
T_cont2['E_PRINCIPAL']:=txt6;
T_cont2.POST;
end;
procedure TMcontract.DBLookupComboBox6Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6,txt7,txt8:STRING;
begin
T_product.Edit;
TXT1:=T_product.FieldByName('PRODUCT_ID').AsSTRING ;
TXT2:=T_product.FieldByName('C_PRODUCT_TYPE').AsSTRING ;
TXT3:=T_product.FieldByName('E_PRODUCT_TYPE').AsSTRING;
TXT4:=T_product.FieldByName('C_PRODUCT_NAME').AsSTRING;
TXT5:=T_product.FieldByName('E_PRODUCT_NAME').AsSTRING ;
TXT6:=T_product.FieldByName('C_COLOR').AsSTRING ;
TXT7:=T_product.FieldByName('E_COLOR').AsSTRING;
TXT8 :=T_product.FieldByName('MATERIAL_SPEC').AsSTRING ;
TMP_VOL:=T_PRODUCT.fieldbyname('VOLUME').ASFLOAT;
T_cont2.edit;
T_cont2['PRODUCT_ID']:=txt1;
T_cont2['C_PRODUCT_TYPE']:=txt2;
T_cont2['E_PRODUCT_TYPE']:=txt3;
//T_cont2['C_PRODUCT_NAME']:=txt4;
T_cont2['E_PRODUCT_NAME']:=txt5;
T_cont2['C_COLOR']:=txt6;
T_cont2['E_COLOR']:=txt7;
T_cont2['MATERIAL_SPEC']:=txt8 ;
T_cont2['VOLUME']:=TMP_VOL;
QUANTITY02.SetFocus;
end;
procedure TMcontract.QUANTITY02Exit(Sender: TObject);
var
TMP_CBM:double;
begin
T_CONT2.Edit;
TMP_CBM:=TMP_VOL*(T_CONT2.FIELDBYNAME('QUANTITY').ASFLOAT);
T_CONT2['TOTAL_VOLUME']:=TMP_CBM;
PRICE02.SetFocus;
END;
procedure TMcontract.price02Exit(Sender: TObject);
begin
T_CONT2.Edit;
T_CONT2['AMOUNT']:= T_CONT2.FIELDBYNAME('QUANTITY').ASFLOAT*T_CONT2.FIELDBYNAME('PRICE').ASFLOAT ;
TMP_AMOUNT:=TMP_AMOUNT+T_CONT2.FIELDBYNAME('AMOUNT').ASFLOAT;
T_cont_titl2.Edit;
T_cont_titl2['SUB_TOTAL_AMOUNT']:=TMP_AMOUNT;
appl_tel.SETFOCUS;
t_cont2.Edit;
appl_tel.SETFOCUS;
end;
procedure TMcontract.DBEdit49Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT52.SetFocus;
END;
procedure TMcontract.DBEdit52Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT55.SetFocus;
end;
procedure TMcontract.DBEdit55Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2.edit;
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT51.SetFocus;
end;
procedure TMcontract.DBEdit51Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT53.SetFocus;
end;
procedure TMcontract.DBEdit53Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2.edit;
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT56.SetFocus;
end;
procedure TMcontract.DBLookupComboBox5Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4:STRING;
begin
T_CUSTOMER.OPEN;
TXT1:=T_CUSTOMER.FieldByName('C_CUSTOMER_ADDRESS').AsSTRING;
TXT2:=T_CUSTOMER.FieldByName('CUSTOMER_TEL').AsSTRING;
TXT3:=T_CUSTOMER.FieldByName('CUSTOMER_FAX').AsSTRING ;
TXT4:=T_CUSTOMER.FieldByName('CUSTOMER_ID').AsSTRING ;
T_cont_titl2.edit;
T_cont_titl2['C_CUSTOMER_ADDRESS']:=txt1;
T_cont_titl2['CUSTOMER_TEL']:=txt2;
T_cont_titl2['CUSTOMER_FAX']:=txt3;
T_cont_titl2['CUSTOMER_ID']:=txt4;
end;
end.
哪位师傅以前碰到过这种情况,帮我看看究竟怎么回事? 我弄了两个钟,还没弄清楚怎么回事?(我剩下才几十分,我只能拿以前自己解决的贴子100分相送)
源码如下:
unit CONTRACT;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, StdCtrls, Mask, ComCtrls, Buttons, Grids,
DBGrids, DB, IBDatabase, IBCustomDataSet, IBTable, IBQuery;
type
TMcontract = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
GroupBox1: TGroupBox;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
Label4: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Label5: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label9: TLabel;
DBEdit7: TDBEdit;
BitBtn1: TBitBtn;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
DBEdit1: TDBEdit;
Label1: TLabel;
DBEdit16: TDBEdit;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
DBEdit17: TDBEdit;
DBEdit18: TDBEdit;
DBEdit19: TDBEdit;
DBEdit20: TDBEdit;
DBEdit21: TDBEdit;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
DBEdit24: TDBEdit;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
GroupBox5: TGroupBox;
cmdadd: TBitBtn;
cmdsave: TBitBtn;
GroupBox6: TGroupBox;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DBEdit8: TDBEdit;
DBLookupComboBox3: TDBLookupComboBox;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBEdit11: TDBEdit;
QUANTITY: TDBEdit;
PRICE: TDBEdit;
AMOUNT: TDBEdit;
DBGrid1: TDBGrid;
IBTransaction1: TIBTransaction;
T_product: TIBTable;
T_applyer: TIBTable;
IBDatabase1: TIBDatabase;
DS_applyer: TDataSource;
DS_product: TDataSource;
T_customer: TIBTable;
T_cont_titl1: TIBTable;
T_cont1: TIBTable;
DS_cont_titl1: TDataSource;
DS_cont1: TDataSource;
DS_customer: TDataSource;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
GroupBox7: TGroupBox;
Label33: TLabel;
DBEdit14: TDBEdit;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
DBEdit27: TDBEdit;
DBEdit28: TDBEdit;
Image2: TImage;
Image3: TImage;
DBComboBox1: TDBComboBox;
DBComboBox2: TDBComboBox;
DBComboBox3: TDBComboBox;
Label34: TLabel;
Label28: TLabel;
DBEdit12: TDBEdit;
BitBtn2: TBitBtn;
GroupBox8: TGroupBox;
GroupBox9: TGroupBox;
CMADD2: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
BitBtn6: TBitBtn;
DBEdit39: TDBEdit;
DBEdit40: TDBEdit;
DBEdit41: TDBEdit;
DBComboBox4: TDBComboBox;
CONT2_ID: TDBEdit;
DBEdit43: TDBEdit;
DBEdit44: TDBEdit;
Label52: TLabel;
Label53: TLabel;
Label54: TLabel;
Label55: TLabel;
Label56: TLabel;
Label57: TLabel;
Label58: TLabel;
Label59: TLabel;
Label60: TLabel;
Label61: TLabel;
Label62: TLabel;
Label63: TLabel;
Label64: TLabel;
Label65: TLabel;
Label66: TLabel;
DBEdit46: TDBEdit;
DBEdit47: TDBEdit;
DBMemo1: TDBMemo;
DBMemo2: TDBMemo;
DBEdit45: TDBEdit;
DBEdit48: TDBEdit;
DBEdit49: TDBEdit;
DBEdit50: TDBEdit;
DBEdit51: TDBEdit;
DBEdit52: TDBEdit;
DBEdit53: TDBEdit;
DBEdit54: TDBEdit;
DBEdit55: TDBEdit;
DBEdit56: TDBEdit;
DBEdit57: TDBEdit;
GroupBox10: TGroupBox;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
DBGrid2: TDBGrid;
DBEdit13: TDBEdit;
DBEdit30: TDBEdit;
DBEdit31: TDBEdit;
DBEdit32: TDBEdit;
DBEdit33: TDBEdit;
QUANTITY02: TDBEdit;
price02: TDBEdit;
DBEdit36: TDBEdit;
appl_tel: TDBEdit;
DBEdit58: TDBEdit;
DBEdit59: TDBEdit;
Label67: TLabel;
T_cont2: TIBTable;
T_cont_titl2: TIBTable;
DBLookupComboBox4: TDBLookupComboBox;
SELL1: TDBLookupComboBox;
DS_cont_titl2: TDataSource;
DS_cont2: TDataSource;
DBLookupComboBox6: TDBLookupComboBox;
procedure cmdaddClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure DBLookupComboBox3Click(Sender: TObject);
procedure QUANTITYExit(Sender: TObject);
procedure PRICEExit(Sender: TObject);
procedure DBEdit1Exit(Sender: TObject);
procedure DBComboBox3Exit(Sender: TObject);
procedure DBEdit4Exit(Sender: TObject);
procedure DBEdit20Exit(Sender: TObject);
procedure DBEdit12Exit(Sender: TObject);
procedure DBLookupComboBox1Click(Sender: TObject);
procedure DBLookupComboBox2Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure CMADD2Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure cmdsaveClick(Sender: TObject);
procedure CONT2_IDExit(Sender: TObject);
procedure DBLookupComboBox4Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure SELL1Click(Sender: TObject);
procedure DBLookupComboBox6Click(Sender: TObject);
procedure QUANTITY02Exit(Sender: TObject);
procedure price02Exit(Sender: TObject);
procedure DBEdit49Change(Sender: TObject);
procedure DBEdit52Change(Sender: TObject);
procedure DBEdit55Change(Sender: TObject);
procedure DBEdit51Change(Sender: TObject);
procedure DBEdit53Change(Sender: TObject);
procedure DBLookupComboBox5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Mcontract: TMcontract;
CON_ID:STRING;
I:INTEGER;
TMP_AMOUNT,TMP_VOL:double;
implementation
{$R *.dfm}
procedure TMcontract.cmdaddClick(Sender: TObject);
begin
TMP_AMOUNT:=0.0;
I:=0;
T_cont_titl1.Append;
T_cont_titl1.Edit;
T_cont_titl1['CONTRACT_DATE']:=NOW;
T_cont_titl1['ETD_DATE']:=NOW;
T_cont_titl1['ETA_DATE']:=NOW;
T_cont_titl1['ETD']:='SHENZHEN';
T_cont_titl1['FOB_ADDRESS']:=T_cont_titl1.FIELDBYNAME('ETD').ASSTRING;
dbedit1.SetFocus;
end;
procedure TMcontract.BitBtn1Click(Sender: TObject);
begin
T_CONT1.Append;
I:=I+1;
T_CONT1.Edit;
T_CONT1['SNO']:=I;
T_CONT1['CONTRACT_ID']:=CON_ID;
end;
procedure TMcontract.DBLookupComboBox3Click(Sender: TObject);
var
TMP_NAME,tmp_COLOR:STRING;
begin
T_PRODUCT.Open;
TMP_NAME:=T_PRODUCT.fieldbyname('E_PRODUCT_NAME').asstring;
TMP_COLOR:=T_PRODUCT.fieldbyname('E_COLOR').asstring;
TMP_VOL:=T_PRODUCT.fieldbyname('VOLUME').ASFLOAT;
T_CONT1.EDIT;
T_CONT1['E_PRODUCT_NAME']:=TMP_NAME;
T_CONT1['E_COLOR']:=TMP_COLOR;
QUANTITY.SetFocus;
end;
procedure TMcontract.QUANTITYExit(Sender: TObject);
var
TMP_CBM:double;
begin
T_CONT1.Edit;
TMP_CBM:=TMP_VOL*(T_CONT1.FIELDBYNAME('QUANTITY').ASFLOAT);
T_CONT1['TOTAL_VOLUME']:=TMP_CBM;
PRICE.SetFocus;
end;
procedure TMcontract.PRICEExit(Sender: TObject);
begin
T_CONT1.Edit;
T_CONT1['AMOUNT']:= T_CONT1.FIELDBYNAME('QUANTITY').ASFLOAT*T_CONT1.FIELDBYNAME('PRICE').ASFLOAT ;
TMP_AMOUNT:=TMP_AMOUNT+T_CONT1.FIELDBYNAME('AMOUNT').ASFLOAT;
T_cont_titl1.Edit;
T_cont_titl1['SUB_TOTAL_AMOUNT']:=TMP_AMOUNT;
DBComboBox3.SETFOCUS;
end;
procedure TMcontract.DBEdit1Exit(Sender: TObject);
begin
T_cont_titl1.Edit;
CON_ID:=T_cont_titl1.FIELDBYNAME('CONTRACT_ID').AsString;
end;
procedure TMcontract.DBComboBox3Exit(Sender: TObject);
var
txt:string;
begin
//GRID1.Refresh;
txt:=dbcombobox3.text;
if txt='USD' THEN
BEGIN
T_cont_titl1.EDIT;
T_cont_titl1['EXCHANGE_RATE']:=1;
END;
end;
procedure TMcontract.DBEdit4Exit(Sender: TObject);
begin
T_cont_titl1.edit;
T_cont_titl1['FOB_ADDRESS']:=T_cont_titl1.FIELDBYNAME('ETD').AsString;
end;
procedure TMcontract.DBEdit20Exit(Sender: TObject);
var
amt1,amt2,amt3:double;
begin
T_cont_titl1['HANDLING_CHARGE']:=T_cont_titl1.FieldByName('HANDLING_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt1:=T_cont_titl1.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl1.FieldByName('OTHER_BANK_CHARGE').AsFloat;
amt3:=T_cont_titl1.FieldByName('HANDLING_CHARGE').AsFloat ;
T_cont_titl1['TOTAL_AMOUNT']:=TMP_AMOUNT+amt1+amt2+amt3;
DBEDIT12.SetFocus;
END;
procedure TMcontract.DBEdit12Exit(Sender: TObject);
begin
T_cont_titl1['TOTAL_CHARGE_USD']:= T_cont_titl1.fieldbyname('TOTAL_AMOUNT').ASFLOAT* T_cont_titl1.fieldbyname('EXCHANGE_RATE').ASFLOAT;
end;
procedure TMcontract.DBLookupComboBox1Click(Sender: TObject);
var
TXT1,TXT2,TXT3:STRING;
begin
T_APPLYER.Edit;
TXT1:=T_APPLYER.FieldByName('E_PUB_BANK').AsSTRING;
TXT2:=T_APPLYER.FieldByName('E_PUB_ACCOUNT').AsSTRING;
TXT3:=T_APPLYER.FieldByName('PUB_ACCOUNTS').AsSTRING ;
T_cont_titl1.edit;
T_cont_titl1['E_BANK']:=txt1;
T_cont_titl1['E_ACCOUNT']:=txt2;
T_cont_titl1['E_ACCOUNTS']:=txt3;
end;
procedure TMcontract.DBLookupComboBox2Click(Sender: TObject);
begin
T_CUSTOMER.Edit;
T_cont_titl1.edit;
{_cont_titl1['E_BANK']:=txt1;
T_cont_titl1['E_ACCOUNT']:=txt2;
T_cont_titl1['E_ACCOUNTS']:=txt3;}
//"CUSTOMER_OBVERSEMARK" BLOB SUB_TYPE 0 SEGMENT SIZE 80,
//"CUSTOMER_FLANKMARK" BLOB SUB_TYPE 0 SEGMENT SIZE 80,
end;
procedure TMcontract.BitBtn2Click(Sender: TObject);
begin
CLOSE;
end;
procedure TMcontract.CMADD2Click(Sender: TObject);
begin
TMP_AMOUNT:=0.0;
I:=0;
T_cont_titl2.Append;
T_cont_titl2.Edit;
T_cont_titl2['CONTRACT_DATE']:=NOW;
CONT2_ID.SetFocus;
end;
procedure TMcontract.BitBtn4Click(Sender: TObject);
begin
T_CONT2.Post;
T_cont_titl2.Post;
end;
procedure TMcontract.cmdsaveClick(Sender: TObject);
begin
T_CONT1.Post;
T_cont_titl1.Post;
end;
procedure TMcontract.CONT2_IDExit(Sender: TObject);
begin
T_cont_titl2.Edit;
CON_ID:=T_cont_titl2.FIELDBYNAME('CONTRACT_ID').AsString;
T_CONT_TITL2.Post;
end;
procedure TMcontract.DBLookupComboBox4Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6,TXT7,TXT8,TXT9:STRING;
begin
T_customer.Edit;
TXT1:=T_customer.FieldByName('CUSTOMER_ID').AsSTRING;
TXT2:=T_customer.FieldByName('C_CUSTOMER_NAME').AsSTRING;
TXT3:=T_customer.FieldByName('E_CUSTOMER_NAME').AsSTRING ;
TXT4:=T_customer.FieldByName('C_COMEIN_PORT').AsSTRING ;
TXT5:=T_customer.FieldByName('E_COMEIN_PORT').AsSTRING;
TXT6:=T_customer.FieldByName('C_CUSTOMER_ADDRESS').AsSTRING;
TXT7:=T_customer.FieldByName('E_CUSTOMER_ADDRESS').AsSTRING ;
TXT8:=T_customer.FieldByName('CUSTOMER_TEL').AsSTRING ;
TXT9:=T_customer.FieldByName('CUSTOMER_FAX').AsSTRING ;
T_cont_titl2.edit;
T_cont_titl2['CUSTOMER_ID']:=txt1;
//T_cont_titl2['C_CUSTOMER_NAME']:=txt2;
T_cont_titl2['E_CUSTOMER_NAME']:=txt3;
T_cont_titl2['C_COMEIN_PORT']:=txt4;
T_cont_titl2['E_COMEIN_PORT']:=txt5;
T_cont_titl2['C_CUSTOMER_ADDRESS']:=txt6;
T_cont_titl2['E_CUSTOMER_ADDRESS']:=txt7;
T_cont_titl2['CUSTOMER_TEL']:=txt8;
T_cont_titl2['CUSTOMER_FAX']:=txt9;
END;
procedure TMcontract.BitBtn6Click(Sender: TObject);
begin
T_CONT2.Append;
I:=I+1;
T_CONT2.Edit;
T_CONT2['SNO']:=I;
T_CONT2['CONTRACT_ID']:=CON_ID;
T_CONT2['PRICE_UNIT']:='RMB';
SELL1.SetFocus;
end;
procedure TMcontract.SELL1Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6:STRING;
begin
T_APPLYER.Edit;
TXT1:=T_APPLYER.FieldByName('APPLYER_ID').AsSTRING ;
TXT2:=T_APPLYER.FieldByName('C_APPLYER_FORSHORT').AsSTRING ;
TXT3:=T_APPLYER.FieldByName('E_APPLYER_FORSHORT').AsSTRING;
TXT4:=T_APPLYER.FieldByName('FACTORY_TEL').AsSTRING;
TXT5:=T_APPLYER.FieldByName('C_PRINCIPAL').AsSTRING ;
TXT6:=T_APPLYER.FieldByName('E_PRINCIPAL').AsSTRING ;
T_cont2.edit;
T_cont2['APPLYER_ID']:=txt1;
T_cont2['C_APPLYER_FORSHORT']:=txt2;
T_cont2['E_APPLYER_FORSHORT']:=txt3;
T_cont2['FACTORY_TEL']:=txt4;
T_cont2['C_PRINCIPAL']:=txt5;
T_cont2['E_PRINCIPAL']:=txt6;
T_cont2.POST;
end;
procedure TMcontract.DBLookupComboBox6Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4,TXT5,TXT6,txt7,txt8:STRING;
begin
T_product.Edit;
TXT1:=T_product.FieldByName('PRODUCT_ID').AsSTRING ;
TXT2:=T_product.FieldByName('C_PRODUCT_TYPE').AsSTRING ;
TXT3:=T_product.FieldByName('E_PRODUCT_TYPE').AsSTRING;
TXT4:=T_product.FieldByName('C_PRODUCT_NAME').AsSTRING;
TXT5:=T_product.FieldByName('E_PRODUCT_NAME').AsSTRING ;
TXT6:=T_product.FieldByName('C_COLOR').AsSTRING ;
TXT7:=T_product.FieldByName('E_COLOR').AsSTRING;
TXT8 :=T_product.FieldByName('MATERIAL_SPEC').AsSTRING ;
TMP_VOL:=T_PRODUCT.fieldbyname('VOLUME').ASFLOAT;
T_cont2.edit;
T_cont2['PRODUCT_ID']:=txt1;
T_cont2['C_PRODUCT_TYPE']:=txt2;
T_cont2['E_PRODUCT_TYPE']:=txt3;
//T_cont2['C_PRODUCT_NAME']:=txt4;
T_cont2['E_PRODUCT_NAME']:=txt5;
T_cont2['C_COLOR']:=txt6;
T_cont2['E_COLOR']:=txt7;
T_cont2['MATERIAL_SPEC']:=txt8 ;
T_cont2['VOLUME']:=TMP_VOL;
QUANTITY02.SetFocus;
end;
procedure TMcontract.QUANTITY02Exit(Sender: TObject);
var
TMP_CBM:double;
begin
T_CONT2.Edit;
TMP_CBM:=TMP_VOL*(T_CONT2.FIELDBYNAME('QUANTITY').ASFLOAT);
T_CONT2['TOTAL_VOLUME']:=TMP_CBM;
PRICE02.SetFocus;
END;
procedure TMcontract.price02Exit(Sender: TObject);
begin
T_CONT2.Edit;
T_CONT2['AMOUNT']:= T_CONT2.FIELDBYNAME('QUANTITY').ASFLOAT*T_CONT2.FIELDBYNAME('PRICE').ASFLOAT ;
TMP_AMOUNT:=TMP_AMOUNT+T_CONT2.FIELDBYNAME('AMOUNT').ASFLOAT;
T_cont_titl2.Edit;
T_cont_titl2['SUB_TOTAL_AMOUNT']:=TMP_AMOUNT;
appl_tel.SETFOCUS;
t_cont2.Edit;
appl_tel.SETFOCUS;
end;
procedure TMcontract.DBEdit49Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT52.SetFocus;
END;
procedure TMcontract.DBEdit52Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT55.SetFocus;
end;
procedure TMcontract.DBEdit55Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2.edit;
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT51.SetFocus;
end;
procedure TMcontract.DBEdit51Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT53.SetFocus;
end;
procedure TMcontract.DBEdit53Change(Sender: TObject);
var
amt0,amt1,amt2,amt3,amt4,amt5:double;
begin
T_cont_titl2.edit;
T_cont_titl2['COMMISION_CHARGE']:=T_cont_titl2.FieldByName('COMMISION_PERCENT').AsFloat/100.0*TMP_AMOUNT ;
amt0:=T_cont_titl2.FieldByName('COMMISION_CHARGE').AsFloat;
amt1:=T_cont_titl2.FieldByName('FOB_CHARGE').AsFloat;
amt2:=T_cont_titl2.FieldByName('OCEAN_FREIGHT_CHARGE').AsFloat;
amt3:=T_cont_titl2.FieldByName('BANK_CHARGE').AsFloat ;
amt4:=T_cont_titl2.FieldByName('other_CHARGE').AsFloat ;
amt5:=T_cont_titl2.FieldByName('had_pay').AsFloat ;
T_cont_titl2['TOTAL_AMOUNT']:=TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4;
T_cont_titl2['hadnot_pay']:= TMP_AMOUNT+amt0+amt1+amt2+amt3+amt4-amt5;
DBEDIT56.SetFocus;
end;
procedure TMcontract.DBLookupComboBox5Click(Sender: TObject);
var
TXT1,TXT2,TXT3,TXT4:STRING;
begin
T_CUSTOMER.OPEN;
TXT1:=T_CUSTOMER.FieldByName('C_CUSTOMER_ADDRESS').AsSTRING;
TXT2:=T_CUSTOMER.FieldByName('CUSTOMER_TEL').AsSTRING;
TXT3:=T_CUSTOMER.FieldByName('CUSTOMER_FAX').AsSTRING ;
TXT4:=T_CUSTOMER.FieldByName('CUSTOMER_ID').AsSTRING ;
T_cont_titl2.edit;
T_cont_titl2['C_CUSTOMER_ADDRESS']:=txt1;
T_cont_titl2['CUSTOMER_TEL']:=txt2;
T_cont_titl2['CUSTOMER_FAX']:=txt3;
T_cont_titl2['CUSTOMER_ID']:=txt4;
end;
end.