New invoice template

Hi,

I want to create a new invoice template without to change the older 4. I copied bold.js to new_template.js but I cant see the new template under WEB GUI. Can you help me please.

Thanks

The easiest solution is to use the UI and save your changes as the custom template.

If you’d like to add a file to storage/templates you’ll also need to add a matching record to the invoice_designs table and then clear the cache by adding ?clear_cache=true to the end of the URL.

Thank you very match for your support.

I’m working on custom invoice template now und have some questions:

  1. The german translation of ‘due_date’ => ‘Fällig am’ is right but it displays wrong on invoce: “Fällig Am”. How can I make “Fällig am”?
  2. The variable $clientDetails schows:

MyFirma
Prager Str. 55
Berlin, 10709
info@exampe.com

one normaly writes an address in germany as:

MyFirma
Prager Str. 55
10709 Berlin

What are single variable of these fields?

Thanks

  1. This will be corrected in the next release. To fix this change the call to ‘uctrans’ to ‘trans’ towards the end of the getInvoiceLabels function in app/Models/Account.php

  2. You can access most variables using dot notation with “Value” at the end. For example, $invoiceNumberValue or $account.address1Value. You’ll need to use the database table schema as a guide for available fields, we’re working on documentation.

Excellent! It works.
My invoice template is almost ready. I still have one problem. In germany one have to show a period of Service on the bill.
Example: period of Service: March 2015
How can I get a variable (March 2015) date(‘F Y’); if the invoice was created in March 2015?

Thanks

Date variables aren’t currently supported. You’d have to add it manually, for example in the ‘note to client’ section.

Hello,

I was able to create a beatiful invoice template. Pdfmake is a nice tools for that purpose.
I also would like to thank you for greate support. This project is very promising.

Bye

johann8, how did you manage the problem with the PLZ variables (I live in Austria and have the same problem) - could you post the corresponding part of your template here?

Oh, and “period of service” is also a needed item in Austria. Hillel, should I open a bug report (feature request) for this one?

And for the template part - wouldn’t it be easy to add a “clone” button to the /company/advanced_settings/customize_design page where you can easily clone a design that “nearly” fits?
This would ask for a new name, and create that storage/templates/$name.js file, and the corresponding db entries?
(Another issue/feature request?)

Thanks,
Christian

Hallo Christian,

mein englisch ist schlecht, deshalb antworte ich in auf deutsch. Hoffentlich wird der Moderator nicht böse sein. Auf die Empfwhlung von Hillel habe ich die einzelne Variable aus der Datenbank genommen. Untet ist der Code:

"columns": [
  {
    "text": [
      "$client.nameValue",
      "\n",
      "$client.address1Value",
      "\n",
      "$client.postal_codeValue",
      " ",
      "$client.cityValue"
    ],
    "fontSize": 11,
    "margin": [
      0,
      -3,
      0,
      90
    ]
  },

Für den Leistungszeitraum habe ich eine temporäre Lösung und zwar: Unter client-Einstellungen gibt es ein Feld Notizen. Dort habe ich einfach geschrieben “August 2015”. Das Feld in der Datenbank heisst client.private_notesValue. Der Code für diesen Abschnitt:

{
“text”: [
“Leistungszeitraum:”,
" ",
{
“text”: “$client.private_notesValue”,
“bold”: true
},
“\n”,
“Zahlungsweise:”,
" ",
{
“text”: “Banküberweisung”,
“bold”: true
}
],
“bold”: false,
“margin”: [
0,
0,
0,
5
]
},

Grüße Johann

Danke!

Does somebody know how to add items to an existing invoice without creating a new one ?
I use the php sdk wrapper.
it always makes a new one.

$client = Client::(20);
$client->createInvoice();
addInvoice($client, $price, $checkout);
////
////
function addInvoice($client, $price, $checkout){
$invoice = $client->createInvoice();
$invoice->addInvoiceItem(‘ITEM’, ‘RestaurantAPP’, $price);
$invoice->due_date = $checkout;
$invoice->save();

}

You need to load an existing invoice, it looks like you’re always calling creatInvoice.

“You need to load an existing invoice, it looks like you’re always calling creatInvoice.”

How do you do that is there any template code ?

$invoice = Invoice::find(1);

thats the client_id that you gave in the ‘find’ function right?

No, it’s the invoice id.

But when i give this code he gives this error?

$invoice = Invoice::find(21);
$invoice->addInvoiceItem(‘ITEM’, 'HotelReservatie ', 16);

$invoice->save();

Fatal error: Uncaught Exception: <!DOCTYPE html> <html> <head> <meta charset=“UTF-8” /> <meta http-equiv=“refresh” content=“1;url=http://localhost/ninja/public” /> <title>Redirecting to http://localhost/ninja/public</title> </head> <body> Redirecting to http://localhost/ninja/public. </body> </html> in C:\xamp3\htdocs\ninja\vendor\invoiceninja\sdk-php\src\InvoiceNinja\Models\AbstractModel.php:165 Stack trace: #0 C:\xamp3\htdocs\ninja\vendor\invoiceninja\sdk-php\src\InvoiceNinja\Models\AbstractModel.php(37): InvoiceNinja\Models\AbstractModel::sendRequest(‘localhost/ninja…’) #1 C:\xamp3\htdocs\ninja\test.php(13): InvoiceNinja\Models\AbstractModel::find(‘21’) #2 {main} thrown in C:\xamp3\htdocs\ninja\vendor\invoiceninja\sdk-php\src\InvoiceNinja\Models\AbstractModel.php on line 165

Are there any details in the app’s error log in storage/logs/laravel-error.log

nothing but isnt there any example of an creating an invoice with an existing client_id