This section describes how you can generate a document. Document Creator Template helps the system generate PDF from different document types.  The document types are specified by the name.  Once the name is populated, the system will generate data similar to the Sampe Voucher Object below.


Name

The following names are allowed that would generate:


  • BillOfLading
  • INVOICE[:customName]
  • CONSOL_INVOICE
  • INCENTIVE_VOUCHER[:customName]



INVOICE

The name is important to tag where the items can be accessible. For example, if you want the document creator to show up in the invoice section, you'll name it

INVOICE[:CustomName]

, and these formats will show up when you want to generate a PDF invoice.  This can be found on the top of any invoice modal.

Details

The following details will be accepted in JSON format. 

{"voucherItemGroup": "", "groupMethod": "", "timezone": "Asia/Kuala_Lumpur", "voucherItemSort": "", "useLineItemRounding": ""}


All dates are stored in GMT time therefore a timezone is required to localize when the invoice is generated. If none is specified, it will default to "Asia/Kuala_Lumpur".  The timezone uses specified here.


By default, the voucher will display ALL voucher items. If grouping is required, you may use the following options to sum the voucher in this format. Pls refer to the template object at the bottom of this page to see how they are related. 


The following is the voucherItemGroup parameters:

  • "booking" - will group all voucher items of the same voucherItems.job.uuid || voucherItem.bookingUuid
  • "chargeItem" - will group all voucher items of the same voucherItems.chargeItemCode.
  • "chargeItemDropOff" - will group all voucher items of the same voucherItems.chargeItemCode and booking.consigneeAddresseUuid. This should be used with the { groupMethod: "AVERAGE" }.
  • "chargeItemUnitPrice" - will group all voucher items of the same voucherItems.chargeItemCode and voucherItem.unit. This should be used with the { groupMethod: "AVERAGE" }.
  • "one" - will group all voucher items into one line item. 

If the voucherItemGroup is set, you may set the groupMethod which dictates how the quanity and unitprice is set:

  • SUM, quantity = 1 and will sum the unit price (DEFAULT)

  • AVERAGE: quantity = count and will average unit price.

  • FIRST: pick the first quantity and unit price. One should be careful with this as the unit price might not match the subtotal.

Note you can use the voucherItems.count variable to display the number of times the variable is grouped into.


Example of "groupMethod": "SUM":


Example of "groupMethod": "AVERAGE":


Example of "groupMethod": "FIRST". Note the Quanity * Unit Price does not equal subtotal:


voucherItemSort 

expects any key of key-value pair. 

    e.g     

{jobShipperRequiredDate : "2024/12/12" 

{"voucherItemSort":"jobShipperRequiredDate"} => will resolve to "2024/12/12"


if this value is set, the description of the invoice will be sorted (ascending) based on this criteria only if voucherItemSort's value is referenced in description.


useLineItemRounding

expects any value that will resolve to be truthy in javascript.

  e.g "true" or 1


if this value is set and truthy,  will round the subTotal, taxTotal and total for every line item and final sum of subTotal, taxTotal and total.


HTML

A sample HTML format could be. Underlying, the system uses handlebars. There are helper functions that you can use such as `{{ math @index "+" 1 }}` which adds the @index (index of a #each loop) if you'll like to display the line item.


Please see this link for sample Invoice(s)


Sample Voucher Object

{
   "title":"INVOICE",
   "invoiceNumberTitle":"INVOICE NO.",
   "companyName":"Sherman Transport Sdn Bhd",
   "companyAddressLine1":"1234 Street",
   "companyAddressLine2":"SuperCity",
   "companyAddressLine3":"",
   "companyPhone":"+6012345678",
   "companyFax":"+4923faX123",
   "companyRegistrationNumber":"123245-M",
   "companyTaxNumber":"XXXTAXNO",
   "accToCode":null,
   "accToDebtorCode":null,
   "accToCreditorCode":null,
   "accToName":"Sherman Transport Sdn Bhd",
   "accToAddress":"1234 SuperStreet\n1234, Super City",
   "accToAddressLine1":"SUPPLY AND DISTRIBUTION DEPARTMENT, LEVEL 21, TOWER 2, PETRONAS TWIN TOWERS",
   "accToAddressLine2":"KUALA LUMPUR CITY CENTRE",
   "accToAddressLine3":"50088, KUALA LUMPUR, FEDERAL TERRITORY OF KUALA LUMPUR",
   "consignee":"7-ELEVEN MALAYSIA SDN BHD - 7-ELEVEN",
   "shipper":"7-ELEVEN MALAYSIA SDN BHD - 7-ELEVEN",
   "shippingAgent":null,
   "description":null,
   "invoiceNumber":"dev_yRhWi2sFj",
   "issueDate":"10/02/2021",
   "term":0,
   "jobNumber":"dev_TE2102032, dev_TE2102033, dev_TE2102034, dev_TE2102035, dev_TE2102036, dev_TE2102037, dev_TE2102038, dev_TE2102039, dev_TE2102040, dev_TE2102041, dev_TE2102042, dev_TE2102043, dev_TE2102044, dev_TE2102045, dev_TE2102046, dev_TE2102047, dev_TE2102048, dev_TE2102049, dev_TE2102050, dev_TE2102051",
   "preparedBy":"sherman@shipx.cc",
   "etdEta":"- / -",
   "portLoading":"",
   "portFinal":"",
   "customerRef":"SL-2102100823-1",
   "shipperInvoiceNumber":"",
   "k1number":"",
   "commodity":"",
   "volume":"20x40 undefined",
   "containerNumber":[
      {
         "no":null,
         "size":40
      }
   ],
   "voucherItems":[
      {
         "index":1,
         "chargeItemCode":"G-TPT-UNIT",
         "chargeItemDescription":"BEING TRANSPORTATION CHARGES",
         "description":null,
         "job":null,
         "bookingUuid":"e4db217c-c4c4-44a0-b701-7f639dffe7f3",
         "size":"40",
  	"shipperAreaCode": 'PK',
  	"shipperZone": undefined,
  	"consigneeAreaCode": 'PG',
  	"consigneeZone": undefined,
  	"driverName": 'Sherman Lai',
  	"driverNick": 'Sher',
  	"driverCode": 'DPK123',
  	"driverReg": null,
  	"driverDept": null,
  	"driverOwnerType": null,
  	"vehicleReg": 'BRD1234',
  	"vehicleCode": 'SW109',
  	"vehicleDept": [],
  	"vehicleOwnerType": 'OWNED',
  	"trailerReg": null,
  	"trailerCode": null,
  	"trailerDept": null,
  	"trailerOwnerType": null,
  	"transportType": 'CURTAINSIDER',
  	"containerType": null,
  	"size": 40,
         "count":1,
         "quantity":1,
         "lastStatusTs":"",
         "unit":"600.00",
         "subTotal":"600.00",
         "taxTotal":"0.00",
         "total":"600.00",
         "localTotal":"600.00"
      },
      {
         "index":2,
         "chargeItemCode":"G-TPT-UNIT",
         "chargeItemDescription":"BEING TRANSPORTATION CHARGES",
         "description":null,
         "job":null,
         "bookingUuid":"c2598bae-f027-405f-81cb-ce0178b79827",
         "size":"40",
  	"shipperAreaCode": 'PK',
  	"shipperZone": undefined,
  	"consigneeAreaCode": 'PG',
  	"consigneeZone": undefined,
  	"driverName": 'Sherman Lai',
  	"driverNick": 'Sher',
  	"driverCode": 'DPK123',
  	"driverReg": null,
  	"driverDept": null,
  	"driverOwnerType": null,
  	"vehicleReg": 'BRD1234',
  	"vehicleCode": 'SW109',
  	"vehicleDept": [],
  	"vehicleOwnerType": 'OWNED',
  	"trailerReg": null,
  	"trailerCode": null,
  	"trailerDept": null,
  	"trailerOwnerType": null,
  	"transportType": 'CURTAINSIDER',
  	"containerType": null,
         "count":1,
         "quantity":1,
         "lastStatusTs":"",
         "unit":"600.00",
         "subTotal":"600.00",
         "taxTotal":"0.00",
         "total":"600.00",
         "localTotal":"600.00"
      },
      {
         "index":3,
         "chargeItemCode":"G-TPT-UNIT",
         "chargeItemDescription":"BEING TRANSPORTATION CHARGES",
         "description":null,
         "job":null,
         "bookingUuid":"c16fa250-5b86-4dd8-b2ec-fa5726c2e84f",
         "size":"40",
  	"shipperAreaCode": 'PK',
  	"shipperZone": undefined,
  	"consigneeAreaCode": 'PG',
  	"consigneeZone": undefined,
  	"driverName": 'Sherman Lai',
  	"driverNick": 'Sher',
  	"driverCode": 'DPK123',
  	"driverReg": null,
  	"driverDept": null,
  	"driverOwnerType": null,
  	"vehicleReg": 'BRD1234',
  	"vehicleCode": 'SW109',
  	"vehicleDept": [],
  	"vehicleOwnerType": 'OWNED',
  	"trailerReg": null,
  	"trailerCode": null,
  	"trailerDept": null,
  	"trailerOwnerType": null,
  	"transportType": 'CURTAINSIDER',
  	"containerType": null,
         "count":1,
         "quantity":1,
         "lastStatusTs":"",
         "unit":"600.00",
         "subTotal":"600.00",
         "taxTotal":"0.00",
         "total":"600.00",
         "localTotal":"600.00"
      },
      {
         "index":4,
         "chargeItemCode":"G-TPT-UNIT",
         "chargeItemDescription":"BEING TRANSPORTATION CHARGES",
         "description":null,
         "job":null,
         "bookingUuid":"c0c41c1b-b2f8-4aa5-a91f-a7507150f47d",
         "size":"40",
  	"shipperAreaCode": 'PK',
  	"shipperZone": undefined,
  	"consigneeAreaCode": 'PG',
  	"consigneeZone": undefined,
  	"driverName": 'Sherman Lai',
  	"driverNick": 'Sher',
  	"driverCode": 'DPK123',
  	"driverReg": null,
  	"driverDept": null,
  	"driverOwnerType": null,
  	"vehicleReg": 'BRD1234',
  	"vehicleCode": 'SW109',
  	"vehicleDept": [],
  	"vehicleOwnerType": 'OWNED',
  	"trailerReg": null,
  	"trailerCode": null,
  	"trailerDept": null,
  	"trailerOwnerType": null,
  	"transportType": 'CURTAINSIDER',
  	"containerType": null,
         "count":1,
         "quantity":1,
         "lastStatusTs":"",
         "unit":"600.00",
         "subTotal":"600.00",
         "taxTotal":"0.00",
         "total":"600.00",
         "localTotal":"600.00"
      }
   ],
   "currency":"MYR",
   "localCurrency":"MYR",
   "subTotal":"12,000.00",
   "taxTotal":"0.00",
   "total":"12,000.00",
   "localTotal":"12,000.00",
   "totalText":"TWELVE THOUSAND AND ZERO CENTS",
   "banks":[
      {
         "name":"HSBC",
         "currency":"MYR",
         "swiftCode":"SCERE",
         "accountNumber":"888-888-8888"
      },
      {
         "name":"United Overseas Bank",
         "currency":"USD",
         "swiftCode":"SCERE",
         "accountNumber":"999-999-999"
      }
   ],
   "taxSummary":[
      {
         "label":"ZR@0%",
         "amount":"12,000.00",
         "tax":"0.00"
      }
   ]
}


INCENTIVE_VOUCHER


A sample template can be found here. The sample data that can be used in this format as follows:

{
  "_id": "7676760d-0ac7-4970-bf1e-35c3c64344ac",
  "ownerUuid": "fce9d4fa-2ecf-4a3b-bc50-6085247fa90b",
  "voucherNo": "dev_INCT21050009",
  "driverUuids": null,
  "drivers": null,
  "incentiveUuids": ["cf7d336a-1c21-4cfe-8f81-c7883d087b83", "a535ae69-b570-4408-899b-aeac5e037f46", "aec829b2-5874-4d57-b6c1-52c632a6fa6a", "3036c22b-0863-4cd0-b5d5-deafba0b9c24", "ad5dee63-d83c-402d-af59-57bcc735f374"],
  "incentives": [{
    "name": "Test",
    "code": "123",
    "amount": 144.44,
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 144.44", null]
  }, {
    "name": "Test Incentive 01",
    "code": "TSTIN001",
    "amount": 133.33,
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 133.33", null]
  }, {
    "name": "UPAH",
    "code": "UPH",
    "amount": 152.55,
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 152.55", null]
  }, {
    "name": "Test Waiting Charges",
    "code": "TSTWA01",
    "amount": 111.11,
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 111.11", null]
  }, {
    "name": "Overpaid",
    "code": "OVP",
    "amount": 75.75,
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "EXPENSE",
    "categorySum": [null, "MYR 75.75"]
  }],
  "date": "31/05/2021",
  "status": "APPROVED",
  "approvedBy": {
    "email": "ariff.rahim@swiftlogistics.com.my",
    "name": null
  },
  "approvedUuid": "e0987915-01d2-4123-816d-03ea446aee42",
  "approvedAt": "2021-05-31T07:58:04.550Z",
  "approvedFinanceBy": {
    "email": null,
    "name": null
  },
  "approvedFinanceUuid": null,
  "approvedFinanceAt": null,
  "updatedAt": null,
  "updatedBy": {
    "email": null,
    "name": null
  },
  "updatedUuid": null,
  "createdAt": "2021-05-31T07:58:01.677Z",
  "createdBy": {
    "email": "ariff.rahim@swiftlogistics.com.my",
    "name": null
  },
  "createdUuid": "e0987915-01d2-4123-816d-03ea446aee42",
  "remarks": null,
  "amount": 617.18,
  "incentiveTypeSum": [{
    "typeUuid": "0a3b1e32-7217-44b2-9bae-06081e082cd0",
    "amount": 144.44
  }, {
    "typeUuid": "0208e646-8259-42a3-afa1-2ec2deb5f6be",
    "amount": 133.33
  }, {
    "typeUuid": "669b58dc-ce55-48d0-90c4-fb1a0790da8f",
    "amount": 152.55
  }, {
    "typeUuid": "13a24d60-be05-4a1b-bfe0-d93e6a679100",
    "amount": 111.11
  }, {
    "typeUuid": "c09610a9-3645-4929-b3db-a61454e1d8ef",
    "amount": 75.75
  }],
  "incentiveCategorySum": [{
    "category": "INCENTIVE",
    "amount": 541.43
  }, {
    "category": "EXPENSE",
    "amount": 75.75
  }],
  "todayDate": "31/05/2021 04:28PM",
  "driversArray": " (272349) -",
  "vehiclesArray": " BNX5975",
  "totals": ["MYR 541.43", "MYR 75.75"],
  "summary": [{
    "name": "Test",
    "code": "123",
    "amount": "MYR 144.44",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 144.44", null]
  }, {
    "name": "Test Incentive 01",
    "code": "TSTIN001",
    "amount": "MYR 133.33",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 133.33", null]
  }, {
    "name": "UPAH",
    "code": "UPH",
    "amount": "MYR 152.55",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 152.55", null]
  }, {
    "name": "Test Waiting Charges",
    "code": "TSTWA01",
    "amount": "MYR 111.11",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 111.11", null]
  }, {
    "name": "Overpaid",
    "code": "OVP",
    "amount": "MYR 75.75",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "EXPENSE",
    "categorySum": [null, "MYR 75.75"]
  }],
  "categoriesList": ["INCENTIVE", "EXPENSE"],
  "jobs": [{
    "name": "Test",
    "code": "123",
    "amount": "MYR 144.44",
    "date": "31/05/2021",
    "description": null,
    "pickUpDrop": null,
    "category": "INCENTIVE",
    "categorySum": ["MYR 541.43", "MYR 75.75"]
  }]
}