<?php /** WorkorderController init Sets the ACL for this Controller */ namespace Edoceo\Imperium; use Edoceo\Radix\DB\SQL; //$acl = Zend_Registry::get('acl'); //if ($acl->has('workorder') == false) { // $acl->add( new Zend_Acl_Resource('workorder') ); //} //$acl->allow('user','workorder'); // parent::init(); $sql = 'SELECT name AS id,name FROM base_enum WHERE link = ? ORDER BY sort'; $this->StatusList = SQL::fetch_mix($sql, array('invoice-status')); $this->ItemStatusList = SQL::fetch_mix($sql, array('invoice-item-status')); $this->UnitList = Base_Unit::getList();
// Date echo '<td class="l">Date:</td><td>' . Form::date('date', $this->WorkOrder['date']) . '</td>'; echo '</tr>'; // Requester & Kind echo '<tr>'; echo '<td class="l">Requester:</td>'; echo '<td>'; echo Form::text('requester', $this->WorkOrder['requester']); echo '</td>'; // Kind echo '<td class="l">Kind:</td><td>' . Form::select('kind', $this->WorkOrder['kind'], $this->KindList) . '</td>'; echo '</tr>'; // Rate & Units & Status echo '<tr>'; $r = Form::number('base_rate', $this->WorkOrder['base_rate'], array('class' => 'rate')); $u = Form::select('base_unit', $this->WorkOrder['base_unit'], Base_Unit::getList()); echo "<td class='l'>Base Rate:</td><td class='nw'>{$r}/{$u}</td>"; // Status echo '<td class="l">Status:</td><td>' . $this->WorkOrder['status'] . '</td>'; echo '</tr>'; // Note echo '<tr><td class="l">Note:</td><td colspan="3"><textarea name="note">' . html($this->WorkOrder['note']) . '</textarea></td></tr>'; // echo "<tr><td class='b r'>Hours Total:</td><td colspan='3' style='color: #f00; font-weight: 700; text-align: right;'>".number_format($this->data['WorkOrder']['bill_amount'],2)."</td></tr>"; // echo "<tr><td class='b r'>Parts Total:</td><td colspan='3' style='color: #f00; font-weight: 700; text-align: right;'>".number_format($this->data['WorkOrder']['bill_amount'],2)."</td></tr>"; // Open Total echo "<tr><td class='l'>Bill Total:</td><td colspan='2' style='font-weight: 700;'>" . number_format($this->WorkOrder['bill_amount'], 2) . "</td></tr>"; echo "<tr><td class='l'>Open Total:</td><td colspan='2' style='color: #f00; font-weight: 700;'>" . number_format($this->WorkOrder['open_amount'], 2) . "</td></tr>"; echo '</table>'; // Hidden Fields & Buttons echo '<div class="cmd">'; echo Form::hidden('id', $this->WorkOrder['id']);
echo '<tr>'; echo '<td class="l">Kind:</td><td>' . Form::select('kind', $this->WorkOrderItem['kind'], WorkOrderItem::$kind_list) . '</td>'; echo '<td class="l">Date:</td><td>' . Form::date('date', $this->WorkOrderItem['date'], array('id' => 'woi_date')) . '</td>'; echo '<td>' . Form::time('time_alpha', $this->WorkOrderItem['time_alpha']) . '</td>'; echo '<td>' . Form::time('time_omega', $this->WorkOrderItem['time_omega']) . '</td>'; echo '</tr>'; // Estimate: Quantity, Rate, Unit, Tax $q = Form::number('e_quantity', $this->WorkOrderItem['e_quantity']); $r = Form::number('e_rate', $this->WorkOrderItem['e_rate']); $u = Form::select('e_unit', $this->WorkOrderItem['e_unit'], Base_Unit::getList()); $t = Form::number('e_tax_rate', tax_rate_format($this->WorkOrderItem['e_tax_rate'])); echo "<tr><td class='l'>Estimate:</td><td>{$q}</td><td><strong>@</strong>{$r}</td><td><strong>per</strong> {$u}<td class='b r'>Tax Rate:</td><td>{$t} %</td></tr>"; // Cost: Quantity, Rate, Unit, Tax $q = Form::number('a_quantity', $this->WorkOrderItem['a_quantity']); $r = Form::number('a_rate', $this->WorkOrderItem['a_rate']); $u = Form::select('a_unit', $this->WorkOrderItem['a_unit'], Base_Unit::getList()); $t = Form::number('a_tax_rate', tax_rate_format($this->WorkOrderItem['a_tax_rate'])); echo "<tr><td class='l'>Actual:</td><td>{$q}</td><td><strong>@</strong>{$r}</td><td><strong>per</strong> {$u}<td class='b r'>Tax Rate:</td><td>{$t} %</td></tr>"; // Notify echo '<tr><td class="l">'; echo '<span title="Input an email address here and a notification email will be sent">Notify:</span></td>'; echo '<td colspan="5">' . Form::text('notify', $this->WorkOrderItem['notify']) . '</td>'; echo '</tr>'; echo "<tr>"; echo "<td class='l'><span title='The Status of this Item, Completed Items will be Billed when creating an Invoice'>Status:</span></td>"; echo '<td colspan="3">'; // echo '<input name="status" type="text" value="' . $this->WorkOrderItem['status'] . '">'; echo Form::select('status', $this->WorkOrderItem['status'], $this->ItemStatusList); echo '</td>'; echo '</tr>'; echo "</table>";