Skip to main content

Templates

Introduction

Templates allow you to create customized designs and documents using raw data. We have a prebuilt range of templates that will allow you to quickly create Statements / Payment Receipts / Payment Refund Receipts and Delivery Notes, but the functionality does not stop there.

You can also run a templates against any entity within the application and have a PDF returned the the entities dataset embedded in. Here is an example of a template which has been produced from a Project:

alt text

When run against our project template, we receive a PDF like this:

alt text

In our template we have constructed (use the Twig templating engine) a document which contain the projects details and a summary of each task time log entry.

Getting Started

Delivery Note Example

Concepts

Templates are simple Html / CSS documents combined with the super powerful twig templating engine.

This combined with the raw data from Invoice Ninja allows you to create a document that exactly fits your requirements. To start, simply create a new template in

Settings / Invoice Design / Custom Designs

alt text

You will see that along with providing a name for the design/template, there is a new selector which allows you to choose whether the design is a regular design (ie for invoices / quotes) or a template which can also be a custom design, but also includes the power twig syntax and data to create bespoke templates.

After selecting the template option, a series of checkboxes will appear where you can associate the data types with the template. This is an important step as it allows us to provide the menu options for this template in the correct location and also provides the correct context when running the template;

for example, if you select the invoice checkbox, the system will be able to prepare your invoice/s to be run through the template. You can select multiple options here and the system will ensure this data is prepared and ready for use in the template.

How did we construct this? Lets take a look at a template sample:

alt text

Embedded in the html/css is a dedicated set of <ninja></ninja> tags, this tells the template engine that we are now using the Twig Templating system.

alt text

Templates always assume that the data being processed in an array of objects. In this particular case, we have an array of projects. If your template will only ever consider a single project then you'll want to harvest the first project in your array of projects using this syntax:

{% if projects %}
{% set project = projects|first %}

Now that we have the project object, we can use this in our template, to print a variable to the template, you would wrap the variable in {{ }} like this:

<h1>{{ project.name }}</h1>
<h3>Due: {{ project.due_date }}</h3>
<h6>{{ project.current_hours }} / {{ project.budgeted_hours }}: (Hours / Budgeted Hours @ {{ project.task_rate }}) - Report generated on {{ "now"|date('Y-m-d') }}</h6>

We've now started to introduce variables into our template and also some nifty twig formats for dynamic data such as a date using this following syntax to present when the report was generated

Report generated on {{ "now"|date('Y-m-d') }}

Lets now loop through the project tasks and output the time_log data with the following sequence

{% for task in project.tasks %}

{% for log in task.time_log %}

<tr>
<td>{{ log.start_date }}</td>
<td>
<div>
<ul>
<li>{{ log.description }}</li>
<li>{{ task.user.name }}</li>
</ul>

</td>
<td>{{ log.duration|date('h:i:s')}}</td>
</tr>
{% endfor %}

{% endfor %}

Here we have created a for loop, iterating over every task in the project, this follows with another for loop where we loop over every time_log entry in each task where we output the dates / description and duration of each task.

Finally, we are able to transform the log.duration (seconds), into a date format with h:i:s format (Hours:Minutes:Seconds)

Using blocks in templates

If you wish to use standard company/client/vendor details, this is super simple using standard div blocks:

<div id="client-details">

<div id="company-details">

<div id="company-address">

<div id="vendor-details">

<div id="shipping-address">

These will populate using the data stored in Settings > Invoice Designs for each block.

Data Access

Twig variables

Accessing data using twig would be as follows:

First we'd check to ensure the variable is available

{% if tasks|e %}
{% endif %}

Then we can iterate

{% if tasks|e %}

{% for task in tasks %}
{% endfor %}

{% endif %}

Accessing data is done using dot notation, for example retrieving the client name of a tasks project would be as follows:

{{ task.project.client.name }}

Invoice Ninja variables

Standard $ notation variables are also available within templates, this allows you to use familiar variables such as $invoice.amount - you can also combine twig and ninja variables like this to integrate conditionals into your template. ie


{% if invoice.balance > 0 %}
$invoice.balance is payable!
{% else %}
Invoice has been paid! Thanks!
{% endif %}

Allowed Tags

  • if
  • for
  • set
  • filter

Allowed Filters

  • escape
  • e
  • upper
  • lower
  • capitalize
  • filter
  • length
  • merge
  • format_currency
  • format_number
  • format_percent_number
  • map
  • join
  • first
  • date
  • sum
  • nl2br
  • reduce

Allowed Functions

  • range
  • cycle
  • constant
  • date

Allowed Properties

  • type_id

Allowed Methods

  • img
  • t

Statements

Statements are special objects in templates. Because the input data point is a client/s we need additional information to understand whether a template is a "statement" template or not.

When creating custom statements, you will want to insert a comment within the template so that the system can resolve that it is a statement for processing

<!doctype html>
<!-- Statement - TemplateID #TS4 ##statement##-->
<html>
<head>

Note the special text

##statement##

This will allow the system to resolve a custom statement.

Object Json Definitions

Here are the object definitions that are available.

Invoice

{
"invoices": [
{
"amount": "$6,606.30",
"balance": "$6,606.30",
"status_id": 2,
"status": "Sent",
"amount_raw": "6606.300000",
"balance_raw": "6606.300000",
"number": "0001",
"discount": "6.000000",
"po_number": "Unde.",
"date": "25. March 2024",
"last_sent_date": "",
"next_send_date": "",
"due_date": "",
"terms": "Default company invoice terms",
"public_notes": "",
"private_notes": "",
"uses_inclusive_taxes": false,
"tax_name1": "GST",
"tax_rate1": 10,
"tax_name2": "VAT",
"tax_rate2": 17.5,
"tax_name3": "THIRDTAX",
"tax_rate3": 5,
"total_taxes": "$1,905.44",
"total_taxes_raw": "1905.440000",
"is_amount_discount": false,
"footer": "Default invoice footer",
"partial": "0.000000",
"partial_due_date": "",
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"custom_surcharge1": 0,
"custom_surcharge2": 0,
"custom_surcharge3": 0,
"custom_surcharge4": 0,
"exchange_rate": 1,
"custom_surcharge_tax1": false,
"custom_surcharge_tax2": false,
"custom_surcharge_tax3": false,
"custom_surcharge_tax4": false,
"reminder1_sent": "",
"reminder2_sent": "",
"reminder3_sent": "",
"reminder_last_sent": "",
"paid_to_date": "$0.00",
"auto_bill_enabled": false,
"line_items": [
{
"quantity": 1,
"cost": "$372.00",
"product_key": "Ut in.",
"notes": "Architecto at est.",
"discount": 0,
"is_amount_discount": false,
"tax_name1": "Sales Tax",
"tax_rate1": 5,
"tax_name2": "",
"tax_rate2": 0,
"tax_name3": "",
"tax_rate3": 0,
"sort_id": "0",
"line_total": "$372.00",
"gross_line_total": "$389.48",
"custom_value1": "https://picsum.photos/200",
"custom_value2": "75",
"custom_value3": "Nulla est incidunt.",
"custom_value4": "Consequatur in.",
"type_id": "1",
"product_cost": "$0.00",
"tax_amount": "$17.48",
"date": "",
"tax_id": "1",
"task_id": "",
"expense_id": "",
"_id": "358982ee-f062-42f3-9dcf-4068e9347fa0",
"cost_raw": 372,
"discount_raw": 0,
"line_total_raw": "372.00",
"gross_line_total_raw": 389.48,
"tax_amount_raw": 17.48,
"product_cost_raw": 0,
"task": {
"number": "0007",
"description": "The task description",
"duration": 726023,
"rate": "$0.00",
"rate_raw": "0.000000",
"created_at": "21. March 2024",
"updated_at": "27. March 2024",
"date": "21. March 2024",
"project": {
"name": "Date App",
"number": "0006",
"created_at": "22. March 2024",
"updated_at": "22. March 2024",
"task_rate": "$0.00",
"task_rate_raw": "0.000000",
"due_date": "",
"private_notes": "",
"public_notes": "",
"budgeted_hours": 1200,
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"color": "",
"current_hours": 0,
"client": {
"name": "Kilback-Stoltenberg",
"balance": "0.000000",
"payment_balance": "0.000000",
"credit_balance": "2084.140000",
"vat_number": "428950405",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
},
"user": {
"name": "Glennie Schaefer Dr. Corbin Rowe",
"email": "small@example.com"
}
},
"time_log": [
{
"start_date_raw": 1711012404,
"start_date": "20. March 2024 22:13:24",
"end_date_raw": 1711095351,
"end_date": "21. March 2024 21:15:51",
"description": "Consequatur voluptas aperiam sapiente optio non dolores quaerat.",
"billable": true,
"duration_raw": 82947,
"duration": "23:02:27"
},
{
"start_date_raw": 1711095651,
"start_date": "21. March 2024 21:20:51",
"end_date_raw": 1711149254,
"end_date": "22. March 2024 12:14:14",
"description": "Aut iusto ducimus molestiae reprehenderit fugiat cum.",
"billable": true,
"duration_raw": 53603,
"duration": "14:53:23"
},
],
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"status": "Ready to do",
"user": {
"name": "Glennie Schaefer Dr. Corbin Rowe",
"email": "small@example.com"
},
"client": {
"name": "Kilback-Stoltenberg",
"balance": "0.000000",
"payment_balance": "0.000000",
"credit_balance": "2084.140000",
"vat_number": "428950405",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
}
}
},
{
"quantity": 1,
"cost": "$73.00",
"product_key": "Non.",
"notes": "Aut sunt totam.",
"discount": 0,
"is_amount_discount": false,
"tax_name1": "Sales Tax",
"tax_rate1": 5,
"tax_name2": "",
"tax_rate2": 0,
"tax_name3": "",
"tax_rate3": 0,
"sort_id": "0",
"line_total": "$73.00",
"gross_line_total": "$76.43",
"custom_value1": "https://picsum.photos/200",
"custom_value2": "29",
"custom_value3": "Accusamus quo.",
"custom_value4": "Qui similique culpa.",
"type_id": "1",
"product_cost": "$0.00",
"tax_amount": "$3.43",
"date": "",
"tax_id": "1",
"task_id": "",
"expense_id": "",
"_id": "013efb0f-5f11-45fc-b404-20427fb0e2a0",
"cost_raw": 73,
"discount_raw": 0,
"line_total_raw": "73.00",
"gross_line_total_raw": 76.43,
"tax_amount_raw": 3.43,
"product_cost_raw": 0
},
],

"client": {
"name": "Kub, Koepp and Conroy",
"balance": "6606.300000",
"payment_balance": "0.000000",
"credit_balance": "0.000000",
"vat_number": "373145743",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
},
"payments": [
{
"status": "Refunded",
"badge": "<h6><span class=\"badge badge-primary\">Refunded<\/span><\/h6>",
"amount": "$104.95",
"applied": "$104.95",
"balance": "-$104.95",
"refunded": "$104.95",
"amount_raw": "104.950000",
"applied_raw": "104.950000",
"refunded_raw": "104.950000",
"balance_raw": -104.95,
"date": "24. March 2024",
"method": "",
"currency": "USD",
"exchange_rate": 1,
"transaction_reference": null,
"is_manual": 1,
"number": "0003",
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"created_at": "25. March 2024",
"updated_at": "25. March 2024",
"refund_activity": ["24. March 2024 Invoice #0029 $104.95 Refunded"],
"client": {
"name": "cypress",
"balance": "0.000000",
"payment_balance": "333.000000",
"credit_balance": "0.000000",
"vat_number": "561724719",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
},
"paymentables": [
{
"invoice": "0029",
"amount_raw": "104.9500",
"refunded_raw": "104.9500",
"net_raw": 0,
"amount": "$104.95",
"refunded": "$104.95",
"net": "$0.00",
"is_credit": false,
"date": "24. March 2024",
"created_at": "25. March 2024",
"updated_at": "25. March 2024",
"timestamp": 1711329333
}
],
}
],
"total_tax_map": [
{
"name": "GST 10%",
"total": 470.09
},
{
"name": "VAT 17.5%",
"total": 822.65
},
{
"name": "THIRDTAX 5%",
"total": 235.04
}
],
"line_tax_map": [
{
"name": "Sales Tax 5%",
"total": 124.72999999999999
},
{
"name": "VAT 17.5%",
"total": 117.95
},
{
"name": "GST 10%",
"total": 134.98
}
]
}
]
}

Payment

{
"payments": [
{
"status": "Completed",
"badge": "<h6><span class=\"badge badge-info\">Completed<\/span><\/h6>",
"amount": "$6,723.74",
"applied": "$6,723.74",
"balance": "$0.00",
"refunded": "$0.00",
"amount_raw": "6723.740000",
"applied_raw": "6723.740000",
"refunded_raw": "0.000000",
"balance_raw": 0,
"date": "22. March 2024",
"method": "",
"currency": "USD",
"exchange_rate": 1,
"transaction_reference": "Manual entry",
"is_manual": 1,
"number": "0002",
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"created_at": "22. March 2024",
"updated_at": "22. March 2024",
"client": {
"name": "Kilback-Stoltenberg",
"balance": "0.000000",
"payment_balance": "0.000000",
"credit_balance": "2084.140000",
"vat_number": "428950405",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
},
"paymentables": [],
"refund_activity": []
}
]
}

Task

{
"tasks": [
{
"number": "0007",
"description": "The task description",
"duration": 726023,
"rate": "$0.00",
"rate_raw": "0.000000",
"created_at": "21. March 2024",
"updated_at": "27. March 2024",
"date": "21. March 2024",
"project": {
"name": "Date App",
"number": "0006",
"created_at": "22. March 2024",
"updated_at": "22. March 2024",
"task_rate": "$0.00",
"task_rate_raw": "0.000000",
"due_date": "",
"private_notes": "",
"public_notes": "",
"budgeted_hours": 1200,
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"color": "",
"current_hours": 0,
"tasks": [],
"client": {
"name": "Kilback-Stoltenberg",
"balance": "0.000000",
"payment_balance": "0.000000",
"credit_balance": "2084.140000",
"vat_number": "428950405",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
},
"user": {
"name": "Glennie Schaefer Dr. Corbin Rowe",
"email": "small@example.com"
}
},
"time_log": [
{
"start_date_raw": 1711012404,
"start_date": "20. March 2024 22:13:24",
"end_date_raw": 1711095351,
"end_date": "21. March 2024 21:15:51",
"description": "Consequatur voluptas aperiam sapiente optio non dolores quaerat.",
"billable": true,
"duration_raw": 82947,
"duration": "23:02:27"
},
{
"start_date_raw": 1711095651,
"start_date": "21. March 2024 21:20:51",
"end_date_raw": 1711149254,
"end_date": "22. March 2024 12:14:14",
"description": "Aut iusto ducimus molestiae reprehenderit fugiat cum.",
"billable": true,
"duration_raw": 53603,
"duration": "14:53:23"
},
],
"custom_value1": "",
"custom_value2": "",
"custom_value3": "",
"custom_value4": "",
"status": "Ready to do",
"user": {
"name": "Glennie Schaefer Dr. Corbin Rowe",
"email": "small@example.com"
},
"client": {
"name": "Kilback-Stoltenberg",
"balance": "0.000000",
"payment_balance": "0.000000",
"credit_balance": "2084.140000",
"vat_number": "428950405",
"address1": "5 Wallaby Way",
"address2": "Apt 1",
"phone": "555 123-1321",
"city": "Sydney",
"state": "NSW",
"postal_code": "2113",
"country_id": "840",
"group": "Special Orders",
"location": {
"location_name": "Billy",
"address": "44 Nice Street<br/>Apt 5<br/>Nicest City, Best State 90210<br/>United States<br/>",
"address1": "44 Nice Street",
"address2": "Apt 5",
"city": "Nicest City",
"state": "Best State",
"postal_code": "90210",
"country": "USA"
}
}
}
]
}

