function renderHtml() { $this->document->setTitle('Betalinger'); if ($this->getForm()->validate()) { $betalinger = VIH_Model_Betaling::search($this->getForm()->exportValue('search')); $data['caption'] = 'Betalinger'; } elseif ($this->query('find') == 'alle') { $betaling = new VIH_Model_Betaling(); $betalinger = $betaling->getList(); $data['caption'] = 'Alle betalinger'; } elseif ($this->query('find') == 'elevforeningen') { $betaling = new VIH_Model_Betaling(); $betalinger = $betaling->getList('elevforeningen'); $data['caption'] = 'Elevforeningen'; } else { $betaling = new VIH_Model_Betaling(); $betalinger = $betaling->getList('not_approved'); $data['caption'] = 'Afventende betalinger'; } $data['betalinger'] = $betalinger; $this->document->addOption('Alle', $this->url(null, array('find' => 'alle'))); $this->document->addOption('Elevforeningen', $this->url(null, array('find' => 'elevforeningen'))); $tpl = $this->template->create('betalinger/betalinger'); return $tpl->render($this, $data); }
function renderHtml() { $tilmelding = new VIH_Model_KortKursus_Tilmelding($this->name()); if (is_numeric($this->query('sletdeltager'))) { $deltager = new VIH_Model_KortKursus_Tilmelding_Deltager($tilmelding, $this->query('sletdeltager')); $deltager->delete(); } elseif ($this->query('action') == 'sendemail') { if ($tilmelding->sendEmail()) { $historik = new VIH_Model_Historik('kortekurser', $tilmelding->get('id')); if (!$historik->save(array('type' => 'kode', 'comment' => 'Kode sendt med e-mail'))) { throw new Exception('Historikken kunne ikke gemmes'); } } else { throw new Exception('E-mailen kunne ikke sendes'); } } if ($this->query('slet_historik_id')) { $historik = new VIH_Model_Historik(intval($this->query('slet_historik_id'))); $historik->delete(); } $deltagere = $tilmelding->getDeltagere(); $historik_object = new VIH_Model_Historik('kortekurser', $tilmelding->get("id")); $betalinger = new VIH_Model_Betaling('kortekurser', $tilmelding->get("id")); if ($this->query('registrer_betaling')) { if ($betalinger->save(array('type' => 'giro', 'amount' => $this->query('beloeb')))) { $betalinger->setStatus('approved'); return new k_SeeOther($this->url()); } else { throw new Exception("Betalingen kunne ikke gemmes. Det kan skyldes et ugyldigt beløb"); } } $tilmelding->loadBetaling(); $this->document->setTitle('Tilmelding #' . $tilmelding->getId()); $this->document->addOption('Tilbage til liste', $this->url('../')); $this->document->addOption('Ret', $this->url('edit')); $this->document->addOption('Slet', $this->url(null, array('delete'))); if ($tilmelding->get('email')) { $this->document->addOption('E-mail', $this->url('email')); } $this->document->addOption('Kundens side', KORTEKURSER_LOGIN_URI . $tilmelding->get('code')); $data = array('deltagere' => $deltagere, 'indkvartering' => !$tilmelding->kursus->isFamilyCourse(), 'type' => $tilmelding->get('keywords'), 'vis_slet' => 'ja'); $historik = array('historik' => $historik_object->getList(), 'tilmelding' => $tilmelding); $historik_tpl = $this->templates->create('tilmelding/historik'); $betaling_data = array('caption' => 'Afventende betalinger', 'betalinger' => $betalinger->getList('not_approved'), 'msg_ingen', 'Der er ingen afventende betalinger.'); $prisoversigt_data = array('tilmelding' => $tilmelding); $prisoversigt_tpl = $this->templates->create('kortekurser/tilmelding/prisoversigt'); $deltager_tpl = $this->templates->create('kortekurser/deltagere'); $betaling_tpl = $this->templates->create('tilmelding/betalinger'); $tilmelding = array('tilmelding' => $tilmelding, 'historik_object' => $historik_object, 'deltagere' => $deltager_tpl->render($this, $data), 'status' => $tilmelding->get('status'), 'prisoversigt' => $prisoversigt_tpl->render($this, $prisoversigt_data), 'historik' => $historik_tpl->render($this, $historik), 'betalinger' => $betaling_tpl->render($this, $betaling_data)); $tpl = $this->templates->create('kortekurser/tilmelding'); return $tpl->render($this, $tilmelding); }
function renderPdf() { $tilmelding = new VIH_Model_LangtKursus_Tilmelding($this->context->name()); $tilmelding->loadBetaling(); $betalinger = new VIH_Model_Betaling('langekurser', $tilmelding->get("id")); $font = 'Arial'; $size = '12'; $size_tabel = "10"; $margin_left = 30; $margin_top = 30; $margin_right = 30; $margin_bottom = 30; $line_height = 6; $pdf = $this->fpdf; $pdf->Open(); $pdf->AddPage(); $pdf->SetFont($font, '', $size); $pdf->setMargins($margin_left, $margin_top, $margin_right); // $pdf->SetAutoPageBreak(1, $margin_bottom); $pdf->AliasNbPages(); $content_width = $pdf->w - $margin_left - $margin_right; $pdf->setY(30); $modtager = '#' . $tilmelding->get("id") . "\n" . $tilmelding->get("navn") . "\n" . $tilmelding->get("adresse") . "\n" . $tilmelding->get("postnr") . " " . $tilmelding->get("postby"); $pdf->Write(5, $modtager); $pdf->setY(50); $pdf->Cell(0, 10, "Vejle, " . date('d-m-Y'), '', '', 'R'); $pdf->setY(80); $pdf->SetFont($font, 'B', $size); $pdf->Text($pdf->getX(), $pdf->getY(), 'Kursus'); $pdf->SetFont($font, '', $size_tabel); // $pdf->Line($pdf->getX(), $pdf->getY(), $pris_width, $pdf->getY()); $pris_width = $margin_left + $content_width - 30; // Her kan der s�ttes lidt minus p�, for at rykke h�jremargin l�ngere ind p� siden. $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Kursus'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->kursus->getKursusNavn()), $pdf->getY(), $tilmelding->kursus->getKursusNavn()); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Kursusstart'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->kursus->getDateStart()->format('%d-%m-%Y')), $pdf->getY(), $tilmelding->kursus->getDateStart()->format('%d-%m-%Y')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Kursusslut'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->kursus->getDateEnd()->format('%d-%m-%Y')), $pdf->getY(), $tilmelding->kursus->getDateEnd()->format('%d-%m-%Y')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + 12); $pdf->SetFont($font, 'B', $size); $pdf->Text($pdf->getX(), $pdf->getY(), 'Prisoversigt'); $pdf->SetFont($font, '', $size_tabel); // $pdf->Line($pdf->getX(), $pdf->getY(), $pris_width, $pdf->getY()); $pris_width = $margin_left + $content_width - 30; // Her kan der s�ttes lidt minus p�, for at rykke h�jremargin l�ngere ind p� siden. $pdf->SetFont($font, '', $size_tabel); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Tilmeldingsgebyr'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('pris_tilmeldingsgebyr')), $pdf->getY(), $tilmelding->get('pris_tilmeldingsgebyr')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Ugepris (' . round($tilmelding->get('pris_uge'), 0) . ' kr * ' . $tilmelding->get('ugeantal') . ' uger)'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('pris_uge') * $tilmelding->get('ugeantal')), $pdf->getY(), $tilmelding->get('pris_uge') * $tilmelding->get('ugeantal')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); if ($tilmelding->get('pris_materiale') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Materialegebyr'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('pris_materiale')), $pdf->getY(), $tilmelding->get('pris_materiale')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('pris_rejsedepositum') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Rejsebetaling'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('pris_rejsedepositum')), $pdf->getY(), $tilmelding->get('pris_rejsedepositum')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('pris_afbrudt_ophold') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Afbrudt ophold'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('pris_afbrudt_ophold')), $pdf->getY(), $tilmelding->get('pris_afbrudt_ophold')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('aktiveret_tillaeg') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Statsstøtte aktiveret'); $pdf->Text($pris_width - $pdf->getStringWidth(round($tilmelding->get('aktiveret_tillaeg'))), $pdf->getY(), round($tilmelding->get('aktiveret_tillaeg'))); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('statsstotte') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), '- Indvandrerstøtte'); $pdf->Text($pris_width - $pdf->getStringWidth('- ' . $tilmelding->get('statsstotte') * $tilmelding->get('ugeantal')), $pdf->getY(), '- ' . $tilmelding->get('statsstotte') * $tilmelding->get('ugeantal')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('kompetencestotte') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), '- Kompetencestøtte'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('kompetencestotte') * $tilmelding->get('ugeantal')), $pdf->getY(), $tilmelding->get('kompetencestotte') * $tilmelding->get('ugeantal')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('elevstotte') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), '- Elevstøtte'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('elevstotte') * $tilmelding->get('ugeantal')), $pdf->getY(), $tilmelding->get('ugeantal_elevstotte') * $tilmelding->get('elevstotte')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } if ($tilmelding->get('kommunestotte') > 0) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), '- Kommunestøtte'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get('kommunestotte')), $pdf->getY(), $tilmelding->get('kommunestotte')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); } $pdf->SetFont($font, 'B', $size_tabel); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'I alt'); $pdf->Text($pris_width - $pdf->getStringWidth($tilmelding->get("pris_total")), $pdf->getY(), $tilmelding->get("pris_total")); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $pris_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->SetFont($font, 'B', $size); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Betalingsrater'); $pdf->SetFont($font, '', $size_tabel); $betalt = ''; $rater_samlet = 0; $rater_samlet = $tilmelding->get('pris_tilmeldingsgebyr'); $rater_1 = 75; $rater_2 = 150; $rater_3 = $content_width + $margin_left; $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), $tilmelding->get("date_created_dk")); $pdf->Text($rater_1, $pdf->getY(), "Tilmeldingsgebyr"); $pdf->Text($rater_2 - $pdf->getStringWidth(number_format($tilmelding->get('pris_tilmeldingsgebyr'), 2, ',', '.')), $pdf->getY(), number_format($tilmelding->get('pris_tilmeldingsgebyr'), 2, ',', '.')); if ($tilmelding->get('betalt') >= $rater_samlet) { $pdf->Text($rater_3 - $pdf->getStringWidth("Betalt"), $pdf->getY(), "Betalt"); } $pdf->Line($pdf->getX(), $pdf->getY() + 2, $rater_3, $pdf->getY() + 2); $i = 1; foreach ($tilmelding->getRater() as $rate) { $rater_samlet += $rate["beloeb"]; $betalt = ''; $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), $rate['dk_betalingsdato']); $pdf->Text($rater_1, $pdf->getY(), $i . ". rate"); $pdf->Text($rater_2 - $pdf->getStringWidth(number_format($rate['beloeb'], 2, ',', '.')), $pdf->getY(), number_format($rate['beloeb'], 2, ',', '.')); if ($tilmelding->get('betalt') >= $rater_samlet) { $pdf->Text($rater_3 - $pdf->getStringWidth("Betalt"), $pdf->getY(), "Betalt"); } $pdf->Line($pdf->getX(), $pdf->getY() + 2, $rater_3, $pdf->getY() + 2); $i++; } $pdf->setY($pdf->getY() + $line_height); $pdf->SetFont($font, 'B', $size); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Betalinger'); $pdf->SetFont($font, '', $size_tabel); $betaling_width = $margin_left + $content_width; foreach ($betalinger->getList() as $betaling) { $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), $betaling->get('date_created_dk')); $pdf->Text($betaling_width - $pdf->getStringWidth(number_format($betaling->get('amount'), 2, ',', '.')), $pdf->getY(), number_format($betaling->get('amount'), 2, ',', '.')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $betaling_width, $pdf->getY() + 2); } $pdf->SetFont($font, 'B', $size_tabel); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "Samlet betalt"); $pdf->Text($betaling_width - $pdf->getStringWidth(number_format($tilmelding->get("betalt"), 2, ',', '.')), $pdf->getY(), number_format($tilmelding->get("betalt"), 2, ',', '.')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $betaling_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "Restance"); $pdf->Text($betaling_width - $pdf->getStringWidth(number_format($tilmelding->get("saldo"), 2, ',', '.')), $pdf->getY(), number_format($tilmelding->get("saldo"), 2, ',', '.')); $pdf->Line($pdf->getX(), $pdf->getY() + 2, $betaling_width, $pdf->getY() + 2); $pdf->setY($pdf->getY() + $line_height); $pdf->SetFont($font, 'B', $size); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Betalingsoplysninger'); $pdf->SetFont($font, '', $size_tabel); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "Du kan indbetale raterne ved kontooverførsel til vores konto i Jyske Bank: 7244-1469664"); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "eller vha. Dankort på " . LANGEKURSER_LOGIN_URI . $tilmelding->get('code')); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "(husk forskel på små og store bogstaver)"); $pdf->setY($pdf->getY() + $line_height); $pdf->SetFont($font, 'B', $size); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), 'Bemærkninger'); $pdf->SetFont($font, '', $size_tabel); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "Bemærk at individuel supplerende elevstøtte og kommunestøtte er skattepligtig B-indkomst."); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "I henhold til lovgivningen trækkes tilsagn om kommunestøtte, indvandrerstøtte og kompetencestøtte"); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "tilbage, hvis eleven ikke gennemfører mindst 12 uger af et kursusforløb. Dette beløb skal altså"); $pdf->setY($pdf->getY() + $line_height); $pdf->Text($pdf->getX(), $pdf->getY(), "efterbetales ved afbrydelse af kursus i utide."); return $pdf->Output(); }
function renderHtml() { $tilmelding = $this->getTilmelding(); if ($this->query('get_prices')) { if (!$tilmelding->getPriserFromKursus()) { throw new Exception('Priser kunne ikke hentes'); } else { return new k_SeeOther($this->url()); } } $historik = new VIH_Model_Historik('langekurser', $tilmelding->get("id")); $betalinger = new VIH_Model_Betaling('langekurser', $tilmelding->get("id")); $rater = $tilmelding->getRater(); if ($this->query('action') == 'sendemail') { if ($tilmelding->sendEmail()) { if (!$historik->save(array('type' => 'kode', 'comment' => 'Kode sendt med e-mail'))) { throw new Exception('Historikken kunne ikke gemmes'); } } else { throw new Exception('E-mailen kunne ikke sendes'); } } elseif ($this->query('action') == 'opretrater') { if (!$tilmelding->opretRater()) { throw new Exception('Raterne kunne ikke oprettes'); } else { return new k_SeeOther($this->url()); } } elseif ($this->query('registrer_betaling')) { if ($betalinger->save(array('type' => 'giro', 'amount' => $this->query('beloeb')))) { $betalinger->setStatus('approved'); } else { throw new Exception("Betalingen kunne ikke gemmes. Det kan skyldes et ugyldigt beløb"); } } elseif ($this->query('slet_historik_id')) { $historik = new VIH_Model_Historik(intval($this->query('slet_historik_id'))); $historik->delete(); } $tilmelding->loadBetaling(); $this->document->setTitle('Tilmelding #' . $tilmelding->get('id')); $this->document->addOption('Til kursus', $this->url('../../' . $tilmelding->kursus->get('id'))); $this->document->addOption('Tilmeldinger', $this->url('../../' . $tilmelding->kursus->get('id') . '/tilmeldinger')); $this->document->addOption('Ret', $this->url(null, array('edit'))); $this->document->addOption('Delete', $this->url(null, array('delete'))); $this->document->addOption('Protokol', $this->url('../../../protokol/holdliste/' . $tilmelding->get('id'))); $this->document->addOption('Brev', $this->url('brev')); $this->document->addOption('F*g', $this->url('f*g')); $this->document->addOption('Diplom', $this->url('diplom')); $this->document->addOption('Kundens side', LANGEKURSER_LOGIN_URI . $tilmelding->get('code')); $opl_data = array('tilmelding' => $tilmelding); $pris_data = array('tilmelding' => $tilmelding); $betal_data = array('betalinger' => $betalinger->getList('not_approved'), 'caption' => 'Betalinger'); $hist_data = array('tilmelding' => $tilmelding, 'historik' => $historik->getList()); $opl_tpl = $this->templates->create('langekurser/tilmelding/oplysninger'); $pris_tpl = $this->templates->create('langekurser/tilmelding/prisoversigt'); $betal_tpl = $this->templates->create('tilmelding/betalinger'); $his_tpl = $this->templates->create('tilmelding/historik'); $data = array('tilmelding' => $tilmelding, 'oplysninger' => $opl_tpl->render($this, $opl_data), 'prisoversigt' => $pris_tpl->render($this, $pris_data), 'betalinger' => $betal_tpl->render($this, $betal_data), 'historik' => $his_tpl->render($this, $hist_data)); // rater if (count($rater) > 0) { $rater_tpl = $this->templates->create('langekurser/tilmelding/rater'); $rater_data = array('tilmelding' => $tilmelding); $data['rater'] = $rater_tpl->render($this, $rater_data); } else { if ($tilmelding->kursus->antalRater() > 0) { $data['rater'] = '<p><a href="' . $this->url(null, array('get_prices' => $tilmelding->get('id'))) . '">Hent priserne fra kurset</a>. Der er endnu ikke oprettet nogen rater <a href="' . $this->url(null, array('action' => 'opretrater')) . '">Opret →</a></p>'; } else { $data['rater'] = '<p>Der er endnu ikke oprettet rater på selve kurset. Dem skal du lige oprette først <a href="' . $this->url('../../' . $tilmelding->getKursus()->get('id') . '/rater') . '">Opret →</a></p>'; } } $data['message'] = ''; $tpl = $this->templates->create('langekurser/tilmelding'); return $tpl->render($this, $data); }