コード例 #1
0
ファイル: Eciovni.php プロジェクト: o5/eciovni
 /**
  * Generates the invoice to the defined template.
  *
  * @param ITemplate $template
  * @return void
  */
 private function generate(ITemplate $template)
 {
     $template->setFile($this->templatePath);
     $template->registerHelper('round', function ($value, $precision = 2) {
         return number_format(round($value, $precision), $precision, ',', '');
     });
     $template->title = $this->data->getTitle();
     $template->id = $this->data->getId();
     $template->items = $this->data->getItems();
     $this->generateSupplier($template);
     $this->generateCustomer($template);
     $this->generateDates($template);
     $this->generateSymbols($template);
     $this->generateFinalValues($template);
 }
コード例 #2
0
ファイル: Eciovni.php プロジェクト: pepakriz/eciovni
 /**
  * Generate final tax sumary
  * 
  * @return array
  */
 private function getFinalTaxSummary()
 {
     $summary = array();
     foreach ($this->data->getTaxes() as $key => $value) {
         $sum = array("name" => $value, "rate" => $key, "outTax" => 0, "tax" => 0, "withTax" => 0);
         foreach ($this->data->getItems() as $item) {
             if ($item->getTax()->inUpperDecimal() == ($key + 100) / 100) {
                 $sum["outTax"] += $item->getUnits() * $item->countUntaxedUnitValue();
                 $sum["tax"] += $item->countTaxValue();
                 $sum["withTax"] += $item->countFinalValue();
             }
         }
         $summary[] = $sum;
     }
     return $summary;
 }