Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / Visual Basic

Create and Print Invoices as Data Report

Rate me:
Please Sign up or sign in to vote.
3.50/5 (7 votes)
20 Mar 2009CPOL3 min read 70.1K   7.3K   15   5
ActiveX to display invoice in grid and edit it, print invoices as Data Report using VB6

img53.JPG

img059.JPG

img058.JPG

img057.JPG

Image 5

Introduction

This ActiveX control is a powerful tool to help you create and print invoices as Data Report. Now you can preview and print invoices by one touch. This ActiveX control has two versions, one to use in the English language (its name is "EInvoice" and another to use in the Arabic language (its name is "AInvoice"). The two controls are the same when using its properties and methods.

You use this ActiveX control in your application by adding it to a form and setting its properties. At design time, my ActiveX control is displayed as an icon on a form, this icon can't be sized. The control is invisible to the user at run time (as CommonDialog control and Timer control).

With my ActiveX, you can:

  • Add new invoice
  • Edit current invoice
  • Delete current invoice
  • Find invoice by order number or by customer name
  • Preview and print current invoice or all invoices of current customer
  • Export current invoice or invoices of current customer to HTML file
  • Click ActiveX control by right button of mouse you can get custom properties

Background

My ActiveX "Invoice Designer" EInvoice or AInvoice depends on table's name and field's name as shown in the following table:

Table name Field name
Orders OrderID
CustomerID
EmployeeID
OrderDate
RequiredDate
Freight

Customers

CustomerID
CompanyName
City
Phone
EmployeesEmployeeID
FirstName
LastName
ProductsProductID
ProductName
Order DetailsOrderID
ProductID
UnitPrice
Quantity
Discount

So, if you build a new database file and want to use my ActiveX control, be sure that your database file includes tables with the same name and your tables include fields which have the same name as you see in the above table.

Don't worry I don't tie your hand, of course you can add other tables and other fields to your database file but you must keep to the table's name and the field's name as given in the above table.

My ActiveX control has one method and twenty one properties. You can read about the method and two properties in the following table. The other properties are in the help file after you download and extract the file "Invoice.zip".
 

Method/PropertyDefinition Example
ViewInvoiceDisplay invoice (order by customer name)EInvoice1.ViewInvoice (in English) or,
AInvoice1.ViewInvoice (in Arabic)
InvoiceDatabaseFileSet path and name of database fileEInvoice1.InvoiceDatabaseFile = App.Path + "\" + "MyMarket.mdb"
InvoiceTitleSet the title of invoiceEInvoice1.InvoiceTitle = "International Food Company"

Using the Code

After you set some properties, you can display the invoice:

VB.NET
EInvoice1.ViewInvoice ' if using "EInvoice" control for English language.
AInvoice1.ViewInvoice ' if using "AInvoice" control for Arabic language.

Remarks

After you download the file Invoice.zip and extract it, you find:

  • Folder MyActiveX includes EInvoice control, AInvoice control and help file explains everything
  • Folder prjEN includes project to test the free trial version EInvoice control
  • Folder prjAR includes project to test the free trial version AInvoice control

Last Words

I hope my ActiveX is useful. This tool is for personal use only and not for public use, you can use it for your own projects. Thanks to The Code Project and thanks to all.

History

  • 20th March, 2009: Initial post

Mostafa Kaisoun
M_Kaisoun@hotmail.com

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Egypt Egypt
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionasd Pin
Member 100192031-May-13 22:49
Member 100192031-May-13 22:49 
GeneralMy vote of 1 Pin
Syed J Hashmi11-Jan-10 18:50
Syed J Hashmi11-Jan-10 18:50 
Questionsource code of acivex controls Pin
Avinash Sureka7-Jun-09 22:32
Avinash Sureka7-Jun-09 22:32 
GeneralError Pin
Tabitutza22-Apr-09 23:01
Tabitutza22-Apr-09 23:01 
GeneralRe: Error Pin
Mostafa Kaisoun24-Apr-09 2:13
Mostafa Kaisoun24-Apr-09 2:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.