CMXX - Billing API
This commit is contained in:
@@ -2421,8 +2421,9 @@ function usageBilling($messages){
|
||||
foreach ($messages as $entry) {
|
||||
$year = $entry['year'];
|
||||
$quarter = $entry['quarter'];
|
||||
$dateObj = DateTime::createFromFormat('!m', $entry['month']);
|
||||
$month = $dateObj->format('F');
|
||||
//$dateObj = DateTime::createFromFormat('!m', $entry['month']);
|
||||
//$month = $dateObj->format('F');
|
||||
$month = $entry['month'];
|
||||
$count = $entry['count'];
|
||||
|
||||
// Initialize arrays if not already set for year, quarter, and month
|
||||
@@ -2779,7 +2780,7 @@ function blockContracts($token){
|
||||
|
||||
//GET USAGE BILLING INFORMATION
|
||||
$usage_billing = usageBilling($contract_usage_servicereports);
|
||||
$billing_cylce_usage = (($billing_plan == 1 && isset($usage_billing[$curYear]['quarters'][$curQuarter]['months'][$curMonth_name])) ? $usage_billing[$curYear]['quarters'][$curQuarter]['months'][$curMonth_name] : (($billing_plan == 2 && isset($usage_billing[$curYear]['quarters'][$curQuarter])) ? $usage_billing[$curYear]['quarters'][$curQuarter]: (($billing_plan == 3 && isset($usage_billing[$curYear])) ? $usage_billing[$curYear]: 0 )));
|
||||
$billing_cylce_usage = (($billing_plan == 1 && isset($usage_billing[$curYear]['quarters'][$curQuarter]['months'][$curMonth])) ? $usage_billing[$curYear]['quarters'][$curQuarter]['months'][$curMonth] : (($billing_plan == 2 && isset($usage_billing[$curYear]['quarters'][$curQuarter])) ? $usage_billing[$curYear]['quarters'][$curQuarter]: (($billing_plan == 3 && isset($usage_billing[$curYear])) ? $usage_billing[$curYear]: 0 )));
|
||||
|
||||
//CHECK FOR OVERRUN
|
||||
if ($billing_cylce_usage >= $billing_max){
|
||||
@@ -2789,4 +2790,18 @@ function blockContracts($token){
|
||||
ioAPIv2('/v2/contracts', $data,$token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// check date is in range ++++++++++++++
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function dateInRange($start_date, $end_date, $date_check)
|
||||
{
|
||||
// Convert to timestamp
|
||||
$start_ts = strtotime($start_date);
|
||||
$end_ts = strtotime($end_date);
|
||||
$check_ts = strtotime($date_check);
|
||||
|
||||
// Check that user date is between start & end
|
||||
return (($check_ts >= $start_ts) && ($check_ts <= $end_ts));
|
||||
}
|
||||
Reference in New Issue
Block a user