• Online Demo
  • 30-day Free Trial

Go Back   Blesta Forums > Community > General Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2012, 02:18 AM
phatpixel phatpixel is offline
Junior Member
 
Join Date: Jul 2012
Posts: 11
Default Display Custom Client Field on Invoice

We're looking to implement an Australian payment platform called BPAY. On each invoice our company will display its unique biller code, along with a customer reference number that is unique to each customer (essentially their UID plus a check-digit). They customer enters both of these at their financial institution when they are making a payment.

I have created a custom client field where I can enter the reference number for each client and would now like to include this number in the Invoice Customization > Terms section at the bottom of the invoice. How can I achieve this? Are there place holders to access variables, as can exist in the e-mail templates?

It would also be great if I could have Blesta automatically calculate the customer reference number based up on their UID, but this may be trickier as their UID probably doesn't exist when initially creating a new client.

Any advice would be appreciated. Thanks!
Reply With Quote
  #2  
Old 08-08-2012, 03:57 PM
Paul's Avatar
Paul Paul is offline
Blesta Developer
 
Join Date: Apr 2006
Location: Wherever I go, there I am.
Posts: 1,467
Send a message via AIM to Paul Send a message via MSN to Paul
Default

How do you calculate the customer reference number using their UID?

The Invoice Customization > Terms section does not support variables. To get it to display on the invoice, you'll want to modify inc/invoice-tcpdf.class.php which draws all the elements on the invoice, and fetch & position the data how you like.

If you use some type of algorithm to generate the reference number, and it just requires the UID, you may be able to do so directly in that file, rather than fetching it from the custom field.
__________________
Paul
Misc Stuff Guy

Blesta
Professional Billing
www.blesta.com
Reply With Quote
  #3  
Old 08-17-2012, 02:32 AM
phatpixel phatpixel is offline
Junior Member
 
Join Date: Jul 2012
Posts: 11
Default

Thanks Paul, you pointed me in the right direction. In case there are any other Australian users of Blesta that go down the BPAY path, here's the amended Footer() function for inc/invoice-tcpdf.class.php which will replace [crn] in the customised footer terms with a customer reference number (CRN).

For our system, we are using a zero-filled 5-digit client ID (UID) plus a MOD10 v5 check digit. Simply change the sprintf statement to accommodate larger or smaller UIDs. You could also replace $this->inv['client_id'] with $this->inv['id'] if you wanted the CRN to refer to a specific invoice rather than just the client ID.

PHP Code:
    public function Footer() {
        
// Draw notes
        
$number preg_replace("/\D/"""sprintf("%05s",$this->inv['client_id']));
        
$length strlen($number);
        
$total 0;
        for(
$i 0$i $length$i++) $total += $number{$i} * ($i 1);
        
$checkdigit fmod($total10);
        
$crn $number $checkdigit;

        
$data = array(
            array( 
str_replace("[crn]"$crn $this->company_info['terms'] ))
        );
        
$options = array(
            
'font_size'=>10,
            
'border'=>0,
            
'x_pos'=>50,
            
'y_pos'=>-135
        
);
        
$this->drawTable($data$options);
    } 
Reply With Quote
Reply

Bookmarks

Tags
bpay, custom, invoice, payment, variable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoice and Proforma invoice naja7host General Discussion 4 05-07-2012 07:36 AM
Invoice specific custom fields? (Purchase Order Number) Hugh Pre-Sale Questions 5 05-19-2009 12:10 PM
Custom Invoice Lines Telifon API & Order Forms 1 12-10-2008 05:05 PM
cronjob probleme !!!!! naja7host General Discussion 15 02-07-2008 11:16 PM


All times are GMT. The time now is 04:12 PM.