<?php
namespace ModulesAbstract\PluginReports\Report\Model\Builder\Helpers; class BuilderHelper { public function getExportConfigs(\Entity\Invoice $invoiceEntity, \Entity\Service $serviceEntity, $component = 'price') { $rowComponents = []; $rowComponents['rowType'] = $component; $rowComponents['clientType'] = ($invoiceEntity->idCorporate ? 'legalEntity' : 'individual'); $rowComponents['currency'] = $invoiceEntity->currency; $rowComponents['serviceCode'] = $serviceEntity->serviceCode; $rowComponents['location'] = $serviceEntity->chosenOffer->location; $rowComponents['calculationType'] = $serviceEntity->offerCalculationType; return \App\Config\ExportData_Fields_ClientInvoice::getInstance()->getActiveFieldsValues($rowComponents); } public function getRowVatPercent(\Entity\Invoice $invoiceEntity, \Entity\Service $serviceEntity, array $components, $operations = ['sale', 'refund', 'storno']) { $return = []; foreach ($invoiceEntity->rowsList as $invoiceRow) { $op = ''; if ($invoiceRow['special'] == 'REFUND') { $op = 'refund'; } elseif ((bool)$invoiceRow['reversesInvoiceRowId']) { $op = 'storno'; } else { $op = 'sale'; } if ($invoiceRow['idReservationService'] == $serviceEntity->getId() && in_array($invoiceRow['rowType'], $components) && in_array($op, $operations)) { $return[$invoiceRow['rowType']] = $invoiceRow['vatPercent']; } } return $return; } }