USDP Application





Changes and Updates

-Added syntax for call to new service that fills PDF

-Modified PDF formatting for border and alignment of SBME box along with other misc changes

-Added Date, Number/Currency, and Percent formatting for PDF printing.

-Commented out the alert for the beanJSON(for the new dialogue box window)

-Cleaned up syntax overall syntax

-Updated name of PDF downloaded to format: "PaymentStatusReport" + "_" + obj.companyName + "_" + obj.monthEnding +".pdf"

2020/04/02

-Added a dialogue box for confirming the download

-Added instructions to the page and confirm dialogue box

-Adjusted PDF form fields and text for alignment.  

-Added page numbers to all pages and initials to Page 2 and up.

2020/04/03

-Updated instructions for further clarification with PDF download/submission and web form submission.

-Added field validation rules to prevent premature PDF generation without required fields.

-Added a check for the Stage action buttons to confirm the PDF is downloaded prior to the web form being submitted.


2020/04/08

-Added form storage for uploading signed and initialed PDFs

-updated email notifications to include PDFs

-updated instructions for modified process

-Added additional logic to prevent unfinished PDF downloads or form submission


2020/07/14

-Project now includes two new fields: Project Manager Name and Project Manager Email.

-The project manager email is sent a notification when a payment status report is submitted for a particular project.

-added project manager name and email to the Payment Status form.

2020/10/14

Update code so that contractor can select their own name for 'Sub-Tier To' (Payer) field in table.

Contractor will not be able to add their own name into Sub-Tier.

User will not be able to add a Non-SMBE company into the Sub-Tier field.

Below would be needed, but is commented out, if in case a non-smbe would be added into the Sub-Tier field.

Balance Adjustment will only and calculate when contractor is an SMBE and not a non-SMBE.

   - This is to avoid UConn double dipping with payments to SMBEs, as they are paid through other system.

RE_ UCONN Supplier Diversity Program (USDP) On-Line Reporting - Answers To Questions You May Have.msg

Field Mapping for PDF


PDF Field Name

var

Leap var (use var column instead)

Leap Field ID

Leap Field Title

1

Month Ending

monthEnding

monthEndCalYear

F_MonthEndCalYear

Combined Month Ending and Calendar Year

2

Contractor Name

companyName

contractorName

F_ContractorName

General Contractor Name

3

Project Name

projectName

projectName

F_ProjectName

Project Name

4

Awarding Agency Name

awardingAgencyName

contractAwardAgency

F_ContractAwardAgency

F_ContractAwardAgency

5

Project Number

projectNumber

projectNumber

F_ProjectNumber

Project Number

6

Is Contractor an S/MBE? What is DAS Class?

smbe

vendorCertClass

F_VendorCertClass

Certification Class

7

Actual Project Mobilization Date

mobilizationDate

mobilizationDate

F_MobilizationDate

Actual Project Mobilization Date

8

Project Value

projectValue

projectValue

F_ProjectValue

Project Value

9

Percent Completed to Date

percentComplete

percentCompleteToDate

F_PercentCompleteToDate

Percent Completed To Date

10

Is this a FINAL Report?

finalReport

isFinalReport

F_IsFinalReport

Is This a Final Report?

11

Estimated Completion Date

completionDate

estCompletionDate

F_EstCompletionDate

Estimated Completion Date

12

Report Entry Date

reportEntryDate

reportEntryDate

F_ReportEntryDate

Report Entry Date

13

Printed Name and Printed Title of Person Signing

printedAuthorizedSignature

signerName

F_SignerName

Signer Name & Title

14

Month Ending

Same as above

monthEndCalYearBottom

F_MonthEndCalYear

Combined Month Ending and Calendar Year

15

Contractor Name

Same as above

contractorNameBottom

F_ContractorName

General Contractor Name

16

Project Name

Same as above

projectNameBottom

F_ProjectName

Project Name

17

Project Number

Same as above

projectNumberBottom

F_ProjectNumber

Project Number

18

S/MBE Contractor Textbox

TBD

smbeTableAsText

F_SmbeTableAsText

SMBE Table As Text

19

S/MBE Contractor Name

contractorName


F_SubtierCompany

Sub-Tier Company

20

DAS Class

dasClass


F_SubtierDasClass

DAS Class

21

Total Contract Amount

totalContractAmount


F_TotalContractAmount

Total Contract Amount

22

Total Payment this Month

totalPaymentThisMonth


F_TotalMonthlyPayment

Total Payment this Month

23

Total Payment to Date

totalPaymentToDate


F_TotalPaymentToDate

Total Payment to Date

24Page Numbers #1 and #2**generated from Process**


25Initials**physically filled by person submitting form**



----------------------------------------------------------------------------

