<?php
 function getBalanceBasicDetails($idBalance) { global $db, $DBTInvoiceBalances, $_LANG; if (!$idBalance) return 0; $thisTm = \App\Utils\Db\TablesUtils::getInstance()->getYmFromId($idBalance); if ($thisTm<200001) return 0; $balanceDetailsSQL="SELECT balanceType, balanceStatus, balanceNumber, balanceDate, balanceCode, balanceName, addTime, idAddUser, confirmTime, idConfirmUser FROM `$DBTInvoiceBalances$thisTm` WHERE id='".$idBalance."'"; $balanceDetailsArr=$db->GetRow($balanceDetailsSQL); if (!is_array($balanceDetailsArr)) { writeLog("Could not get balance details. SQL: ".$balanceDetailsSQL, 'events', 10); return 0; } $balanceDetailsArr['balanceTypeName']=$_LANG['balanceInvoices']['balanceDetails']['type'][$balanceDetailsArr['balanceType']]; $balanceDetailsArr['balanceStatusName']=$_LANG['balanceInvoices']['balanceDetails']['status'][$balanceDetailsArr['balanceStatus']]; return $balanceDetailsArr; } function getReservationIdentifiers($idRes, $idType) { $return=array('id'=>'', 'code'=>'', 'number'=>''); if (!$idRes) return $return; if ($idType!='id' and $idType!='code' and $idType!='number') return $return; global $db, $DBTReservations; if ($idType=="id") { $idr=\App\Utils\Db\TablesUtils::getInstance()->switchIdReservationConversion($idRes, 'normal'); $tt=\App\Utils\Db\TablesUtils::getInstance()->getYmFromId($idr); $resDetSQL="SELECT reservationCode, reservationNumber, convertedId FROM `$DBTReservations$tt` WHERE id='$idr'"; $resDet=$db->GetRow($resDetSQL); $return['id']=\App\Utils\Db\TablesUtils::getInstance()->switchIdReservationConversion($idRes, 'converted'); $return['number']=$resDet['reservationNumber']; $return['code']=$resDet['reservationCode']; if ($db->ErrorNo()) writeLog("Could not get reservation id details.", 'events', 9); } if ($idType=="code") { $return['code']=$idRes; } if ($idType=="number") { $return['number']=$idRes; } return $return; } function getLocationDetails($locationCode) { $codes=preg_split('#[ |*,:]#', $locationCode); $countryCode=$codes[0]; $cityId=$codes[1]; if (!$countryCode and !is_numeric($cityId)) return; $return['countryCode']=$countryCode; $return['countryName']=\Entity\Country::select($countryCode)->name; $return['cityId']=$cityId; $return['cityName']=\Entity\City::select($cityId)->name; return $return; } 