Home > Invoice Plane > InvoicePlane–Enabling Date Parameters

InvoicePlane–Enabling Date Parameters

Sometimes it is necessary to include some form of dates in either the item or the item description for InvoicePlane.

In order to do so, you will need to edit 3 files

application\helpers\pdf_helper.php

search for function generate_invoice_pdf

and replace

$data = array(
        ‘invoice’ => $invoice,
        ‘invoice_tax_rates’ => $CI->mdl_invoice_tax_rates->where(‘invoice_id’, $invoice_id)->get()->result(),
          ‘items’ => $CI->mdl_items->get_items_and_replace_vars($invoice_id, $invoice->invoice_date_due),
        ‘payment_method’ => $payment_method,
        ‘output_type’ => ‘pdf’
    );

 

application\modules\guest\controllers\view.php

search for  public function invoice

$data = array(
                ‘invoice’ => $invoice,
                     ‘items’ => $this->mdl_items->get_items_and_replace_vars($invoice->invoice_id, $invoice->invoice_date_due),
                ‘invoice_tax_rates’ => $this->mdl_invoice_tax_rates->where(‘invoice_id’, $invoice->invoice_id)->get()->result(),
                ‘invoice_url_key’ => $invoice_url_key,
                ‘flash_message’ => $this->session->flashdata(‘flash_message’),
                ‘payment_method’ => $payment_method
            );

 

application\modules\invoices\models\mdl_items.php

add the following function to Mdl_Items class

public function get_items_and_replace_vars($invoice_id, $invoice_date_created = ‘now’)
     {
         $items = array();
         $query = $this->where(‘invoice_id’, $invoice_id)->get();

         foreach($query->result() as $item) {
             $item->item_name = $this->parse_item($item->item_name, $invoice_date_created);
             $item->item_description = $this->parse_item($item->item_description, $invoice_date_created);
             $items[] = $item;
         }
         return $items;
     }

 

 

Now you can do things like

Support and maintenance for {{{Month}}} {{{Year}}}

 

which will then appear as

image

Advertisements
Categories: Invoice Plane
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: