unit U_CPFHSQInPut;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
  cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
  cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
  StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
  cxDropDownEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
  cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters,
  dxSkinscxPCPainter, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
  dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
  dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
  dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
  dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
  dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
  dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
  dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
  dxSkinXmas2008Blue;

type
  TfrmPBFHSQInPut = class(TForm)
    ToolBar1: TToolBar;
    TBSave: TToolButton;
    TBClose: TToolButton;
    ScrollBox1: TScrollBox;
    ToolBar2: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    v1PRTColor: TcxGridDBColumn;
    ADOTemp: TADOQuery;
    ADOCmd: TADOQuery;
    DataSource1: TDataSource;
    Order_Sub: TClientDataSet;
    ADOQuery1: TADOQuery;
    cxGridPopupMenu2: TcxGridPopupMenu;
    Label1: TLabel;
    SQType: TComboBox;
    Note: TEdit;
    Label12: TLabel;
    Label11: TLabel;
    SHDWName: TBtnEditC;
    v1Column3: TcxGridDBColumn;
    v1Column6: TcxGridDBColumn;
    Label2: TLabel;
    SQDate: TDateTimePicker;
    Label5: TLabel;
    YWYName: TBtnEditC;
    v1Column1: TcxGridDBColumn;
    Label3: TLabel;
    ranchang: TBtnEditC;
    Label4: TLabel;
    toconno: TBtnEditC;
    Label6: TLabel;
    ISZD: TComboBox;
    Label7: TLabel;
    carno: TBtnEditC;
    Label8: TLabel;
    driver: TBtnEditC;
    Label9: TLabel;
    cktype: TEdit;
    Tv1Column1: TcxGridDBColumn;
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBSaveClick(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure SHDWNameBtnUpClick(Sender: TObject);
    procedure SHDWNameBtnDnClick(Sender: TObject);
    procedure FHTaiTouBtnDnClick(Sender: TObject);
    procedure FHTaiTouBtnUpClick(Sender: TObject);
    procedure ShouKuanKeyPress(Sender: TObject; var Key: Char);
    procedure v1Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
    procedure YWYNameBtnUpClick(Sender: TObject);
    procedure YWYNameBtnDnClick(Sender: TObject);
    procedure ranchangBtnUpClick(Sender: TObject);
    procedure ranchangBtnDnClick(Sender: TObject);
    procedure toconnoBtnUpClick(Sender: TObject);
    procedure toconnoBtnDnClick(Sender: TObject);
    procedure carnoBtnDnClick(Sender: TObject);
    procedure carnoBtnUpClick(Sender: TObject);
    procedure driverBtnUpClick(Sender: TObject);
    procedure driverBtnDnClick(Sender: TObject);
  private
    fuserName: string;
    procedure InitData();
    procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
    function SaveData(): Boolean;
    { Private declarations }
  public
    PState, CopyInt: Integer;
    FMainId, FFMainId, ChkStr, ConPriceStr: string;
    FXS: Integer;
    FClothType: string; 
    { Public declarations }
  end;

var
  frmPBFHSQInPut: TfrmPBFHSQInPut;
  newh: hwnd;

implementation

uses
  U_DataLink, U_ZDYHelp, U_RTFun, U_SQKCHZSelList, U_ZdyAttachGYS,
  U_ContractListNXSel, U_ZdyAttachment, U_ContractListSel, U_SQKCHZSelList2,
  U_SXCKKCSelList;

{$R *.dfm}

procedure TfrmPBFHSQInPut.TBCloseClick(Sender: TObject);
begin

  WriteCxGrid('发货申请录入TV1', Tv1, '发货管理1');
  Close;
end;

procedure TfrmPBFHSQInPut.InitData();
var
  fsj: string;
begin
  fsj := 'select Name=ZdyName from KH_Zdy where Type=''ClothType'' ';
  if PState = 0 then
  begin
    YWYName.Text := dname;
    SQDate.DateTime := SGetServerDate10(ADOTemp);
    ISZD.ItemIndex := 1;
  end;
  with ADOQuery1 do
  begin
    Close;
    SQL.Clear;
    sql.Add(' select A.*  ');
    sql.Add(' from SQ_FH_Sub A');
    if PState = 1 then
    begin
      sql.Add('where FHMainId=''' + Trim(FMainId) + '''');
    end;
    if PState = 0 then
    begin
      sql.Add(' where 1<>1');

    end;
    Open;
  end;
  SCreateCDS20(ADOQuery1, Order_Sub);
  SInitCDSData20(ADOQuery1, Order_Sub);

  with ADOQuery1 do
  begin
    Close;
    sql.Clear;
    sql.Add('select A.* ');
    sql.Add(' from SQ_FH_Main A');
    sql.Add(' where FHMainId=''' + Trim(FMainId) + ''' ');
    Open;
  end;
  SCSHDataNew(ADOQuery1, ScrollBox1, 1);
end;

procedure TfrmPBFHSQInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
var
  FType, ZDYName, FText: string;
begin
end;

procedure TfrmPBFHSQInPut.FormShow(Sender: TObject);
begin
  readCxGrid('发货申请录入TV1', Tv1, '发货管理1');
  InitData();
end;

function TfrmPBFHSQInPut.SaveData(): Boolean;
var
  maxno, maxmnno, FSSId: string;
  fconNO, fmxType: string;
begin
  try
    ADOCmd.Connection.BeginTrans;
    ///保存主表
    if Trim(FMainId) = '' then
    begin
      if GetLSNo(ADOCmd, maxno, 'FC', 'SQ_FH_Main', 3, 1) = False then
      begin
        ADOCmd.Connection.RollbackTrans;
        Application.MessageBox('取最大号失败!', '提示', 0);
        Exit;
      end;
    end
    else
    begin
      maxno := Trim(FMainId);
    end;
    with ADOCmd do
    begin
      Close;
      sql.Clear;
      SQL.Add('select * from SQ_FH_Main where FHmainid=''' + Trim(FMainId) + '''');
      Open;
    end;
    with ADOCmd do
    begin
      if Trim(FMainId) = '' then
      begin
        Append;
      end
      else
      begin
        Edit;
      end;
//      FieldByName('SQType').Value := '成品布';
      FieldByName('FHmainid').Value := Trim(maxno);
      FieldByName('SHDWCode').Value := Trim(SHDWName.TxtCode);
      RTSetsavedata(ADOCmd, 'SQ_FH_Main', ScrollBox1, 1);

      if Trim(FMainId) = '' then
      begin
        FieldByName('Filler').Value := Trim(DName);
        FieldByName('FillCode').Value := Trim(DCode);
        FieldByName('FillTime').Value := SGetServerDateTime(ADOTemp);
      end
      else
      begin
        FieldByName('Editer').Value := Trim(DName);
        FieldByName('EditCode').Value := Trim(DCode);
        FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
      end;
      Post;
    end;

    FMainId := Trim(maxno);
    ///保存子表
    Order_Sub.DisableControls;
    with Order_Sub do
    begin
      First;
      while not Eof do
      begin
        if Trim(Order_Sub.fieldbyname('FHSubId').AsString) = '' then
        begin
          if GetLSNo(ADOCmd, maxno, 'SS', 'SQ_FH_Sub', 4, 1) = False then
          begin
            Order_Sub.EnableControls;
            ADOCmd.Connection.RollbackTrans;
            Application.MessageBox('取子流水号失败！', '提示', 0);
            Exit;
          end;
        end
        else
        begin
          maxno := Trim(Order_Sub.fieldbyname('FHSubId').AsString);
        end;
        with ADOCmd do
        begin
          Close;
          SQL.Clear;
          sql.Add('select * from SQ_FH_Sub ');
          sql.Add(' where FHSubId=''' + Trim(maxno) + '''');
          Open;
        end;
        if ADOCmd.IsEmpty then
        begin
          FSSId := '';
        end
        else
        begin
          FSSId := Trim(maxno);
        end;
        with ADOCmd do
        begin
          if Trim(FSSId) = '' then
          begin
            Append;
          end
          else
          begin
            Edit;
          end;
          FieldByName('FHMainId').Value := Trim(FMainId);
          FieldByName('FHSubId').Value := Trim(maxno);
          RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'SQ_FH_Sub', 0);
          FieldByName('FromMainId').Value := Order_Sub.fieldbyname('FromMainId').Value;
          FieldByName('FromSubId').Value := Order_Sub.fieldbyname('FromSubId').Value;
          FieldByName('FromKHName').Value := Order_Sub.fieldbyname('FromKHName').Value;
          FieldByName('FromConNo').Value := Order_Sub.fieldbyname('FromConNo').Value;
          Post;
        end;
        Order_Sub.Edit;
        Order_Sub.FieldByName('FHSubId').Value := Trim(maxno);
        Next;
      end;
    end;
    Order_Sub.EnableControls;
    with ADOCmd do
    begin
      Close;
      sql.Clear;
      sql.Add('Update SQ_FH_Main Set ');
      sql.Add('SQPiQtyHZ=(select Sum(SQPiQty) from SQ_FH_Sub A where A.FHMainId=SQ_FH_Main.FHMainId)');
      sql.Add('where SQ_FH_Main.FHMainId=''' + Trim(FMainId) + '''');
//      showmessage(sql.text);
      ExecSQL;
    end;
    ADOCmd.Connection.CommitTrans;
    Result := True;
  except
    ADOCmd.Connection.RollbackTrans;
    Application.MessageBox('保存失败！', '提示', 0);
    Result := False;
  end;
end;

procedure TfrmPBFHSQInPut.TBSaveClick(Sender: TObject);
var
  Freal: Double;
begin
  ToolBar1.SetFocus;

  if Trim(ISZD.Text) = '' then
  begin
    Application.MessageBox('是否允许转单不能为空！', '提示', 0);
    Exit;
  end;
  if Trim(toconno.Text) = '' then
  begin
    Application.MessageBox('出到合同不能为空！', '提示', 0);
    Exit;
  end;
  if Trim(SQType.Text) = '' then
  begin
    Application.MessageBox('出库类型不能为空！', '提示', 0);
    Exit;
  end;
//  if Trim(FHTaiTou.Text) = '' then
//  begin
//    Application.MessageBox('发货抬头不能为空！', '提示', 0);
//    Exit;
//  end;

  if Order_Sub.IsEmpty then
  begin
    Application.MessageBox('明细不能为空！', '提示', 0);
    Exit;
  end;
//  if Order_Sub.Locate('SCConNo', null, []) = True then
//  begin
//    Application.MessageBox('白坯单号不能为空！', '提示', 0);
//    Exit;
//  end;
  if Order_Sub.Locate('SQPiQty', null, []) = True then
  begin
    Application.MessageBox('申请匹数不能为空！', '提示', 0);
    Exit;
  end;
  if SaveData() then
  begin
    Application.MessageBox('保存成功！', '提示', 0);
  end;
end;

procedure TfrmPBFHSQInPut.ToolButton1Click(Sender: TObject);
begin
//  if Trim(ISZD.Text) = '' then
//  begin
//    Application.MessageBox('请先选择 是否允许转单！', '提示', 0);
//    Exit;
//  end;


  if Trim(toconno.Text) = '' then
  begin
    Application.MessageBox('请先选择 出到合同！', '提示', 0);
    Exit;
  end;

  if cktype.Text = '明细' then
  begin

    try
      frmSQKCHZSelList2 := TfrmSQKCHZSelList2.Create(Application);
      with frmSQKCHZSelList2 do
      begin
        if ISZD.Text = '不允许' then
        begin
          fiszd := '不允许';

        end
        else
        begin

        end;
        fconNO := Self.toconno.Text;
        if ShowModal = 1 then
        begin
          while frmSQKCHZSelList2.CDS_Main.Locate('SSel', true, []) do
          begin
            with Self.Order_Sub do
            begin
              Append;
              FieldByName('P_Code').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('P_Code').AsString);
              FieldByName('P_CodeName').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('P_CodeName').AsString);
//            FieldByName('P_MF').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('P_MF').AsString);
//            FieldByName('P_kz').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('P_kz').AsString);
//            FieldByName('FromOrderNo').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('OrderNo').AsString);
//            FieldByName('FromKHName').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('KHName').AsString);
//            FieldByName('FromConNo').Value := Trim(frmSQKCHZSelList2.CDS_Main.fieldbyname('ConNO').AsString);
              FieldByName('SQPiQty').Value := frmSQKCHZSelList2.CDS_Main.fieldbyname('PiQty').Value;
              FieldByName('BatchNo').Value := frmSQKCHZSelList2.CDS_Main.fieldbyname('BatchNo').Value;

              Post;
            end;
            frmSQKCHZSelList2.CDS_Main.Delete;
          end;
          Next;
        end;
      end;
    finally
      frmSQKCHZSelList2.Free;
    end;
  end
  else
  begin
    try
      frmSXCKKCSelList := TfrmSXCKKCSelList.Create(Application);
      with frmSXCKKCSelList do
      begin
        fconNO := Self.toconno.Text;
        ToolButton1.Visible := True;
        if ShowModal = 1 then
        begin
          frmSXCKKCSelList.CDS_Main.DisableControls;
          with frmSXCKKCSelList.CDS_Main do
          begin
            First;
            while frmSXCKKCSelList.CDS_Main.Locate('SSel', True, []) do
            begin
              with Self.Order_Sub do
              begin
                Append;
                FieldByName('P_Code').Value := Trim(frmSXCKKCSelList.CDS_Main.fieldbyname('SPCODE').AsString);
                FieldByName('P_CodeName').Value := Trim(frmSXCKKCSelList.CDS_Main.fieldbyname('SPNAME').AsString);

                FieldByName('SQPiQty').Value := frmSXCKKCSelList.CDS_Main.fieldbyname('MXKCPiQty').Value;
                Post;
              end;
              frmSXCKKCSelList.CDS_Main.Delete;
            end;
          end;
          frmSXCKKCSelList.CDS_Main.EnableControls;

        end;
      end;
    finally
      frmSXCKKCSelList.Free;
    end;
  end;
end;

procedure TfrmPBFHSQInPut.ToolButton2Click(Sender: TObject);
begin
  if Order_Sub.IsEmpty then
    Exit;
  if Trim(Order_Sub.fieldbyname('FHSubId').AsString) <> '' then
  begin
    with ADOTemp do
    begin
      Close;
      sql.Clear;
      sql.Add('select * from SQ_FH_Sub where FHSubId=''' + Trim(Order_Sub.fieldbyname('FHSubId').AsString) + '''');
      sql.add(' and isnull(FHPiQty,0)>0');
      Open;
    end;
    if ADOTemp.IsEmpty = False then
    begin
      Application.MessageBox('已发货不能删除数据!', '提示', 0);
      exit;
    end;
    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) <> IDYES then
      Exit;
    with ADOCmd do
    begin
      Close;
      sql.Clear;
      sql.Add('delete SQ_FH_Sub where FHSubId=''' + Trim(Order_Sub.fieldbyname('FHSubId').AsString) + '''');
      ExecSQL;
    end;
    with ADOCmd do
    begin
      Close;
      sql.Clear;
      sql.Add('Update SQ_FH_Main Set ');
      sql.Add('SQPiQtyHZ=(select Sum(SQPiQty) from SQ_FH_Sub A where A.FHMainId=SQ_FH_Main.FHMainId)');
      sql.Add('where FHMainId=''' + Trim(FMainId) + '''');
      ExecSQL;
    end;
  end;
  Order_Sub.Delete;
end;

procedure TfrmPBFHSQInPut.SHDWNameBtnUpClick(Sender: TObject);
begin
  if SQtype.Text = '加工出库' then
  begin
    try
      frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
      with frmZdyAttachGYS do
      begin
        if ShowModal = 1 then
        begin
          Self.SHDWName.Text := Trim(CDS_HZ.fieldbyname('Name').AsString);
          Self.SHDWName.TxtCode := Trim(CDS_HZ.fieldbyname('code').AsString);
        end;
      end;
    finally
      frmZdyAttachGYS.Free;
    end;
  end
  else
  begin
    try
      frmZdyAttachment := TfrmZdyAttachment.Create(Application);
      with frmZdyAttachment do
      begin
        if ShowModal = 1 then
        begin
          self.SHDWName.TxtCode := Trim(CDS_HZ.fieldbyname('Code').AsString);
          self.SHDWName.Text := Trim(CDS_HZ.fieldbyname('Name').AsString);
          self.YwyName.Text := Trim(CDS_HZ.fieldbyname('YwyName').AsString);

        end;
      end;
    finally
      frmZdyAttachment.Free;
    end;
  end;

end;

procedure TfrmPBFHSQInPut.SHDWNameBtnDnClick(Sender: TObject);
begin
  SHDWName.Text := '';
end;

procedure TfrmPBFHSQInPut.FHTaiTouBtnDnClick(Sender: TObject);
begin
//  FHTaiTou.Text := '';
end;

procedure TfrmPBFHSQInPut.FHTaiTouBtnUpClick(Sender: TObject);
begin
//  try
//    frmZDYHelp := TfrmZDYHelp.Create(Application);
//    with frmZDYHelp do
//    begin
//      flag := 'FHTaiTou';
//      flagname := '发货抬头';
//      if ShowModal = 1 then
//      begin
//        Self.FHTaiTou.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
//      end;
//    end;
//  finally
//    frmZDYHelp.Free;
//  end;
end;

procedure TfrmPBFHSQInPut.ShouKuanKeyPress(Sender: TObject; var Key: Char);
begin
  if not (((Key >= '0') and (Key <= '9')) or (Key = '.') or (Key = #8)) then
  begin
    Key := #0;
  end
  else if (pos('.', TEdit(Sender).text) <> 0) then
  begin
    if Key = '.' then
    begin
      Key := #0;
    end;
  end;
end;

procedure TfrmPBFHSQInPut.v1Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
//  try
//    frmCPManageFMSel:=TfrmCPManageFMSel.Create(Application);
//    with frmCPManageFMSel do
//    begin
//      if ShowModal=1 then
//      begin
//        Self.PrtCodeName.Text:=Trim(frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString);
//        Self.PrtCode.Text:=Trim(frmCPManageFMSel.CDS_Main.fieldbyname('CYNo').AsString);
////        Self.C_Spec.Text:=Trim(frmCPManageFMSel.CDS_Main.fieldbyname('CYSpec').AsString);
//      end;
//    end;
//  finally
//    frmCPManageFMSel.Free;
//  end;
end;

procedure TfrmPBFHSQInPut.YWYNameBtnUpClick(Sender: TObject);
begin
  try
    frmZDYHelp := TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      flag := 'YWYName';
      flagname := '业务员';
      if ShowModal = 1 then
      begin
        Self.YWYName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmPBFHSQInPut.YWYNameBtnDnClick(Sender: TObject);
begin
  YWYName.Text := '';
end;

procedure TfrmPBFHSQInPut.ranchangBtnUpClick(Sender: TObject);
begin
//  try
//    frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
//    with frmZdyAttachGYS do
//    begin
//      if ShowModal = 1 then
//      begin
//        Self.ranchang.Text := Trim(CDS_HZ.fieldbyname('Name').AsString);
//
//      end;
//    end;
//  finally
//    frmZdyAttachGYS.Free;
//  end;
  try
    frmZDYHelp := TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      flag := 'ranchang';
      flagname := '染厂';
      if ShowModal = 1 then
      begin
        Self.ranchang.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmPBFHSQInPut.ranchangBtnDnClick(Sender: TObject);
begin
  ranchang.Text := '';
end;

procedure TfrmPBFHSQInPut.toconnoBtnUpClick(Sender: TObject);
begin
  try
    frmContractListSel := TfrmContractListSel.Create(Application);
    with frmContractListSel do
    begin

      if ShowModal = 1 then
      begin

        self.toConNo.Text := Trim(frmContractListSel.Order_Main.fieldbyname('ConNo').AsString);
        self.SHDWName.Text := Trim(frmContractListSel.Order_Main.fieldbyname('BuyName').AsString);
        self.SHDWName.TxtCode := Trim(frmContractListSel.Order_Main.fieldbyname('buyno').AsString);
      end;

       /////////////////清除原料ID/////////////////////////

    end;
  finally
    frmContractListSel.Free;
  end;
end;

procedure TfrmPBFHSQInPut.toconnoBtnDnClick(Sender: TObject);
begin
  toconno.Text := '';
end;

procedure TfrmPBFHSQInPut.carnoBtnDnClick(Sender: TObject);
begin
  carno.Text := '';
end;

procedure TfrmPBFHSQInPut.carnoBtnUpClick(Sender: TObject);
begin
  try
    frmZDYHelp := TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      flag := 'carno';
      flagname := '车牌号';
      if ShowModal = 1 then
      begin
        Self.carno.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmPBFHSQInPut.driverBtnUpClick(Sender: TObject);
begin
  try
    frmZDYHelp := TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      flag := 'driver';
      flagname := '驾驶员';
      if ShowModal = 1 then
      begin
        Self.driver.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmPBFHSQInPut.driverBtnDnClick(Sender: TObject);
begin
  driver.Text := '';
end;

end.

