unit U_TaxInput;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
  cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
  cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
  cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
  RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
  cxTextEdit, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
  cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
  dxBarBuiltInMenu, U_BaseList, cxContainer, cxCurrencyEdit, dxSkinWXI;

type
  TfrmTaxInput = class(TForm)
    ToolBar1: TToolBar;
    TBClose: TToolButton;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ToolButton3: TToolButton;
    ScrollBox1: TScrollBox;
    Label7: TLabel;
    Note: TMemo;
    CBusiness_unit: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    CCustomer: TEdit;
    Label3: TLabel;
    CC_Name: TEdit;
    Label4: TLabel;
    Csalesman: TEdit;
    Label5: TLabel;
    C_WBHXJE: TEdit;
    Label6: TLabel;
    C_HXrate: TEdit;
    Label8: TLabel;
    C_RMBHXJE: TEdit;
    Label9: TLabel;
    SFHS: TEdit;
    Label10: TLabel;
    Label11: TLabel;
    CWBSHJE: TEdit;
    Label12: TLabel;
    CWBSHrate: TEdit;
    Label13: TLabel;
    CRMBSSJE: TEdit;
    Label14: TLabel;
    CTSSY: TEdit;
    Label15: TLabel;
    CCPKPJE: TEdit;
    Label16: TLabel;
    CGDSL: TEdit;
    Label17: TLabel;
    CRate: TEdit;
    Label18: TLabel;
    COrtherRate: TEdit;
    Label19: TLabel;
    CWBSY: TEdit;
    Label22: TLabel;
    TSLLSY: TEdit;
    Label23: TLabel;
    GDS: TEdit;
    Label24: TLabel;
    COrderSF: TEdit;
    Label25: TLabel;
    CZDDate: TDateTimePicker;
    COrderNo: TBtnEditC;
    ToolButton1: TToolButton;
    CSXF: TEdit;
    Label20: TLabel;
    ToolButton2: TToolButton;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
    procedure PayMentBtnUpClick(Sender: TObject);
    //procedure OppCoNameBtnUpClick(Sender: TObject);
    //procedure OppParentCoNameBtnUpClick(Sender: TObject);
    //procedure OurBankNameBtnUpClick(Sender: TObject);
    //procedure OppBankNameBtnUpClick(Sender: TObject);
    //procedure FFAbstractDLBtnUpClick(Sender: TObject);
    procedure OrderNoBtnUpClick(Sender: TObject);
    procedure COrderNoBtnUpClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure CRateChange(Sender: TObject);
    procedure CCPKPJEChange(Sender: TObject);
    procedure CGDSLChange(Sender: TObject);
