1. Home
  2. Reports
  3. Report Template Definition

Report Template Definition

A report template is an HTML document with additional mark-up, specific to CostMiner. Writing new report forms or making significant changes to the standard ones requires some knowledge of the HTML standard. You do not need to have deep understanding of the technology to make small changes to the existing templates, though. Any changes in the template are instantly reflected in the preview on the right-hand side, which makes it easier to make adjustments.

The data that can be potentially used in the report is loaded into a model. The model has fields. Some fields are numbers and text, while other can be models themselves. For instance, for a job, Total is a numeric field, and Customer is another model that has fields containing the information about the customer.

You control how the data from the model is inserted in the template by placing commands in the text of the template. The commands are enclosed in double braces. For instance, {{ TaxRate * 100 }} will produce 12 in the final HTML if TaxRate = 0.12.

Commands

SyntaxDescriptionExample
{{ expression }}Outputs the expression. The expression can use the fields in the current model.{{ TaxRate * 100 }}
{{ if expression }}
content
{{ /if }}
For expressions with a logical result (yes/no or true/false), outputs the content if the result of the expression is ‘true’. Otherwise, the content is skipped. For expressions with non-logical result, outputs the content if the result of the expression is not blank. Content can have nested commands in it.{{ if Tax <> 0 }}
The invoice includes tax.
{{ /if }}
{{ if Tax = 0 }}
No tax will be charged.
{{ /if }}{{ if SiteAddress }}
An address was provided.
{{ /if }}
{{ with expression }}
content
{{ /if }}
Outputs the content replacing the current model with model provided by expression. If the expression result is blank, the content is skipped.{{ with Customer.PostalAddress }}
Customer Location:
  {{ City }}, {{ State }}.
{{ /with }}
{{ each expression }}
content
{{ /if }}
Outputs the content for each item in the list provided by expression. If the expression result is blank, the content is skipped. The model used with the content is the current item.{{ each AllItems }}
<tr>
  <td>
    {{ Description }}
  </td>
  <td>
    {{ Total }}
  </td>
</tr>
{{ /each }}

Expressions

The expressions can use the following operations.

OperationPriorityDescriptionExample
()1Control the order of calculation.Total * (1 + TaxRate)
NOT1True if the argument is false or blank, false otherwise.NOT (ReportType=”QuoteBeforeJobMarkup”)
NOT Customer
.1Allows accessing a nested field.Customer.PostalAddress.Street1
 ,/2Regular arithmetic operationsTaxRate * 100
+3Regular arithmetic operationsTotal + Tax
AND4True if both arguments are true, false otherwiseHasTax AND NOT TaxExclusive
OR5True if either argument is true, false otherwise.NOT HasTax OR TaxExclusive
?5Equals to the second argument if the first argument is true, equals to the third argument otherwise.ReportType=”QuoteBeforeJobMarkup” ?
   TotalBeforeJobMarkup : TotalWithTax

Models

Quote/Invoice Report

This model represents the Quote and Invoice reports has the following fields.

FieldType and formatDescription
AllNodesList of Item/Heading ModelsThe list of all headings and items in the estimate.
BusinessEntity ModelThe details of the current business space.
CompletionDateDateThe job completion date.
CustomerEntity ModelThe job customer.
DescriptionTextThe job description.
DocumentDateDateThe document date.
DocumentNumberTextThe document number.
HasCodesTrue/falseTrue if at least one item in the estimate has a code, false otherwise. This field can be used to hide the Code column from the report if it is going to be redundant.
HasTaxTrue/falseTrue if tax is configured, false otherwise.
LogoTextData URL for the logo. Can be used as the value for the src attribute of the image tag in HTML.
MaxOutlineLevelNumberThe number of levels in the estimate.
ReportTypeTextHas one of the following values, depending on the type of the report:QuoteQuoteBeforeJobMarkupInvoice
SiteAddressAddress ModelThe job site address.
StartDateDateThe job start date.
TaxNameTextThe name of the sales tax configured in the business settings, such as ‘VAT’, ‘GST’ or ‘Sales Tax’.
TaxMoneyThe tax calculated for the total. If the total is exclusive of tax, the tax is calculated on top of the total. If it is inclusive, the tax is part of the total.
TaxExclusiveTrue/falseTrue if the total is exclusive of tax, false otherwise.
TaxRateNumberThe rate for the sales tax configured in the business settings. For instance, 0.12 = 12%.
TopNodesList of Item/Heading ModelsThe list of headings and items on the first level of the estomate.
TotalMoneyThe job total with the job mark-up applied.
TotalBeforeJobMarkupMoneyThe job total without the job mark-up applied.
TotalWithTaxMoneyThe total including tax. If the total is exclusive of tax, the field equals to Total + Tax. If it is inclusive, the field equals Total.

Item or Heading

This model represents an item or heading has the following fields.

FieldType and formatDescription
AdjustedQuantityNumberQuantity * Factor
ChildrenList of Item/Heading ModelsThe list of children for a heading. The list is empty for an item.
CodeTextThe item code.
DescriptionTextThe item description.
IsHeadingTrue/falseTrue if the line is a heading, false if it is an item.
OutlineLevelNumberThe outline level of the item, starting from 1.
OutlineLevelNumberThe outline level of the item, starting from 1.
PriceBeforeJobMarkupMoneyThe item price without the job mark-up. Equals Rate * Item Mark-up.
PriceMoneyThe item price with the job mark-up. Equals Rate * Item Mark-up * Job Mark-up.
ReportQuote/Invoice Report ModelThe report that contains the item.
UnitUnit ModelThe unit of measure.
TotalMoneyThe item total with the job mark-up.
TotalBeforeJobMarkupMoneyThe item total without the job mark-up.

Entity

This model represents the details of the space business or a customer has the following fields. When used in a report as a single value, e.g. {{ Customer }}, rendered as the person name and/or company in one line.

FieldType and formatDescription
BusinessNumberTextThe business number.
CompanyTextThe business name.
EmailTextThe email.
FaxTextThe fax number.
FirstNameTextThe first name.
LastNameTextThe last name.
MultilineTextTextThe person name and/or company formatted as text on 1 or 2 lines. Use white-space: pre, white-space: pre-wrap or white-space: pre-line in css to preserve the line breaks.
Phone1TextThe first phone number.
Phone2TextThe second phone number.
PostalAddressAddress ModelThe address.
TaxNumberTextThe tax number.
TitleTextThe title for a person.
WebsiteTextThe website address.

Address

This model represents an address. When used in a report as a single value, e.g. {{ PostalAddress }}, rendered in one line with the address elements separated by commas.

FieldType and formatDescription
CityTextThe city.
CountryTextThe country.
MultilineTextTextThe address formatted as text with multiple lines. Use white-space: pre, white-space: pre-wrap or white-space: pre-line in css to preserve the line breaks.
PostcodeTextThe postcode.
SateTextThe state.
Street1TextThe first line of the street address.
Street2TextThe second line of the street address.

Unit

This model represents a unit of measure. When used in a report as a single value, e.g. {{ Unit }}, rendered as the short name of the unit.

FieldType and formatDescription
IsTimeTrue/falseTrue if the unit is for measuring time, such as hour or day, or false otherwise.
NameTextThe full unit name.
ShortNameTextThe short unit name.
Updated on February 14, 2022

Was this article helpful?

Related Articles