Home arrow Delphi-Kylix arrow Page 5 - 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 - Client Management Code
(Page 5 of 6 )

unit viewclients;

interface

uses

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

  Dialogs, Grids, DBGrids, StdCtrls, DB, ADODB, Buttons, ExtCtrls, DBCtrls;

type

  TForm6 = class(TForm)

    DBGrid1: TDBGrid;

    adoc: TADOTable;

    DataSource1: TDataSource;

    Panel1: TPanel;

    mem: TMemo;

    edname: TEdit;

    edcontact: TEdit;

    edfax: TEdit;

    edemail: TEdit;

    edphone: TEdit;

    StaticText1: TStaticText;

    StaticText2: TStaticText;

    StaticText3: TStaticText;

    StaticText4: TStaticText;

    StaticText5: TStaticText;

    StaticText6: TStaticText;

    btnAddC: TBitBtn;

    RadioButton1: TRadioButton;

    BitBtn1: TBitBtn;

    btnExit: TBitBtn;

    Panel2: TPanel;

    DBMemo1: TDBMemo;

    StaticText7: TStaticText;

    procedure Button1Click(Sender: TObject);

    procedure btnAddCClick(Sender: TObject);

    procedure btnExitClick(Sender: TObject);

    procedure RadioButton1Click(Sender: TObject);

    procedure FormActivate(Sender: TObject);

    procedure BitBtn1Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

   

  end;

var

  Form6: TForm6;

implementation

{$R *.dfm}

uses invmain;

procedure activatewidgets;

begin

form6.edname.Enabled:=true;

form6.edemail.Enabled:=true;

form6.edphone.Enabled:=true;

form6.edfax.Enabled:=true;

form6.edcontact.Enabled:=true;

form6.btnaddc.Enabled:=true;

form6.mem.Enabled:=true;

end;

procedure de_activatewidgets;

begin

form6.edname.Enabled:=false;

form6.edemail.Enabled:=false;

form6.edphone.Enabled:=false;

form6.edfax.Enabled:=false;

form6.edcontact.Enabled:=false;

form6.btnaddc.Enabled:=false;

form6.mem.Enabled:=false;

//empty the widgets

form6.edname.Clear;

form6.edemail.Clear;

form6.edphone.Clear;

form6.edfax.Clear;

form6.edcontact.Clear;

form6.mem.Clear;

form6.RadioButton1.Checked:=false;

end;

procedure TForm6.Button1Click(Sender: TObject);

begin

close;

end;

procedure TForm6.btnAddCClick(Sender: TObject);

begin

with adoc do

begin

try

Screen.Cursor := crHourGlass;

Insert;

FieldByName('name').Text := edname.Text;

FieldByName('address').AsString :=mem.Lines.Text;

FieldByName('email').text := edemail.text;

FieldByName('phone').text :=edphone.Text;

FieldByName('fax').text :=edfax.Text;

FieldByName('contact').text := edcontact.Text;

post;

except on E : Exception do

showmessage(e.Message);

end;

end;

messagedlg(edname.text + ' has been added.',mtInformation,

      [mbOk], 0);

Screen.Cursor := crDefault;

de_activatewidgets;

end;

procedure TForm6.btnExitClick(Sender: TObject);

begin

close;

end;

procedure TForm6.RadioButton1Click(Sender: TObject);

begin

activatewidgets;

end;

procedure TForm6.FormActivate(Sender: TObject);

begin

de_activatewidgets;

end;

procedure TForm6.BitBtn1Click(Sender: TObject);

begin

if adoc.RecNo > 0 then

adoc.Delete;

adoc.Refresh;

end;

procedure TForm6.FormCreate(Sender: TObject);

begin

adoc.ConnectionString:=form1.con;

adoc.Active:=true;

dbgrid1.Hint:='Click to make changes to the client details. '+#13#10+' Any changes you make will automatically be updated.';

end;

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