From a02c1cd5799a062a6f92ffeba56d0b62cea3fcd4 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 29 Oct 2019 17:40:12 +0100 Subject: [PATCH] Added FORMATTER form_formatNullToStringNumber: formats NULL to '0.00' Now this is used to display 0.00 in Betrag-column when the value is null. --- .../views/lehre/lehrauftrag/acceptLehrauftrag.php | 14 ++++++++++++++ .../lehre/lehrauftrag/acceptLehrauftragData.php | 2 +- .../views/lehre/lehrauftrag/approveLehrauftrag.php | 14 ++++++++++++++ .../lehre/lehrauftrag/approveLehrauftragData.php | 2 +- .../views/lehre/lehrauftrag/orderLehrauftrag.php | 14 ++++++++++++++ .../lehre/lehrauftrag/orderLehrauftragData.php | 2 +- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 6ab0c722c..ad563bd5b 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -126,6 +126,20 @@ $this->load->view( } } + // ----------------------------------------------------------------------------------------------------------------- + // Formatters - changes display information, not the data itself + // ----------------------------------------------------------------------------------------------------------------- + + // Formats null values to a string number '0.00' + var form_formatNulltoStringNumber = function(cell){ + if (cell.getValue() == null){ + return '0.00'; + } + else { + return cell.getValue(); + } + } + // ----------------------------------------------------------------------------------------------------------------- // Header filter // ----------------------------------------------------------------------------------------------------------------- diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index a9b96d30d..c14c72f39 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -370,7 +370,7 @@ $filterWidgetArray = array( stunden: {align:"right", headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}, width: "5%"}, - betrag: {align:"right", + betrag: {align:"right", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}, width: "8%"}, diff --git a/application/views/lehre/lehrauftrag/approveLehrauftrag.php b/application/views/lehre/lehrauftrag/approveLehrauftrag.php index 242cc1d6d..6e8c38e29 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftrag.php @@ -151,6 +151,20 @@ $this->load->view( } } + // ----------------------------------------------------------------------------------------------------------------- + // Formatters - changes display information, not the data itself + // ----------------------------------------------------------------------------------------------------------------- + + // Formats null values to a string number '0.00' + var form_formatNulltoStringNumber = function(cell){ + if (cell.getValue() == null){ + return '0.00'; + } + else { + return cell.getValue(); + } + } + // ----------------------------------------------------------------------------------------------------------------- // Header filter // ----------------------------------------------------------------------------------------------------------------- diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index 5b797d865..f446e4352 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -390,7 +390,7 @@ $filterWidgetArray = array( stunden: {align:"right", headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}}, - betrag: {align:"right", + betrag: {align:"right", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}}, vertrag_id: {visible: false}, diff --git a/application/views/lehre/lehrauftrag/orderLehrauftrag.php b/application/views/lehre/lehrauftrag/orderLehrauftrag.php index 5a28b5884..f9673f8eb 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftrag.php @@ -150,6 +150,20 @@ $this->load->view( } } + // ----------------------------------------------------------------------------------------------------------------- + // Formatters - changes display information, not the data itself + // ----------------------------------------------------------------------------------------------------------------- + + // Formats null values to a string number '0.00' + var form_formatNulltoStringNumber = function(cell){ + if (cell.getValue() == null){ + return '0.00'; + } + else { + return cell.getValue(); + } + } + // ----------------------------------------------------------------------------------------------------------------- // Header filter // ----------------------------------------------------------------------------------------------------------------- diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 0f952b421..3d4c204c3 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -395,7 +395,7 @@ $filterWidgetArray = array( headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}}, stundensatz: {visible: false}, - betrag: {align:"right", + betrag: {align:"right", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},