From d28922ed24632b02f14fa1deb6168e7a0c9c5ae6 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Thu, 5 Feb 2026 09:34:33 -0700 Subject: [PATCH] Made change to Billing Customizer to format total cost as a decimal --- .../table/ONPRC_BillingCustomizer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/onprc_billing/src/org/labkey/onprc_billing/table/ONPRC_BillingCustomizer.java b/onprc_billing/src/org/labkey/onprc_billing/table/ONPRC_BillingCustomizer.java index 3c678ea9d..804757c78 100644 --- a/onprc_billing/src/org/labkey/onprc_billing/table/ONPRC_BillingCustomizer.java +++ b/onprc_billing/src/org/labkey/onprc_billing/table/ONPRC_BillingCustomizer.java @@ -180,8 +180,17 @@ private void addTotalCost(AbstractTableInfo ti) if (ti.getColumn("totalCost") == null && unitCost != null && ti.getColumn("quantity") != null) { - SQLFragment sql = new SQLFragment("(" + ExprColumn.STR_TABLE_ALIAS + ".unitCost * " + ExprColumn.STR_TABLE_ALIAS + ".quantity)"); - ExprColumn totalCost = new ExprColumn(ti, "totalCost", sql, JdbcType.DOUBLE, ti.getColumn("unitCost"), ti.getColumn("quantity")); + SQLFragment sql = new SQLFragment( + "CAST(ROUND((" + ExprColumn.STR_TABLE_ALIAS + ".unitCost * " + + ExprColumn.STR_TABLE_ALIAS + ".quantity), 2) AS DECIMAL(18,2))"); + ExprColumn totalCost = new ExprColumn( + ti, + "totalCost", + sql, + JdbcType.DECIMAL, + ti.getColumn("unitCost"), + ti.getColumn("quantity") + ); totalCost.setLabel("Total Cost"); totalCost.setFormat("$###,##0.00"); ti.addColumn(totalCost);