Post

1 follower Follow
0
Avatar

Generating Statement with a Calculation

 

Hi Rainer

 

 

Following on from this I am now trying to create a similar thing for outstanding supplier invoices.

I am using the following calculation but as you can see the result is returning as an invalid date? I suspect it is something to do with the fact that i had to create a field in the Purchase Orders called Created On - I couldnt see the created on date when i tried to add it as an @ field in teh calculation originally.

 

var date = @All of Created On with nulls;
var so = @All of Link with nulls;
var sup = @All of Supplier Invoice Number with nulls;
var due = @All of Outstanding Amount with nulls;
var age = @All of Ageing Status with nulls;
var gbp = "£/€";

var lines = [];
for(var i = 0; i < date.length;i++){
number = Number(due[i][0]) || 0;
if(number != 0){
lines.push(moment(date[i]).format("DD/MM/YYYY") + " | " + so[i] + " / " + sup[i] +  " | "  + gbp + due[i] + " | " + age[i]  );
}};

"Date | CV PO / Supplier Invoice | Outstanding | Ageing \n" +
"--- | --- | --- | --- \n"+
lines.join("\n")

Chris Wood

Please sign in to leave a comment.