CMR on Backgrounds or Preprinted paper
About
Cargo Office has the possibility to generate a CMR of one or more shipments.
With this feature enabled you can choose for:
- A. printing on preprinted paper
When printing on preprinted paper you can choose for the file formats PDF and HTML.
- B. printing on background
When printing on backgrounds the file format is PDF.
Note: this feature is only available when enabled. Expect working hours for implementation. When interested in this functionality send Cargo Office programmers a request by using your Bug tracking system.
Backoffice parameters (cmrOutput, cmrType, cmrBackgroundPDF, cmrBarcode)
In Backoffice the following parameters can be set in the section Orderentry:
- cmrOutput:
PDF or HTML
- cmrType: kind of CMR, single page, twofold or fourfold.
This only makes sense if the output format is PDF. Valid options: CMR_4_copies.
- cmrBackgroundPDF:
'yes' if you want the backgrounds to be generated, 'no' for none.
- cmrBarcode: shipment fields to be put in barcode.
Multiple fields must be dot-separated: eg. CN.shipmentID
- cmrBlocks: layout defintion of the CMR
cmrBlocks
The cmrBlocks parameter defines the position and contents of the various squares.
Its should start with a CSS style definition followed by the definition of the various blocks of the CMR.
The definition of a block should start with a specification of the position on the paper by specifying all four parameters top, left, width, height in milimeters from the top-left corner.
The content definition specifies the shipment fields to be printed. For example:
- CSS definitions:
{
font-size:12pt;
font-family:'Arial';
line-height:0.9em;
font-weight:bold;
}
table.tr.td:nth-child(2) {
width: 40mm;
}
- Definition of the positioning of a block:
block_0:
top= 5 # size in mm
left= 183
width = 20
height = 8
content_0:
- Definition of the content of a block:
{param(cmrCarrierCode)}
block_1:
top = 22
left = 30
width = 90
height = 20
content_1:
{pickupName}
{pickupAddress}
{pickupPostcode} {pickupCity}
{pickupCountry}
- For the goodslines to be tabular one can specify the rows like:
row_1:
top = 120
left = 50
width = 100
height = 10
block_7:
width = 20
content_7:
{quantity1} {packing1} {goodsID1}
{quantity2} {packing2} {goodsID2}
{quantity3} {packing3} {goodsID3}
{quantity4} {packing4} {goodsID4}
{quantity5} {packing5} {goodsID5}
end_row
- In order to specify the width of a single column (column 2 in this example) one can add a rule to the style section like:
table.tr.td:nth-child(2){
width: 40mm;
}
- Please note the units must be suffixed in this rule.
CSS styling
It is possible to use different styling for elements on the CMR. The styles can be set at the top of the parameter. Individual blocks can be addressed as follows (* is general styling):
style: *{
font-size:10pt;
font-family:'Arial';
line-height:0.9em;
font-weight:bold;
}
.block18 {
font-size:7pt;
font-family:'Arial';
line-height:1em;
font-weight:normal;
}
Image styling in cmrBlocks parameter:
- The styling of the logo you can add in top of the CSS
- You have to use element img
- For instance use the following CSS for img (place it under the default style)
style:
*{
font-size:12pt;
font-family:'Arial';
line-height:0.9em;
font-weight:bold;
}
img{
width: 25mm;
height: 15mm;
}
Default content of the cmrBlocks parameter:
# CMR block definition
# If this param is set, this template will be used
#
style:
*{
font-size:12pt;
font-family:'Arial';
line-height:0.9em;
font-weight:bold;
}
block_0:
top= 5 # size in mm
left= 183
width = 20
height = 8
content_0:
{param(cmrCarrierCode)}
block_1:
top = 22
left = 30
width = 90
height = 20
content_1:
{pickupName}
{pickupAddress}
{pickupPostcode} {pickupCity}
{pickupCountry}
block_2:
top = 50
left = 30
width = 90
height = 20
content_2:
{deliveryName}
{deliveryAddress}
{deliveryPostcode} {deliveryCity}
{deliveryCountry}
block_3:
top = 72
left = 30
width = 90
height = 20
content_3:
{deliveryCity}
{deliveryCountry}
block_4:
top = 88
left = 30
width = 90
height = 20
content_4:
{pickupCity} {pickupCountry}
{pickupDate}
row_1:
top = 120
left = 50
width = 100
height = 10
block_7:
width = 20
content_7:
{quantity1} {packing1} {goodsID1}
{quantity2} {packing2} {goodsID2}
{quantity3} {packing3} {goodsID3}
{quantity4} {packing4} {goodsID4}
{quantity5} {packing5} {goodsID5}
end_row
block_13:
top = 200
left = 30
width = 90
height = 30
content_13:
{orderReference}
block_15:
top = 249
left = 145
width = 20
height = 5
content_15:
{CODcurrency} {CODamount}
block_16:
top = 50
left = 115
width = 90
height = 20
content_16:
{param(bookingformaddress)}
block_18:
top = 85
left = 115
width = 90
height = 20
content_18:
{remarks}
block_211:
top = 255
left = 30
width = 25
height = 5
content_211:
{pickupCity}
block_212:
top = 255
left = 55
width = 30
height = 5
content_212:
{pickupDate}
block_23:
top = 260
left = 85
width = 55
height = 30
content_23:
{logo}
Conditional printing
It is possible to use conditions so text can be printed depending on field value. The general format of conditions is:
condition(@ [fieldname] [operator] [value]
)? [value when true]
: [value when false]
Where...
- [fieldname] is a fieldname from the shipment.
- [operator] can be <>, ==.
- [value] must be enclosed in single quotes. [value] can be a literal value but can also be a comparison like '>0' which is an operator and value at once.
- [value when true] and [value when false] can contain fieldnames (enclosed in curly brackets {}) and literal texts (enclosed in double quotes "").
Please note:
- conditions have to start at the beginning of a line.
- the [value when false] is obligatory, it is not possible to only mention the 'value when true'. Value when false can be "" so nothing gets printed.
- there is no way to test for multiple fields at once
- there is no embedding and no && or || construction, you can only test for the value of 1 field at a time
- there is no possibility to test for all goodsline fields at once, you need to test each one separately
Some examples:
condition(
@deliveryTime <>'')? {deliveryCountry} {deliveryTime}" - "{deliveryTime2} : {deliveryCountry}
(if deliveryTime is filled, print {deliveryCountry} {deliveryTime} - {deliveryTime2}, else print {deliveryCountry})
condition(
@whQuantityPick1 '>0')? "paklijst" : ""
(if whQuantityPick1 >0, print "paklijst")
condition(
@palletExchange1 == 'No')? "DO NOT SWAP PALLETS" : ""
(if palletExchange1 holds value 'No', print 'DO NOT SWAP PALLETS' else print nothing.
-- WiljoVanLenthe - 2014-01-30
--
PieterHoekstra - 2013-05-23