📄 statisticfrm.pas
字号:
unit StatisticFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ChildFrm, Menus, Buttons, Grids, DBGrids, StdCtrls, ExtCtrls,
ComCtrls;
type
TStatisticForm = class(TChildForm)
Splitter1: TSplitter;
gbDataBrowse: TGroupBox;
dbgCount: TDBGrid;
pageControlCount: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
GroupBox3: TGroupBox;
Label1: TLabel;
Label3: TLabel;
Label2: TLabel;
GroupBox1: TGroupBox;
gbSmallType: TGroupBox;
Panel1: TPanel;
gbBigType: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
cbSmallType: TComboBox;
Panel2: TPanel;
Label4: TLabel;
cbBigType: TComboBox;
bbtnBigSmallType: TBitBtn;
bbtnSmallTypePrint: TBitBtn;
bbtnBigBook: TBitBtn;
bbtnBigBookPrint: TBitBtn;
Label8: TLabel;
bbtnBigSmallBook: TBitBtn;
bbtnBigSmallBookPrint: TBitBtn;
bbtnBigtype: TBitBtn;
lbBigCount: TLabel;
lbSmallCount: TLabel;
lbBookCount: TLabel;
lbBigSmallCount: TLabel;
lbBigBookCount: TLabel;
lbSmallBookCount: TLabel;
GroupBox2: TGroupBox;
GroupBox4: TGroupBox;
Label9: TLabel;
lbReaderCount: TLabel;
bbtnReader: TBitBtn;
bbtnReaderQuit: TBitBtn;
bbtnReaderPrint: TBitBtn;
bbtnReaderQuitPrint: TBitBtn;
Label10: TLabel;
lbQuitReaderCount: TLabel;
GroupBox5: TGroupBox;
Label11: TLabel;
lbBorrowCount: TLabel;
Label13: TLabel;
lbCurBorrowCount: TLabel;
GroupBox6: TGroupBox;
bbtnBorrowCount: TBitBtn;
bbtnCurBorrowCount: TBitBtn;
Label12: TLabel;
lbCurReturnCount: TLabel;
bbtnCurRetureCount: TBitBtn;
GroupBox7: TGroupBox;
Panel3: TPanel;
bbtnBorrowBook: TBitBtn;
bbtnCurBorrowBook: TBitBtn;
bbtnRetureBook: TBitBtn;
bbtnCurRetureBook: TBitBtn;
bbtnBorrowBookPrint: TBitBtn;
bbtnCurBorrowBookPrint: TBitBtn;
bbtnRetureBookPrint: TBitBtn;
bbtnCurRetureBookPrint: TBitBtn;
bbtnEachBorrowbook: TBitBtn;
bbtnEachBorrowbookPrint: TBitBtn;
bbtnEachReturnBookPrint: TBitBtn;
bbtnEachReturnBook: TBitBtn;
procedure FormDestroy(Sender: TObject);
procedure cbBigTypeChange(Sender: TObject);
procedure cbSmallTypeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bbtnBigtypeClick(Sender: TObject);
procedure bbtnBigSmallTypeClick(Sender: TObject);
procedure bbtnBigBookClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnBigSmallBookClick(Sender: TObject);
procedure bbtnReaderClick(Sender: TObject);
procedure bbtnReaderQuitClick(Sender: TObject);
procedure pageControlCountChange(Sender: TObject);
procedure bbtnSmallTypePrintClick(Sender: TObject);
procedure bbtnBigBookPrintClick(Sender: TObject);
procedure bbtnBigSmallBookPrintClick(Sender: TObject);
procedure bbtnReaderPrintClick(Sender: TObject);
procedure bbtnReaderQuitPrintClick(Sender: TObject);
procedure bbtnBorrowCountClick(Sender: TObject);
procedure bbtnCurBorrowCountClick(Sender: TObject);
procedure bbtnCurRetureCountClick(Sender: TObject);
procedure bbtnBorrowBookClick(Sender: TObject);
procedure bbtnBorrowBookPrintClick(Sender: TObject);
procedure bbtnCurBorrowBookClick(Sender: TObject);
procedure bbtnCurBorrowBookPrintClick(Sender: TObject);
procedure bbtnRetureBookClick(Sender: TObject);
procedure bbtnRetureBookPrintClick(Sender: TObject);
procedure bbtnCurRetureBookClick(Sender: TObject);
procedure bbtnCurRetureBookPrintClick(Sender: TObject);
procedure bbtnEachBorrowbookClick(Sender: TObject);
procedure bbtnEachBorrowbookPrintClick(Sender: TObject);
procedure bbtnEachReturnBookClick(Sender: TObject);
procedure bbtnEachReturnBookPrintClick(Sender: TObject);
private
{ Private declarations }
procedure clearComponentCaptionText;
procedure setDBGridFiledCaption(Atype:string);
public
{ Public declarations }
end;
var
StatisticForm: TStatisticForm;
glbStatisticDate,glbFindBigType,glbTypeCount,glbFindSmallType:string;
implementation
{$R *.dfm}
uses dmFrm,prtreaderidfrm, prtBookCountfrm, findOfDateFrm,prtBorrowCountFrm;
procedure TStatisticForm.clearComponentCaptionText;
begin
lbBigCount.Caption:='';
lbSmallCount.Caption:='';
lbBookCount.Caption:='';
lbBigSmallCount.Caption:='';
lbBigBookCount.Caption:='';
lbSmallBookCount.Caption:='';
cbBigType.Text:='';
cbSmallType.Text:='';
gbBigType.Caption:='大类名';
gbSmallType.Caption:='小类名';
gbBigType.Enabled:=false;
gbSmallType.Enabled:=false;
lbReaderCount.Caption:='';
lbQuitReaderCount.Caption:='';
lbBorrowCount.Caption:='';
lbCurBorrowCount.Caption:='';
lbCurReturnCount.Caption:='';
end;
procedure TStatisticForm.FormDestroy(Sender: TObject);
begin
inherited;
StatisticForm:=nil;
end;
procedure TStatisticForm.cbBigTypeChange(Sender: TObject);
var
tmpBigSmallCount,tmpBigBookCount:string;
begin
inherited;
dbgCount.DataSource:=nil;
gbBigType.Caption:=cbBigType.Text;
glbFindBigType:=cbBigType.Items.Values[cbBigType.Items.Names[cbbigtype.ItemIndex]];
glbFindBigType:=glbFindBigType+'('+cbBigType.Items.Names[cbbigtype.ItemIndex]+')';
cbSmallType.Clear;
DMbook.CountBigCount(cbBigType.Items.Names[cbBigType.ItemIndex],tmpBigSmallCount,tmpBigBookCount,cbSmallType.items);
lbBigSmallCount.Caption:=tmpBigSmallCount;
lbBigBookCount.Caption:=tmpBigBookCount;
gbBigType.Enabled:=true;
end;
procedure TStatisticForm.cbSmallTypeChange(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
gbSmallType.Caption:=cbSmallType.Text;
glbFindSmallType:=cbSmallType.Items.Values[cbSmallType.Items.Names[cbSmallType.ItemIndex]];
glbFindSmallType:=glbFindSmallType+'('+cbSmallType.Items.Names[cbSmallType.ItemIndex]+')';
//汇总小类
DMbook.CountBookDataFromWhere('BIGSMALLBOOKCOUNT',cbSmallType.Items.Names[cbSmallType.ItemIndex]);
lbSmallBookCount.Caption:=dmbook.QryStatisticBook.FieldByName('bigsmallbookcount').AsString;
if lbSmallBookCount.Caption='' then lbSmallBookCount.Caption:='0';
gbSmallType.Enabled:=True;
end;
procedure TStatisticForm.FormCreate(Sender: TObject);
begin
inherited;
clearComponentCaptionText;
DMbook.CountAllCount(cbBigType.Items);
lbBigCount.Caption:=inttostr(DMbook.glbBigTypeCount);
lbSmallCount.Caption:=inttostr(DMbook.glbSmallTypeCount);
lbBookCount.Caption:=inttostr(DMbook.glbBookCount);
DMbook.CountReaderDataFromWhere('READERCOUNT','');
lbReaderCount.Caption:=DMbook.QryStatisticReader.FieldByName('readercount').AsString;
DMbook.CountReaderDataFromWhere('READERQUITCOUNT','');
lbQuitReaderCount.Caption:=DMbook.QryStatisticReader.FieldByName('readerquitcount').AsString;
dmBook.CountBorrowDataFromWhere('BORROWCOUNT',now());
lbBorrowCount.Caption:=DMbook.QryStatisticBorrow.FieldByName('borrowcount').AsString;
dmBook.CountBorrowDataFromWhere('CURBORROWCOUNT',now());
lbcurBorrowCount.Caption:=DMbook.QryStatisticBorrow.FieldByName('curborrowcount').AsString;
dmBook.CountBorrowDataFromWhere('CURRETURNCOUNT',now());
lbCurReturnCount.Caption:=DMbook.QryStatisticBorrow.FieldByName('curreturncount').AsString;
end;
procedure TStatisticForm.bbtnBigtypeClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountBookDataFromWhere('BIG','');
dbgCount.DataSource:=DMbook.dsStatisticBook;
setDBGridFiledCaption('BIG');
end;
procedure TStatisticForm.bbtnBigSmallTypeClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountBookDataFromWhere('BIGSMALL',cbBigType.Items.Names[cbBigType.ItemIndex]);
dbgCount.DataSource:=DMbook.dsStatisticBook;
setDBGridFiledCaption('BIGSMALL');
end;
procedure TStatisticForm.bbtnBigBookClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountBookDataFromWhere('BIGBOOK',cbBigType.Items.Names[cbBigType.ItemIndex]);
dbgCount.DataSource:=DMbook.dsStatisticBook;
setDBGridFiledCaption('BIGBOOK');
end;
procedure TStatisticForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
DMbook.closeCountData;
Action:=caFree;
end;
procedure TStatisticForm.bbtnBigSmallBookClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountBookDataFromWhere('BIGSMALLBOOK',cbSmallType.Items.Names[cbSmallType.ItemIndex]);
dbgCount.DataSource:=DMbook.dsStatisticBook;
setDBGridFiledCaption('BIGSMALLBOOK');
end;
procedure TStatisticForm.bbtnReaderClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountReaderDataFromWhere('READERDATA','');
dbgCount.DataSource:=DMbook.dsStatisticReader;
setDBGridFiledCaption('READERDATA');
end;
procedure TStatisticForm.bbtnReaderQuitClick(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
DMbook.CountReaderDataFromWhere('READERQUITDATA','');
dbgCount.DataSource:=DMbook.dsStatisticReader;
setDBGridFiledCaption('READERQUITDATA');
end;
procedure TStatisticForm.pageControlCountChange(Sender: TObject);
begin
inherited;
dbgCount.DataSource:=nil;
end;
procedure TStatisticForm.bbtnSmallTypePrintClick(Sender: TObject);
begin
inherited;
bbtnBigSmallType.Click;
//列印的代码
glbTypeCount:='共'+lbBigSmallCount.Caption+'个小类';
if not assigned(prtBookCount) then
prtBookCount:=TprtBookCount.Create(Application);
try
prtBookCount.RB1.Enabled:=true;
prtBookCount.RB1.Checked:=true;
prtBookCount.RB2.Enabled:=false;
prtBookCount.RB3.Enabled:=false;
prtBookCount.ShowModal;
finally
prtBookCount.Free;
prtBookCount:=nil;
end;
end;
procedure TStatisticForm.bbtnBigBookPrintClick(Sender: TObject);
begin
inherited;
bbtnBigBook.Click;
//列印的代码
glbTypeCount:='共'+lbBigBookCount.Caption+'册图书';
if not assigned(prtBookCount) then
prtBookCount:=TprtBookCount.Create(Application);
try
prtBookCount.RB1.Enabled:=false;
prtBookCount.RB2.Checked:=true;
prtBookCount.RB2.Enabled:=True;
prtBookCount.RB3.Enabled:=false;
prtBookCount.ShowModal;
finally
prtBookCount.Free;
prtBookCount:=nil;
end;
end;
procedure TStatisticForm.bbtnBigSmallBookPrintClick(Sender: TObject);
begin
inherited;
bbtnBigSmallBook.Click;
//列印的代码
glbTypeCount:='共'+lbSmallBookCount.Caption+'册图书';
if not assigned(prtBookCount) then
prtBookCount:=TprtBookCount.Create(Application);
try
prtBookCount.RB1.Enabled:=false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -