⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jxc.pas

📁 基于ACESS数据库的小型进销存管理软件。
💻 PAS
字号:
unit JXC;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, ComCtrls, DBCtrls, FR_Class,
  FR_DSet, FR_DBSet;

type
  TForm1 = class(TForm)
    ADOTable1: TADOTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Label1: TLabel;
    Label2: TLabel;
    InB: TEdit;
    Label3: TLabel;
    InC: TEdit;
    Label4: TLabel;
    InD: TEdit;
    Label5: TLabel;
    InE: TEdit;
    Label6: TLabel;
    InF: TEdit;
    Label7: TLabel;
    InG: TEdit;
    Label8: TLabel;
    InI: TEdit;
    Label9: TLabel;
    InJ: TEdit;
    Label10: TLabel;
    InK: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    InA: TDateTimePicker;
    frDBDataSet1: TfrDBDataSet;
    frReport2: TfrReport;
    Button5: TButton;
    Label11: TLabel;
    InL: TEdit;
    DataSource2: TDataSource;
    ADOTable2: TADOTable;
    DBLookupComboBox1: TDBLookupComboBox;
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  a:integer;
  b:double;

implementation

uses Unit4, Frm_Print, Unit6;

{$R *.dfm}

procedure TForm1.Button3Click(Sender: TObject);
begin
with AdoTable1 do
begin
try
adotable1.Append;
AdoTable1.FieldByName('InA').AsDateTime:=InA.Date;
AdoTable1.FieldByName('InB').AsString:=InB.Text;
Adotable1.FieldByName('InC').AsString:=Inc.text;
//AdoTable1.FieldByName('InD').AsString:=InD.text;
AdoTable1.FieldByName('InD').AsString:=dblookupcombobox1.text;
adotable1.FieldByName('InE').AsInteger:=strtoint(InE.Text);
adotable1.FieldByName('InF').AsFloat:=strtofloat(format('%8.6f',[strtofloat(InF.Text)]));
adotable1.FieldByName('InG').AsFloat:=strtofloat(format('%8.6f',[strtofloat(InG.text)]));
adotable1.FieldByName('InH').asfloat:=strtofloat(format('%8.6f',[strtofloat(InF.Text)*strtofloat(InG.Text)]));
adotable1.FieldByName('InI').asString:=InI.text;
adotable1.FieldByName('InJ').asString:=InJ.text;
adotable1.FieldByName('InK').asString:=InK.text;
adotable1.FieldByName('inl').Asinteger:=strtoint(inl.text);
adotable1.post;
showmessage('数据已经正确存盘!');
except
Cancel;
ShowMessage('数据存盘发生错误,请检查数据是否正确!');
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with adotable1 do
begin
try
adotable1.edit;
AdoTable1.FieldByName('InA').AsDateTime:=InA.Date;
AdoTable1.FieldByName('InB').AsString:=InB.Text;
Adotable1.FieldByName('InC').AsString:=Inc.text;
AdoTable1.FieldByName('InD').AsString:=dblookupcombobox1.text;
adotable1.FieldByName('InE').AsInteger:=strtoint(InE.Text);
adotable1.FieldByName('InF').AsFloat:=strtofloat(format('%8.6f',[strtofloat(InF.Text)]));
adotable1.FieldByName('InG').AsFloat:=strtofloat(InG.text);
adotable1.FieldByName('InH').asfloat:=strtofloat(format('%8.6f',[strtofloat(InF.Text)*strtofloat(InG.Text)]));
adotable1.FieldByName('InI').asString:=InI.text;
adotable1.FieldByName('InJ').asString:=InJ.text;
adotable1.FieldByName('InK').asString:=InK.text;
adotable1.FieldByName('inl').asinteger:=strtoint(inl.text);
adotable1.post;
showmessage('数据已经正确存盘!');
except
Cancel;
ShowMessage('数据存盘发生错误,请检查数据是否正确!');
end;
InB.Text:='';
InC.text:='';
//dblookupcombobox1.text:=adotable1.fieldbyname('InD').AsString;
InE.text:='';
InF.Text:='';
InG.Text:='';
InI.Text:='';
InJ.Text:='';
InK.Text:='';
inl.text:='';
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if MessageDlg('是否删除',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
with adotable1 do
begin
adotable1.delete;
adotable1.First;
end;
  end;
button2.Enabled:=false;
end;

procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
button2.Enabled:=true;
button1.Enabled:=true;
InA.date:=adotable1.fieldbyname('InA').AsDatetime;
InB.Text:=adotable1.fieldbyname('InB').AsString;
InC.text:=adotable1.fieldbyname('InC').AsString;
//dblookupcombobox1.text:=adotable1.fieldbyname('InD').AsString;
InE.text:=inttostr(adotable1.fieldbyname('InE').asinteger);
InF.Text:=floattostr(adotable1.fieldbyname('InF').AsFloat);
InG.Text:=floattostr(adotable1.fieldbyname('InG').AsFloat);
InI.Text:=adotable1.fieldbyname('InI').AsString;
InJ.Text:=adotable1.fieldbyname('InJ').AsString;
InK.Text:=adotable1.fieldbyname('InK').Asstring;
inl.text:=inttostr(adotable1.fieldbyname('inl').asinteger);
a:=strtoint(ine.text);
b:=strtofloat(INF.text);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
     form1.close;
     form1.ADOTable1.Active:=false;
     form1.ADOTable1.Active:=true;
     frReport2.LoadFromFile('print\101.frf');
     frReport2.OnObjectClick := nil;
     frReport2.OnMouseOverObject := nil;
     frReport2.ModifyPrepared:=false;
     frReport2.Preview := FormPrint.frPreview1;
     if frReport2.PrepareReport then
     frReport2.ShowPreparedReport;
     FormPrint.ShowModal;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
//form6.visible:=true;
application.CreateForm(Tform6,form6);
form6.ShowModal;
form6.ADOTable1.Active:=false;
form6.ADOTable1.Active:=true;
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -