Home arrow Delphi-Kylix arrow Page 4 - Looking at the Details for an Invoicing Application in Delphi
DELPHI-KYLIX

Looking at the Details for an Invoicing Application in Delphi


In the previous article we discussed the requirements and purpose of the invoicing application that we are creating. We also listed the main application code. In this part of the article we are going to look at how to connect the database that we created earlier to the application code. We will also look at some of the code in detail.

Author Info:
By: Chris Neeman
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
July 16, 2007
TABLE OF CONTENTS:
  1. · Looking at the Details for an Invoicing Application in Delphi
  2. · Settings Unit
  3. · New Invoice Form and Code
  4. · Invoice Management Code and Output
  5. · Client Management Code
  6. · Final output and Conclusion

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Looking at the Details for an Invoicing Application in Delphi - Invoice Management Code and Output
(Page 4 of 6 )

The remaining part of the application deals mostly with managing invoice and client information. Check below for a listing of the code for the two units.

unit viewchange;

interface

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, DBCtrls, ExtCtrls, Mask, Buttons,math, RpRave,

  RpDefine, RpCon, RpConDS, DB, ADODB, RpRenderCanvas, RpRenderPreview,

  RpRender, RpRenderPDF, RpBase, RpSystem;

type

  TForm5 = class(TForm)

    GroupBox1: TGroupBox;

    StaticText7: TStaticText;

    StaticText3: TStaticText;

    dbm: TDBMemo;

    StaticText6: TStaticText;

    StaticText4: TStaticText;

    dbnav: TDBNavigator;

    edinvname: TDBText;

    StaticText1: TStaticText;

    SpeedButton1: TSpeedButton;

    StaticText2: TStaticText;

    DBText4: TDBText;

    edAmount: TDBEdit;

    edTotal: TDBEdit;

    SpeedButton2: TSpeedButton;

    rds: TRvDataSetConnection;

    rvp: TRvProject;

    cd: TDataSource;

    cado: TADOTable;

    DBMemo1: TDBMemo;

    rds2: TRvDataSetConnection;

    edstatus: TDBEdit;

    StaticText5: TStaticText;

    pdf1: TRvRenderPDF;

    RvRenderPreview1: TRvRenderPreview;

    rvs: TRvSystem;

    SpeedButton3: TSpeedButton;

    procedure SpeedButton1Click(Sender: TObject);

    procedure edTotalClick(Sender: TObject);

    procedure edAmountChange(Sender: TObject);

    procedure SpeedButton2Click(Sender: TObject);

    procedure SpeedButton3Click(Sender: TObject);

    procedure FormShow(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form5: TForm5;

  tots:real;

  dt:tdatetime;

implementation

{$R *.dfm}

uses invmain;

procedure TForm5.SpeedButton1Click(Sender: TObject);

begin

close;

end;

procedure TForm5.edTotalClick(Sender: TObject);

var

am:real;

begin

edtotal.Clear;

if tots > 0 then

begin

am:= (form1.vat / 100) * tots;

tots:=tots + am;

tots:=RoundTo(tots,-2);

edTotal.Text:=floattostr(tots);

end;

end;

procedure TForm5.edAmountChange(Sender: TObject);

begin

tots:= strtofloat(edAmount.Text);

end;

procedure TForm5.SpeedButton2Click(Sender: TObject);

begin

rvp.Execute;

end;

procedure TForm5.SpeedButton3Click(Sender: TObject);

begin

dt:=now;

ShortDateFormat := 'dmyyyy';

rvs.DefaultDest:=rdFile;

rvs.DoNativeOutput:=false;

rvs.RenderObject:= pdf1;

rvs.OutputFileName:='d:'+edinvname.Caption +''+DateToStr(Date)+'.pdf';

rvs.SystemSetups:=rvs.SystemSetups-[ssAllowsetup];

rvp.Engine:=rvs;

rvp.Execute;

end;

procedure TForm5.FormShow(Sender: TObject);

begin

cado.ConnectionString:=form1.con;

form1.ado1.ConnectionString:=form1.con;

form1.ado1.Active:=true;

form1.ado1.recno:=form1.num;

cado.active:=true;

{cd.DataSet:='cado';

cado.tablename:='clients';

cado.masterfield:='invname';

edamount.datasource:='Form1.d1';

edamount.datafield:='amount';

edtotal.datasource:='Form1.d1';

edtotal.datafield:='total';

edstatus.datasource:='Form1.d1';

edstatus.datafield:='status';

dbtext4.datasource:='Form1.d1';

dbnav.datasource:='Form1.d1';

dbm.datasource:='Form1.d1';

dbm.datafield:='notes';

}

//client properties

{cd.DataSet:=cado;

cado.tablename:='clients';

cado.MasterFields:='invname';

edinvname.datasource:=cd;

dbmemo1.datasource:=cd;

dbmemo1.DataField:='address';

edinvname.DataField:='invname'; }

//cado.Active:=true;

rvp.ProjectFile:=form1.rav;

end;

end.

Output produced by this code:


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 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials