CMXX - Update billing report
This commit is contained in:
@@ -22,15 +22,15 @@ switch ($permission) {
|
|||||||
$whereclause = '';
|
$whereclause = '';
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
$whereclause = '';
|
$whereclause = 'WHERE u.view IN (4,5)';
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||||
$whereclause = 'WHERE accounthierarchy like :condition ';
|
$whereclause = 'WHERE c.accounthierarchy like :condition AND u.view IN (1,2,3)';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
||||||
$whereclause = 'WHERE accounthierarchy like :condition ';
|
$whereclause = 'WHERE c.accounthierarchy like :condition AND u.view IN (1,2,3)';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +53,11 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
}
|
}
|
||||||
elseif ($v[0] == 'search') {
|
elseif ($v[0] == 'search') {
|
||||||
//build up search
|
//build up search
|
||||||
$clause .= ' AND reference like :'.$v[0];
|
$clause .= ' AND c.reference like :'.$v[0];
|
||||||
}
|
}
|
||||||
elseif ($v[0] == 'servicetool') {
|
elseif ($v[0] == 'servicetool') {
|
||||||
//build up search
|
//build up search
|
||||||
$clause .= ' AND servicetool like :'.$v[0];
|
$clause .= ' AND c.servicetool like :'.$v[0];
|
||||||
}
|
}
|
||||||
else {//create clause
|
else {//create clause
|
||||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||||
@@ -72,15 +72,15 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
//Define Query
|
//Define Query
|
||||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||||
//Request for total rows
|
//Request for total rows
|
||||||
$sql = 'SELECT count(*) as count FROM contracts '.$whereclause.'';
|
$sql = 'SELECT count(*) as count FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.'';
|
||||||
}
|
}
|
||||||
elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
||||||
//SQL for Paging
|
//SQL for Paging
|
||||||
$sql = 'SELECT * FROM contracts '.$whereclause.'';
|
$sql = 'SELECT * FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.'';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//SQL for Paging
|
//SQL for Paging
|
||||||
$sql = 'SELECT * FROM contracts '.$whereclause.' LIMIT :page,:num_products';
|
$sql = 'SELECT * FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.' LIMIT :page,:num_products';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ switch ($permission) {
|
|||||||
$whereclause = '';
|
$whereclause = '';
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
$whereclause = '';
|
$whereclause = 'WHERE u.view IN (4,5)';
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||||
$whereclause = 'WHERE accounthierarchy like :condition ';
|
$whereclause = 'WHERE accounthierarchy like :condition AND u.view IN (1,2,3)';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
||||||
$whereclause = 'WHERE accounthierarchy like :condition ';
|
$whereclause = 'WHERE accounthierarchy like :condition AND u.view IN (1,2,3)';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +53,11 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
}
|
}
|
||||||
elseif ($v[0] == 'search') {
|
elseif ($v[0] == 'search') {
|
||||||
//build up search
|
//build up search
|
||||||
$clause .= ' AND reference like :'.$v[0];
|
$clause .= ' AND c.reference like :'.$v[0];
|
||||||
}
|
}
|
||||||
elseif ($v[0] == 'servicetool') {
|
elseif ($v[0] == 'servicetool') {
|
||||||
//build up search
|
//build up search
|
||||||
$clause .= ' AND servicetool like :'.$v[0];
|
$clause .= ' AND c.servicetool like :'.$v[0];
|
||||||
}
|
}
|
||||||
else {//create clause
|
else {//create clause
|
||||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||||
@@ -72,15 +72,15 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
//Define Query
|
//Define Query
|
||||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||||
//Request for total rows
|
//Request for total rows
|
||||||
$sql = 'SELECT count(*) as count FROM contracts '.$whereclause.'';
|
$sql = 'SELECT count(*) as count FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.'';
|
||||||
}
|
}
|
||||||
elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
elseif (isset($criterias['list']) && $criterias['list'] =='') {
|
||||||
//SQL for Paging
|
//SQL for Paging
|
||||||
$sql = 'SELECT * FROM contracts '.$whereclause.'';
|
$sql = 'SELECT * FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.'';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//SQL for Paging
|
//SQL for Paging
|
||||||
$sql = 'SELECT * FROM contracts '.$whereclause.' LIMIT :page,:num_products';
|
$sql = 'SELECT * FROM contracts c JOIN users u ON c.createdby = u.username '.$whereclause.' LIMIT :page,:num_products';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ $status = isset($_GET['status']) ? '&status='.$_GET['status'] : '';
|
|||||||
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
|
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
|
||||||
|
|
||||||
//SET DEFAULT VALUES
|
//SET DEFAULT VALUES
|
||||||
$ye = (isset($_GET['year'])? $_GET['year'] : $curYear);
|
$ye = ((isset($_GET['year']) && $_GET['year'] !='' )? $_GET['year'] : $curYear);
|
||||||
$mo = (isset($_GET['month'])? $_GET['month'] : '');
|
$mo = ((isset($_GET['month']) && $_GET['month'] !='')? $_GET['month'] : $curMonth_name);
|
||||||
$qu = ((isset($_GET['month']) ? (int)ceil(date("n",strtotime($mo)) / 3): $curQuarter));
|
$qu = ((isset($_GET['month']) ? (int)ceil(date("n",strtotime($mo)) / 3): $curQuarter));
|
||||||
|
|
||||||
// Determine the URL
|
// Determine the URL
|
||||||
@@ -157,10 +157,11 @@ $view .= '
|
|||||||
$view .= '
|
$view .= '
|
||||||
<div class="content-block">
|
<div class="content-block">
|
||||||
<div class="table">
|
<div class="table">
|
||||||
|
'.$ye.' - '.$qu.' - '.$mo.'
|
||||||
<table class="sortable">
|
<table class="sortable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.$contract_id.'</th>
|
<th>#</th>
|
||||||
<th>'.$contract_status.'</th>
|
<th>'.$contract_status.'</th>
|
||||||
<th>'.$contract_account.'</th>
|
<th>'.$contract_account.'</th>
|
||||||
<th>'.$contract_type.'</th>
|
<th>'.$contract_type.'</th>
|
||||||
@@ -168,8 +169,9 @@ $view .= '
|
|||||||
<th>'.$contract_start_date.'</th>
|
<th>'.$contract_start_date.'</th>
|
||||||
<th>'.$contract_end_date.'</th>
|
<th>'.$contract_end_date.'</th>
|
||||||
<th>'.$contract_reference.'</th>
|
<th>'.$contract_reference.'</th>
|
||||||
<th>BillingCount</th>
|
<th>'.$contract_billing_count.'</th>
|
||||||
<th>'.$contract_service.'</th>
|
<th>'.$contract_service_2.'</th>
|
||||||
|
<th>'.$contract_overrun.'</th>
|
||||||
<th>'.$general_actions.'</th>
|
<th>'.$general_actions.'</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -247,6 +249,10 @@ $view .= '
|
|||||||
//GetPartnerDetails
|
//GetPartnerDetails
|
||||||
$partner_data = json_decode($response['accounthierarchy'],true);
|
$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_percentage = ($billing_run != 0) ? round((($billing_run/$usage_service_count)*100),2) : 0;
|
||||||
|
$usage_per_status = ($usage_percentage < 100) ? 'enabled' : 'disabled';
|
||||||
$view .= '
|
$view .= '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$response['rowID'].'</td>
|
<td>'.$response['rowID'].'</td>
|
||||||
@@ -259,6 +265,7 @@ $view .= '
|
|||||||
<td>'.$response['reference'].'</td>
|
<td>'.$response['reference'].'</td>
|
||||||
<td>'.$billing_run.'</td>
|
<td>'.$billing_run.'</td>
|
||||||
<td>'.$response['service_count'].' </td>
|
<td>'.$response['service_count'].' </td>
|
||||||
|
<td><span class="status '.$usage_per_status .'">'.$usage_percentage.'</span></td>
|
||||||
<td><a href="index.php?page=contract&rowID='.$response['rowID'].'" class="btn_link">'.$general_view .'</a></td>
|
<td><a href="index.php?page=contract&rowID='.$response['rowID'].'" class="btn_link">'.$general_view .'</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
';
|
';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ define('service','dashboard,profile,assets,equipments,equipment,equipment_manage
|
|||||||
/*Admin*/
|
/*Admin*/
|
||||||
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,application');
|
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,application');
|
||||||
/*AdminPlus*/
|
/*AdminPlus*/
|
||||||
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles');
|
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles');
|
||||||
/*Build*/
|
/*Build*/
|
||||||
define('build','buildtool,buildtool,application');
|
define('build','buildtool,buildtool,application');
|
||||||
/*Distribution*/
|
/*Distribution*/
|
||||||
|
|||||||
@@ -526,6 +526,10 @@ $contract_billing3 = 'Annual';
|
|||||||
|
|
||||||
$contract_service = 'Number of service events based on billingplan';
|
$contract_service = 'Number of service events based on billingplan';
|
||||||
|
|
||||||
|
$contract_billing_count = 'Verbraucht';
|
||||||
|
$contract_service_2 = 'Vertraglich';
|
||||||
|
$contract_overrun = 'Abweichung';
|
||||||
|
|
||||||
$contract_id = 'Vertrags-ID';
|
$contract_id = 'Vertrags-ID';
|
||||||
$contract_account = 'Konto';
|
$contract_account = 'Konto';
|
||||||
$contract_type = 'Typ';
|
$contract_type = 'Typ';
|
||||||
|
|||||||
@@ -525,6 +525,10 @@ $contract_billing3 = 'Anual';
|
|||||||
|
|
||||||
$contract_service = 'Número de eventos de servicio basado en el plan de facturación';
|
$contract_service = 'Número de eventos de servicio basado en el plan de facturación';
|
||||||
|
|
||||||
|
$contract_billing_count = 'Consumido';
|
||||||
|
$contract_service_2 = 'Contratado';
|
||||||
|
$contract_overrun = 'Desviacion';
|
||||||
|
|
||||||
$contract_id = 'ID de Contrato';
|
$contract_id = 'ID de Contrato';
|
||||||
$contract_account = 'Cuenta';
|
$contract_account = 'Cuenta';
|
||||||
$contract_type = 'Tipo';
|
$contract_type = 'Tipo';
|
||||||
|
|||||||
@@ -531,6 +531,10 @@ $contract_billing3 = 'Jaarlijks';
|
|||||||
|
|
||||||
$contract_service = 'Aantal service events obv betaalschema';
|
$contract_service = 'Aantal service events obv betaalschema';
|
||||||
|
|
||||||
|
$contract_billing_count = 'Verbruikt';
|
||||||
|
$contract_service_2 = 'Gecontracteerd';
|
||||||
|
$contract_overrun = 'Afwijking';
|
||||||
|
|
||||||
$contract_id = 'Contractnummer';
|
$contract_id = 'Contractnummer';
|
||||||
$contract_account = 'Klant';
|
$contract_account = 'Klant';
|
||||||
$contract_type = 'Type';
|
$contract_type = 'Type';
|
||||||
|
|||||||
@@ -524,6 +524,10 @@ $contract_billing3 = 'Anual';
|
|||||||
|
|
||||||
$contract_service = 'Número de eventos de serviço baseado no plano de faturamento';
|
$contract_service = 'Número de eventos de serviço baseado no plano de faturamento';
|
||||||
|
|
||||||
|
$contract_billing_count = 'Consumido';
|
||||||
|
$contract_service_2 = 'Contratado';
|
||||||
|
$contract_overrun = 'Desvio';
|
||||||
|
|
||||||
$contract_id = 'ID do Contrato';
|
$contract_id = 'ID do Contrato';
|
||||||
$contract_account = 'Conta';
|
$contract_account = 'Conta';
|
||||||
$contract_type = 'Tipo';
|
$contract_type = 'Tipo';
|
||||||
|
|||||||
@@ -526,6 +526,10 @@ $contract_billing3 = 'Annual';
|
|||||||
|
|
||||||
$contract_service = 'Number of service events based on billingplan';
|
$contract_service = 'Number of service events based on billingplan';
|
||||||
|
|
||||||
|
$contract_billing_count = 'Consumed';
|
||||||
|
$contract_service_2 = 'Contracted';
|
||||||
|
$contract_overrun = 'Deviation';
|
||||||
|
|
||||||
$contract_id = 'Contract ID';
|
$contract_id = 'Contract ID';
|
||||||
$contract_account = 'Account';
|
$contract_account = 'Account';
|
||||||
$contract_type = 'Type';
|
$contract_type = 'Type';
|
||||||
|
|||||||
Reference in New Issue
Block a user