<?php
 $reqFilters=$R['supplier']; if (isset($reqFilters['idReservation'])) { $S['balanceInvoices']['supplier']['idReservation']=$reqFilters['idReservation']; $idsList = explode(',', $reqFilters['idReservation']); $arr = array(); foreach ($idsList as $id) { $idOrder = \App\Utils\Db\TablesUtils::getInstance()->switchIdReservationConversion(trim($id), 'normal'); $arr[] = \App\Utils\Db\TablesUtilsCached::getInstance()->getYmFromId($idOrder); } $arr = array_unique($arr); $reqFilters['invoiceIdOfficeUser'] = '0|0'; $reqFilters['invoiceStartDate'] = \Engine\DateTime::createFromIsoDate(sprintf('%s-%s-01', substr(min($arr), 0, 4), substr(min($arr), -2)))->sub(new \DateInterval("P3M"))->formatDateStd(); $invoiceEndIso = \Engine\DateTime::createFromIsoDate(sprintf('%s-%s-01', substr(max($arr), 0, 4), substr(max($arr), -2)))->add(new \DateInterval("P9M"))->formatDateIso(); if ($invoiceEndIso>TODAY_ISO) { $invoiceEndIso = TODAY_ISO; } $invoiceEndDate = \Engine\DateTime::isoToStd($invoiceEndIso); $reqFilters['invoiceEndDate'] = $invoiceEndDate; } if (isset($reqFilters['idReservationType'])) $S['balanceInvoices']['supplier']['idReservationType']=$reqFilters['idReservationType']; if (isset($reqFilters['advancedFilters'])) $S['balanceInvoices']['supplier']['advancedFilters']=$reqFilters['advancedFilters']; if (isset($reqFilters['invoiceStartDate'])) $S['balanceInvoices']['supplier']['invoiceStartDate']=$reqFilters['invoiceStartDate']; if (isset($reqFilters['invoiceEndDate'])) $S['balanceInvoices']['supplier']['invoiceEndDate']=$reqFilters['invoiceEndDate']; if (isset($reqFilters['invoiceNumber'])) $S['balanceInvoices']['supplier']['invoiceNumber']=$reqFilters['invoiceNumber']; if (isset($reqFilters['invoiceIdOfficeUser'])) $S['balanceInvoices']['supplier']['invoiceIdOfficeUser']=$reqFilters['invoiceIdOfficeUser']; if (isset($reqFilters['typeInvoiceOfficeUserName'])) $S['balanceInvoices']['supplier']['typeInvoiceOfficeUserName']=$reqFilters['typeInvoiceOfficeUserName']; if (isset($reqFilters['idSupplierAndService'])) $S['balanceInvoices']['supplier']['idSupplierAndService']=$reqFilters['idSupplierAndService']; if (isset($reqFilters['typeSupplierAndServiceName'])) $S['balanceInvoices']['supplier']['typeSupplierAndServiceName']=$reqFilters['typeSupplierAndServiceName']; if (isset($reqFilters['serviceCode'])) $S['balanceInvoices']['supplier']['serviceCode']=$reqFilters['serviceCode']; if (isset($reqFilters['balanceStatus'])) $S['balanceInvoices']['supplier']['balanceStatus']=$reqFilters['balanceStatus']; if (isset($reqFilters['text'])) $S['balanceInvoices']['supplier']['text']=$reqFilters['text']; if (isset($reqFilters['dueStartDate'])) $S['balanceInvoices']['supplier']['dueStartDate']=$reqFilters['dueStartDate']; if (isset($reqFilters['dueEndDate'])) $S['balanceInvoices']['supplier']['dueEndDate']=$reqFilters['dueEndDate']; if (isset($reqFilters['status'])) $S['balanceInvoices']['supplier']['status']=$reqFilters['status']; if (isset($reqFilters['extResDate'])) $S['balanceInvoices']['supplier']['extResDate']=$reqFilters['extResDate']; if (isset($reqFilters['extResId'])) $S['balanceInvoices']['supplier']['extResId']=$reqFilters['extResId']; if (isset($reqFilters['idPassenger'])) $S['balanceInvoices']['supplier']['idPassenger']=$reqFilters['idPassenger']; if (isset($reqFilters['typePassengerName'])) $S['balanceInvoices']['supplier']['typePassengerName']=$reqFilters['typePassengerName']; if (isset($reqFilters['idDestination'])) $S['balanceInvoices']['supplier']['idDestination']=$reqFilters['idDestination']; if (isset($reqFilters['typeDestinationName'])) $S['balanceInvoices']['supplier']['typeDestinationName']=$reqFilters['typeDestinationName']; if (isset($reqFilters['serviceStartDate'])) $S['balanceInvoices']['supplier']['serviceStartDate']=$reqFilters['serviceStartDate']; if (isset($reqFilters['serviceEndDate'])) $S['balanceInvoices']['supplier']['serviceEndDate']=$reqFilters['serviceEndDate']; if (isset($reqFilters['ticketNo'])) $S['balanceInvoices']['supplier']['ticketNo']=$reqFilters['ticketNo']; if (isset($reqFilters['idMiceProject'])) $S['balanceInvoices']['supplier']['idMiceProject']=$reqFilters['idMiceProject']; if (isset($reqFilters['typeMiceProjectName'])) $S['balanceInvoices']['supplier']['typeMiceProjectName']=$reqFilters['typeMiceProjectName']; if ($reqFilters['changeIdRes']=="number") { $S['balanceInvoices']['supplier']['idReservationType']="number"; $resIds=explode(",", $S['balanceInvoices']['supplier']['idReservation']); $resIdFinal=array(); foreach($resIds as $thisId) { $thisResNo=\Entity\Order::select( \App\Utils\Db\TablesUtils::getInstance()->switchIdReservationConversion($thisId, 'normal') )->reservationNumber; if ($thisResNo) $resIdFinal[]=$thisResNo; } $S['balanceInvoices']['supplier']['idReservation']=implode(", ", $resIdFinal); } ?>