unit u_op_airtruck_add2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, StdCtrls, wwdbdatetimepicker, Buttons, BusinessSkinForm; type Tfrm_op_airtruck_add2 = class(TForm) Label1: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; data1: TDataSource; ComboBox1: TComboBox; Label2: TLabel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; procedure FormShow(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_airtruck_add2: Tfrm_op_airtruck_add2; implementation uses u_main,u_op_airtruck2,my_sys_function; {$R *.dfm} procedure Tfrm_op_airtruck_add2.FormShow(Sender: TObject); begin wwDBDateTimePicker1.MinDate:=Logininfo.endday+1; wwDBDateTimePicker1.Date:=date; end; procedure Tfrm_op_airtruck_add2.SpeedButton3Click(Sender: TObject); begin close ; end; procedure Tfrm_op_airtruck_add2.SpeedButton1Click(Sender: TObject); begin data1.DataSet.Insert; if Trim(ComboBox1.Text)<>'' then data1.DataSet['业务类型']:=ComboBox1.Text else data1.DataSet['业务类型']:='自有车'; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['录入人']:=employee; data1.DataSet['分部名称']:=subComp; data1.DataSet['录入日期']:=date; data1.DataSet['操作员']:=employee; data1.DataSet['操作部门']:=department; data1.DataSet['揽货人']:=employee; data1.DataSet['客服员']:=employee; data1.DataSet['发车地']:=get_parameters_value(19,'TSINGTAO'); data1.DataSet['业务来源']:=ComboBox1.Text; frm_op_airtruck2.Notebook1.PageIndex:=1; frm_op_airtruck2.bsSkinButton11.Caption:='返回列表'; Close ; end; procedure Tfrm_op_airtruck_add2.SpeedButton2Click(Sender: TObject); var afield : variant; i: Integer; begin if data1.DataSet.IsEmpty then begin showmessage('没有复制母体,不能复制新建!'); exit; end; afield := vararraycreate([0,data1.DataSet.fieldcount-1],varvariant); for i := 0 to (data1.DataSet.fieldcount-1) do begin afield[i] :=data1.DataSet.fields[i].value ; end; data1.DataSet.append; for i := 0 to (data1.DataSet.fieldcount-1) do begin data1.DataSet.fields[i].value := afield[i] ; end; if Trim(ComboBox1.Text)<>'' then data1.DataSet['业务类型']:=ComboBox1.Text else data1.DataSet['业务类型']:='自有车'; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['录入人']:=employee; data1.DataSet['分部名称']:=subComp; data1.DataSet['录入日期']:=date; data1.DataSet['操作员']:=employee; // data1.DataSet['操作部门']:=department; data1.DataSet['揽货人']:=employee; data1.DataSet['客服员']:=employee; data1.DataSet['发车地']:=get_parameters_value(19,'TSINGTAO'); data1.DataSet['业务来源']:=ComboBox1.Text; close; end; end.