www.pudn.com > dianlijiankong.rar > UHWTYGL.~pas, change:2005-12-17,size:25924b


unit UHWTYGL; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, ExtCtrls, Buttons, ToolWin, ComCtrls, StdCtrls, Grids, DBGrids; 
 
type 
  TFRM_HWTYGL = class(TForm) 
    ToolBar1: TToolBar; 
    SpeedButton1: TSpeedButton; 
    SpeedButton2: TSpeedButton; 
    SpeedButton3: TSpeedButton; 
    SpeedButton4: TSpeedButton; 
    SpeedButton5: TSpeedButton; 
    SpeedButton6: TSpeedButton; 
    Panel1: TPanel; 
    Panel2: TPanel; 
    GroupBox1: TGroupBox; 
    Label22: TLabel; 
    Label21: TLabel; 
    Label20: TLabel; 
    Label19: TLabel; 
    Label18: TLabel; 
    Label17: TLabel; 
    GroupBox2: TGroupBox; 
    Label13: TLabel; 
    Label14: TLabel; 
    Label15: TLabel; 
    Label16: TLabel; 
    GroupBox3: TGroupBox; 
    Label9: TLabel; 
    Label10: TLabel; 
    Label11: TLabel; 
    Label12: TLabel; 
    GroupBox4: TGroupBox; 
    Label8: TLabel; 
    Label7: TLabel; 
    Label6: TLabel; 
    GroupBox5: TGroupBox; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label23: TLabel; 
    Edit2: TEdit; 
    Edit3: TEdit; 
    Edit6: TEdit; 
    Edit5: TEdit; 
    Edit1: TEdit; 
    Label1: TLabel; 
    Edit8: TEdit; 
    Edit4: TEdit; 
    ComboBox1: TComboBox; 
    Edit7: TEdit; 
    Edit9: TEdit; 
    Edit10: TEdit; 
    Edit11: TEdit; 
    ComboBox2: TComboBox; 
    Edit12: TEdit; 
    Edit14: TEdit; 
    DBGrid1: TDBGrid; 
    Edit15: TEdit; 
    Edit16: TEdit; 
    Edit17: TEdit; 
    Edit18: TEdit; 
    Edit19: TEdit; 
    Edit20: TEdit; 
    Edit21: TEdit; 
    ComboBox3: TComboBox; 
    procedure SpeedButton6Click(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
    procedure FormShow(Sender: TObject); 
    procedure SpeedButton1Click(Sender: TObject); 
    procedure SpeedButton2Click(Sender: TObject); 
    procedure SpeedButton3Click(Sender: TObject); 
    procedure SpeedButton4Click(Sender: TObject); 
    procedure SpeedButton5Click(Sender: TObject); 
    procedure ComboBox1DropDown(Sender: TObject); 
    procedure ComboBox1Change(Sender: TObject); 
    procedure ComboBox2DropDown(Sender: TObject); 
    procedure ComboBox2Change(Sender: TObject); 
    procedure ComboBox3DropDown(Sender: TObject); 
    procedure Edit15Exit(Sender: TObject); 
    procedure Edit16Exit(Sender: TObject); 
    procedure Edit18Exit(Sender: TObject); 
    procedure Edit4KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit5KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit6KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit7KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit1KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit2KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit3KeyPress(Sender: TObject; var Key: Char); 
    procedure ComboBox1KeyPress(Sender: TObject; var Key: Char); 
    procedure ComboBox2KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit12KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit14KeyPress(Sender: TObject; var Key: Char); 
    procedure ComboBox3KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit8KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit9KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit10KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit11KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit15KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit16KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit17KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit18KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit19KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit20KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit8Change(Sender: TObject); 
    procedure Edit9Change(Sender: TObject); 
    procedure Edit10Change(Sender: TObject); 
    procedure Edit11Change(Sender: TObject); 
    procedure Edit15Change(Sender: TObject); 
    procedure Edit16Change(Sender: TObject); 
    procedure Edit17Change(Sender: TObject); 
    procedure Edit18Change(Sender: TObject); 
    procedure Edit20Change(Sender: TObject); 
    procedure Edit21Change(Sender: TObject); 
    procedure DBGrid1CellClick(Column: TColumn); 
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; 
      DataCol: Integer; Column: TColumn; State: TGridDrawState); 
  private 
    { Private declarations } 
  public 
    procedure tr;       //去除空字符 
    procedure bh;        //自动编号 
    Procedure GetAll;    //获得所有数据 
    Procedure Posting;   //提交数据 
    Procedure CLS;       //清除控件中内容 
    Procedure DIS;       //控件不可用 
    Procedure ENA;       //控件可用 
    procedure CYXX;     //承运信息 
    Function CanSave:Boolean;   //判断是否保存 
    { Public declarations } 
  end; 
 
var 
  FRM_HWTYGL: TFRM_HWTYGL; 
 
implementation 
 
uses UMAIN, UDM, UHWSQXX; 
 
{$R *.dfm} 
procedure TFRM_HWTYGL.CYXX; 
begin 
  with DM.QGSJBXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select 公司名称,联系电话,法人代表 from 公司信息表'); 
    Open; 
  end; 
  Edit5.Text:=DM.QGSJBXX.FieldByName('公司名称').Value; 
  Edit6.Text:=DM.QGSJBXX.FieldByName('联系电话').Value; 
  Edit7.Text:=DM.QGSJBXX.FieldByName('法人代表').Value; 
end; 
procedure TFRM_HWTYGL.tr; 
var 
i:integer; 
begin 
  for i:=ComponentCount - 1 downto 0 do 
    if(Components[i] is TEdit) then 
    TEdit(Components[i]).Text:=trim(TEdit(Components[i]).Text); 
end; 
Function TFRM_HWTYGL.CanSave: Boolean; 
begin 
  if (ComboBox1.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('申请编号不能为空!','提示!',0+MB_ICONINFORMATION); 
    Exit; 
  end; 
  if (Edit1.Text='') then 
  begin 
   Result:=False; 
   Application.MessageBox('客户名称不能为空!','提示信息',0+MB_ICONINFORMATION); 
   exit; 
  end; 
  if (Edit2.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('客户电话不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit3.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('客户联系人不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit4.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('托运单号不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit5.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('承运单位不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit6.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('承运单位电话不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit7.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('承运单位联系人不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit8.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('收货单位不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit9.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('收货单位电话不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit10.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('收货单位联系人不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit11.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('收货地点不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (ComboBox2.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('承运司机不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit12.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('驾驶证号不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (ComboBox3.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('车辆号码不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit14.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('司机手机不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit15.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('保险金额不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit16.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('保险费用不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit17.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('付款方式不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit18.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('运费不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit19.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('费用合计不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit20.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('已付费用不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
end; 
 
procedure TFRM_HWTYGL.bh; 
var 
i:integer; 
s,m:string; 
begin 
  s:= 'TY'+ FormatDateTime('yyyymmdd',Now()); 
  With DM.QHWTYXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('select max(托运单号) as ss From 货物托运信息表'); 
    Open; 
  end; 
  If DM.QHWTYXX.FieldByName('ss').Value=null then 
    s := s + '001' 
  else 
  begin 
    m:= Trim(DM.QHWTYXX.FieldByName('ss').Value) ; 
    i:= StrToInt(Trim(Copy(m,11,8))) ; 
    if i<9 then 
      s:= s + '00'+ InttoStr(i +1) 
    else if i<99 then 
      s:= s + '0'+ InttoStr(i +1) 
    else 
      s:= s +InttoStr(i +1); 
  end; 
  Edit4.Text := s; 
end;           ///////////////////////////// 
 
procedure TFRM_HWTYGL.GetAll; 
begin 
  ComboBox1.Text:=DM.DSOHWTYXX.FieldByName('申请编号').AsString; 
  Edit1.Text:=DM.DSOHWTYXX.FieldByName('客户名称').AsString; 
  Edit2.Text:=DM.DSOHWTYXX.FieldByName('客户电话').AsString; 
  Edit3.Text:=DM.DSOHWTYXX.FieldByName('客户联系人').AsString; 
 
  Edit4.Text:=DM.DSOHWTYXX.FieldByName('托运单号').AsString; 
  Edit5.Text:=DM.DSOHWTYXX.FieldByName('承运单位').AsString; 
  Edit6.Text:=DM.DSOHWTYXX.FieldByName('承运单位电话').AsString; 
  Edit7.Text:=DM.DSOHWTYXX.FieldByName('承运单位联系人').AsString; 
 
  Edit8.Text:=DM.DSOHWTYXX.FieldByName('收货单位').AsString; 
  Edit9.Text:=DM.DSOHWTYXX.FieldByName('收货单位电话').AsString; 
  Edit10.Text:=DM.DSOHWTYXX.FieldByName('收货单位联系人').AsString; 
  Edit11.Text:=DM.DSOHWTYXX.FieldByName('收货地点').AsString; 
 
  ComboBox2.Text:=DM.DSOHWTYXX.FieldByName('承运司机').AsString; 
  Edit12.Text:=DM.DSOHWTYXX.FieldByName('驾驶证号').AsString; 
  ComboBox3.Text:=DM.DSOHWTYXX.FieldByName('车牌号码').AsString; 
  Edit14.Text:=DM.DSOHWTYXX.FieldByName('司机手机').AsString; 
 
  Edit15.Text:=DM.DSOHWTYXX.FieldByName('保险金额').AsString; 
  Edit16.Text:=DM.DSOHWTYXX.FieldByName('保险费用').AsString; 
  Edit17.Text:=DM.DSOHWTYXX.FieldByName('付款方式').AsString; 
  Edit18.Text:=DM.DSOHWTYXX.FieldByName('运费').AsString; 
  Edit19.Text:=DM.DSOHWTYXX.FieldByName('费用合计').AsString; 
  Edit20.Text:=DM.DSOHWTYXX.FieldByName('已付费用').AsString; 
  Edit21.Text:=DM.DSOHWTYXX.FieldByName('备注').AsString; 
end; 
procedure TFRM_HWTYGL.Posting; 
begin 
  if ActionCD='N' then 
  BEGIN 
    with DM.QHWTYXX do 
    begin 
      Close; 
      SQL.Clear; 
      SQL.Add('INSERT INTO 货物托运信息表(申请编号,客户名称,客户电话,客户联系人,'); 
      SQL.Add('托运单号,承运单位,承运单位电话,承运单位联系人,'); 
      SQL.Add('收货单位,收货单位电话,收货单位联系人,收货地点,'); 
      SQL.Add('承运司机,驾驶证号,车牌号码,司机手机,'); 
      SQL.Add('保险金额,保险费用,付款方式,运费,费用合计,已付费用,备注)'); 
      SQL.Add('Values(:申请编号,:客户名称,:客户电话,:客户联系人,'); 
      SQL.Add(':托运单号,:承运单位,:承运单位电话,:承运单位联系人,'); 
      SQL.Add(':收货单位,:收货单位电话,:收货单位联系人,:收货地点,'); 
      SQL.Add(':承运司机,:驾驶证号,:车牌号码,:司机手机,'); 
      SQL.Add(':保险金额,:保险费用,:付款方式,:运费,:费用合计,:已付费用,:备注)'); 
      Parameters.Items[0].Value:=ComboBox1.Text; 
      Parameters.Items[1].Value:=Edit1.Text; 
      Parameters.Items[2].Value:=Edit2.Text; 
      Parameters.Items[3].Value:=Edit3.Text; 
      Parameters.Items[4].Value:=Edit4.Text; 
      Parameters.Items[5].Value:=Edit5.Text; 
      Parameters.Items[6].Value:=Edit6.Text; 
      Parameters.Items[7].Value:=Edit7.Text; 
      Parameters.Items[8].Value:=Edit8.Text; 
      Parameters.Items[9].Value:=Edit9.Text; 
      Parameters.Items[10].Value:=Edit10.Text; 
      Parameters.Items[11].Value:=Edit11.Text; 
      Parameters.Items[12].Value:=ComboBox2.Text; 
      Parameters.Items[13].Value:=Edit12.Text; 
      Parameters.Items[14].Value:=ComboBox3.Text; 
      Parameters.Items[15].Value:=Edit14.Text; 
      Parameters.Items[16].Value:=Edit15.Text; 
      Parameters.Items[17].Value:=Edit16.Text; 
      Parameters.Items[18].Value:=Edit17.Text; 
      Parameters.Items[19].Value:=Edit18.Text; 
      Parameters.Items[20].Value:=Edit19.Text; 
      Parameters.Items[21].Value:=Edit20.Text; 
      Parameters.Items[22].Value:=Edit21.Text; 
      Prepared:=True; 
      ExecSQL; 
    end; 
  END else 
  if ActionCD='M' then 
  begin 
    With DM.QHWTYXX DO 
    begin 
      Close; 
      SQL.Clear; 
      SQL.Add('update   货物托运信息表 Set 申请编号=:申请编号1,客户名称=:客户名称1,客户电话=:客户电话1,'); 
      SQL.Add('客户联系人=:客户联系人1,承运单位=:承运单位1,承运单位电话=:承运单位电话1,承运单位联系人=:承运单位联系人1,'); 
      SQL.Add('收货单位=:收货单位1,收货单位电话=:收货单位电话1,收货单位联系人=:收货单位联系人1,收货地点=:收货地点1,'); 
      SQL.Add('承运司机=:承运司机1,驾驶证号=:驾驶证号1,车牌号码=:车牌号码1,司机手机=:司机手机1,'); 
      SQL.Add('保险金额=:保险金额1,保险费用=:保险费用1,付款方式=:付款方式1,运费=:运费1,'); 
      SQL.Add('费用合计=:费用合计1,已付费用=:已付费用1,备注=:备注1 where 托运单号=:托运单号1'); 
      Parameters.Items[0].Value:=ComboBox1.Text; 
      Parameters.Items[1].Value:=Edit1.Text; 
      Parameters.Items[2].Value:=Edit2.Text; 
      Parameters.Items[3].Value:=Edit3.Text; 
      Parameters.Items[4].Value:=Edit5.Text; 
      Parameters.Items[5].Value:=Edit6.Text; 
      Parameters.Items[6].Value:=Edit7.Text; 
      Parameters.Items[7].Value:=Edit8.Text; 
      Parameters.Items[8].Value:=Edit9.Text; 
      Parameters.Items[9].Value:=Edit10.Text; 
      Parameters.Items[10].Value:=Edit11.Text; 
      Parameters.Items[11].Value:=ComboBox2.Text; 
      Parameters.Items[12].Value:=Edit12.Text; 
      Parameters.Items[13].Value:=ComboBox3.Text; 
      Parameters.Items[14].Value:=Edit14.Text; 
      Parameters.Items[15].Value:=Edit15.Text; 
      Parameters.Items[16].Value:=Edit16.Text; 
      Parameters.Items[17].Value:=Edit17.Text; 
      Parameters.Items[18].Value:=Edit18.Text; 
      Parameters.Items[19].Value:=Edit19.Text; 
      Parameters.Items[20].Value:=Edit20.Text; 
      Parameters.Items[21].Value:=Edit21.Text; 
      Parameters.Items[22].Value:=DM.DSOHWTYXX.FieldByName('托运单号').AsString; 
      Prepared:=true; 
      ExecSQL; 
    end; 
  end; 
end; 
procedure TFRM_HWTYGL.ENA; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if (Components[i] is TEdit) then 
    begin 
      TEdit(Components[i]).Color:=clWindow; 
      TEdit(Components[i]).ReadOnly:=False; 
    end; 
  end; 
  ComboBox1.Color:=clWindow; 
  ComboBox2.Color:=clWindow; 
  ComboBox3.Color:=clWindow; 
  SpeedButton1.Enabled:=False; 
  SpeedButton2.Enabled:=False; 
  SpeedButton3.Enabled:=True; 
  SpeedButton4.Enabled:=False; 
  Panel1.Enabled:=True; 
end; 
procedure TFRM_HWTYGL.DIS; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if (Components[i] is Tedit) then 
    begin 
      TEdit(Components[i]).Color:=$00EFEFEF; 
      TEdit(Components[i]).ReadOnly:=true; 
    end; 
  end; 
  ComboBox1.Color:=$00EFEFEF; 
  ComboBox2.Color:=$00EFEFEF; 
  ComboBox3.Color:=$00EFEFEF; 
  SpeedButton1.Enabled:=True; 
  SpeedButton2.Enabled:=True; 
  SpeedButton3.Enabled:=False; 
  SpeedButton4.Enabled:=False; 
  Panel1.Enabled:=False; 
end; 
procedure TFRM_HWTYGL.CLS; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if(Components[i] is TEdit) then 
      TEdit(Components[i]).Clear; 
  end; 
  ComboBox1.Clear; 
  ComboBox2.Clear; 
  ComboBox3.Clear; 
end; 
////////////////////////////////////////////////// 
procedure TFRM_HWTYGL.SpeedButton6Click(Sender: TObject); 
begin 
  ACtionCD:=''; 
  Close;  
end; 
 
procedure TFRM_HWTYGL.FormCreate(Sender: TObject); 
begin 
  with DM.QHWTYXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select * from 货物托运信息表'); 
    Open; 
  end; 
  DM.DSOHWTYXX.Open; 
end; 
 
procedure TFRM_HWTYGL.FormShow(Sender: TObject); 
begin 
  DIS; 
  if ActionCD = 'M' then 
    GetAll 
  else if ActionCD = 'N' then 
  begin 
    CLS; 
    ENA; 
  end; 
end; 
 
procedure TFRM_HWTYGL.SpeedButton1Click(Sender: TObject); 
begin 
  CLS; 
  ENA; 
  ActionCD := 'N'; 
  bh; 
  CYXX; 
  ComboBox1.SetFocus; 
  Edit15.Text:='0'; 
  Edit16.Text:='0'; 
  Edit18.Text:='0'; 
  Edit19.Text:='0'; 
  Edit20.Text:='0'; 
end; 
 
procedure TFRM_HWTYGL.SpeedButton2Click(Sender: TObject); 
begin 
  ENA; 
  SpeedButton4.Enabled:=True; 
  ACtionCD := 'M'; 
end; 
 
procedure TFRM_HWTYGL.SpeedButton3Click(Sender: TObject); 
begin 
  if (cansave) then 
  begin 
    Edit19.Text:=FloatToStr(StrToFloat(Edit15.Text)+StrToFloat(Edit16.Text)+StrToFloat(Edit18.Text)); 
    Posting; 
    DIS; 
    DM.DSOHWTYXX.Close; 
    DM.DSOHWTYXX.Open; 
    Application.MessageBox('保存成功!','提示!',64); 
    actioncd:=''; 
    self.Close; 
  end; 
end; 
 
procedure TFRM_HWTYGL.SpeedButton4Click(Sender: TObject); 
begin 
  if DM.DSOHWTYXX.RecordCount=0 then 
  begin 
    Application.MessageBox('没有记录可以删除!','提示',0+MB_ICONINFORMATION); 
    Exit; 
  end; 
  if DM.DSOHWTYXX.IsEmpty then 
    Exit; 
  if ID_YES=application.MessageBox('确实要删除这条记录吗?','提示',MB_YESNO) then 
  begin 
    DM.DSOHWTYXX.Delete; 
    self.OnShow(Sender); 
  end; 
end; 
 
procedure TFRM_HWTYGL.SpeedButton5Click(Sender: TObject); 
begin 
  DIS; 
  SpeedButton4.Enabled:=False; 
  FRM_HWTYGL.GetAll; 
  ActionCD:=''; 
end; 
 
procedure TFRM_HWTYGL.ComboBox1DropDown(Sender: TObject); 
var 
i:integer; 
begin 
  ComboBox1.Clear; 
  With DM.QHWSQXX do 
  begin 
    CLose; 
    SQL.Clear; 
    SQL.Add('Select 申请编号 from 货物申请信息表'); 
    Open; 
    if (Recordcount>0) then 
      First; 
    for i:=0 to Recordcount-1 do 
    begin 
      ComboBox1.Items.Add(FieldByName('申请编号').AsString); 
      Next; 
    end; 
  end; 
end; 
 
procedure TFRM_HWTYGL.ComboBox1Change(Sender: TObject); 
begin 
  Edit1.Clear; 
  with DM.QHWSQXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select 客户名称 from 货物申请信息表 where 申请编号='+''''+ComboBox1.Text+''''); 
    Open; 
  end; 
  if ComboBox1.Text<>'' then 
  begin 
    Edit1.Text:=DM.QHWSQXX.FieldByName('客户名称').Value; 
  end; 
  Edit2.Clear; 
  with DM.QHWSQXX do 
  begin 
    Close;                                
    SQL.Clear; 
    SQL.Add('Select 客户电话 from 货物申请信息表 where 申请编号='+''''+ComboBox1.Text+''''); 
    Open; 
  end; 
  if ComboBox1.Text<>'' then 
  begin 
    Edit2.Text:=DM.QHWSQXX.FieldByName('客户电话').Value; 
  end; 
  Edit3.Clear; 
  with DM.QHWSQXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select 联系人 from 货物申请信息表 where 申请编号='+''''+ComboBox1.Text+''''); 
    Open; 
  end; 
  if ComboBox1.Text<>'' then 
  begin 
    Edit3.Text:=DM.QHWSQXX.FieldByName('联系人').Value; 
  end; 
  Edit8.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.ComboBox2DropDown(Sender: TObject); 
var 
i:integer; 
begin 
  ComboBox2.Clear; 
  With DM.QSJJBXX do 
  begin 
    CLose; 
    SQL.Clear; 
    SQL.Add('Select 司机姓名 from 司机信息表'); 
    Open; 
    if (Recordcount>0) then 
      First; 
    for i:=0 to Recordcount-1 do 
    begin 
      ComboBox2.Items.Add(FieldByName('司机姓名').AsString); 
      Next; 
    end; 
  end; 
end; 
 
procedure TFRM_HWTYGL.ComboBox2Change(Sender: TObject); 
begin 
  Edit12.Clear; 
  with DM.QSJJBXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select 驾照号码 from 司机信息表 where 司机姓名='+''''+ComboBox2.Text+''''); 
    Open; 
  end; 
  if ComboBox2.Text<>'' then 
  begin 
    Edit12.Text:=DM.QSJJBXX.FieldByName('驾照号码').Value; 
  end; 
  Edit14.Clear; 
  with DM.QSJJBXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('Select 手机号码 from 司机信息表'); 
    Open; 
  end; 
  if ComboBox2.Text<>'' then 
  begin 
    Edit14.Text:=DM.QSJJBXX.FieldByName('手机号码').Value; 
  end; 
  ComboBox3.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.ComboBox3DropDown(Sender: TObject); 
var 
i:integer; 
begin 
  ComboBox3.Clear; 
  With DM.QCLJBXX do 
  begin 
    CLose; 
    SQL.Clear; 
    SQL.Add('Select 车牌号码 from 车辆信息表'); 
    Open; 
    if (Recordcount>0) then 
      First; 
    for i:=0 to Recordcount-1 do 
    begin 
      ComboBox3.Items.Add(FieldByName('车牌号码').AsString); 
      Next; 
    end; 
  end; 
 
end; 
 
procedure TFRM_HWTYGL.Edit15Exit(Sender: TObject); 
begin 
  Edit19.Text:=FloatToStr(StrToFloat(Edit15.Text)+StrToFloat(Edit16.Text)+StrToFloat(Edit18.Text)); 
end; 
 
procedure TFRM_HWTYGL.Edit16Exit(Sender: TObject); 
begin 
  Edit19.Text:=FloatToStr(StrToFloat(Edit15.Text)+StrToFloat(Edit16.Text)+StrToFloat(Edit18.Text)); 
end; 
 
procedure TFRM_HWTYGL.Edit18Exit(Sender: TObject); 
begin 
  Edit19.Text:=FloatToStr(StrToFloat(Edit15.Text)+StrToFloat(Edit16.Text)+StrToFloat(Edit18.Text)); 
end; 
 
procedure TFRM_HWTYGL.Edit4KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit5KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit6KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit7KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit1KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit2KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit3KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.ComboBox1KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in[#13,#8]) then 
    key:=#0; 
end; 
 
procedure TFRM_HWTYGL.ComboBox2KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in[#13,#8]) then 
    key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit12KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.Edit14KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_HWTYGL.ComboBox3KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not(key in[#8,#13]) then 
    key:=#0; 
  if key=#13 then 
    Edit15.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit8KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','A'..'Z','0'..'9'] then 
    key:=#0; 
  if key=#13 then 
    Edit9.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit9KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','-',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit10.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit10KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['0'..'9','a'..'z','A'..'Z'] then 
    key:=#0; 
  if key=#13 then 
    Edit11.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit11KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z'] then 
    key:=#0; 
  if key=#13 then 
    ComboBox2.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit15KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','.',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit16.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit16KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','.',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit17.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit17KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','A'..'Z','0'..'9'] then 
    key:=#0; 
  if key=#13 then 
    Edit18.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit18KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','.',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit19.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit19KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in[#13]) then 
    key:=#0; 
  if key=#13 then 
    Edit20.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit20KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','.',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit21.SetFocus; 
end; 
 
procedure TFRM_HWTYGL.Edit8Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit9Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit10Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit11Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit15Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit16Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit17Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit18Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit20Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.Edit21Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_HWTYGL.DBGrid1CellClick(Column: TColumn); 
begin 
  GetAll; 
end; 
 
procedure TFRM_HWTYGL.DBGrid1DrawColumnCell(Sender: TObject; 
  const Rect: TRect; DataCol: Integer; Column: TColumn; 
  State: TGridDrawState); 
begin 
  FRM_MAIN.SetDBGird(Sender as TDBGrid,DM.QHWTYXX ,Rect,DataCol,Column,State); 
end; 
 
end.