<?php
$availableTableColumns = array_keys($tableColumns); $reportFilters['orderDate']['startDate'] = standard2mysqlDateConversion($reportFilters['orderDate']['startDate']); $reportFilters['orderDate']['endDate'] = standard2mysqlDateConversion($reportFilters['orderDate']['endDate']); if ($reportFilters['offerStartDate']['startDate']) { $reportFilters['offerStartDate']['startDate'] = standard2mysqlDateConversion($reportFilters['offerStartDate']['startDate'])." 00:00:00"; } if ($reportFilters['offerStartDate']['endDate']) { $reportFilters['offerStartDate']['endDate'] = standard2mysqlDateConversion($reportFilters['offerStartDate']['endDate'])." 23:59:59"; } if ($reportFilters['offerEndDate']['startDate']) { $reportFilters['offerEndDate']['startDate'] = standard2mysqlDateConversion($reportFilters['offerEndDate']['startDate'])." 00:00:00"; } if ($reportFilters['offerEndDate']['endDate']) { $reportFilters['offerEndDate']['endDate'] = standard2mysqlDateConversion($reportFilters['offerEndDate']['endDate'])." 23:59:59"; } if ($reportFilters['addTime']['startDate']) { $reportFilters['addTime']['startDate'] = standard2mysqlDateConversion($reportFilters['addTime']['startDate'])." 00:00:00"; } if ($reportFilters['addTime']['endDate']) { $reportFilters['addTime']['endDate'] = standard2mysqlDateConversion($reportFilters['addTime']['endDate'])." 23:59:59"; } $reportFilters['invoiceDate']['startDate'] = standard2mysqlDateConversion($reportFilters['invoiceDate']['startDate']); $reportFilters['invoiceDate']['endDate'] = standard2mysqlDateConversion($reportFilters['invoiceDate']['endDate']); list($reportFilters['serviceResponsibleOfficeUser']['idOffice'], $reportFilters['serviceResponsibleOfficeUser']['idUser']) = explode("|", $reportFilters['serviceResponsibleOfficeUser']['id']); list($reportFilters['orderResponsibleOfficeUser']['idOffice'], $reportFilters['orderResponsibleOfficeUser']['idUser']) = explode("|", $reportFilters['orderResponsibleOfficeUser']['id']); $reportFilters['invoiceCorporate'] = $reportFilters['invoiceClientCorporate']['id']; $reportFilters['invoiceCustomer'] = $reportFilters['invoiceClientCustomer']['id']; $reportFilters['offerSupplier'] = $reportFilters['offerSupplier']['id']; $reportFilters['serviceStatusOp'] = (array)$reportFilters['serviceStatusOp']; $reportFilters['serviceStatusFin'] = (array)$reportFilters['serviceStatusFin']; $reportFilters['serviceBalanced'] = (array)$reportFilters['serviceBalanced']; $reportExtraFilters = []; if ($reportFilters['invoiceCorporate']) { $reportExtraFilters['invoiceCorporate'] = \Entity\Corporate::select($reportFilters['invoiceCorporate'])->fullDuplicatedCorporatesGroup; } if ($reportFilters['invoiceCustomer']) { $reportExtraFilters['invoiceCustomer'] = \Entity\Customer::select($reportFilters['invoiceCustomer'])->fullDuplicatedCustomersGroup; } if ($reportFilters['corporateGroups']) { $reportFilters['corporateGroups'] = $reportFilters['corporateGroups']['d']; } if ($reportFilters['corporateGroups']) { $corporateGroupsHelper = new \App\ReportsData\Helpers\PartnerGroups\Corporate(); $corporateGroupsHelper->setGroupElementsLinear($reportFilters['corporateGroups']); $reportExtraFilters['corporatesInGroups'] = $corporateGroupsHelper->getPartnerIdsList(); } if ($reportFilters['supplierGroups']) { $reportFilters['supplierGroups'] = $reportFilters['supplierGroups']['d']; } if ($reportFilters['supplierGroups']) { $supplierGroupsHelper = new \App\ReportsData\Helpers\PartnerGroups\Supplier(); $supplierGroupsHelper->setGroupElementsLinear($reportFilters['supplierGroups']); $reportExtraFilters['suppliersInGroups'] = $supplierGroupsHelper->getPartnerIdsList(); } try { include(__DIR__."/reportData_executeSQL.php"); include(__DIR__."/reportData_otherFields.php"); include(__DIR__."/reportData_loopRecords.php"); } catch (\DBException $e) { killReport("Could not run SQL in report. SQL error: ".$e->getMessage()); } catch (\Exception $e) { killReport("Could not process report. Error: ".$e->getMessage()); } 