cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to work with accumulative variables in JPOS Print Templates in CCO

npinzon
Participant
0 Kudos
266

Dear all,

Have you ever tried to use an accumulative variable in a print JPOS template for CCO?

I’ve been working in some changes required here, for the day-end closing printing report, and in some iterations I need to get some summarized values for example de total of the differences between actual and target values of the many credit cards configured, as it would be easier for the sales manager in the report to find out some troubles with how they select the payments.

I know already that I must use the paymentDifferences and there I can find those values, so I’m assigning to a local variable inside a list cycle this variable in to different ways just to make a test.

Ex. <#assign x += (diff.actualAmount)/> or <#assign yo>${(diff.targetAmount+y)}</#assign>

But with any of the above’s I always get the last credit card payment value, it doesn’t summarize the information even been inside the cycle.

I've checked some useful information of how to work with freemarker, here i left also a link with the manual of it (https://freemarker.apache.org/docs/dgui.html) but i haven't had a glance of how to do it.

I will appreciate any idea about it.

Thanks in advance,

Nasmiye Pinzon R.

Accepted Solutions (0)

Answers (1)

Answers (1)

npinzon
Participant

Dear all,

I could finally figure it out with some extra help of my coworkers.

The way to assign to a local variable that accumulates values must be like this:

<#assign x += (diff.actualAmount)/>, the other way concats each value if you have it inside a list.

It's also important to take into account that those variables must be iniciated before the begining of the list

Ex.

<#assign NoCantidadEfectivo=0/>

<#list oReceipts.paymentItems as TPayments>

<#if TPayments.paymentFormCode=='09' && oReceipts.paymentNetAmount gte 0 && TPayments.businessTransactionAmount gte 0 > <#assign NoCantidadEfectivo = NoCantidadEfectivo?number+1/>

</#if> </#list>

I hope this could help you out whenever you need to add some information into print_templates.

Nasmiye PR.