Billing module - modifying invoice template

Discussion in 'Plugins/Modules/Addons' started by Amorphous, Mar 12, 2014.

  1. Amorphous

    Amorphous New Member

    Hello, i have started to use the billing module, right now i am trying to implement some API, so far everything is ok.

    I have some urgent matters about the invoice templates and invoide pdf creation .... i am a little new at all this, i am still learning , haven t found anyhing on the forum to help me about:

    How do i use the variables to customize the created invoice ??? wich ones are for:

    Client name

    these are the settings now ... i simply cannot find the var name for Client name not Company name.. right now {tmpl_var name='invoice_name'}<br /> shows only the company name ..... i need to know which one is the variable for Customer name...

    {tmpl_var name='invoice_name'}<br />
    {tmpl_var name='invoice_street'}<br />
    {tmpl_var name='invoice_zip'} {tmpl_var name='company_city'}<br />
    {tmpl_var name='invoice_state'}<br />
    {tmpl_var name='invoice_country'}<br />


    I am trying also to modify a little the structure for the next steps ... i want to create a new line inside invoice, where i want to be shown the item template name ( Web-hosting Ultra for example ) this is one of my template names ...

    i have already modified the css files, the structure and the alignment , this is not an issue .... the issues are the variables that define the values that i need ... how can i find them and where ??

    how do i use the variables to show inside the invoice this argument ???

    trust me i have opened almost all the files and tryed to find the appropriate variables with no result ..... if they don t exist ..... how can i create them and where ???? i have bought the billing module, the ispconfig manual , i am willing to buy also a billing manual if there is one, just so that i don t need to wait for answers when i really am in a hury ....
    plz help ...


    Thank you very much !!
     
    Last edited: Mar 12, 2014
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You seem to mix up invoices with html pages, the variables you posted above look like variables for the HTML template system. Invoices are PDF files, they are created with the fpdf libray in the make_pdf_invoice.php file in the invoice template folder. A extensive documentation on fpdf can be found here

    in the make_pdf_invoice.php file, you can find the invoice, client and company details in these arrays:

    $this->invoice
    $this->company
    $this->client
    $this->invoice_settings

    The make_pdf_invoice.php contans also a lot of comments that describe for what the code is for.

    you can download the billing manual here:

    http://www.ispconfig.org/page/en/addons/billing-module.html
     
  3. Amorphous

    Amorphous New Member

    Thanks Till,

    yes i meant the htm files, i have managed to modify now , from pay.php i have chnged the variables by adding also one line for the client name,

    $out['invoice_name'] = $invoice['contact_name'];
    $out['invoice_company_name'] = $invoice['company_name'];
    $out['invoice_street'] = $invoice['street'];
    $out['invoice_zip'] = $invoice['zip'];
    $out['invoice_state'] = $invoice['state'];
    $out['invoice_country'] = $invoice['country'];


    and .htm file now looks like this ...

    Name: {tmpl_var name='invoice_name'}<br />
    Company Name: {tmpl_var name='invoice_company_name'}<br />
    Address: {tmpl_var name='invoice_street'}<br />
    {tmpl_var name='invoice_zip'} {tmpl_var name='company_city'}<br />
    {tmpl_var name='invoice_state'}<br />
    {tmpl_var name='invoice_country'}<br />

    now i am trying to add a line, ( added in css the field)

    <div id="invoicedetails2">
    <b>Services :</b> {tmpl_var name='invoice_item_template'}<br />
    </div>

    how can i set this {tmpl_var name='invoice_item_template'} in pay.php to show me the template item that the client has to pay ?

    $out['invoice_item_template'] = $invoice['invoice_template'];

    how can i modify this $invoice['invoice_template']; so it will show me the template name of my client ??

    all the rest i will try to do it on my own :)
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The invoice item template is used to fill the invoice text field when you create / edit a invoice, but it is not connected to the invoice afterwards.
     
  5. Amorphous

    Amorphous New Member

    one last question, i allmost finished editing the htm template for pay.php.

    what i want exactly, is to be able to insert in the invoice created by pay.php

    and payments_pay.htm the values for the description of one template ....

    when i have added the item templates, all of them have these fields

    Type, Name an description ... and so on

    i am interested in importing Description in the pay.php generated invoice ...

    In the .pdf invoice, i have one field Description - where i can see the item`s description

    how can i import the same setting in payment_pay.htm an pay.php ??

    i have to make a variable like this :

    $out['description'] = $invoice['item_name'];


    and in the payment_pay.htm to be called my this setting:

    {tmpl_var name='description'}


    how to fill out these fields ? 'description' 'item_name' ??

    Thank you very much and sorry i misslead you earlier, this is what i intented to ask from the begininning :)
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    A invoice consists of a record in the "invoice" tabe, which holds the invoice data like address, payment method etc. The invoice items are stored in the invoice_item table, you cans elect them from there by invoice ID.
     
  7. Amorphous

    Amorphous New Member

    Thank you very much till i have managed to realize exactly what to do , i have tried to call from mysql the values that i need , it seems i have to learn a little more about this :)))

    no worries, i think i have managed to do something else, the harder way , but safer for me,
    i have implemented a <?php string for echo .... if else ..

    if {tmpl_var name='invoice_amount_formatted'} = some value ..... echo " message1"
    else if {tmpl_var name='invoice_amount_formatted'} = next value ... echo " message2"

    and so on .... i have only 8 templates should not be to much work :)) but at least i have the idea how to do it...

    caling string and values from mysql .... not my best owrk so far :)))

    Thanks again :)
     

Share This Page