Skip to content

Commit 65b720a

Browse files
authored
Made change to Billing Customizer to format total cost as a decimal (#1630)
Review and approved will deploy Tonight
1 parent 3c3bb64 commit 65b720a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

onprc_billing/src/org/labkey/onprc_billing/table/ONPRC_BillingCustomizer.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,17 @@ private void addTotalCost(AbstractTableInfo ti)
180180

181181
if (ti.getColumn("totalCost") == null && unitCost != null && ti.getColumn("quantity") != null)
182182
{
183-
SQLFragment sql = new SQLFragment("(" + ExprColumn.STR_TABLE_ALIAS + ".unitCost * " + ExprColumn.STR_TABLE_ALIAS + ".quantity)");
184-
ExprColumn totalCost = new ExprColumn(ti, "totalCost", sql, JdbcType.DOUBLE, ti.getColumn("unitCost"), ti.getColumn("quantity"));
183+
SQLFragment sql = new SQLFragment(
184+
"CAST(ROUND((" + ExprColumn.STR_TABLE_ALIAS + ".unitCost * " +
185+
ExprColumn.STR_TABLE_ALIAS + ".quantity), 2) AS DECIMAL(18,2))");
186+
ExprColumn totalCost = new ExprColumn(
187+
ti,
188+
"totalCost",
189+
sql,
190+
JdbcType.DECIMAL,
191+
ti.getColumn("unitCost"),
192+
ti.getColumn("quantity")
193+
);
185194
totalCost.setLabel("Total Cost");
186195
totalCost.setFormat("$###,##0.00");
187196
ti.addColumn(totalCost);

0 commit comments

Comments
 (0)