This section is intended for those who wish to use e-Bills more seriously. This could allow you to:
Some of the functions will require a small understanding of coding in PHP (C experience is fine)
etc/_configure.inc is the file that contains configuration variables for the server side PHP code. The contents of this file are well commented, so if you need to take a browse and update as necessary.
If you run multiple instances of e-Bills you will definitely need to update this file.
If the format of customer references created in the "Add customer" function do not meet the needs of your business then edit the auto_customer_ref() function in create-defaults.inc (remember to take a copy first). The default is for this function to create references of the style CSnnnnnn, where nnnnnn is a random number. It can be manually overwritten in the "Add customer" entry form.
If the format of contract references created in the "Add customer" and "Add contract" functions do not meet the needs of your business then edit the auto_contract_ref() function in create-defaults.inc (remember to take a copy first). The default is for this function to create references of the style CS-yyyy-iiii, where yyyy is the year and iiii is a sequential number. It can be manually overwritten in the "Add contract" entry form.
The following variable is defined in etc/_configure.inc:
define( "INVOICE_NUMBER_START", 10000 );
INVOICE_NUMBER_START defines the base for your invoice numbers, change it as required or set to zero.
You only need to do this once, but it is necessary to learn something about TeX. The TeTeX HOWTO gives some useful advice and there are some great sites, including Text Processing using LaTeX from the University of Cambridge Department of Engineering which contains excellent tutorial information. I strongly suggest you create a new .tex file from Standard.tex and use that as a starting point.
Here's some useful pointers:
1. All PHP variables start with a '$' sign. I've used the same within the billing template file (it was easy for PHP to evaluate directly) and TeX doesn't use the $ often. Here's the list:
Purpose Variable name Date $todays_date $payment_duedateReference $invoice_number $customer_ref $contract_ref $billing_sequenceCustomer $customer_name $contact_name $address1 $address2 $address3 $town $county $postcodeYour organisation $org_vat_reg $org_company $org_address1 $org_address2 $org_address3 $org_town $org_county $org_postcode $org_tel $org_fax $org_email $org_web $org_co_regProduct data $ref $product_code $description $qty $comments $amountCharge summary $vat $subtotal $grandtotal
You'll see how these are used within Standard.tex. Note also that you don't need to use of these within a bill and that some fields can be used in different ways, e.g. $contact_ref could be used as a "Meter number" or a "Customer Purchase Order Number", rather than a contract number
2. I've deliberately started all the template filenames with a capital letter 'A' through 'Z'. The configure billing template file written in PHP will only pick up filenames with a capital starting letter and a .tex extension.
3. Note that I've used '%%% Detail' within the .tex file to state that the next line contains the (repeated) line with Product information. This line is output as many times as needed within the production of a bill.
4. If your bills extend to more than one page ensure that you sort out the headers and footers for subsequent pages.
5. Changing simply the currency is quite easy. Replace the "\pounds" with "EUR" for example.
6. Test this new template using an existing .tex file created by ebills (from the ebills.pdfs directory) and run from the command line with:
# bin/ebills_make_pdf file_name // Leave off the .tex extension
or type
# pslatex file_name.tex > /dev/null 2>&1 # pslatex file_name.tex > /dev/null 2>&1 // YES it needs to be run twice! # dvips -t a4 file_name.dvi -o > /dev/null 2>&1 # ps2pdf -sPAPERSIZE=a4 -dSubsetFonts=true -dEmbedAllFonts=true file_name.ps > /dev/null 2>&1
You can specify how bills will be delivered to customers with each contract. There are three options: post, emali and fax, with the latter not fully implemented yet. The default option is post, resulting in bills being printed.
emails are sent as html, with the same text repeated as a plain text attachment and the bill attached as a PDF file.
If you send bills by email then you may wish to edit 'etc/send_bill_by_email.htm'. This is an html file contain various PHP variables. The variables are evaluated prior to sending, in order to give the email some life.
The variables that you can use are:
| Variable | Purpose |
| $org_email | Email address of contact in case of queries |
| $org_tel | Your company's telephone number |
| $org_fax | Your company's fax number |
| $org_contact | Contact in your company for enquiries |
| $org_company_name | Name of your company |
| $cust_ref | Reference number for this customer |
| $cust_name | Name of customer |
| $cont_cont_ref | Contract reference or Purchase Order number |
| $date_time | Date & Time email sent |
| $version | e-Bills version number |
Restriction: please note that this file is also used to create the plain text attachment that is sent with hte html email. The PHP simply removes html tags to create the plain text file. You are advised to edit this file using an html editor to ensure that the line width appropriate for plain text reading (i.e. not too long and not too many line breaks).
The billing engine is detected automatically by the web side PHP code and if present it will be used. To use the billing engine all you need is:
edit _etc/_configure.inc and update the following statement to contain the correct path
define( "BILLING_ENGINE_PATH", "/home/ebills/bin/ebills_engine_demo" );
or
edit _etc/_configure.inc and update the following statement to contain the correct path
define( "BILLING_ENGINE_PATH", "/home/ebills/bin/ebills_bgnd_exec" );
The following shows the options available from the Billing Engine:
# ./ebills_bgnd_exec -h Usage: ebills_bgnd_exec [OPTION] -c c process contract 'c' only -d debug output: show dates for all contracts -f output formatted html text (with d or l options) -h display this help and exit -l list of bills to be produced -L see LICENCE and exit -p produce pdf file (by implication .tex also) -q quiet mode - no messages -r f read config 'f' -s spool .ps file to printer -t produce .tex file -v show version number and exit -V show configuration parameters and exit Options are processed from left to right (use -r early) For latest release see www.asplen.co.uk/billing
When run from the web-side code it will be called with the "-fp" switches, resulting in html formatted output and a .tex and .pdf file being produced.
When run as a cron job you would use the "-qp" switches and from the command line use the "-p"
You can optionally provide specify a configuration file (see etc/ebills.conf). The default looks like:
# ebills.conf - ebills configuration files # # This file is only used by the BILLING ENGINE # and must replicate the info in _configure.inc # found in the web_server # # (c) Asplen Management Ltd 2001-2002 # # v1.3 23/10/2002 # # This file provides all the configuration data for an # ebills installation. # # Paths to key directories PATH_TO_PDFS "/home/httpd/e-bills.pdfs/" TEX_TEMPLATE "/home/ebills/bill_templates/billformat.tex" EBILLS_RUNNER "/usr/local/ebills/bin/ebills_make_pdf" # The number used as the base for invoice numbers INVOICE_NUMBER_START 10000 # Database hostname, database name, e-bills' username & password DB_HOSTNAME "localhost" DB_DBNAME "ebills" DB_USERNAME "ebguest" DB_PASSWORD "guest" # End of ebills.conf
You may find yourself running in either an ASP environment or simply in an environment where you have to produce bills for two or more legal entities. Running e-Bills as separate instances allows you to control which employees access the data from each company anf for you to utilise bill formats that show the correct company addresses and corporate information.
The process is quite simple and if you've already installed e-Bills is a case repeating the process using new domain names, directory names and database name
# mysqladmin -u username -ppassword create ebills_newname # mysql -u username -ppassword ebills_newname < ebdb-create-tables # mysql -u username -ppassword ebills_newname < ebdb-add-users
and that's about it.... login as su, add some users, update the organisation data and you are there.
To add a logo into your bills you will need to create a version of your logo as an EPS (Encapsulated PostScript) file. We used OpenOffice Draw (www.openoffice.org) to create our logo and to save it as an EPS file using the File / Export function. Remember to set the image size to be sensible for the invoice (the e-Bills logo is 3.5 cm wide x 2.6 cm high). The file saved as type 2, color was 7KB. Save the logo in your bill_templates folder (e.g. /home/ebills/bill_templates)
When you've created your EPS logo edit the relevant bill template file (e.g. Standard.tex). This contains the following lines:
%% The LH Heading comprising logo
%% UNCOMMENT the following FOUR lines and change the path if necssary to provide a logo
%\fancyhead[LO,LE]{
%\begin{tabular}{l}
%\includegraphics{/home/ebills/bill_templates/eBills_logo_EPS.eps}
%\end{tabular}}
%
Remove the comment ('%' character) from the beginning of hte 4 lines. Also ensure that the path to the logo file is correct. Next, select that billing template from the Super User configuration options.
The next bill you create will contain your logo.