<?php
 $servTranslations=servicesCfg_servicesTranslations(); $invoicesList=array(); if (is_array($invoiceRowsList)) { foreach($invoiceRowsList as $id=>$thisRow) { $thisTableMonth=$thisRow['tableMonth']; $thisIdInvoice=$thisRow['idInvoice']; $thisIdInvoiceRow=$thisRow['idRow']; if (!$invoicesList[$thisIdInvoice]) { $invoicesList[$thisIdInvoice]['idInvoice']=$thisRow['idInvoice']; $invoicesList[$thisIdInvoice]['invoiceNumber']=$thisRow['invoiceNumber']; $invoicesList[$thisIdInvoice]['invoiceDate']=$thisRow['invoiceDate']; $invoicesList[$thisIdInvoice]['idSupplier']=$thisRow['idSupplier']; $invoicesList[$thisIdInvoice]['supplierName']=\Entity\Supplier::select($thisRow['idSupplier'])->alias; $invoicesList[$thisIdInvoice]['currency']=$thisRow['currency']; $invoicesList[$thisIdInvoice]['statusOp']=$thisRow['statusOp']; $invoicesList[$thisIdInvoice]['blockTime']=$thisRow['blockTime']; $invRowsCntSQL="SELECT COUNT(*) FROM `$DBTSupplierInvoiceRows$thisTableMonth` WHERE idInvoice='$thisIdInvoice'"; $invoicesList[$thisIdInvoice]['rowsCountTotal']=$db->GetOne($invRowsCntSQL); if ($db->ErrorNo()) { writeLog("Could not get invoice rows count. SQL: ".$invRowsCntSQL, 'events', 9); } } $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['id']=$thisRow['idRow']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['description']=$thisRow['description']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['serviceName']=$servTranslations[$thisRow['serviceCode']]; $psgDet=getCustomerDetails($thisRow['idPassenger']); $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['idPassenger']=$thisRow['idPassenger']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['passengerName']=$psgDet['name']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['balanceDetails']=getBalanceBasicDetails($thisRow['idBalance']); $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['reservationId']=$thisRow['reservationId']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['reservationIdConverted']=\App\Utils\Db\TablesUtils::getInstance()->switchIdReservationConversion($thisRow['reservationId'], 'converted'); $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['reservationCode']=$thisRow['reservationCode']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['reservationNumber']=$thisRow['reservationNumber']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['externalReservationId']=$thisRow['externalReservationId']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['externalReservationDate']=$thisRow['externalReservationDate']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['checkIn']=$thisRow['checkIn']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['contractNumber']=$thisRow['contractNumber']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['ticketNo']=$thisRow['ticketNo']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['supplierServiceName']= \Entity\SupplierProduct::select($thisRow['idSupplierProduct'])->productName; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['countryCode']=$thisRow['countryCode']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['countryName']=\Entity\Country::select($thisRow['countryCode'])->name; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['cityId']=$thisRow['cityId']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['cityName']=\Entity\City::select($thisRow['cityId'])->name; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['rowTotalValue']=$thisRow['rowTotalValue']; $invoicesList[$thisIdInvoice]['rowsList'][$thisIdInvoiceRow]['idBalance']=$thisRow['idBalance']; $invoicesList[$thisIdInvoice]['rowsCountDisplayed']++; } } ?>