//    procedure COrderSFChange(Sender: TObject);
    procedure COrtherRateChange(Sender: TObject);
    procedure COrderNoChange(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    //procedure ToolButton1Click(Sender: TObject);
    //procedure ToolButton2Click(Sender: TObject);
  private
    { Private declarations }
    procedure InitGrid();
    procedure CalculateProduct(Sender: TObject);
    procedure CalculateProduct2(Sender: TObject);
    procedure CalculateProduct3(Sender: TObject);
    procedure CalculateProduct4(Sender: TObject);
    function SaveData(): Boolean;
    //procedure CalculateProduct;
  public
    { Public declarations }
    FFFID, PState: string;
  end;

var
  frmTaxInput: TfrmTaxInput;

implementation

uses
  U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_BankSel, U_ZDYHelpFY,
  U_TradePlanSel, U_FinFileUp, U_FtyFileUp, U_TaxSel, U_TaxSet;

{$R *.dfm}

procedure TfrmTaxInput.InitGrid();
begin
  try

    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered := False;
      Close;
      SQL.Clear;
      sql.Add(' select  * from Costing_Table where CostMID =''' + Trim(FFFID) + '''');
      Open;
    end;
    if not ADOQueryMain.IsEmpty then
    begin
      SCSHData(ADOQueryMain, ScrollBox1, 0);
      //OppCoName.TxtCode := Trim(ADOQueryMain.FieldByName('OppCoNo').AsString);
      //OurCoName.TxtCode := Trim(ADOQueryMain.FieldByName('OurCoNo').AsString);
      //OppParentCoName.TxtCode := Trim(ADOQueryMain.FieldByName('OppParentCoNo').AsString);
      //OurBankName.TxtCode := Trim(ADOQueryMain.FieldByName('OurBankID').AsString);
      //OppBankName.TxtCode := Trim(ADOQueryMain.FieldByName('OppBankID').AsString);
    end
    else
    begin
//      SQDate.DateTime := SGetServerDateTime(ADOQueryTemp);
//      PKDate.DateTime := SQDate.DateTime
    end;

    if PState = '复制' then
    begin
      FFFID := '';

    end;
  finally
    ADOQueryMain.EnableControls;
  end;
end;

//procedure TfrmTaxInput.OppBankNameBtnUpClick(Sender: TObject);
//begin
//
//  try
//    frmZDYHelp := TfrmZDYHelp.Create(Application);
//    with frmZDYHelp do
//    begin
//      flag := self.OppCoName.TxtCode;
//      flagname := '对方账户';
//      if ShowModal = 1 then
//      begin
//        TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
//      end;
//    end;
//  finally
//    frmZDYHelp.Free;
//  end;
//end;

//procedure TfrmTaxInput.OppCoNameBtnUpClick(Sender: TObject);
//begin
//  try
//    frmCompanySel := TfrmCompanySel.Create(Application);
//    with frmCompanySel do
//    begin
//      if RegType.text = '付款' then
//      begin
//        FCoType := '供应商';
//      end
//      else
//      begin
//        FCoType := '客户';
//      end;
//
//      if ShowModal = 1 then
//      begin
//        OppCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
//        OppCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
//        OppParentCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
//        OppParentCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
//        OppBankName.Text := Trim(CDS_1.fieldbyname('AcName').AsString);
//        OppBankName.TxtCode := Trim(CDS_1.fieldbyname('CBID').AsString);
//      end;
//    end;
//  finally
//    frmCompanySel.Free;
//  end;
//end;

//procedure TfrmTaxInput.OppParentCoNameBtnUpClick(Sender: TObject);
//begin
//  try
//    frmCompanySel := TfrmCompanySel.Create(Application);
//    with frmCompanySel do
//    begin
//      FCoType := '供应商';
//      if ShowModal = 1 then
//      begin
//        OppParentCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
//        OppParentCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
//      end;
//    end;
//  finally
//    frmCompanySel.Free;
//  end;
//end;

procedure TfrmTaxInput.OrderNoBtnUpClick(Sender: TObject);
begin
  try
    frmTradePlanSel := TfrmTradePlanSel.Create(Application);
    with frmTradePlanSel do
    begin
//      FMainID := MainID.Text;
      if ShowModal = 1 then
      begin
        //Self.OrderNO.Text := CDS_1.fieldbyname('OrderNo').value;
//        Self.OurCoName.Text := Trim(CDS_1.fieldbyname('OurCoName').AsString);
//        Self.OurCoName.TxtCode := Trim(CDS_1.fieldbyname('OurCoNo').AsString);
        //Self.BuyConNo.text := Trim(CDS_1.fieldbyname('BuyConNo').AsString);
      end;
    end;
  finally
    frmTradePlanSel.Free;
  end;
end;

//procedure TfrmTaxInput.OurBankNameBtnUpClick(Sender: TObject);
//begin
//  try
//    frmBankSel := TfrmBankSel.Create(Application);
//    with frmBankSel do
//    begin
//      if ShowModal = 1 then
//      begin
//        OurBankName.Text := Trim(CDS_1.fieldbyname('BankName').AsString);
//        OurBankName.TxtCode := Trim(CDS_1.fieldbyname('BkID').AsString);
//      end;
//    end;
//  finally
//    frmBankSel.Free;
//  end;
//end;

procedure TfrmTaxInput.FormDestroy(Sender: TObject);
begin
  frmTaxInput := nil;
end;

procedure TfrmTaxInput.PayMentBtnUpClick(Sender: TObject);
var
  fsj: string;
  FWZ: Integer;
begin
  fsj := Trim(TEdit(Sender).Hint);
  FWZ := Pos('/', fsj);
  try
    frmZDYHelp := TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      MainType := '付款';
      flag := Copy(fsj, 1, FWZ - 1);
      flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
      if ShowModal = 1 then
      begin
        TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

//procedure TfrmTaxInput.FFAbstractDLBtnUpClick(Sender: TObject);
//var
//  fsj: string;
//  FWZ: Integer;
//begin
//  fsj := Trim(TEdit(Sender).Hint);
//  FWZ := Pos('/', fsj);
//  try
//    frmZDYHelpFY := TfrmZDYHelpFY.Create(Application);
//    with frmZDYHelpFY do
//    begin
////      if RegType.text = '付款' then
////      begin
////        MainType := '付款类型';
////      end
//      else
//      begin
//        MainType := '收款类型';
//      end;
//      flag := Copy(fsj, 1, FWZ - 1);
//      flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
//      if ShowModal = 1 then
//      begin
//        TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('Note2').AsString);
//        FFAbstract.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
//      end;
//    end;
//  finally
//    frmZDYHelpFY.Free;
//  end;
//end;

procedure TfrmTaxInput.COrderNoBtnUpClick(Sender: TObject);
begin
  try
    frmTaxSel := TfrmTaxSel.Create(Application);
    with frmTaxSel do
    begin
      if ShowModal = 1 then
      begin
        CBusiness_unit.Text := Trim(CDS_1.fieldbyname('OurCoName').AsString);
        COrderNo.Text := Trim(CDS_1.fieldbyname('OrderNo').AsString);
        CCustomer.Text := Trim(CDS_1.fieldbyname('CustName').AsString);
        CC_Name.Text := Trim(CDS_1.fieldbyname('C_Name').AsString);
        C_WBHXJE.Text := Trim(CDS_1.fieldbyname('SumUSD').AsString);
        C_RMBHXJE.Text := Trim(CDS_1.fieldbyname('SumCNY').AsString);
        C_HXrate.Text := Trim(CDS_1.fieldbyname('HXHV').AsString);
        Csalesman.Text := Trim(CDS_1.fieldbyname('Saleser').AsString);
        SFHS.Text := Trim(CDS_1.fieldbyname('ISTax').AsString);
        CSXF.Text := Trim(CDS_1.fieldbyname('SXF').AsString);
        with ADOQueryTemp do
        begin
          close;
          sql.Clear;
          sql.Add(' SELECT STUFF(');
          sql.Add('     (SELECT distinct '','' + CAST(CAST(A.WoJHExchangeRate AS DECIMAL(18, 2)) AS VARCHAR)');
          sql.Add('      FROM Finance_WriteOff A');
          sql.Add('      INNER JOIN Finance_Flow B ON A.FromId = B.FFID');
          sql.Add('      INNER JOIN Finance_Flow C ON A.ToId = C.FFID');
          sql.Add('      WHERE C.OrderNo = ' + quotedstr(COrderNo.Text));
          sql.Add('      FOR XML PATH('''')),');
          sql.Add('1, 1, '''') AS WoJHExchangeRates');
          open;
        end;
//        C_HXrate.Text := ADOQueryTemp.FieldByName('WoJHExchangeRates').AsString;
      end;
    end;
  finally
    frmTaxSel.Free;
  end;
end;

procedure TfrmTaxInput.COrderNoChange(Sender: TObject);
begin
  CalculateProduct4(Sender);
end;

procedure TfrmTaxInput.COrtherRateChange(Sender: TObject);
begin
  CalculateProduct4(Sender);
end;

procedure TfrmTaxInput.CRateChange(Sender: TObject);
begin
  CalculateProduct2(Sender);
end;

procedure TfrmTaxInput.FormClose(Sender: TObject; var Action: TCloseAction);
begin

  Action := caFree;
end;

procedure TfrmTaxInput.FormCreate(Sender: TObject);
begin
  CWBSHJE.OnChange := CalculateProduct;
  CWBSHrate.OnChange := CalculateProduct;
end;

procedure TfrmTaxInput.TBCloseClick(Sender: TObject);
begin

  close;
end;

procedure TfrmTaxInput.FormShow(Sender: TObject);
begin
//  if Trim(FFFID) = '' then
//  begin
//    with ADOQueryTemp do
//    begin
//      Close;
//      SQL.Clear;
//      sql.Add(' select top 1 * from BS_Company where CoType=''我司''  order by CoCode ');
//      Open;
//    end;
//    OurCoName.Text := Trim(ADOQueryTemp.fieldbyname('CoAbbrName').AsString);
//    OurCoName.TxtCode := Trim(ADOQueryTemp.fieldbyname('CoCode').AsString);
//  end;
  if PState = '新增' then
    ToolButton1.Visible := True
  else
    ToolButton1.Visible := False;

  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.add('select * from SY_Tax');
    open;
    First;
    while not eof do
    begin
      if FieldByName('type').AsString = 'CGDSL' then
        CGDSL.text := FieldByName('value').AsString
      else if FieldByName('type').AsString = 'CRate' then
        CRate.text := FieldByName('value').AsString
      else if FieldByName('type').AsString = 'COrtherRate' then
        COrtherRate.text := FieldByName('value').AsString;
      Next;
    end;

  end;
//  CGDSL.text := '0.028';
//  CRate.text := '0.13';
//  COrtherRate.text := '0.07';
  CZDDate.date := DServerDate;
  InitGrid();
end;

procedure TfrmTaxInput.TBRafreshClick(Sender: TObject);
begin
  InitGrid();
end;

function TfrmTaxInput.SaveData(): Boolean;
var
  MaxId, MaxSubId, FCoCode, FCCID: string;
begin
  try
    ADOQueryCmd.Connection.BeginTrans;
    if Trim(FFFID) = '' then
    begin
      if not GetLSNo(ADOQueryCmd, MaxId, 'TAX', 'Costing_Table', 4, 1) then
        raise Exception.Create('取最大号失败！');
    end
    else
    begin
      MaxId := Trim(FFFID);
    end;

    with ADOQueryCmd do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from Costing_Table where CostMID=''' + Trim(FFFID) + '''');
      Open;
    end;
    with ADOQueryCmd do
    begin
      if Trim(FFFID) = '' then
      begin
        Append;
        FieldByName('FillId').Value := Trim(DCode);
        FieldByName('Filler').Value := Trim(DName);
      end
      else
      begin
        Edit;
        FieldByName('EditId').Value := Trim(DCode);
        FieldByName('Editer').Value := Trim(DName);
        FieldByName('Edittime').Value := SGetServerDateTime(ADOQueryTemp);
      end;
//      FieldByName('OppCoNo').Value := Trim(OppCoName.TxtCode);
//      FieldByName('OurCoNo').Value := Trim(OurCoName.TxtCode);
//      FieldByName('OppParentCoNo').Value := Trim(OppParentCoName.TxtCode);
//      FieldByName('OurBankID').Value := Trim(OurBankName.TxtCode);
//      FieldByName('OppBankID').Value := Trim(OppBankName.TxtCode);
////      FieldByName('OppBanKID
      FieldByName('CostMID').Value := Trim(MaxId);
      RTSetsavedata(ADOQueryCmd, 'Costing_table', ScrollBox1, 0);
      FieldByName('HYStatus').Value := 0;
      Post;
    end;

    ADOQueryCmd.Connection.CommitTrans;
    FCCID := Trim(MaxSubId);
    Result := True;
  except
    Result := false;
    ADOQueryCmd.Connection.RollbackTrans;
    application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
  end;
end;

//procedure TfrmTaxInput.ToolButton1Click(Sender: TObject);
//begin
//  try
//    frmFinFileUp := TfrmFinFileUp.Create(Application);
//    with frmFinFileUp do
//    begin
////      Code.Text := Trim(Self.CDS_1.fieldbyname('CoCode').AsString);
//      FBCIID := FFFID;
//      if ShowModal = 1 then
//      begin
//        Self.InitGrid();
////        Self.CDS_1.Locate('BCIID', BCIID, []);
//      end;
//    end;
//  finally
//    frmFinFileUp.Free;
//  end;
//end;

//procedure TfrmTaxInput.ToolButton2Click(Sender: TObject);
//begin
//  try
//    frmFtyFileUp := TfrmFtyFileUp.Create(Application);
//    with frmFtyFileUp do
//    begin
//      with ADOQueryTemp do
//      begin
//        Close;
//        sql.Clear;
//        sql.Add(' select * from BS_Company where  CoCode=' + quotedstr(Trim(OppCoName.TxtCode)));
//        Open;
//      end;
//      //Code.Text := self.OppCoName.TxtCode;
//      //FBCIID := Trim(ADOQueryTemp.fieldbyname('CoID').AsString);
//      if ShowModal = 1 then
//      begin
//        Self.InitGrid();
////        Self.CDS_1.Locate('BCIID', BCIID, []);
//      end;
//    end;
//  finally
//    frmFtyFileUp.Free;
//  end;
//end;

procedure TfrmTaxInput.CalculateProduct(Sender: TObject);//计算外币收益
var
  AValue, BValue, CValue: Double;
begin
  if (PState = '新增') or (PState = '修改') then
  begin
    try
      if (CWBSHrate.Text = '') or (CWBSHJE.Text = '') then
      begin
        CWBSY.Text := '';
        exit;
      end;

      AValue := StrToFloatDef(CWBSHrate.Text, 0);
      BValue := StrToFloatDef(CWBSHJE.Text, 0);
      CValue := AValue * BValue;
      CWBSY.Text := FormatFloat('0.00', CValue);
    except
      on E: Exception do
        CWBSY.Text := '输入错误';
    end;
  end;

end;

procedure TfrmTaxInput.CalculateProduct2(Sender: TObject);//计算退税理论收益
var
  AValue, BValue, CValue, DValue: Double;
begin
  if (PState = '新增') or (PState = '修改') then
  begin
    if (CCPKPJE.Text = '') or (CRate.Text = '') then
    begin
      TSLLSY.Text := '';
      exit;
    end;
    try
      AValue := StrToFloatDef(CCPKPJE.Text, 0);
      BValue := StrToFloatDef(CRate.Text, 0);
      CValue := AValue / (1 + BValue) * BValue;
      TSLLSY.Text := FormatFloat('0.00', CValue);
    except
      on E: Exception do
        TSLLSY.Text := '输入错误';
    end;
  end;

end;

procedure TfrmTaxInput.CalculateProduct3(Sender: TObject); //计算国地税
var
  AValue, BValue, CValue, DValue: Double;
begin
  if (PState = '新增') or (PState = '修改') then
  begin
    if (CCPKPJE.Text = '') or (CGDSL.Text = '') then
    begin
      GDS.Text := '';
      exit;
    end;
    try
      AValue := StrToFloatDef(CCPKPJE.Text, 0);
      BValue := StrToFloatDef(CGDSL.Text, 0);
      CValue := AValue * BValue;
      GDS.Text := FormatFloat('0.00', CValue);
    except
      on E: Exception do
        GDS.Text := '输入错误';
    end;
  end;

end;

procedure TfrmTaxInput.CalculateProduct4(Sender: TObject); //计算其他税费
var
  AValue, BValue, BBValue, CValue, Dvalue: Double;
begin
  if (PState = '新增') or (PState = '修改') then
  begin
    if (COrtherRate.Text = '') or (CCPKPJE.Text = '') or (COrderNo.Text = '') then
    begin
      COrderSF.Text := '';
      exit;
    end;

    try
      AValue := StrToFloatDef(COrtherRate.Text, 0);
      BValue := 0;
      with ADOQueryTemp do
      begin
        Close;
        SQL.Clear;
        SQL.Text := 'SELECT TotalAmount FROM V_SF_YFK2 WHERE OrderNo = :OrderNo';
        Parameters.ParamByName('OrderNo').Value := COrderNo.Text;
        Open;
        if not IsEmpty then
          BValue := FieldByName('TotalAmount').AsFloat;
        Close;
      end;
      with ADOQueryTemp do
      begin
        Close;
        SQL.Clear;
        SQL.Text := 'exec P_Trade_ZD @orderno = ' + QuotedStr(COrderNo.Text);
        Open;
        if not IsEmpty then
          BBValue := FieldByName('ZDRKFee').AsFloat - FieldByName('ZDCKFee').AsFloat;
        Close;
      end;

      CValue := StrToFloatDef(CCPKPJE.Text, 0);
      Dvalue := (CValue - (BValue + BBValue)) * AValue;
      COrderSF.Text := FormatFloat('0.00', Dvalue);
    except
      on E: Exception do
        COrderSF.Text := '输入错误: ' + E.Message;
    end;
  end;

end;

procedure TfrmTaxInput.CCPKPJEChange(Sender: TObject);
begin
  CalculateProduct2(Sender);
  CalculateProduct3(Sender);
  CalculateProduct4(Sender);
end;

procedure TfrmTaxInput.CGDSLChange(Sender: TObject);
begin
  CalculateProduct3(Sender);
end;

procedure TfrmTaxInput.ToolButton1Click(Sender: TObject);
begin
  try
    frmTaxSet := TfrmTaxSet.Create(Application);
    with frmTaxSet do
    begin
      if ShowModal = 1 then
      begin
        Self.CGDSL.Text := CGDSL.Text;
        Self.CRate.Text := CRate.Text;
        Self.COrtherRate.Text := COrtherRate.Text;
      end;
    end;
  finally
    frmTaxSet.Free;
  end;
end;

procedure TfrmTaxInput.ToolButton2Click(Sender: TObject);
begin
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select * from V_Tax2 where orderno=' + QuotedStr(COrderNo.Text));
    Open;
  end;
  C_WBHXJE.Text := Trim(ADOQueryTemp.fieldbyname('SumUSD').AsString);
  C_RMBHXJE.Text := Trim(ADOQueryTemp.fieldbyname('SumCNY').AsString);
  C_HXrate.Text := Trim(ADOQueryTemp.fieldbyname('HXHV').AsString);
  CSXF.Text := Trim(ADOQueryTemp.fieldbyname('SXF').AsString);
end;

procedure TfrmTaxInput.ToolButton3Click(Sender: TObject);
begin
  ToolBar1.SetFocus;
//  if Trim(OppCoName.Text) = '' then
//  begin
//    Application.MessageBox('对方单位不能为空!', '提示', 0);
//    Exit;
//  end;
//  if Trim(OurCoName.Text) = '' then
//  begin
//    Application.MessageBox('我方单位不能为空!', '提示', 0);
//    Exit;
//  end;
//   if Trim(RegType.Text) = '' then
//  begin
//    Application.MessageBox('登记类型不能为空!', '提示', 0);
//    Exit;
//  end;
//  if Trim(OurBankName.Text) = '' then
//  begin
//    Application.MessageBox('我方账户不能为空!', '提示', 0);
//    Exit;
//  end;
//  if Trim(Currency.Text) = '' then
//  begin
//    Application.MessageBox('币种不能为空!', '提示', 0);
//    Exit;
//  end;
//  if Trim(FFAbstractDL.Text) = '' then
//  begin
//    Application.MessageBox('费用类别不能为空!', '提示', 0);
//    Exit;
//  end;
  if SaveData() then
  begin
    Application.MessageBox('保存成功!', '提示', 0);
    ModalResult := 1;
  end;
end;

end.

