Skip to content

Instantly share code, notes, and snippets.

@ritacse
Last active April 16, 2025 12:28
Show Gist options
  • Save ritacse/f3b6cfa7c0d8c46655d0cfb0196e0525 to your computer and use it in GitHub Desktop.
Save ritacse/f3b6cfa7c0d8c46655d0cfb0196e0525 to your computer and use it in GitHub Desktop.
var BindreportDataToHTML = function () {
ReceiveSummary = _.chain(ReceiveSummary)
.sortBy('companyID')
.sortBy('purchaseIndentID')
.sortBy('itemID')
.value();
var html = '';
console.log(ReceiveSummary);
var totalReceiveValue = _.reduce(ReceiveSummary, function (total, obj) { return total + obj.receiveValue }, 0);
for (var i = 0; i < ReceiveSummary.length; i++) {
html += '<tr align="center">' +
'<td >' + (i + 1) + '</td>' +
`<td class="rptMRR" style="color:blue; cursor:pointer;" id="${ReceiveSummary[i].mrR_ID}">${ReceiveSummary[i].mrR_ID}</td>` + // click event will call
`<td class="rptPurchaseOrder" style="color:blue; cursor:pointer;" id="${ReceiveSummary[i].pO_ID}">${ReceiveSummary[i].pO_ID}</td>` + // click event will call
'<td>' + moment(ReceiveSummary[i].receiveDateTime).format('MMM DD, YYYY hh:mm A') + '</td>' +
'<td style="text-align:left;">' + ReceiveSummary[i].storeName + '</td>' +
'<td style="text-align:left;">' + ReceiveSummary[i].supplierName + '</td>' +
'<td style="text-align:right;">' + ReceiveSummary[i].receiveValue + '</td>' +
'</tr>';
}
$("#tblReceivesummary").append(html);
}
document.addEventListener('click', function (event) {
var id = event.target.id;
debugger
var TEMP = 'c5dee8d5819e488099be42ec693e2075';
var url = '';
if (event.target.classList.contains('rptPurchaseOrder')) {
var POIds = id.split(', ');
for (var i = 0; i < POIds.length; i++) {
url = '/PurchaseOrder/PDDetailsReport?POID=' + POIds[i].trim() + '_' + TEMP; // Local Report
}
}
else if (event.target.classList.contains('rptMRR')) {
var MRIds = id.split(', ');
for (var i = 0; i < MRIds.length; i++) {
url = '/MaterialReceive/RptMaterialReceiveWithQCDetails?MRRId=' + MRIds[i].trim() + '_' + TEMP;
}
}
if (url != '')
window.open(url, '_blank');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment