unit u_ctn_cqfee; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, bsSkinCtrls, dxBarDBNav, ExtCtrls, DBCtrls, Grids, DBGridEh; type Tfrm_ctn_cqfee = class(TForm) t_ctn_cqfee: TADOQuery; t_ctn_cqfee1: TDataSource; t_crm_client: TADOQuery; t_crm_client1: TDataSource; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridColumn; bsSkinPanel1: TbsSkinPanel; DBNavigator1: TDBNavigator; bsSkinButton6: TbsSkinButton; DBGridEh1: TDBGridEh; procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton6Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_ctn_cqfee: Tfrm_ctn_cqfee; implementation uses my_sys_function; {$R *.dfm} procedure Tfrm_ctn_cqfee.FormShow(Sender: TObject); begin t_crm_client.Open; t_ctn_cqfee.Open; end; procedure Tfrm_ctn_cqfee.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:=caFree; end; procedure Tfrm_ctn_cqfee.bsSkinButton6Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 表现形式 from t_code_ctn'); SQL.Add('order by 表现形式'); Open;First; while not Eof do begin if not t_ctn_cqfee.Locate('客户简称;表现形式',VarArrayOf([t_ctn_cqfee.FieldByName('客户简称').AsString, FieldByName('表现形式').AsString]), [loPartialKey]) then begin t_ctn_cqfee.Insert; t_ctn_cqfee.FieldByName('表现形式').AsString:=FieldByName('表现形式').AsString; t_ctn_cqfee.FieldByName('客户简称').AsString:=t_crm_client.FieldByName('客户简称').AsString; t_ctn_cqfee.FieldByName('免箱使期').Value:=0; t_ctn_cqfee.FieldByName('箱使费1').Value:=0; t_ctn_cqfee.FieldByName('区间1').Value:=0; t_ctn_cqfee.FieldByName('箱使费2').Value:=0; t_ctn_cqfee.FieldByName('区间2').Value:=0; t_ctn_cqfee.FieldByName('箱使费3').Value:=0; t_ctn_cqfee.FieldByName('区间3').Value:=0; t_ctn_cqfee.FieldByName('箱使费4').Value:=0; t_ctn_cqfee.FieldByName('区间4').Value:=0; t_ctn_cqfee.FieldByName('箱使费5').Value:=0; t_ctn_cqfee.FieldByName('区间5').Value:=0; t_ctn_cqfee.Post; end; Next; end; finally Free; end; end; end.