Definitions

Invoice / Quote / Credit / Purchase Order Definition

FieldDescriptionExample
amountformatted currency$6,606.30
balanceformatted currency$6,606.30
status_idinteger representation of the status2
statustext representation of invoice statusSent
amount_rawfloat6606.300000
balance_rawfloat6606.300000
numberinvoice number0001
discountfloat6.000000
po_numberstringUnde.
datestring25. March 2024
last_sent_datestring25. March 2024
next_send_datestring25. March 2024
due_datestring25. March 2024
termsstringDefault company invoice terms
public_notesstringPublic Notes
private_notesstringPrivate notes
uses_inclusive_taxesbooleanfalse
tax_name1stringGST
tax_rate1float1
tax_name2stringVAT
tax_rate2float17.
tax_name3stringTHIRDTAX
tax_rate3float0
total_taxesformatted currency$1,905.44
total_taxes_rawfloat1905.440000
is_amount_discountboolfalse
footerstringDefault invoice footer
partialfloat0.000000
partial_due_datestring24/1/2024
custom_value1stringCustom Value
custom_value2stringCustom Value
custom_value3stringCustom Value
custom_value4stringCustom Value
custom_surcharge1float0
custom_surcharge2float0
custom_surcharge3float0
custom_surcharge4float0
exchange_ratefloat1
custom_surcharge_tax1booleanfalse
custom_surcharge_tax2booleanfalse
custom_surcharge_tax3booleanfalse
custom_surcharge_tax4booleanfalse
reminder1_sentstring25. March 2024
reminder2_sentstring25. March 2024
reminder3_sentstring25. March 2024
reminder_last_sentstring25. March 2024
paid_to_dateformatted currency$0.00
auto_bill_enabledbooleamfalse
line_itemsarrayLine items
clientobjectClient
paymentsarrayPayment
total_tax_maparrayTax Map
line_tax_maparrayTax Map

Line items definition

FieldDescriptionExample
quantityfloat1
costformatted currency$372.00
product_keystringUt in.
notesstringArchitecto at est.
discountfloat0
is_amount_discountbooleanfalse
tax_name1stringSales Tax
tax_rate1float5
tax_name2string
tax_rate2float0
tax_name3string
tax_rate3float0
sort_idfloat0
line_totalformatted currency$372.00
gross_line_totalformatted currency$389.48
custom_value1stringhttps://picsum.photos/200
custom_value2string75
custom_value3stringNulla est incidunt.
custom_value4stringConsequatur in.
type_idstring1
product_costformatted currency$0.00
tax_amountformatted currency$17.48
datestring24/1/2023
tax_idstring1
task_idstring
taskobjectTask
expense_idstring
_idstring358982ee-f062-42f3-9dcf-4068e9347fa0
cost_rawfloat372
net_coststring$372.00
net_cost_rawfloat372.00
discount_rawfloat0
line_total_rawfloat372.00
gross_line_total_rawfloat389.48
tax_amount_rawfloat17.48
product_cost_rawfloat0

Tax map definition

FieldDescriptionExample
namestringGST 10%
totalfloat470.09

Payment definition

FieldDescriptionExample
statusstringRefunded
badgestringRefunded
amountformatted currency$104.95
appliedformatted currency$104.95
balanceformatted currency-$104.95
refundedformatted currency$104.95
amount_rawfloat104.950000
applied_rawfloat104.950000
refunded_rawfloat104.950000
balance_rawfloat-104.95
datestring24. March 2024
methodstringVisa
currencystringUSD
exchange_ratefloat1
transaction_referencestring2sd2fv34
is_manualboolean1
numberstring0003
custom_value1stringCustom Value
custom_value2stringCustom Value
custom_value3stringCustom Value
custom_value4stringCustom Value
created_atstring25. March 2024
updated_atstring25. March 2024
refund_activityarray of string[24. March 2024 Invoice #0029 $104.95 Refunded]
paymentablesarrayPaymentables
clientobjectClient

Paymentables definition

FieldDescriptionExample
invoicestring0029
amount_rawfloat104.9500
refunded_rawfloat104.9500
net_rawfloat0
amountformatted currency$104.95
refundedformatted currency$104.95
netformatted currency$0.00
is_creditbooleanfalse
datestring24. March 2024
created_atstring25. March 2024
updated_atstring25. March 2024
timestampunix timestamp171132933

Task Definition

FieldDescriptionExample
numberTask number0007
descriptionTask DescriptionService for bob
durationDuration of task in seconds72602
rateTask rate currency formatted$0.00
rate_rawTask rate raw float0.000000
created_atDate task created21. March 2024
updated_atDate task updated27. March 2024
dateDate of task21. March 2024
custom_value1Task Custom Value 1Custom Value
custom_value2Task Custom Value 2Custom Value
custom_value3Task Custom Value 3Custom Value
custom_value4Task Custom Value 4Custom Value
statusThe task statusReady to do
userThe Creating User ObjectSee User Property definition
clientThe Client ObjectSee Client Property definition
projectThe Client ObjectSee Client Property definition
time_logArray of time log entriesSee time_log definition

Expense Definition

FieldDescriptionExample
categoryThe expense categoryTravel
amountThe expense amount$100.00
amount_rawThe expense amount raw100.00
dateThe expense date24. March 2024
private_notesThe expense private notesPrivate notes
public_notesThe expense public notesPublic notes
exchange_rateThe expense exchange rate1.00
tax_name1The expense tax name 1GST
tax_rate1The expense tax rate 110
tax_name2The expense tax name 2VAT
tax_rate2The expense tax rate 217
tax_name3The expense tax name 3THIRDTAX
tax_rate3The expense tax rate 30
tax_amount1The expense tax amount 1$10.00
tax_amount2The expense tax amount 2$17.00
tax_amount3The expense tax amount 3$0.00
payment_dateThe expense payment date24. March 2024
transaction_referenceThe expense transaction reference1234567890
custom_value1The expense custom value 1Custom Value
custom_value2The expense custom value 2Custom Value
custom_value3The expense custom value 3Custom Value
custom_value4The expense custom value 4Custom Value
calculate_tax_by_amountThe expense calculate tax by amounttrue
uses_inclusive_taxesThe expense uses inclusive taxestrue
clientThe expense clientClient
vendorThe expense vendorVendor
projectThe expense projectProject

Vendor Definition

FieldDescriptionExample
nameThe vendor nameVendor Name
emailThe vendor emailvendor@example.com
phoneThe vendor phone1234567890
websiteThe vendor websitehttps://www.vendor.com
numberThe vendor number1234567890
id_numberThe vendor id number1234567890
vat_numberThe vendor vat number1234567890
currencyThe vendor currencyUSD
custom_value1The vendor custom value 1Custom Value
custom_value2The vendor custom value 2Custom Value
custom_value3The vendor custom value 3Custom Value
custom_value4The vendor custom value 4Custom Value
addressThe vendor address1234 Main St, Anytown, USA
shipping_addressThe vendor shipping address1234 Main St, Anytown, USA
localeThe vendor localeen

Time Log Definition

Time Log Array (of objects)
start_date_rawunix timestamp1711095651
start_dateFormatted start date21. March 2024 21:20:51
end_date_rawunix timestamp1711149254
end_dateFormatted start date22. March 2024 12:14:14
descriptionThe task item descriptionAut iusto ducimus molestiae reprehenderit fugiat cum
billableboolean - defines if this time entry is billabletrue
duration_rawseconds - raw duration of entry53603
durationformatted duration14:53:23

User Definition

Creating User Object
nameThe users nameBob Jane
emailThe users emailbob@gmail.com

Client Definition

Client Object
nameThe full client nameKilback-Stoltenberg
balanceThe client balance0.000000
payment_balanceThe client payment balance0.000000
credit_balanceThje client credit balance2084.140000
vat_numberThe client VAT Number428950405
currencyThe client currency codeUSD
localeThe client localeen
address1The first line of the billing address5 Wallaby Way
address2The second line of the billing addressApt 1
cityThe citySydney
stateThe state or provinceNSW
postal_codeThe postal or zip code2113
country_idThe country ID840
groupThe client group nameSpecial Orders
locationThe client location objectLocation
phoneThe client phone number555 123-1321
addressThe formatted billing address1 Wallaby Way, Sydney
shipping_addressThe formatted shipping address2 Wallaby Way, Sydney
custom_value1The first client custom valueBob
custom_value2The second client custom valueBlue
custom_value3The third client custom valueBatman
custom_value4The fourth client custom valuePistachio

Location Definition

Location Object
location_nameThe location nameBilly
addressThe formatted location address with HTML line breaks44 Nice Street
Apt 5
Nicest City, Best State 90210
United States
address1The first line of the location address44 Nice Street
address2The second line of the location addressApt 5
cityThe cityNicest City
stateThe state or provinceBest State
postal_codeThe postal or zip code90210
countryThe country nameUSA

Project Definition

Project Object
nameThe project nameDate App
numberThe project number0006
created_atDate created22. March 2024
updated_atDate updated22. March 2024
task_rateTask Rate for project (formatted in currency)$0.00
task_rate_rawTask rate for project - float format0.000000
due_dateThe due date for the project22. March 2025
private_notesThe private notes of the projectPrivate notes
public_notesThe public notes of the projectPublic notes
budgeted_hoursThe number of hours budgeted for the project200
custom_value1Project Custom Value 1Custom Value
custom_value2Project Custom Value 2Custom Value
custom_value3Project Custom Value 3Custom Value
custom_value4Project Custom Value 4Custom Value
colorThe color associated with the project#fff
current_hoursThe accured hours of the project so far100
tasksArray of tasksTask
expensesArray of expensesExpense
userThe Creating User ObjectUser
clientThe Client ObjectClient

Sample Templates

Statements

NameDescriptionPreview
TS1Plain StatementDownload
TS2Color StatementDownload
TS3Vertical StatementDownload
TS4Logo StatementDownload

Delivery Notes

NameDescriptionPreview
TD43 ColumnDownload
TD52 Column / FooterDownload
TD122 ColumnDownload
TD132 Column MonoDownload

Payment Receipts

NameDescriptionPreview
TP6StandardDownload
TP7HorizontalDownload

Refund Receipts

NameDescriptionPreview
TR8HorizontalDownload
TR9StandardDownload

Project/Tasks

NameDescriptionPreview
TP11Project OutlineDownload
TT10TaskDownload

Snippets

Here are some quick and easy snippets you can use in your templates/designs

Display payments table on an invoice

<ninja>
{% if invoices %}
{% set invoice = invoices|first %}
<div>
<table>
{% if invoice.payments is not empty %}
<tr><td>Date</td><td>Amount</td></tr>
{% for payment in invoice.payments %}
<tr>
<td>{{ payment.date }}</td>
<td>{{ payment.amount }}</td>
</tr>

{% endfor %}
</table>
{% endif %}

{% endif %}
</ninja>