templatable invoices
[freeside.git] / htdocs / docs / billing.html
index 46ae1fd..7841bf7 100644 (file)
@@ -3,19 +3,37 @@
 </head>
 <body>
   <h1>Billing</h1>
-  The <b>freeside-bill</b> script can be run daily to bill all customers.  Usage: bill [ -c [ i ] ] [ -d <i>date</i> ] [ -b ] <i>user</i>
   <ul>
-    <li>-c: Turn on collecting (you probably want this).
-    <li>-i: Real-time billing (as opposed to bacth billing).  Only relevant for credit cards.
-    <li>-d: Pretend it is <i>date</i> (parsed by Date::Parse)
-    <li>-b: N/A
-  </ul>
-  Printing should be configured on your freeside machine to print invoices.
-  <br><br>Batch credit card processing
-  <ul>
-    <li>After this script is run, a credit card batch will be in the <a href="schema.html#cust_pay_batch">cust_pay_batch</a> table.  Export this table to your credit card batching.
-    <li>When your batch completes, erase the cust_pay_batch records in that batch and add any necessary paymants to the <a href="schema.html#cust_pay">cust_pay</a> table.  Example code to add payments is:
-    <pre>use FS::cust_pay;
+    <li>To enable billing, you <b>must</b> create an <a href="config.html#invoice_template">invoice_template</a> configuration file.  An example file is available in the <i>conf/</i> directory of the distribution.  You also need to create an <a href="config.html#lpr">lpr</a> configuration file to enable postal invoices.
+    <ul>
+      <li>Optional: Invoice template customization
+        <ul>
+          <li>See the <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> documentation for details on the substitution language.
+          <li>You <b>must</b> call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column.
+          <li>In addition, the following variables are available:
+            <ul>
+              <li>$invnum - invoice number
+              <li>$date - as a UNIX timestamp (see <a href="http://search.cpan.org/doc/GBARR/TimeDate-1.09/lib/Date/Format.pm">Date::Format</a> for conversion functions).
+              <li>$page - current page
+              <li>$total_pages - total pages
+              <li>@address - A six-element array containing the customer name, company, and address.
+              <li>$overdue - true if this invoice is overdue
+            </ul>
+        </ul>
+    </ul>
+    <li>You can bill individual customers by clicking on the <i>Bill now</i> link on the main customer view.
+    <li> The <b>freeside-bill</b> script can be run daily to bill all customers.  Usage:<pre>bill [ -c [ i ] ] [ -d <i>date</i> ] [ -b ] <i>user</i></pre>
+      <ul>
+        <li>-c: Turn on collecting (you probably want this).
+        <li>-i: Real-time billing (as opposed to bacth billing).  Only relevant for credit cards.
+        <li>-d: Pretend it is <i>date</i> (parsed by <a href="http://search.cpan.org/doc/GBARR/TimeDate-1.09/lib/Date/Parse.pm">Date::Parse</a>)
+        <li>-b: N/A
+      </ul>
+      <br><br>Batch credit card processing
+      <ul>
+        <li>After this script is run, a credit card batch will be in the <a href="schema.html#cust_pay_batch">cust_pay_batch</a> table.  Export this table to your credit card batching.
+        <li>When your batch completes, erase the cust_pay_batch records in that batch and add any necessary paymants to the <a href="schema.html#cust_pay">cust_pay</a> table.  Example code to add payments is:
+        <pre>use FS::cust_pay;
 
 # loop over all records in batch
 
@@ -36,13 +54,14 @@ if ( $error ) {
 # end loop
 </pre>
 All fields except paybatch are contained in the cust_pay_batch table.  You can use paybatch field to track particular batches and/or particular transactions within a batch.<br><br>
-    <li>The <b>freeside-print-batch</b> script can print or email pending credit card batches for manual entry.  Usage: freeside-print-batch [-v] [-p] [-e] [-a] [-d] <i>user</i>
-      <ul>
-        <li>-v: Verbose - Prints records to STDOUT.
-        <li>-p: Print to printer lpr as found in the conf directory.
-        <li>-e: Email output to user found in the Conf email file.
-        <li>-a: Automatically pays all records in cust_pay_batch.  Use -d with this option usually.
-        <li>-d: Delete - Pays account and deletes record from cust_pay_batch.
+        <li>The <b>freeside-print-batch</b> script can print or email pending credit card batches for manual entry.  Usage: freeside-print-batch [-v] [-p] [-e] [-a] [-d] <i>user</i>
+          <ul>
+            <li>-v: Verbose - Prints records to STDOUT.
+            <li>-p: Print to printer lpr as found in the conf directory.
+            <li>-e: Email output to user found in the Conf email file.
+            <li>-a: Automatically pays all records in cust_pay_batch.  Use -d with this option usually.
+            <li>-d: Delete - Pays account and deletes record from cust_pay_batch.
+          </ul>
       </ul>
   </ul>
 </body>