Example #1
0
     Session::flash('info', 'Hawk monitoring has been added to this invoice, reminders will be according to cron schedule');
     $this->redirect('/invoice/view?i=' . $Invoice['id']);
     break;
 case 'no hawk':
     $Invoice->delFlag(Invoice::FLAG_HAWK);
     $Invoice->save();
     Session::flash('info', 'Hawk monitoring has been removed from this invoice');
     $this->redirect('/invoice/view?i=' . $Invoice['id']);
     break;
 case 'copy':
     // Copy Invoice
     $I_Copy = new Invoice();
     foreach (array('contact_id', 'requester', 'kind', 'status', 'base_rate', 'base_unit', 'bill_address_id', 'ship_address_id', 'note') as $x) {
         $I_Copy[$x] = $Invoice[$x];
     }
     $I_Copy->setFlag(Invoice::FLAG_OPEN);
     $I_Copy->save();
     // Copy Invoice Items
     $list = $Invoice->getInvoiceItems();
     foreach ($list as $II_Orig) {
         $II_Copy = new InvoiceItem(null);
         $II_Copy['invoice_id'] = $I_Copy['id'];
         foreach (array('quantity', 'rate', 'unit', 'name', 'note', 'tax_rate') as $x) {
             $II_Copy[$x] = $II_Orig[$x];
         }
         $II_Copy->save();
     }
     Radix::redirect('/invoice/view?i=' . $I_Copy['id']);
     break;
 case 'paid':
     // New Transaction Holder