//Get current page
var CurrentPage = xfa.layout.absPage(this);
//Get current page - content page - fields
var FieldList = xfa.layout.pageContent(CurrentPage, "subform",false);
var FieldListLength = FieldList.length;
//Check page contains EndBlock
var FieldListIndex = 0;
var Item;
var FoundInd = false;;
for (FieldListIndex; FieldListIndex < FieldListLength; FieldListIndex++) {
Item = FieldList.item(FieldListIndex);
if (Item.name === "EndBlock") {
FoundInd = true;
}
}
//Hide subform if EndBlock found
if (FoundInd === true) {
this.presence = "hidden";
}
//Get current page
var currentPage = xfa.layout.absPage(this);
var currentPage_Index = currentPage.toString();
//Sum TOTAL_AMOUNT fields
var oFields = xfa.layout.pageContent(currentPage, "field");
var nNodesLength = oFields.length;
var oTotalAmountFloat = Number(0);
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if (oFields.item(nNodeCount).name == "TOTAL_AMOUNT") {
oTotalAmountFloat = ((oTotalAmountFloat * 100) +
(Number(oFields.item(nNodeCount).rawValue) * 100))/100;
}
}
this.rawValue = Number(oTotalAmountFloat);
//Get current page
var CurrentPage = xfa.layout.absPage(this);
//Get current page - content page - fields
var FieldList = xfa.layout.pageContent(CurrentPage, "field",false);
var FieldListLength = FieldList.length;
//Check for a Sales order item line
var FieldListIndex = 0;
var Item;
var FoundInd = false;;
for (FieldListIndex; FieldListIndex < FieldListLength; FieldListIndex++) {
Item = FieldList.item(FieldListIndex);
if (Item.name === "TOTAL_AMOUNT") {
FoundInd = true;
}
}
//If no Sales order item line, than hide Previous page subtotal
if (FoundInd === false) {
this.presence = "hidden";
}
//Get previous page
var CurrentPage = xfa.layout.absPage(this);
var CurrentPage_Index = Number( CurrentPage.toString() );
var PreviousPage_Index = CurrentPage_Index - 1;
//Get Bottom page subtotal
var FieldList = xfa.layout.pageContent( PreviousPage_Index, "field", true);
var FieldListLength = FieldList.length;
for (var FieldListCount = 0; FieldListCount < FieldListLength; FieldListCount++) {
if (FieldList.item(FieldListCount).name == "PageSubtotalAmount") {
this.rawValue = FieldList.item(FieldListCount).rawValue;
}
}
//Get current page
var CurrentPage = xfa.layout.absPage(this);
//Get current page - master page - fields
var FieldList = xfa.layout.pageContent(CurrentPage, "field",true);
var FieldListLength = FieldList.length;
//Get Previous page subtotal
var FieldListCount = 0;
var PreviousPageSubtotal = 0;
for (FieldListCount; FieldListCount < FieldListLength; FieldListCount++) {
if (FieldList.item(FieldListCount).name == "PreviousPageSubtotalAmount") {
PreviousPageSubtotal = +FieldList.item(FieldListCount).rawValue;
}
}
//Calculate current page total
var TotalAmount = PreviousPageSubtotal * 100;
var FieldListIndex2 = 0;
var Item;
//Get current page - content page - fields
FieldList = xfa.layout.pageContent(CurrentPage, "field",false);
FieldListLength = FieldList.length;
//Sum total amounts (X 100 to overcome decimal problems)
for (FieldListIndex2; FieldListIndex2 < FieldListLength; FieldListIndex2++) {
Item = FieldList.item(FieldListIndex2);
if (Item.className === "field" && Item.name === "TOTAL_AMOUNT") {
TotalAmount += Item.rawValue * 100;
}
}
this.rawValue = TotalAmount / 100;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |