CostMiner logo User's Guide

Report Template

Contents

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

Syntax Description Example

{{ 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.

Operation Priority Description Example
(...) 1 Control the order of calculation.

Total * (1 + TaxRate)

NOT 1 True if the argument is false or blank, false otherwise.

NOT (ReportType="QuoteBeforeJobMarkup")
NOT Customer

. 1 Allows accessing a nested field.

Customer.PostalAddress.Street1

*,/ 2 Regular arithmetic operations

TaxRate * 100

+,- 3 Regular arithmetic operations

Total + Tax

AND 4 True if both arguments are true, false otherwise

HasTax AND NOT TaxExclusive

OR 5 True if either argument is true, false otherwise.

NOT HasTax OR TaxExclusive

? 5 Equals 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.

Field Type and format Description
AllNodes List of Item/Heading Models The list of all headings and items in the estimate.
Business Entity Model The details of the current business space.
CompletionDate Date The job completion date.
Customer Entity Model The job customer.
Description Text The job description.
DocumentDate Date The document date.
DocumentNumber Text The document number.
HasCodes True/false True 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.
HasTax True/false True if tax is configured, false otherwise.
Logo Text Data URL for the logo. Can be used as the value for the src attribute of the image tag in HTML.
MaxOutlineLevel Number The number of levels in the estimate.
ReportType Text

Has one of the following values, depending on the type of the report:

  • Quote
  • QuoteBeforeJobMarkup
  • Invoice
SiteAddress Address Model The job site address.
StartDate Date The job start date.
TaxName Text The name of the sales tax configured in the business settings, such as 'VAT', 'GST' or 'Sales Tax'.
Tax Money The 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.
TaxExclusive True/false True if the total is exclusive of tax, false otherwise.
TaxRate Number The rate for the sales tax configured in the business settings. For instance, 0.12 = 12%.
TopNodes List of Item/Heading Models The list of headings and items on the first level of the estomate.
Total Money The job total with the job mark-up applied.
TotalBeforeJobMarkup Money The job total without the job mark-up applied.
TotalWithTax Money The 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.

Field Type and format Description
AdjustedQuantity Number Quantity * Factor
Children List of Item/Heading Models The list of children for a heading. The list is empty for an item.
Code Text The item code.
Description Text The item description.
IsHeading True/false True if the line is a heading, false if it is an item.
OutlineLevel Number The outline level of the item, starting from 1.
OutlineLevel Number The outline level of the item, starting from 1.
PriceBeforeJobMarkup Money The item price without the job mark-up. Equals Rate * Item Mark-up.
Price Money The item price with the job mark-up. Equals Rate * Item Mark-up * Job Mark-up.
Report Quote/Invoice Report Model The report that contains the item.
Unit Unit Model The unit of measure.
Total Money The item total with the job mark-up.
TotalBeforeJobMarkup Money The 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.

Field Type and format Description
BusinessNumber Text The business number.
Company Text The business name.
Email Text The email.
Fax Text The fax number.
FirstName Text The first name.
LastName Text The last name.
MultilineText Text The 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.
Phone1 Text The first phone number.
Phone2 Text The second phone number.
PostalAddress Address Model The address.
TaxNumber Text The tax number.
Title Text The title for a person.
Website Text The 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.

Field Type and format Description
City Text The city.
Country Text The country.
MultilineText Text The 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.
Postcode Text The postcode.
Sate Text The state.
Street1 Text The first line of the street address.
Street2 Text The 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.

Field Type and format Description
IsTime True/false True if the unit is for measuring time, such as hour or day, or false otherwise.
Name Text The full unit name.
ShortName Text The short unit name.