Home arrow Delphi-Kylix arrow Page 4 - Invoicing in Delphi: Show Me the Money
DELPHI-KYLIX

Invoicing in Delphi: Show Me the Money


Have you been looking for a way to tame the invoices in your small business? In this article, the first of two parts, we are going to create a fully functioning invoicing system that can be used in almost any environment and situation. Interested? Keep reading.

Author Info:
By: Chris Neeman
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
July 09, 2007
TABLE OF CONTENTS:
  1. · Invoicing in Delphi: Show Me the Money
  2. · Building the Database
  3. · Building the Application Interface
  4. · Finished Code
  5. · Rest of the Code and the Conclusion

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Invoicing in Delphi: Show Me the Money - Finished Code
(Page 4 of 5 )

Below is the listing for the entire main unit:

unit invmain;

interface

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms,
Dialogs, Buttons, StdCtrls, RpDefine, RpCon,
  RpConDS, DB, ADODB, Grids, 
DBGrids, RpRave, Menus, ExtCtrls,
  ToolWin, ComCtrls,math, INIFiles,
RpRender, RpRenderPDF,
  RpRenderRTF, RpRenderHTML;

type 
  TForm1 = class(TForm) 
    MainMenu1: TMainMenu; 
    PopupMenu1: TPopupMenu; 
    File1: TMenuItem; 
    Windows1: TMenuItem; 
    Clients1: TMenuItem; 
    ools1: TMenuItem; 
    Settings1: TMenuItem; 
    ViewAllClients1: TMenuItem; 
    About1: TMenuItem; 
    Exit1: TMenuItem; 
    Panel1: TPanel; 
    btndelete: TBitBtn; 
    Statistics1: TMenuItem; 
    btnAddInv: TBitBtn; 
    srchpnl: TPanel; 
    rb1: TRadioButton; 
    rb2: TRadioButton; 
    edsearch: TEdit; 
    btnsearch: TBitBtn; 
    BitBtn1: TBitBtn; 
    Label1: TLabel; 
    Label2: TLabel; 
    StaticText2: TStaticText; 
    StaticText3: TStaticText; 
    db1: TDBGrid; 
    ado1: TADOTable; 
    d1: TDataSource; 
    ado1invno: TAutoIncField; 
    ado1invname: TWideStringField; 
    ado1invdate: TDateTimeField; 
    ado1notes: TMemoField; 
    ado1status: TWideStringField; 
    ado1amount: TBCDField; 
    ado1total: TBCDField; 
    procedure File1Click(Sender: TObject); 
    procedure CreateNewInvoice1Click(Sender: TObject); 
    procedure BitBtn2Click(Sender: TObject); 
    procedure db1DblClick(Sender: TObject); 
    procedure Exit1Click(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
    procedure db1CellClick(Column: TColumn); 
    procedure FormShow(Sender: TObject); 
    procedure btndeleteClick(Sender: TObject); 
    procedure btnAddInvClick(Sender: TObject); 
    procedure Statistics1Click(Sender: TObject); 
    procedure btnsearchClick(Sender: TObject); 
    procedure Settings1Click(Sender: TObject); 
    procedure ViewAllClients1Click(Sender: TObject); 
    procedure About1Click(Sender: TObject); 
    procedure BitBtn1Click(Sender: TObject); 
    procedure ado1AfterPost(DataSet: TDataSet); 
    procedure ado1AfterScroll(DataSet: TDataSet); 
   { procedure ado1AfterPost(DataSet: TDataSet); 
    procedure ado1AfterScroll(DataSet: TDataSet); }

  private 
    { Private declarations }

  public 
    { Public declarations } 
     vat:real; 
     con,rav:string; 
     num:integer; 
  end;

var 
  Form1: TForm1;

implementation

{$R *.dfm}

uses newinv,viewchange, stats, settings, viewclients, about;
procedure TForm1.File1Click(Sender: TObject);
begin
 
close;
end;

procedure TForm1.CreateNewInvoice1Click(Sender: TObject);
begin
 
form2.Show;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
 
close;
end;

procedure TForm1.db1DblClick(Sender: TObject);
begin
 
//num:=db1.Fields[0].AsInteger;
 
num:=ado1.RecNo;
 
ado1.recno:=num;
 
with TForm5.Create(Application) do
 
begin 
 
  ShowModal; 
 
  Free;
 
end;

  //form5.show;
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
 
close;
end;

procedure TForm1.FormCreate(Sender: TObject);

var
 
settings : TINIFile;

begin
 
settings := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'settings.ini'); 
  try
   
con:=settings.ReadString('Settings', 'con',''); 
  //showmessage(con);
 
vat:=settings.ReadFloat('Settings', 'vat',8.5); 
  //  showmessage(floattostr(vat));
 
rav:=settings.ReadString('Settings', 'rav','');
 
showmessage(rav); 
  finally 
   settings.Free; 
  end; 
  {if (ip= 'Empty') or (port<1) then begin 
    messagedlg('Your connection details are not set. Click ok to continue.', mtInformation,[mbOk], 0); 
     } 
end;

procedure TForm1.db1CellClick(Column: TColumn);
begin
  //a:='clicked';
end;

procedure TForm1.FormShow(Sender: TObject);

var
 
i:integer;

begin
 
//set ado properties
 
ado1.ConnectionString:=con;
 
ado1.TableName:='invoices';
 
ado1.Active:=true;
 
label1.caption:=inttostr(ado1.RecordCount); 
  i:=ado1.RecordCount;
 
label2.Caption:=inttostr(i);
end;

procedure TForm1.btndeleteClick(Sender: TObject);
begin
 
if ado1.RecordCount > 0 then
 
begin
   
ado1.Delete;
 
end
 
else
   
showmessage('No invoices to delete');
end;

procedure TForm1.btnAddInvClick(Sender: TObject);
begin
 
ado1.Active:=false;
 
//form1.ado1.TableName:='';
 
form2.show;
end;


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials