Example #1
0
    header("Location: /invoices/?id=notFound");
    exit;
}
if (isset($_GET['go']) && $_GET['go'] == "y") {
    $invoicesDelete = new Invoices();
    $invoicesDelete->setInvoicesid($_GET['id']);
    $invoicesDelete->deleteFromDB();
    header("Location: /invoices/?ItemDeleted=y");
    exit;
}
include "../tmpl/header.php";
$invoices = new Invoices();
// Load DB data into object
$invoices->setInvoicesid($_GET['id']);
$invoices->loadInvoices();
$all = $invoices->getAll();
if (isset($all)) {
    ?>

<div class="panel panel-info">
	<div class="panel-heading">
		<strong>Viewing <?php 
    echo $invoices->getInvoicesid();
    ?>
</strong>
	</div>
	<div class="panel-body">
		<?php 
    foreach ($all as $key => $value) {
        if (isset($value) && $value != '') {
            ?>
Example #2
0
 /**
  * Search the record for the Select2 JQuery Object by ajax
  * @return json
  */
 public function searchAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $term = $this->getParam('term');
         $id = $this->getParam('id');
         if (!empty($term)) {
             $term = "%{$term}%";
             $records = Invoices::findbyCustomFields("formatted_number LIKE ? OR number LIKE ?", array($term, $term));
             die(json_encode($records));
         }
         if (!empty($id)) {
             $records = Invoices::find($id);
             if ($records) {
                 $records = $records->toArray();
             }
             die(json_encode(array($records)));
         }
         $records = Invoices::getAll();
         die(json_encode($records));
     } else {
         die;
     }
 }