From c225ae6ae1e1fcfd7a2e6296709e65ad561a5ae8 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 2 Dec 2019 18:28:55 +1100 Subject: [PATCH] added summary figure for total --- html/bts_client_invoice_template.html | 9 ++++++--- ts.php | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/html/bts_client_invoice_template.html b/html/bts_client_invoice_template.html index d2e813c..b40e7c4 100644 --- a/html/bts_client_invoice_template.html +++ b/html/bts_client_invoice_template.html @@ -60,7 +60,8 @@ Name of Service NDIS code Total Hours - + Unit Price + Total {{/has_summary}} @@ -70,7 +71,8 @@ {{tos}} {{ndis}} {{Hours}} - + {{unitprice}} + {{tos_total}} {{/summary}} @@ -80,7 +82,8 @@ Name of Service NDIS code Total Hours - + Unit Price + Sum: {{overall_total}} diff --git a/ts.php b/ts.php index 83f59af..ee2c0b5 100644 --- a/ts.php +++ b/ts.php @@ -1465,17 +1465,23 @@ ZOT; { $response['nojob'] = true; } - + $response['overall_total'] = 0; foreach ($summary as $key => $val) { + $unitprice = $price->get_tos_price($key); + $tos_total = $val * $price->get_tos_price($key); + $response['overall_total'] += $tos_total; $response['summary'][] = array( 'ndis' => $key, 'tos' => $price->get_tos_full_str($key), + 'unitprice'=> $unitprice, 'Hours'=> sprintf("%0.2f", $val), + 'tos_total'=> sprintf("%0.2f", $tos_total), ); } if (count($summary) > 0){ $response['has_summary'] = true; + $response['overall_total'] = sprintf("%0.2f", $response['overall_total'] ); }