<?php
namespace ModulesAbstract\PluginReports\Report\Model\EntityExtends; class Offer extends \App\Entity\Utils\Extension_GetAttributeAbstract { public function getAttribute($var) { if ($var == 'supplierTotal') { return $this->entity->__get('supplierWorkValue') + $this->entity->__get('supplierWorkVat'); } if ($var == 'taxTotal') { return $this->entity->__get('taxWorkValue') + $this->entity->__get('taxWorkVat'); } if ($var == 'commissionTotal') { return $this->entity->__get('commissionWorkValue') + $this->entity->__get('commissionWorkVat'); } if ($var == 'discountTotal') { return $this->entity->__get('discountWorkValue') + $this->entity->__get('discountWorkVat'); } if ($var == 'vatTotal') { return 0 + $this->entity->__get('supplierWorkVat') + $this->entity->__get('taxWorkVat') + $this->entity->__get('commissionWorkVat') - $this->entity->__get('discountWorkVat'); } if ($var == 'valueTotal') { return 0 + $this->entity->__get('supplierWorkValue') + $this->entity->__get('taxWorkValue') + $this->entity->__get('commissionWorkValue') - $this->entity->__get('discountWorkValue'); } if ($var == 'offerItemDefault') { $offerItemIds = array_keys($this->entity->__get('offerItems')); return \Entity\OfferItem::select(reset($offerItemIds)); } if ($var == 'vatCalculations') { return \App\Config\Services_Calculations_OfferVat::getInstance()->getCalculationDetails( $this->entity->__get('serviceCode'), $this->entity->__get('locationCode'), $this->entity->__get('calculationType') ); } if ($var == 'duration') { $duration = 1; $fields = $this->entity->getFields(); if ($fields[$var]) { $duration = $fields[$var]; } return $duration; } } }