The CoreTRM comes with some default document that can be used. The main default document is Invoice. However, you are able to build custom document in Word or PDF format.
It is common that there are a fair amount of document that are used by the trading company. Most of the document should be able to produce by the system since most of the trade data are inside the system.
Lets take an example of creating a new Trade Recap document. The Trade Recap will appear like below:
- Click on the document name to be redirected to the document details view.
- From the Sections, click on and select "Document Root" to add a new section. All documents will have to start with "Document Root".
- From the section details on the right, enter a name for the section. In our example, enter "Trade Recap".
- From the section details on the right, select the starting object from where the document should retrieve the data. In our example, select "Contract".
- From the section details on the right, select enter any criteria relating to this section. Typically, for Document Root, we will need to link the parameter from screen select to object here. In this example, we are expecting the user to select a contract from the screen and then print the "Trade Recap". So we will be linking the contractseqnum from screen to the object in the section using {param}. The code to use is:
contractseqnum.eq.{param:dataobjectuniquekeyseqnum}
- Next, below the new "Document Root: Trade Recap" , click on to add new section.
Typically, in a document, you can use different type of section to layout how the data will be displayed in the document. Each type has some specific properties in the section details. The main section type are Stack Container, Column Container, Table, Image, Single Item Value, Static Text, Horizontal Line, Footer and Header.
Stack Container: Allows you to stack the data inside the container.
Column Container: Allows you to divide the document layout into columns. Typically, in 1,2,3 or 4 columns format. As a result, you can place the data in a structure manner.
Table: Allows you to display multiple rows of table when the results has more than 1 row.
Image: Allows you to display image in the document.
Single Item Value: Allows you to display a single value in the document.
Static Text: Allows you to display a single value in the document.
Horizontal Line: Allows you to display a horizontal line in the document.
Footer: Allows you to display data in the footer section of the document.
Header: Allows you to display data in the Header section of the document.
- In our example, we will use a column container to create the Logo (on the left) and Company Name and Address (on the right).
- Next, in the Section Title of the Column Container, you can include a title to identify this section. In our example, enter "Booking Entity Header".
- Next, click on the under the Column Container, to add new section. In our example, we can use a Stack Container and enter section title as "Left".
- In the Stack Container: Left section details, we can set more properties of the container. In our example, we can set the width of the container to be fixed at 300.
- Next, under the Stack Container: Left, we can include the logo. In our example, we will select "Image" as a new section. We can enter Section Title as "Booking Entity Logo".
- In the Image:Booking Entity Logo section details, we can set more properties for the section. In our example, since we are displaying the logo. We use:
Object Name: Attachment
Parent Section: Trade Recap[11729]. This is to link the attachment object to the Trade Recap Document Root so that when the contract is selected, we will be able to get the booking entity from the contract.
Section criteria: will be the code below. The criteria will link the dataobjectseqnum to 420 which is created when a logo image is attached to booking entity. Then also having the criteria that the file usage type is "EL"(Booking Entity Logo) and that the attachment is active.
dataobjectseqnum.eq.420.and.dataobjectuniquekeyseqnum.eq.{11729:contract.core_settlement_bookingentity.bookingentityseqnum}.and.fileusagetypecode.eq.EL.and.activeind.eq.true
Booking Entity Logo Attachment can be found in Reference Data-> Accounting-> Booking Entities-> Attachment Tab.
Column Item Ref: as per the code below. A function fnGetFileAsDataUrl will have to be used to get the URL of the attachment and render the image back to the document.
fnGetFileAsDataUrl(i:filestoreguid,i:filetypecode)
In our example, we will also set the width and height of the image as Width:230 and Height:110 and Aligment:Left.
- Next, we will create the right section for the Company Name and Address.
- Click on in the lower part of the Column Container to add a new section. In our example, select Stack Container and enter the section title as "Right". Notice that because we are using Column Container section earlier, the system will place the Stack Container next to Stack Container:Left.
- Under the Stack Container: Right, click on to create a new section. In our example, we will select "Single Item Value" and enter the section title as "Company Name". This section will be use to retrieve the Booking Entity Name.
- In the Single Item value: Company Name section details, we can set more properties for the section. In our example, we will use the following:
Object Name: Contract
Parent Section: Trade Recap[11729]. This is to link the contract object to the Trade Recap Document Root so that when the contract is selected, we will be able to get the booking entity name from the contract.
Section criteria: will be the code below. This is to link the contract object to the Root Document Contract object.
contractseqnum.eq.{11729:contractseqnum}
Column Item Ref: will be the bookingentityname Item Ref.
contract.core_settlement_bookingentity.bookingentityname
In our example, we will also set Aligment:Left.
- Next, we will create the section for the Booking Entity Address.
- Click on under the Single Item Value:Company. In our example, select List and enter the section title as "Booking Entity Address". When "List" section is used, the system will list all the row from that object.
- In the List: Booking Entity Address section details, we can set more properties for the section. In our example, we will use the following:
Object Name: Address
Parent Section: Trade Recap[11729]. This is to link the address object to the Trade Recap Document Root so that when the contract is selected, we will be able to get the booking entity name from the contract.
Section criteria: will be the code below. This is to link the Address object bookingentityseqnum to the Root Document Contract object bookingentityseqnum.
bookingentityseqnum.eq.{11729:contract.core_settlement_bookingentity.bookingentityseqnum}.and.activeind.eq.TRUE
Column Item Ref: will be the core_address_line.addressline Item Ref. Since we use "List" as section type, the system will display all the address line of the Booking Entity.
Sort Item Ref: we will include a sort item ref using core_address_line.lineordernum to sort the address line before displaying in the document.
In our example, we will also set Aligment:Left.
- Next, we will create the remaining part of the trade recap. In order to create some spacing between the Entity Header Section with the next section, we can include a blank Static Text Section before starting the next section.
- Click on outside the Column Container Section to create a new section. In our example, we will select "Static Text" Section and name it as "Space". This will create some spacing with the next section.
- For the Static Text:Space section detail, we will not include additional properties.
- Next, we will create the title of the document to be display at the center of the document.
- Click on after the Static Text:Space section to create a new section and enter "Trade Recap" as the section Title.
For the Static Text:Space section detail, we include a Static Text: "Trade Recap" and set Alignment:Center.
- Next, we will create a horizontal line.
- Click on after the Static Text:Trade Recap section to create a new section and enter "Line" as the section Title.
- For the Horizontal Line:Line section detail, we will not include additional properties.
- Next, we will create the section for the Seller.
- Click on under the Horizontal Line:Line. In our example, select Column Container and enter the section title as "Seller". We will use the Column Container to create a 2 Column display left side for the text and right side for the value.
- For the Column Container:Seller section detail, we will not include additional properties.
- Next, we will create the section to display the static text Seller on the left.
- Click on under the Column Container:Seller. In our example, select Static Text and enter the section title as "Seller".
- In the Static Text: Seller section details, we can set more properties for the section. In our example, we will use the following:
We will set Static Text as "Seller:", Width:"100" and Aligment:Left.
- Next, we will create the section for the seller name value.
- Click on under the Static Text: Seller. In our example, select Single Item Value and enter the section title as "Seller Name". Since Seller Name will be a single value, we can use Single Item Value.
- In the Single Item Value: Seller Name section details, we can set more properties for the section. In our example, we will use the following:
Object Name: Contract Item
Parent Section: Trade Recap[11729]. This is to link the Contract Item object to the Trade Recap Document Root so that when the contract is selected, we will be able to get the related Contract Item data.
Section criteria: will be the code below. This is to link the Contract Item object contractseqnum to the Root Document Contract object contractseqnum.
contractseqnum.eq.{11729:contractseqnum}
Column Item Ref: will be the bookingentityname Item Ref. Hoewever, to know if we are seller or buyer, we will need to use buysellcode. The function is below:
fnIf(i:buysellcode,eq,S,i:contract.core_settlement_bookingentity.bookingentityname,i:contract.core_counterparty.counterpartyname)
In our example, we will also set Aligment:Left.
- Next, we can create a spacing between seller and buyer. We can Click on outside the Column Container Section to create a new section. In our example, we will select "Static Text" Section and name it as "Space". This will create some spacing with the next section.
- Next, we can create the Buyer Section and Buyer Name Value similar to Seller. We can use step 29 to 37 again.
Note: For Column Item Ref, the Function will be changed to check buysellcode equal to B.
fnIf(i:buysellcode,eq,B,i:contract.core_settlement_bookingentity.bookingentityname,i:contract.core_counterparty.counterpartyname)
- Next, we can create a space section again after the Buyer Section.
- Next, we can create the commodity section.
- Click on under the Static Text:Space. In our example, select Column Container and enter the section title as "Commodity". We will use the Column Container to create a 2 Column display left side for the text and right side for the value.
- For the Column Container:Commodity section detail, we will not include additional properties.
- Next, we will create the section to display the static text Commodity on the left.
- Click on under the Column Container:Commodity. In our example, select Static Text and enter the section title as "Commodity".
- In the Static Text: Commodity section details, we can set more properties for the section. In our example, we will use the following:
We will set Static Text as "Commodity:", Width:"100" and Aligment:Left.
- Next, we will create the section for the seller name value.
- Click on under the Static Text: Commodity. In our example, select Table and enter the section title as "Commodity". Since Commodity Name can be more than 1 value, we can use Table to display more than 1 value if there are more than 1 contract item entered.
- In the Table: Commodity section details, we can set more properties for the section. In our example, we will use the following:
Object Name: Contract Item
Parent Section: Trade Recap[11729]. This is to link the Contract Item object to the Trade Recap Document Root so that when the contract is selected, we will be able to get the related Contract Item data.
Section criteria: will be the code below. This is to link the Contract Item object contractseqnum to the Root Document Contract object contractseqnum.
contractseqnum.eq.{11729:contractseqnum}
Column Item Ref: will be the contractcommodityname Item Ref.
contractitem.core_contract_commodity.contractcommodityname
In our example, we will also set Aligment:Left.
- Next, we can create a space section again after the Commodity Section.
- Next, we can create the Specification section.
- Click on under the Static Text:Space. In our example, select Column Container and enter the section title as "Specification". We will use the Column Container to create a 2 Column display left side for the text and right side for the value.
- For the Column Container:Specification section detail, we will not include additional properties.
- Next, we will create the section to display the static text Specification on the left.
- Click on under the Column Container:Specification. In our example, select Static Text and enter the section title as "Specification".
- In the Static Text: Specification section details, we can set more properties for the section. In our example, we will use the following:
We will set Static Text as "Specification:", Width:"100" and Aligment:Left.
- Next, we will create the section for the seller name value.
- Click on under the Static Text: Specification. In our example, select Static Text and enter the section title as "Specification Details". Since we are displaying a group of static text, we can use Static Text section again.
- In the Static Text: Specification Details section details, we can set the static text, we will use the following:
- Density: 0.950 (Max)
- Viscosity: 380cst (Max)
- CCR: 13 wt (Max)
- Flash Point: 75( Min)
- The remaining sections will be the same as above. For Delivery Range, Quantity and Range, a Table Section will be used so that if there are more than 1 contract item, the system will display the data correctly.
After the document are built, you will need to decide on which view this document can be printed. For our example, the view that we are using is Physical -> Contract View. This is done via View Builder and custom tab.
Custom Tab allows you to add custom application into the view so that based on selection by the user, the custom application will be triggered.
When can further specify some criteria for the table button using custom Item.