From 693982df275c33264402c0c3cf2ec53a36360492 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 9 Oct 2025 12:23:51 -0700 Subject: [PATCH 1/4] Modified program to include "transactionNUmber" as part of the invoice items "Reverse/Adjustments editing process. --- .../onprc_billing/window/ReverseChargeWindow.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js index fb7058865..d4caa1f0e 100644 --- a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js +++ b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js @@ -122,7 +122,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { filterArray: [ LABKEY.Filter.create('objectid', this.checked.join(';'), LABKEY.Filter.Types.IN) ], - columns: 'rowid,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost', + columns: 'rowid,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost,transactionNumber', scope: this, failure: LDK.Utils.getErrorCallback(), success: this.onDataLoad @@ -530,6 +530,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { chargeId: sr.getValue('chargeId'), quantity: sr.getValue('quantity'), sourceInvoicedItem: sr.getValue('objectid'), + transactionNumber: sr.getValue('transactionNumber'), //these may be overridden project: sr.getValue('project'), @@ -537,20 +538,6 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { creditedaccount: sr.getValue('creditedaccount'), unitcost: sr.getValue('unitcost') - //these are deliberately ignored - //transactionNumber: sr.getValue('transactionNumber'), - //item: sr.getValue('item'), - //itemCode: sr.getValue('itemCode'), - //category: sr.getValue('category'), - //servicecenter: sr.getValue('servicecenter'), - //faid: sr.getValue('faid'), - //lastName: sr.getValue('lastName'), - //firstName: sr.getValue('firstName'), - //department: sr.getValue('department'), - //totalcost: sr.getValue('totalcost'), - //rateId: sr.getValue('rateId'), - //exemptionId: sr.getValue('exemptionId'), - //creditaccountid: sr.getValue('creditaccountid') }; objectIds.push(sr.getValue('objectid')); From f21b16b2a276fe194294fa9efba414fe75c007cb Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 9 Oct 2025 15:55:31 -0700 Subject: [PATCH 2/4] Modified program to include "transactionNUmber" as part of the invoice items "Reverse/Adjustments editing process. --- .../queries/onprc_billing/miscCharges.query.xml | 11 +++++++++++ .../resources/schemas/onprc_billing.xml | 3 ++- .../onprc_billing/window/ReverseChargeWindow.js | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/onprc_billing/resources/queries/onprc_billing/miscCharges.query.xml b/onprc_billing/resources/queries/onprc_billing/miscCharges.query.xml index 7b284cbb5..15de3d9a1 100644 --- a/onprc_billing/resources/queries/onprc_billing/miscCharges.query.xml +++ b/onprc_billing/resources/queries/onprc_billing/miscCharges.query.xml @@ -27,6 +27,17 @@ + + Source Transaction + false + + /ONPRC/Admin/Finance + onprc_billing + invoicedItems + objectid + transactionNumber + + onprc_billing diff --git a/onprc_billing/resources/schemas/onprc_billing.xml b/onprc_billing/resources/schemas/onprc_billing.xml index 2bb09f73b..f6e728bc5 100644 --- a/onprc_billing/resources/schemas/onprc_billing.xml +++ b/onprc_billing/resources/schemas/onprc_billing.xml @@ -419,10 +419,11 @@ Source Transaction true + /ONPRC/Admin/Finance onprc_billing invoicedItems objectid - rowid + transactionNumber diff --git a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js index d4caa1f0e..fb7058865 100644 --- a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js +++ b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js @@ -122,7 +122,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { filterArray: [ LABKEY.Filter.create('objectid', this.checked.join(';'), LABKEY.Filter.Types.IN) ], - columns: 'rowid,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost,transactionNumber', + columns: 'rowid,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost', scope: this, failure: LDK.Utils.getErrorCallback(), success: this.onDataLoad @@ -530,7 +530,6 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { chargeId: sr.getValue('chargeId'), quantity: sr.getValue('quantity'), sourceInvoicedItem: sr.getValue('objectid'), - transactionNumber: sr.getValue('transactionNumber'), //these may be overridden project: sr.getValue('project'), @@ -538,6 +537,20 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { creditedaccount: sr.getValue('creditedaccount'), unitcost: sr.getValue('unitcost') + //these are deliberately ignored + //transactionNumber: sr.getValue('transactionNumber'), + //item: sr.getValue('item'), + //itemCode: sr.getValue('itemCode'), + //category: sr.getValue('category'), + //servicecenter: sr.getValue('servicecenter'), + //faid: sr.getValue('faid'), + //lastName: sr.getValue('lastName'), + //firstName: sr.getValue('firstName'), + //department: sr.getValue('department'), + //totalcost: sr.getValue('totalcost'), + //rateId: sr.getValue('rateId'), + //exemptionId: sr.getValue('exemptionId'), + //creditaccountid: sr.getValue('creditaccountid') }; objectIds.push(sr.getValue('objectid')); From 4cd1d08ff92113f8c4ca6c23899eec314d7c6b1e Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Tue, 7 Oct 2025 13:24:24 -0700 Subject: [PATCH 3/4] Update to replace sourceDoceumtn with Transaction --- .../window/ReverseChargeWindow.js | 80 +++++++++++++++---- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js index fb7058865..d87cd5df1 100644 --- a/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js +++ b/onprc_billing/resources/web/onprc_billing/window/ReverseChargeWindow.js @@ -4,6 +4,9 @@ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 * Modified jonesga October 30, 2024 * **Per Finance Issue Tracker 11380 added debit Aklias add function to allow change of debit alias when no center project is associated + * Modified [Your Name] September 29, 2025 + * **Added transaction number links to the header for easy reference to invoiced items + * **Optimized link generation to prevent script timeout on large datasets */ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { extend: 'Ext.window.Window', @@ -48,8 +51,10 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { labelWidth: 150 }, items: [{ + itemId: 'headerPanel', html: 'This helper allows you to make adjustments and reversals. Once you select the type of adjustment, look below to see an explanation of the items it will create.

' + - 'NOTE: You have selected ' + this.checked.length + ' items to be reversed or adjusted. These are based on the rows you checked on the previous grid.', + 'NOTE: You have selected ' + this.checked.length + ' items to be reversed or adjusted. These are based on the rows you checked on the previous grid.

' + + 'Loading transaction details...', style: 'padding-bottom: 10px;' },{ xtype: 'radiogroup', @@ -122,7 +127,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { filterArray: [ LABKEY.Filter.create('objectid', this.checked.join(';'), LABKEY.Filter.Types.IN) ], - columns: 'rowid,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost', + columns: 'rowid,transactionNumber,objectid,invoiceid,invoiceid/status,Id,date,project,creditedaccount,debitedaccount,rateId,exemptionId,quantity,investigatorId,chargeid,unitcost,transactionNumber', scope: this, failure: LDK.Utils.getErrorCallback(), success: this.onDataLoad @@ -134,13 +139,56 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { this.selectRowsResults = results; var missingCharge = 0; + var transactionMap = {}; + var maxLinksToShow = 20; + if (results && results.rows && results.rows.length){ - Ext4.Array.forEach(results.rows, function(r){ + for (var i = 0; i < results.rows.length; i++) { + var r = results.rows[i]; var sr = new LDK.SelectRowsRow(r); + if (!sr.getValue('chargeId')){ missingCharge++; } - }, this); + + var transNum = sr.getValue('transactionNumber'); + if (transNum && Object.keys(transactionMap).length < maxLinksToShow) { + if (!transactionMap[transNum]) { + var url = LABKEY.ActionURL.buildURL('query', 'executeQuery', null, { + schemaName: 'onprc_billing', + 'query.queryName': 'invoicedItems', + 'query.transactionNumber~eq': transNum + }); + transactionMap[transNum] = '' + Ext4.util.Format.htmlEncode(transNum) + ''; + } + } + } + } + + var headerPanel = this.down('#headerPanel'); + if (headerPanel) { + var linksHtml = ''; + var transactionLinks = []; + + for (var key in transactionMap) { + if (transactionMap.hasOwnProperty(key)) { + transactionLinks.push(transactionMap[key]); + } + } + + if (transactionLinks.length > 0) { + linksHtml = '
Transaction Numbers: ' + transactionLinks.join(', '); + if (results.rows.length > maxLinksToShow) { + linksHtml += ' (showing first ' + transactionLinks.length + ' unique transactions)'; + } + } + + headerPanel.update( + 'This helper allows you to make adjustments and reversals. Once you select the type of adjustment, look below to see an explanation of the items it will create.

' + + 'NOTE: You have selected ' + this.checked.length + ' items to be reversed or adjusted. These are based on the rows you checked on the previous grid.' + + linksHtml + ); } if (Ext4.Msg.isVisible()) @@ -192,13 +240,13 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { items.push({ html: 'This will reverse the original charges and create adjustments based on your selections below. ' + - '
    ' + - '
  • All transactions will use the date selected below, as opposed to the original transaction date.
  • ' + - '
  • The reversal will use the aliases used on the original transaction. This does not check whether the aliases are still valid.
  • ' + - '
  • If you choose to change the project, the project/alias selected will be used on the adjustment. If you leave this blank, the original project/alias will be used
  • ' + - '
  • If you select an alternate credit alias, this will be used on all adjustments. Otherwise the original credit alias will be used.' + - '
  • Note: you can leave any or all of these fields blank and create the adjustment. You will have the opportunity to view the adjustment form, which allows you to independently edit any of these values there as well.
  • ' + - '
', + '
    ' + + '
  • All transactions will use the date selected below, as opposed to the original transaction date.
  • ' + + '
  • The reversal will use the aliases used on the original transaction. This does not check whether the aliases are still valid.
  • ' + + '
  • If you choose to change the project, the project/alias selected will be used on the adjustment. If you leave this blank, the original project/alias will be used
  • ' + + '
  • If you select an alternate credit alias, this will be used on all adjustments. Otherwise the original credit alias will be used.' + + '
  • Note: you can leave any or all of these fields blank and create the adjustment. You will have the opportunity to view the adjustment form, which allows you to independently edit any of these values there as well.
  • ' + + '
', style: 'padding-bottom: 10px;' },{ xtype: 'datefield', @@ -429,7 +477,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { } //added as part of Finance 11380 update by Gary //this issues is causing error - if (this.down('#doChangedebitAlias').getValue() && !this.down('#newDebitAliasField').getValue()){ + if (this.down('#doChangedebitAlias').getValue() && !this.down('#newDebitAliasField').getValue()){ Ext4.Msg.alert('Error', 'You have checked that you want to alter the debit alias, but did not supply the new alias. Either enter an alias or uncheck the field'); return; } @@ -491,7 +539,7 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { toApply.debitedaccount = Ext4.String.trim(toApply.debitedaccount); } } - //Added by Gary as part of 11380 update + //Added by Gary as part of 11380 update if (this.down('#doChangedebitAlias').getValue()){ toApply.debitedaccount = this.down('#newDebitAliasField').getValue(); if (toApply.debitedaccount){ @@ -529,16 +577,16 @@ Ext4.define('ONPRC_Billing.window.ReverseChargeWindow', { investigatorId: sr.getValue('investigatorId'), chargeId: sr.getValue('chargeId'), quantity: sr.getValue('quantity'), - sourceInvoicedItem: sr.getValue('objectid'), + sourceInvoicedItem: sr.getValue('transactionNumber'), //these may be overridden project: sr.getValue('project'), debitedaccount: sr.getValue('debitedaccount'), creditedaccount: sr.getValue('creditedaccount'), - unitcost: sr.getValue('unitcost') + unitcost: sr.getValue('unitcost'), //these are deliberately ignored - //transactionNumber: sr.getValue('transactionNumber'), + transactionNumber: sr.getValue('transactionNumber') //item: sr.getValue('item'), //itemCode: sr.getValue('itemCode'), //category: sr.getValue('category'), From 9ce6baa0ef2a57190334a3f8830d383e3d0f9340 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Tue, 4 Nov 2025 07:14:12 -0700 Subject: [PATCH 4/4] Update of ChargeRate.js to have the end date use an Time of end of day 23:59 after creating a variable calld endofDay --- .../resources/queries/onprc_billing/chargeRates.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/onprc_billing/resources/queries/onprc_billing/chargeRates.js b/onprc_billing/resources/queries/onprc_billing/chargeRates.js index 3ee20ddab..0b8f87628 100644 --- a/onprc_billing/resources/queries/onprc_billing/chargeRates.js +++ b/onprc_billing/resources/queries/onprc_billing/chargeRates.js @@ -16,10 +16,18 @@ function beforeUpdate(row, errors){ function beforeUpsert(row, errors){ if (row.startDate){ + // normalize to date-only (00:00) row.startDate = ldkUtils.removeTimeFromDate(row.startDate); } if (row.endDate){ - row.endDate = ldkUtils.removeTimeFromDate(row.endDate); + // normalize to date-only first + var cleanDate = ldkUtils.removeTimeFromDate(row.endDate); + + // create a new date object set to 23:59 + var endOfDay = new Date(cleanDate); + endOfDay.setHours(23, 59, 0, 0); + + row.endDate = endOfDay; } } \ No newline at end of file