wiki:Guides/PDFInvoiceFormat

PDF Invoice Template Format

Format used to create PDF template. Please use any text editor (such as Notepad) to modify the templates. Save it in plain text format (txt)

Syntax

General

A line starting with # is a comment or a directive

Examples:

# This is comment and will not be displayed on PDF
# below directive starts new table with ID1
#TABLE1 

Headings

Line starting with numbers are headings. Lesser number means higher significance heading. The text should be put in < > brackets

Examples:

1<Heading 1>
2<Heading 2>

Sample source: attachment:heading.txt Sample PDF: attachment:heading.pdf

Formatting

<b>text here will be bold</b>
<i>text here is italic</i>
<c:alink:http://www.datatechlabs.com>this is hyperlink</c:alink>

Sample source: attachment:formatting.txt Sample PDF: attachment:formatting.pdf

Directives

Page break
# below directive starts new page  
#NP
Font
#FONT(face="Arial", size="10")

"#FONT" defines font which will follow in next sections

attributes:

  • face = "name" sets font face name, example "Helvetica", "Courier". For full list, please see below
  • size = "value" sets font size for the following text sections

WARNING! Setting FONT attribute before defining table will disable <b> <i> tags in table

Image
#IMAGE(src="http://www.datatechlabs.com/templates/datatechlabs/images/DTL_logo_2_RGB.jpg",justification="left",width="200")

"#IMAGE" places jpeg or png image in the document
attributes:

  • src = image path on server or HTTP or FTP URL
  • padding (optional) = is the number of page units that will pad the image on all sides. The default is five (5). If you do not want any padding, you may enter 0.
  • width (optional) = is the width of the image on the page. The default is to use the actual width of the image in pixels. Whether or not you specify a width, the actual width of the image on the page will depend on what you enter for the $resize argument as well as the placement of the image on the page.
  • resize (optional) = can be one of 'full', 'width', or 'none'. The default value is 'full'.
  • justification = determines the horizontal position of the image within the current column. The default is 'center', and can be specified as either 'center', 'left', or 'right'. This setting has little meaning if the image has been resized to fit the column and only makes a practical difference if the width of the image is smaller than the width of the column.
Logo - a special case of image
#LOGO(justification="left",width="200")

same as above for IMAGE tag, but automatically uses image which is set as your logo in the system.

Tables
#TABLE1(title="Sample Table", width="200", border="0", shade="0", font-size="10", cellpadding-row="1", cellpadding-col="1")
#TD1(title="<i>Column1</i>", align="left")
#TD1(title="Column2", align="left")
#TD1(title="Column3", align="left")
#TR1(source="<b>Row1</b>;Row1;Row1", format="%s;%s;%s")
#TR1(source="<b>Row2</b>;Row2;Row2", format="%s;%s;%s")
#TR1(source="<b>Row3</b>;Row3;Row3", format="%s;%s;%s")
#ENDTABLE1

Sample source: attachment:tables.txt Sample PDF: attachment:tables.pdf

"#TABLE<N>" displays tables
<N> - Integer number, represents unique ID of table (example #TABLE1, #TABLE2)
attributes:

  • title = "text" displays title above table
  • border = "mode" border around table: 0- none, 1 -borders, 2 -borders and lines between rows
  • shade = "mode" shade: 0 -none, 1 - alternate lines, 2 - both line sets shaded
  • font-size = "size" font size
  • align = "left|right|center|value" alignment of table (relative or fixed pixels)
  • cellpadding-row = "value" padding between horizontal border of cell and text
  • cellpadding-col = "value" padding between vertical border of cell and text
  • width = "value" width of the table

"#TD<N>" defines table data cell, required exactly one definition per column
<N> - Integer number, represents unique ID of table (example #TABLE1, #TABLE2)
attributes:

  • title = "name" Name of the column (<b></b> <i></i> can be used)
  • source = "source" Data Display Source (see details below)
  • align = "left|right|center|value" alignment of data in cell (relative or fixed pixels)
  • width = "value" width of column
  • format = "pattern" formats representation of strings or numbers (example: "%s" - string, "%01.2f" number with 2 decimals, "%d" - integer. For durations representation here are following special formats: "%HH:MM:SS", "%MM:SS"

"#TD<N>" defines table data row. The number of rows will be generated automatically, depending of available data in the invoice
<N> - Integer number, represents unique ID of table (example #TABLE1, #TABLE2)
attributes:

  • source = "source" Data Display Source (see details below)
  • align = "left|right|center|value" alignment of data in cell (relative or fixed pixels)
  • width = "value" width of column
  • format = "pattern" formats representation of strings or numbers (example: "%s" - string, "%01.2f" number with 2 decimals, "%d" - integer. For durations representation here are following special formats: "%HH:MM:SS", "%MM:SS"

"#ENDTABLE<N>" mandatory table closing statement
<N> - Integer number, represents unique ID of table (example #TABLE1, #TABLE2)

Data

Invoice is populated by placing predefined placeholders in specific places in the invoice:

Below is list of supported attributes in Invoice Template

To be placed anywhere in file:

$CLIENT_ID                   Client ID
$CLIENT_NAME                 Client (Account) Name
$COMPANY_NAME                Company Name
$CONTACT_ADDRESS_1           Address 1
$CONTACT_ADDRESS_2           Address 2
$CONTACT_PHONE_1             Phone Number
$CONTACT_FAX                 Fax Number
$CONTACT_EMAIL               Email Address
$CONTACT_CITY                City
$CONTACT_STATE               State
$CONTACT_ZIP                 ZIP
$CONTACT_COUNTRY             Country
$CONTACT_BILL_ADDRESS_1      Billing Address 1
$CONTACT_BILL_ADDRESS_2      Billing Address 2
$CONTACT_BILL_CITY           Billing City
$CONTACT_BILL_STATE          Billing State
$CONTACT_BILL_ZIP            Billing ZIP
$CONTACT_BILL_COUNTRY        Billing Country
$CONTACT_CUST_1              Custom field No1
$CONTACT_CUST_2              Custom field No2
$CONTACT_CUST_3              Custom field No3
$CONTACT_CUST_4              Custom field No4
$CONTACT_CUST_5              Custom field No5
$CONTACT_CUST_6              Custom field No6
$CONTACT_CUST_7              Custom field No7
$CONTACT_CUST_8              Custom field No8
$CONTACT_CUST_9              Custom field No9
$CONTACT_CUST_10             Custom field No10
$CONTACT_NOTES               Notes field
$CONTACT_VATNUMBER           VAT number
$CONTACT_CURRENCY            Currency Name if the account
$TOTAL_AMOUNT                Total invoice amount, including tax (MODIFIED!)
$TOTAL_CALLS                 Number of calls
$TOTAL_BILLDUR               Total billed duration
$INVOICE_CREATED             Invoice generation date
$INVOICE_CREATED_DATETIME    Invoice generation date and time (hh:mm)
$INVOICE_NUMBER              Invoice number
$TOTAL_NET_AMOUNT            Total net amount (ex taxes)
$TOTAL_NET_WITH_DISCOUNT     Total net amount (ex taxes) including discount
$TOTAL_TAX_AMOUNT            Total amount of taxes
$TOTAL_TAX_RATE              Tax rate (percentage)
$TOTAL_DISCOUNT_AMOUNT       Total amount of discount
$TOTAL_DISCOUNT_RATE         Discount rate (percentage)
$OPENING_BALANCE             Opening balance
$CLOSING_BALANCE             Closing balance
$TOTAL_PAYMENTS              Total Payments
$TOTAL_CURRENCY              Total Invoice Currency
$TOTAL_START_TIME            Invoice Period Start Time
$TOTAL_END_TIME              Invoice Period End Time
$TOTAL_DUE_DATE              Invoice Due Date

To be placed only in table rows:

table fields (available via #TD1(source="$ATTR") ) - only to be used within tables

$CALLS_DEST_GROUP_NAME       Destination group name
$CALLS_DEST_GROUP_CODE       Destination group code
$CALLS_COUNT                 Number of calls by group
$CALLS_BILL_DUR              Billed duation of calls in group
$CALLS_AMOUNT                Amount (money) of calls in group
$CALLS_DURATION              Total duration of calls in group
$CALLS_ST_TIME               Period start time YYYY-MM-DD
$CALLS_ENT_TIME              Period end time YYYY-MM-DD
$CALLS_RATE_PER_MIN          Rate per minute, average

Notes

NOTE! to display Euro symbol, use

^

character

Examples

Last modified 4 years ago Last modified on Mar 26, 2013, 7:55:52 AM

Attachments (8)

Download all attachments as: .zip