User Management for an Internet Access Control Application - Stats Page
(Page 4 of 4 )
That covers the user management module. Next we will look at the stats page. I’ve not fully implemented this module because it is an optional extra. But I assume that if you wanted to see any kind of statistics, that you will want to see the running total, i.e. how much the business has made so far. So I’ve written some SQL queries that you can choose from to display the kind of information that you would want:
unit stats;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm8 = class(TForm)
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
StaticText4: TStaticText;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
{$R *.dfm}
uses logon;
procedure TForm8.FormShow(Sender: TObject);
var
inv,pending,paid:integer;
rtotal:real;
begin
rtotal:=0;
{
//get the total by this user
form3.q.Close;
form3.q.SQL.Text:='Select sum() from mula';
form3.q.Open;
inv:= form3.q.RecordCount;
label1.caption:= inttostr(inv);
//
form3.q.Close;
form3.q.SQL.Text:='Select * from mula WHERE status = :stat';
form3.q.Parameters.ParamByName('stat').Value:='paid';
form3.q.Open;
paid:=form3.q.RecordCount;
label3.caption:= inttostr(paid);
}
//runnning total
form3.q.Close;
form3.q.SQL.Text:='Select total from mula';
form3.q.Open;
form3.q.First;
while not form3.q.EOF do
begin
rtotal:=rtotal + form3.q.fieldbyname('total').AsFloat;
form3.q.Next;
end;
label3.caption:='$'+ floattostr(rtotal);
end;
end.
Conclusion
This concludes the discussion of the server part of the access control application. The next part of the series on Internet access control will focus on the client application.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |