public function page_expenses()
 {
     $action = isset($_GET['action']) ? $_GET['action'] : 'list';
     $type = isset($_GET['type']) ? $_GET['type'] : 'pv';
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
     $template = '';
     switch ($action) {
         case 'new':
             if ($type == 'payment_voucher') {
                 $template = dirname(__FILE__) . '/views/expense/payment-voucher.php';
             } elseif ($type == 'vendor_credit') {
                 $template = dirname(__FILE__) . '/views/expense/vendor-credit.php';
             }
             break;
         case 'view':
             $transaction = Model\Transaction::find($id);
             $template = dirname(__FILE__) . '/views/expense/single.php';
             break;
         default:
             $template = dirname(__FILE__) . '/views/expense/transaction-list.php';
             break;
     }
     if (file_exists($template)) {
         include $template;
     }
 }
Beispiel #2
0
 public function prepare()
 {
     $this->model = Model\Transaction::create(['order' => $this->order, 'data' => json_encode($this->toArray(), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)]);
     $this['order_id'] = $this->model->getKey();
 }