From 0c5bd3f83ee96d6a730fa92021fb9859ad6b7c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Tue, 5 Nov 2024 16:32:12 +0100 Subject: [PATCH] CM90 - Bug report_contracts --- api/v1/get/cartests.php | 2 +- api/v2/get/billing.php | 122 +++++++++++++++++++++++++++++++++++ report_contracts_billing.php | 6 +- 3 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 api/v2/get/billing.php diff --git a/api/v1/get/cartests.php b/api/v1/get/cartests.php index ff8ece3..a08e174 100644 --- a/api/v1/get/cartests.php +++ b/api/v1/get/cartests.php @@ -28,7 +28,7 @@ if(isset($get_content) && $get_content!=''){ } elseif ($v[0] == 'search') { //build up search - $clause .= ' AND (carbrand like :'.$v[0].' OR createdby like :'.$v[0].')'; + $clause .= ' AND (carbrand like :'.$v[0].' OR createdby like :'.$v[0].' OR rowID like :'.$v[0].')'; } else {//create clause $clause .= ' AND '.$v[0].' = :'.$v[0]; diff --git a/api/v2/get/billing.php b/api/v2/get/billing.php new file mode 100644 index 0000000..468db75 --- /dev/null +++ b/api/v2/get/billing.php @@ -0,0 +1,122 @@ + $response['rowID'] , + $contract_status => $$status, + $contract_account => $partner_data['soldto'], + $contract_type => $$type, + $contract_billinglabel =>$$contract_billingplan_text, + $contract_start_date =>$response['start_date'], + $contract_end_date => $date, + $contract_reference =>$response['reference'], + $contract_billing_count =>$billing_run, + $contract_service_2 =>$response['service_count'], + $contract_overrun => $usage_percentage + ); +} + +//------------------------------------------ +//JSON_ENCODE +//------------------------------------------ +$messages = json_encode($output, JSON_UNESCAPED_UNICODE); + +//Send results +echo $messages; +?> \ No newline at end of file diff --git a/report_contracts_billing.php b/report_contracts_billing.php index 24e584c..c6ff3da 100644 --- a/report_contracts_billing.php +++ b/report_contracts_billing.php @@ -17,12 +17,12 @@ $prev_page = ($_SESSION['origin'] == 'equipments') ? $_SESSION['prev_origin_equi //create backbutton to prev_origin $back_btn_orgin = ($prev_page != '')? ''.$button_back.'':''; -/*Check if allowed +//Check if allowed if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){ header('location: index.php'); exit; } -*/ + //Defaults $contract = [ @@ -250,7 +250,7 @@ $view .= ' $partner_data = json_decode($response['accounthierarchy'],true); //SHOW USAGE PERCENTAGE - $usage_service_count = ($response['service_count'] != 0 || $response['service_count'] !='') ? $response['service_count']:1; + $usage_service_count = ($response['service_count'] > 0) ? $response['service_count']:1; $usage_percentage = ($billing_run != 0) ? round((($billing_run/$usage_service_count)*100),2) : 0; $usage_per_status = ($usage_percentage < 100) ? 'enabled' : 'disabled'; $view .= '