unit u_code_truck_client; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, BusinessSkinForm, StdCtrls, DBCtrls, Mask, dxTL,DB, dxDBCtrl, dxDBGrid, dxCntner, bsSkinCtrls, RxLookup, ExtCtrls; type Tfrm_code_truck_client = class(TForm) Label2: TLabel; dxDBGrid1: TdxDBGrid; DBEdit2: TDBEdit; bsBusinessSkinForm1: TbsBusinessSkinForm; dxDBGrid1Column1: TdxDBGridMaskColumn; Label1: TLabel; DBEdit1: TDBEdit; Label3: TLabel; DBEdit3: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; Label4: TLabel; Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton6: TbsSkinButton; procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton6Click(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_code_truck_client: Tfrm_code_truck_client; code_truck_client_num:integer; implementation uses u_data_share, u_op_letter, my_sys_function, u_op_truck; {$R *.dfm} procedure Tfrm_code_truck_client.bsSkinButton1Click(Sender: TObject); begin frm_data_share.t_code_truck_client.insert; end; procedure Tfrm_code_truck_client.bsSkinButton2Click(Sender: TObject); begin table_post(frm_data_share.t_code_truck_client); end; procedure Tfrm_code_truck_client.bsSkinButton4Click(Sender: TObject); begin table_delete(frm_data_share.t_code_truck_client); end; procedure Tfrm_code_truck_client.bsSkinButton3Click(Sender: TObject); begin table_cancel(frm_data_share.t_code_truck_client); end; procedure Tfrm_code_truck_client.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_truck_client.FormShow(Sender: TObject); begin frm_data_share.t_code_truck_client.requery; end; procedure Tfrm_code_truck_client.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(frm_data_share.t_code_truck_client); end; procedure Tfrm_code_truck_client.bsSkinButton6Click(Sender: TObject); begin if frm_data_share.t_code_truck_client.IsEmpty then exit; case code_truck_client_num of 1: begin frm_op_letter.t_op_letter_pc.edit; frm_op_letter.t_op_letter_pc['厂家']:=frm_data_share.t_code_truck_client['厂家名称']; frm_op_letter.t_op_letter_pc['厂家地址']:=frm_data_share.t_code_truck_client['厂家地址']; frm_op_letter.t_op_letter_pc['厂家联系人']:=frm_data_share.t_code_truck_client['厂家联系人']; frm_op_letter.t_op_letter_pc['厂家联系电话']:=frm_data_share.t_code_truck_client['厂家联系电话']; frm_op_letter.t_op_letter_pc.post; end; 2: begin frm_op_truck.t_op_letter_pc.edit; frm_op_letter.t_op_letter_pc['厂家']:=frm_data_share.t_code_truck_client['厂家名称']; frm_op_truck.t_op_letter_pc['厂家地址']:=frm_data_share.t_code_truck_client['厂家地址']; frm_op_truck.t_op_letter_pc['厂家联系人']:=frm_data_share.t_code_truck_client['厂家联系人']; frm_op_truck.t_op_letter_pc['厂家联系电话']:=frm_data_share.t_code_truck_client['厂家联系电话']; frm_op_truck.t_op_letter_pc.post; end; end; close; end; procedure Tfrm_code_truck_client.RxDBLookupCombo1Change(Sender: TObject); begin if frm_data_share.t_code_truck_client.State in [dsinsert,dsedit] then begin if frm_data_share.t_crm_client.Locate('客户简称',RxDBLookupCombo1.DisplayValues[1],[])then begin frm_data_share.t_code_truck_client['厂家地址']:=frm_data_share.t_crm_client.fieldbyname('通讯地址').AsString; frm_data_share.t_code_truck_client['厂家联系人']:=frm_data_share.t_crm_client.fieldbyname('海运联系人').asstring; frm_data_share.t_code_truck_client['厂家联系电话']:=frm_data_share.t_crm_client.fieldbyname('海运电话').asstring; end; end; end; end.