function sendEmail() { if (!isset($this->id)) { bail("must haz id to do that!"); } //trigger_error('Invoice #'.$this->id.' preparing to send email'); $d = new PHP5_Accessor(); $d->invoice = $this; $d->company = $this->getCompany(); $r = getRenderer(); $htmlcontent = $r->view('invoiceEmail', $d); $plaincontent = $r->view('invoiceEmailPlain', $d); $email_address = $this->getBillingEmailAddress() . $this->getAdditionalRecipients(); if ($this->getType() == 'dated') { $subject = 'Radical Designs Invoice ' . Util::pretty_date($this->get('end_date')); } else { $subject = 'Radical Designs Invoice ' . Util::pretty_date($this->get('date')); } $boundary = "nextPart"; $headers = 'From: ' . BILLING_EMAIL_ADDRESS . "\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary = {$boundary}\n\n"; $headers .= "This is a MIME encoded message.\n\n"; $headers .= "\n--{$boundary}\n"; // beginning \n added to separate previous content $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $headers .= $plaincontent; $headers .= "\n\n--{$boundary}\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $headers .= $htmlcontent; $email_sent = mail($email_address, $subject, "", $headers); if ($email_sent) { $this->set(array('sent_date' => Util::date_format(), 'status' => 'sent')); Render::msg('Email Sent'); } else { $this->set(array('status' => 'failed')); Render::msg('Email Failed To Send', 'bad'); } $this->save(); }
?> </td> <td><?php echo $oTrabajo['cur_nombre']; ?> </td> <td><?php echo Model_Tabladetabla::getValue($oTrabajo['tab_codigo_grupo']); ?> </td> <td><?php echo Model_Tabladetabla::getValue($oTrabajo['tab_codigo_tipo']); ?> </td> <td><?php echo Util::date_format($oTrabajo['tra_fecha_limite']); ?> </td> <td> <a class="btn btn-warning" href="/archivo/list/<?php echo $oTrabajo['tra_codigo']; ?> "><i class="icon-file icon-white"></i></a> <?php if ($perfil == 'P002') { ?> <a class="btn btn-info" href="/trabajo/edit/<?php echo $oTrabajo['tra_codigo']; ?> "><i class="icon-edit icon-white"></i></a> <a class="btn btn-danger" href="/trabajo/delete/<?php
function index($params) { $three_months_ago = Util::date_format('-3 months'); $this->data->payments = getMany('Payment', array('date_range' => array('start_date' => $three_months_ago))); $this->data->invoices = getMany('Invoices', array('date_range' => array('start_date' => $three_months_ago))); }