Пример #1
0
<?php

require_once 'checkSession.php';
$display = false;
$extraction = new extraction();
$actualYears = date('y');
$actualMonth = date('m');
$debDateYear = '01-01-' . $actualYears;
$endDateYear = '31-12-' . $actualYears;
$debDateMonth = '01-' . $actualMonth . '-' . $actualYears;
$endDateMonth = date('t-m-y', strtotime($actualYears . '-' . $actualMonth . '-' . '31'));
$ordersYear = $extraction->getOrdersWithDate($debDateYear, $endDateYear);
$ordersMonth = $extraction->getOrdersWithDate($debDateMonth, $endDateMonth);
//Calcul of year turnover
$yearTurnover = 0;
foreach ($ordersYear as $order) {
    $yearTurnover += $order->getPrice();
}
$yearTurnover = number_format($yearTurnover, 2, ',', ' ');
//Calcul of month turnover
$monthTurnover = 0;
foreach ($ordersMonth as $order) {
    $monthTurnover += $order->getPrice();
}
$monthTurnover = number_format($monthTurnover, 2, ',', ' ');
//Calcul of the period if set
if (isset($_GET["dateDeb"]) && $_GET["dateDeb"] != "" && isset($_GET["dateEnd"]) && $_GET["dateEnd"] != "") {
    //Check if the period is in the new or the old Biothys
    $dateMigration = "15-08-15";
    $tsdateMigration = DateTime::createFromFormat('j-m-y', $dateMigration)->getTimestamp();
    $display = true;