A specific Template for each Invoice Family

duplicate
Tags: #<Tag:0x00007f8e0e59d690>

#1

Hello everybody.

I hope I can help you somehow. Since I am not a developer I can maybe share my ideas and templates (see my post into category “templates sharing”).
My first idea is about linking to each Invoice Family a different Invoice Template.
Why? Let’s make an example.
Let’s say I am a Hotel Manager… or Accounting Manager for a hotel.
I work both with consumer users and travel agencies (or tour operators).
At guest checkout, if the guest is a consumer user, I need to make a receipt for b2c. For this receipt I can only print the gross amount (or amounts). I do not need to particularize the tax rates (tax-rateS - plural - it not a typos).
On checkout when the guests have come to me through a travel agency (or tour operator) I need to issue an invoice for b2b to the travel agency. This is pretty different than the b2c receipt. Now I need to particularize for each service: net amount, tax rate, tax amount, gross amount… why not, even the discount for the travel agency. Each service has usually a different tax rate than the other services in the same invoice. The cost for the room has 10% tax rate. Laundry service has 22% tax rate. Room-frigobar has no tax rate but food and beverages taken at the hotel-restaurant have 10% tax rate.
Ok I do not want to bother you any longer.
I hope you find this subject will be interesting for you.

Thanks for you time

Kindest regards, gsolina


#2

Last Update: 19.12.2017


#3

Very good idea!

Here is another case scenario:
A small company in Poland is doing business with both domestic and foreign companies. All domestic invoices should be in Polish but the others should be in English. Two invoice families with a different template for each one would solve the problem :smile:


#4

Hello
Since I am not a developer and I just know a few things about PHP and MySQL, for the moment I realized one template for all purpose. I mean the template make a CASE for the Invoce-Grop-ID and print a different layout based on the Invoice-Group-ID.
This works but it is not really professional and the source code for the template is getting longer.
But it would be great to adding both specific PHP and Email templates for each Invoice-Group.
If anyone is a developer and like my idea… I am here.
Kindest regards
gsolina


#5

maybe you can resolve the problem of the language with a condition in template.

I’m not into the code of IP but I think there’s a variable to check and compare against customer language

Example:
IF customer is not from Poland THEN use english language ELSE use the default language.


#6

Good point @FooLab but in some countries there are some more mandatory fields on the invoice. Such fields are included in the template using custom fields ability of IP, but of course do not exist in translation variables so they will be displayed in the native language only, even if the rest of the invoice will be in English :frowning:


#7

you can create translations for that custom fields too!

the problem is that during a version update you will loose them.

You can create an extra poland and english translation files so they will not overwrite during update process.

here the request:


#8

Hi,

I somehow hacked this into invoicePlane, it’s a little of work, but it does the job. I amware that this isn’t the right ‘mvc’ way to do it, but I don’t really got hold of CodeIgniter and this app in particular…

First make sure every invoice number will start with a unique identifier per group.

In this example I used B2B and B2C invoices, which started with B or C respectively. (e.g. B02012016-1, or C02012016-1).

So you create invoice groups: B2B and B2C (or any other).

Now you create 2 templates, one for B2B and one for B2C.

Now create a third template file, name it invoice_switcher.php (or something like that)

Add the following code to this file:

<?php
    if(substr( $invoice->invoice_number, 0, 1 ) === "B")
        include ("B2B_template.php");
    elseif(substr( $invoice->invoice_number, 0, 1 ) === "C")
        include ("B2C_template.php");
    else
        include ("InvoicePlane.php");
?>

You could also check for $invoice->invoice_group_id, but I thought this was more clear and easier in this case.

Now in your systemsettings, under invoices change default pdf template to invoice_switcher.

This is it, now your B2B invoices take the B2B_template and B2C takes the B2C_template, all other normal invoices will take the default IP template.

Cheers,
Kreekhoorn


Use different Quote template per Invoice group
Associate template to client
Mehrere Templates für Rechnungen nutzen?
Select invoice template programmatically
#9

I have just added a pull request for this feature since it soves a lot of problems in my company.


#10

Should the translation for custom field be done by the custom_variables? I tried but still see the name I created on the editing invoice the custom field.

My current language is Traditional Chinese and I create the custom field name in English as I assume the IP will take the name as the custom field id, is that correct or I should create it with my language and make custom translation on English translation file?

Best regards,

Kelvin


#11

I can see it here:

Is there any reason why this is not been implemented?


#12

Hi kreekhoorn Apologies for a reply to such an old thread, but do you happen to know if this still works?

I’ve just tried it and can’t seem to get it to work for me.


#14

Hi juanfernandes,

I haven’t used invoiceplane in a while (I think I haven’t used it for two years).

I don’t know how much change there has been, but I think the concept still works. Could you explain what doesn’t work and what the output / debug messages are?

Kreekhoorn


#15

Further discussion see here: Selectable PDF template for customer, quote, invoice, group


closed #16