//Confirm dialogue box after clicking button to create and return PDF
app.getSharedData().downloadPdfConfirm = function() {
app.setSuppressWarning(true);
require(["dijit/Dialog", "dijit/form/Button", "dojo/domReady!"], function (Dialog,Button) {
var button = new Button({ label: "OK" });
button.setAttribute('style', 'margin-left:300px;margin-top:10px;');
button.setAttribute('class', 'lfFormActionSubmitBtn');
button.setAttribute('tabindex', '-1');
button.startup();
waitDialog = new Dialog({
title : "USDP Status Report PDF Download",
content : "Your Status Report PDF is now being generated. You should receive it within a few seconds through your browser. <br><br> After successfully downloading the PDF, click the Submit Status Report button at the bottom of the web page to finalize the web form.",
style : "width: 400px;font-size:11pt;"
});
button.placeAt(waitDialog);
button.on("click", function(event) {
waitDialog.hide();
// location.replace("https://financialapps.its.uconn.edu/");
});
});
waitDialog.show();
jQuery(".dijitDialogCloseIcon").css("display", "none");
}

//Syntax for generating PDF
app.getSharedData().FillPdfUrl = 'https://dev.api.finance.uconn.edu/webapi/generatePaymentReport';

//create function for mapping fields within object and array for textbox
app.getSharedData().FillPdf = function() {

var form = app.getForm('F_StatusReport');
var theBO = form.getBO();

var ajaxResult = '';
var beanJSON;
var obj = {};
obj.monthEnding = theBO.F_MonthEndCalYear.getValue();
obj.companyName = theBO.F_ContractorName.getValue();
obj.projectName = theBO.F_ProjectName.getValue();
obj.awardingAgencyName = theBO.F_ContractAwardAgency.getValue();
obj.projectNumber = theBO.F_ProjectNumber.getValue();
obj.smbe = theBO.F_VendorCertClass.getValue();
if(theBO.F_MobilizationDate.getValue() !== ""){
obj.mobilizationDate = theBO.F_MobilizationDate.getValue().toISOString().substring(0, 10)};

if(theBO.F_ProjectValue.getValue() !== ""){
obj.projectValue = '$' + theBO.F_ProjectValue.getValue().toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')};

// obj.percentComplete = Number(theBO.F_PercentCompleteToDate.getValue()/100).toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2});
if(theBO.F_PercentCompleteToDate.getValue() !== ""){
obj.percentComplete = theBO.F_PercentCompleteToDate.getValue().toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') + '%'};

obj.finalReport = theBO.F_IsFinalReport.getValue();
if(theBO.F_EstCompletionDate.getValue() !== ""){
obj.completionDate = theBO.F_EstCompletionDate.getValue().toISOString().substring(0, 10)};

if(theBO.F_ReportEntryDate.getValue() !== ""){
obj.reportEntryDate = theBO.F_ReportEntryDate.getValue().toISOString().substring(0, 10)};

obj.printedAuthorizedSignature = theBO.F_SignerName.getValue();


var table = app.getForm('F_StatusReport').getBO().F_SMBECTable;


//set textbox values with array
var paymentDetails = [];
var p;

var tblRow = null;
for(var i = 0; i < table.getLength(); i++) {
tblRow = table.get(i);
var company = get(tblRow , 'F_SubtierCompany').getValue();
var dasCode = get(tblRow , 'F_SubtierDasClass').getValue();
var contractAmount = get(tblRow , 'F_TotalContractAmount').getValue().toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
var monthlyPayment = get(tblRow , 'F_TotalMonthlyPayment').getValue().toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
var paymentToDate = get(tblRow , 'F_TotalPaymentToDate').getValue().toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
// var contractAmount = get(tblRow , 'F_TotalContractAmount').getValue().toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
// var monthlyPayment = get(tblRow , 'F_TotalMonthlyPayment').getValue().toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
// var paymentToDate = get(tblRow , 'F_TotalPaymentToDate').getValue().toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
paymentDetails.push({
"contractorName" : company ,
"dasClass" : dasCode,
"totalContractAmount" : contractAmount,
"totalPaymentThisMonth" : monthlyPayment,
"totalPaymentToDate" : paymentToDate
});
}


obj.paymentDetails = paymentDetails;

beanJSON = JSON.stringify(obj);
//alert(beanJSON);

//attempt call without ajax. Ajax can have issues with binary returns.
var req = new XMLHttpRequest();
req.open("POST", app.getSharedData().FillPdfUrl, true);
req.responseType = "blob";
req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
req.onload = function (event) {
var blob = req.response;
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download= "PaymentStatusReport" + "_" + obj.companyName + "_" + obj.monthEnding +".pdf";
link.click();
}
req.send(beanJSON);


}


//load external css
dojo.require("dojo.NodeList-manipulate");
dojo.ready(function(){
dojo.query("head").append('<link href="https://media.feb.uconn.edu/base/uconn-leap-style-92.min.css" rel="stylesheet" type="text/css">');
});

//load uconn cookie js
dojo.require("dojo.io.script");
dojo.ready(function() {
dojo.io.script.get({
url: "https://scripts-universityofconn.netdna-ssl.com/cookie-notification.js"
})
});

app.getSharedData().showOkDialogBox = function(title,content) {
require(["dijit/Dialog", "dijit/form/Button", "dojo/domReady!"], function (Dialog,Button) {
var okButton = new Button({ label: "OK" });
okButton.setAttribute('style', 'margin-left:370px;margin-top:10px;');
okButton.setAttribute('tabindex', '1');
okButton.startup();
genDialog = new Dialog({
title : title,
content : content,
style : "width: 470px;font-size:11pt;"
});
okButton.placeAt(genDialog);
okButton.on("click", function(event) {
genDialog.hide();
});
});
genDialog.show();
}

app.getSharedData().restUrls = {
"baseInfo": {"protocol":window.location.protocol,"host":window.location.host,"format":"json","appId":app.getUID(),"contextRoot":app.getSharedData().RegionUtils.contextRoot()},
"addCertifiedCompany": function(params) {
var template = "{protocol}//{host}/{contextRoot}/secure/org/data/{appId}/F_CertifiedCompany?format=application/{format}&freedomIdentifyKey={freedomIdentifyKey}";
return app.getSharedData().StringUtils.stringFormat(template, $.extend(params,this.baseInfo));
}
}

app.getSharedData().getDasCodeByDasText = function(dasText) {
var tVal = dasText.replace(/\s+/g,"");
if (tVal === "MBE" || tVal === "MBENone") return "MBE";
if (tVal === "SBE" || tVal === "SBENone") return "SBE";
var map = {
"AmericanIndian":"N",
"AmericanIndianDisabled":"DN",
"AmericanIndianWoman":"NW",
"AmericanIndianWomanDisabled":"DNW",
"AsianPacificAmericanandPacificIslander":"A",
"AsianPacificAmericanandPacificIslanderDisabled":"DA",
"AsianPacificAmericanandPacificIslanderWoman":"AW",
"AsianPacificAmericanandPacificIslanderWomanDisabled":"DAW",
"BlackAmerican":"B",
"BlackAmericanDisabled":"DB",
"BlackAmericanWoman":"BW",
"BlackAmericanWomanDisabled":"DBW",
"HispanicAmerican":"H",
"HispanicAmericanDisabled":"DH",
"HispanicAmericanWoman":"HW",
"HispanicAmericanWomanDisabled":"DHW",
"IberianPeninsula":"I",
"IberianPeninsulaDisabled":"DI",
"IberianPeninsulaWoman":"IW",
"IberianPeninsulaWomanDisabled":"DIW",
"Disabled":"D",
"Woman":"W",
"WomanAsian":"AW",
"WomanDisabled":"DW"
}
var value = map[tVal.substring(3)];
if (value !== "") return value;
if (value === "") return "?";
};

app.getSharedData().createYearSelectOptions = function(year,floor,ceil,isDesc=0) {
var options = [];
for (var i = year - floor; i <= year + ceil; i++) {
options.push({title:i,value:i});
}
if (isDesc) {
options.sort(function(a,b) {
return a.title + b.title;
})
}
return options;
}


/* onClick of Button for PDF download */

BO.F_CheckBox1.setValue(true);

app.getSharedData().downloadPdfConfirm();

var monthEnding = BO.F_MonthEndCalYear.getValue();
var companyName = BO.F_ContractorName.getValue();
var projectName = BO.F_ProjectName.getValue();
var awardingAgencyName = BO.F_ContractAwardAgency.getValue();
var projectNumber = BO.F_ProjectNumber.getValue();
var smbe = BO.F_VendorCertClass.getValue();
var mobilizationDate = BO.F_MobilizationDate.getValue();
var projectValue = BO.F_ProjectValue.getValue();
var percentComplete = BO.F_PercentCompleteToDate.getValue();
var finalReport = BO.F_IsFinalReport.getValue();
var completionDate = BO.F_EstCompletionDate.getValue();
var reportEntryDate = BO.F_ReportEntryDate.getValue();
var printedAuthorizedSignature = BO.F_SignerName.getValue();
var smbeTableAsText = BO.F_SmbeTableAsText.getValue();

//errors with these 2 rows
var result = app.getSharedData().FillPdf();
//var json_obj = JSON.parse(result);

/*
//From returning LDAP search, not sure if parts of this need to be used
var tbl = BO.F_firstlastsrchresults;
tbl.setValue(new Array()); //clear table

for (var i = 0; i < json_obj.length; i++){
var row = json_obj[i];
var person = app.getSharedData().LdapSearchByCriteriaResult();
person.initializeData(row);

var newRow = tbl.createNew();
// var newCols = newRow.getChildren();

get(newRow, 'F_srchfirstname').setValue(person.firstName);
get(newRow, 'F_SrchLastname').setValue(person.lastName);
get(newRow, 'F_Srchtblenetid').setValue(person.netId);
get(newRow, 'F_srchtblorg').setValue(person.deptName);
get(newRow, 'F_srchtblemail').setValue(person.email);
get(newRow, 'F_srchtblphone').setValue(person.phoneNumber);

//newCols.get(0).setValue(person.firstName);
//newCols.get(1).setValue(person.lastName);
//newCols.get(2).setValue(person.netId);
//newCols.get(3).setValue(person.deptName);
//newCols.get(4).setValue(person.email);
//newCols.get(5).setValue(person.phoneNumber);

tbl.add(newRow);

}
*/