Example #1
0
    }
    $result = $order->getSearchInvoice($keyword, $page, $offset = 10);
    $smarty->assign('ordercount', count($result));
    $smarty->assign('page', $page);
    $smarty->assign('pagecount', ceil(count($result) / $offset));
    $smarty->assign('orders', $result);
    $smarty->assign('content', $smarty->fetch('invoice.tpl'));
} elseif (isset($_GET['action']) && $_GET['action'] == 'deleteinvoice') {
    $id = $_GET['id'];
    $chalan_no = $_GET['chalan_no'];
    $order->deleteInvoice($id, $chalan_no);
    header('Location: ' . FRONTEND . 'invoice.php');
    exit;
} elseif (isset($_GET['action']) && $_GET['action'] == 'paidinvoice') {
    $id = $_GET['id'];
    $order->markInvoicedPaid($id);
    header('Location: ' . FRONTEND . 'invoice.php');
    exit;
} else {
    $page = 1;
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    $orders = $order->getOrders($page, $offset = 10);
    $smarty->assign('ordercount', $order->getInvoiceCount());
    $smarty->assign('page', $page);
    $smarty->assign('pagecount', ceil($order->getInvoiceCount() / $offset));
    $smarty->assign('orders', $orders);
    $smarty->assign('content', $smarty->fetch('invoice.tpl'));
}
$smarty->assign('action', 'invoice');