unit U_InputBoxCostPrice; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, DB, ADODB, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBasic, 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, dxSkinOffice2016Colorful, dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, cxTextEdit, Vcl.Menus, cxButtons; type TfrmInputBoxCostPrice = class(TForm) Panel1: TPanel; Label1: TLabel; CostPriceEquation: TcxTextEdit; cxButton1: TcxButton; ADO_GS: TADOQuery; Label3: TLabel; CostPrice: TcxTextEdit; procedure cxButton1Click(Sender: TObject); procedure CostPriceEquationExit(Sender: TObject); private { Private declarations } procedure JSCBJ(); public FFFIDS: string; { Public declarations } end; var frmInputBoxCostPrice: TfrmInputBoxCostPrice; implementation {$R *.dfm} procedure TfrmInputBoxCostPrice.JSCBJ(); begin if CostPriceEquation.Text <> '' then begin try with ADO_GS do begin Close; SQL.Clear; Filtered := false; sql.Add('select JG=round((0.001-0.001+(' + CostPriceEquation.Text + ')),2) '); Open; end; CostPrice.Text := ADO_GS.FieldByName('JG').AsString; except CostPriceEquation.SetFocus; application.MessageBox(PChar('计算公式异常;' + Exception(ExceptObject).Message), '提示信息', 0); exit; end; end else begin CostPrice.Text := '0'; end; end; procedure TfrmInputBoxCostPrice.CostPriceEquationExit(Sender: TObject); begin JSCBJ(); end; procedure TfrmInputBoxCostPrice.cxButton1Click(Sender: TObject); begin ModalResult := 1; end; end.