Capital Expenditure Request (CER) with Advanced Form

This process can be downloaded and imported into your Integrify instance. The downloadable .json file is at the bottom of this page. Directions for importing processes.


We turbocharged our standard Capital Expenditure Request process with a new, advanced request form that uses a special grid to total amounts vertically and horizontally using Javascript.

Download this App

capex-request-advanced-form.png

capex-request-advanced-form-grid.png

Here is the full javascript used to total grid entries vertically and horizontally (it's already included in the download):

var grd = intForm.getElementByClientID("grd2");

console.clear();
grd.events.onChange = function()
{
var grd2 = intForm.getElementByClientID("grd2");
var faBusCase = intForm.getElementByClientID("faBusCase");
var numTotalCapex = intForm.getElementByClientID("numTotalCapex");

var JanTotal = 0;
var FebTotal = 0;
var MarTotal = 0;
var AprTotal = 0;
var MayTotal = 0;
var JunTotal = 0;
var JulTotal = 0;
var AugTotal = 0;
var SepTotal = 0;
var OctTotal = 0;
var NovTotal = 0;
var DecTotal = 0;
var YearTotal = 0;
var nextYearTotal = 0;


//calculate column totals first by month, then by year
for (var i=0; i < 2; i++)
{
if (grd2.gridOptions.data[i].Jan != null)
{
JanTotal += parseFloat(grd2.gridOptions.data[i].Jan);
}

if (grd2.gridOptions.data[i].Feb != null)
{
FebTotal += parseFloat(grd2.gridOptions.data[i].Feb);
}

if (grd2.gridOptions.data[i].Mar != null)
{
MarTotal += parseFloat(grd2.gridOptions.data[i].Mar);
}

if (grd2.gridOptions.data[i].Apr != null)
{
AprTotal += parseFloat(grd2.gridOptions.data[i].Apr);
}

if (grd2.gridOptions.data[i].May != null)
{
MayTotal += parseFloat(grd2.gridOptions.data[i].May);
}

if (grd2.gridOptions.data[i].June != null)
{
JunTotal += parseFloat(grd2.gridOptions.data[i].June);
}

if (grd2.gridOptions.data[i].July != null)
{
JulTotal += parseFloat(grd2.gridOptions.data[i].July);
}

if (grd2.gridOptions.data[i].Aug != null)
{
AugTotal += parseFloat(grd2.gridOptions.data[i].Aug);
}

if (grd2.gridOptions.data[i].Sep != null)
{
SepTotal += parseFloat(grd2.gridOptions.data[i].Sep);
}

if (grd2.gridOptions.data[i].Oct != null)
{
OctTotal += parseFloat(grd2.gridOptions.data[i].Oct);
}

if (grd2.gridOptions.data[i].Nov != null)
{
NovTotal += parseFloat(grd2.gridOptions.data[i].Nov);
}

if (grd2.gridOptions.data[i].Dec != null)
{
DecTotal += parseFloat(grd2.gridOptions.data[i].Dec);
}

if (grd2.gridOptions.data[i]["2021"] != null)
{
nextYearTotal += parseFloat(grd2.gridOptions.data[i]["2021"]);
}
}

grd2.gridOptions.data[2].Jan = parseFloat(JanTotal);
grd2.gridOptions.data[2].Feb = parseFloat(FebTotal);
grd2.gridOptions.data[2].Mar = parseFloat(MarTotal);
grd2.gridOptions.data[2].Apr = parseFloat(AprTotal);
grd2.gridOptions.data[2].May = parseFloat(MayTotal);
grd2.gridOptions.data[2].June = parseFloat(JunTotal);
grd2.gridOptions.data[2].July = parseFloat(JulTotal);
grd2.gridOptions.data[2].Aug = parseFloat(AugTotal);
grd2.gridOptions.data[2].Sep = parseFloat(SepTotal);
grd2.gridOptions.data[2].Oct = parseFloat(OctTotal);
grd2.gridOptions.data[2].Nov = parseFloat(NovTotal);
grd2.gridOptions.data[2].Dec = parseFloat(DecTotal);

grd2.gridOptions.data[2]["2020"] = parseFloat(YearTotal);
grd2.gridOptions.data[2]["2021"] = parseFloat(nextYearTotal);

JanTotal = 0;
FebTotal = 0;
MarTotal = 0;
AprTotal = 0;
MayTotal = 0;
JunTotal = 0;
JulTotal = 0;
AugTotal = 0;
SepTotal = 0;
OctTotal = 0;
NovTotal = 0;
DecTotal = 0;
YearTotal = 0;
nextYearTotal = 0;

//calculate opex column totals by month then by year
for (var i=3; i < 5; i++)
{
if (grd2.gridOptions.data[i].Jan != null)
{
JanTotal += parseFloat(grd2.gridOptions.data[i].Jan);
}

if (grd2.gridOptions.data[i].Feb != null)
{
FebTotal += parseFloat(grd2.gridOptions.data[i].Feb);
}

if (grd2.gridOptions.data[i].Mar != null)
{
MarTotal += parseFloat(grd2.gridOptions.data[i].Mar);
}

if (grd2.gridOptions.data[i].Apr != null)
{
AprTotal += parseFloat(grd2.gridOptions.data[i].Apr);
}

if (grd2.gridOptions.data[i].May != null)
{
MayTotal += parseFloat(grd2.gridOptions.data[i].May);
}

if (grd2.gridOptions.data[i].June != null)
{
JunTotal += parseFloat(grd2.gridOptions.data[i].June);
}

if (grd2.gridOptions.data[i].July != null)
{
JulTotal += parseFloat(grd2.gridOptions.data[i].July);
}

if (grd2.gridOptions.data[i].Aug != null)
{
AugTotal += parseFloat(grd2.gridOptions.data[i].Aug);
}

if (grd2.gridOptions.data[i].Sep != null)
{
SepTotal += parseFloat(grd2.gridOptions.data[i].Sep);
}

if (grd2.gridOptions.data[i].Oct != null)
{
OctTotal += parseFloat(grd2.gridOptions.data[i].Oct);
}

if (grd2.gridOptions.data[i].Nov != null)
{
NovTotal += parseFloat(grd2.gridOptions.data[i].Nov);
}

if (grd2.gridOptions.data[i].Dec != null)
{
DecTotal += parseFloat(grd2.gridOptions.data[i].Dec);
}


if (grd2.gridOptions.data[i]["2021"] != null)
{
nextYearTotal += parseFloat(grd2.gridOptions.data[i]["2021"]);
}
}//end of column total for loop


grd2.gridOptions.data[5].Jan = parseFloat(JanTotal);
grd2.gridOptions.data[5].Feb = parseFloat(FebTotal);
grd2.gridOptions.data[5].Mar = parseFloat(MarTotal);
grd2.gridOptions.data[5].Apr = parseFloat(AprTotal);
grd2.gridOptions.data[5].May = parseFloat(MayTotal);
grd2.gridOptions.data[5].June = parseFloat(JunTotal);
grd2.gridOptions.data[5].July = parseFloat(JulTotal);
grd2.gridOptions.data[5].Aug = parseFloat(AugTotal);
grd2.gridOptions.data[5].Sep = parseFloat(SepTotal);
grd2.gridOptions.data[5].Oct = parseFloat(OctTotal);
grd2.gridOptions.data[5].Nov = parseFloat(NovTotal);
grd2.gridOptions.data[5].Dec = parseFloat(DecTotal);


grd2.gridOptions.data[5]["2021"] = parseFloat(nextYearTotal);


//calculate row totals
for (var i = 0; i < 6; i++)
{

var YearTotal = 0;
if (grd2.gridOptions.data[i].Jan != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Jan);
}

if (grd2.gridOptions.data[i].Feb != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Feb);
}

if (grd2.gridOptions.data[i].Mar != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Mar);
}

