<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class SummenHonorarjournal extends DruckListeZahlung
{
  public function getListID()
  {
    return 8;
  }

  

  public function getListTyp()
  {
    return '6';
  }

  

  public function loadFactoryDefaults()
  {
    parent::loadFactoryDefaults();
    
    $this->setTitle1();
  }

  

  public function setTitle1()
  {
    $this->settings->title1 = 'Honorarjournal';
  }

  

  
  public function _prepare($pKnr = '')
  {
    parent::_prepare($pKnr);

    
    
    $this->spaltenbeginnary = array(3, 32);
    $this->spaltenbreiteary = array(30.5, 9);
  }

  


  

  
  protected function _printDruckListe($pKurs = '')
  {
    $this->pdf->ln(4.5);
    $this->pdf->CellAtX('3%', '', '', '', '', '', 1);
    $this->pdf->ln(8.5);

    
    

    
    $summeHonorar = 0;
    $summeFahrtkosten = 0;
    $summeSpesen = 0;
    $summeSonstige = 0;
    
    foreach ($this->zahlungary as $zahlung) {
      switch ($zahlung->art) {
            case 1: $summeHonorar += $this->mop->stringToFloat($zahlung->betrag);
              break;
            case 2: $summeHonorar += $this->mop->stringToFloat($zahlung->betrag);
              break;
            case 3: $summeFahrtkosten += $this->mop->stringToFloat($zahlung->betrag);
              break;
            case 4: $summeSpesen += $this->mop->stringToFloat($zahlung->betrag);
              break;
            default: $summeSonstige += $this->mop->stringToFloat($zahlung->betrag);
              break;
          }
    }

        
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Buchungsart', 'B', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[1] . '%', 'Betrag', 'B', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    $this->pdf->ln($this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', '', '', '', '', '38%', 1, 0);
    $this->pdf->ln(0.5 * $this->height);

    
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Honorar', '', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[1] . '%', $this->mop->floatToString($summeHonorar), '', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    $this->pdf->ln($this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Fahrtkosten', '', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[1] . '%', $this->mop->floatToString($summeFahrtkosten), '', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    $this->pdf->ln($this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Spesen', '', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[1] . '%', $this->mop->floatToString($summeSpesen), '', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    $this->pdf->ln($this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Sonst.', '', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX($this->spaltenbeginnary[1] . '%', $this->mop->floatToString($summeSonstige), '', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    $this->pdf->ln($this->height);

    $this->pdf->ln(2.5);
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', '', '', '', '', '38%', 1, 0);
    $this->pdf->ln(3.5);

    
    $this->pdf->CellAtX($this->spaltenbeginnary[0] . '%', 'Summe', 'B', '', '', $this->spaltenbreiteary[0] . '%', '', $this->height);
    $this->pdf->CellAtX('32%', $this->mop->floatToString($summeHonorar + $summeFahrtkosten + $summeSpesen + $summeSonstige), 'B', 'R', '', $this->spaltenbreiteary[1] . '%', '', $this->height);
    
    $this->getFussnote4HonorarJournal();
  }

  
}