add print_batch script from Joel Griffiths
[freeside.git] / htdocs / docs / billing.html
1 <head>
2   <title>Billing</title>
3 </head>
4 <body>
5   <h1>Billing</h1>
6   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>
7   <ul>
8     <li>-c: Turn on collecting (you probably want this).
9     <li>-i: Real-time billing (as opposed to bacth billing).  Only relevant for credit cards.  Not available without modifying site_perl/Bill.pm
10     <li>-d: Pretend it is <i>date</i> (parsed by Date::Parse)
11     <li>-b: N/A
12   </ul>
13   Printing should be configured on your freeside machine to print invoices.
14   <br><br>Batch credit card processing
15   <ul>
16     <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.
17     <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:
18     <pre>use FS::cust_pay;
19
20 # loop over all records in batch
21
22 my $payment=create FS::cust_pay (
23   'invnum' => $invnum,
24   'paid' => $paid,
25   '_date' => $_date,
26   'payby' => $payby,
27   'payinfo' => $payinfo,
28   'paybatch' => $paybatch,
29 );
30
31 my $error=$payment->insert;
32 if ( $error ) {
33   #process error
34 }
35
36 # end loop
37 </pre>
38 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>
39     <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>
40       <ul>
41         <li>-v: Verbose - Prints records to STDOUT.
42         <li>-p: Print to printer lpr as found in the conf directory.
43         <li>-e: Email output to user found in the Conf email file.
44         <li>-a: Automatically pays all records in cust_pay_batch.  Use -d with this option usually.
45         <li>-d: Delete - Pays account and deletes record from cust_pay_batch.
46       </ul>
47   </ul>
48 </body>