if (grd2.gridOptions.data[i].Apr != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Apr);
}

if (grd2.gridOptions.data[i].May != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].May);
}

if (grd2.gridOptions.data[i].June != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].June);
}

if (grd2.gridOptions.data[i].July != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].July);
}

if (grd2.gridOptions.data[i].Aug != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Aug);
}

if (grd2.gridOptions.data[i].Sep != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Sep);
}

if (grd2.gridOptions.data[i].Oct != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Oct);
}

if (grd2.gridOptions.data[i].Nov != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Nov);
}

if (grd2.gridOptions.data[i].Dec != null)
{
YearTotal += parseFloat(grd2.gridOptions.data[i].Dec);
}

grd2.gridOptions.data[i]["2020"] = parseFloat(YearTotal);


if (grd2.gridOptions.data[i]["2021"] != null)
{
grd2.gridOptions.data[i]["Request Total"] = parseFloat(YearTotal) + parseFloat(grd2.gridOptions.data[i]["2021"]);
} else
{
grd2.gridOptions.data[i]["Request Total"] = parseFloat(YearTotal);
}

}//end of row total for loop


//show
if (parseFloat(grd2.gridOptions.data[2]["Request Total"]) > 50000)
{
faBusCase.show = true;
faBusCase.validation.required = true;
} else
{
faBusCase.validation.required = false;
faBusCase.show = false;
}

numTotalCapex.Answer = grd2.gridOptions.data[2]["Request Total"];

}//end of onchange

Note: Right-click on the button and then select "Save Link As" to download the .JSON file and avoid opening the file in your browser.

Download the Process