$smarty->assign('invoice_no', $invoice_no); $invoice_date = strftime(DATE_FORMAT, strtotime($invoice->invoice_date)); $smarty->assign('invoice_date', $invoice_date); $payment_date = $invoice->processed_date == 'null' || $invoice->processed_date == "0000-00-00 00:00:00" ? "" : strftime(DATE_FORMAT, strtotime($invoice->processed_date)); $smarty->assign('payment_date', $payment_date); ///$invoice_to $emp = Employer::find_by_username($username); $invoice_to = $emp->address(); $invoice_to = str_replace(":", "<br />", $invoice_to); $name = $emp->full_name(); $invoice_to = $name . "<br />" . $invoice_to; $smarty->assign('invoice_to', $invoice_to); $payment_to = "Jobberland<br />Address1 <br />Address1<br />Code"; $smarty->assign('payment_to', $payment_to); //item $package = Package::find_by_id($invoice->fk_package_id); $description = $package->package_desc; $smarty->assign('description', $description); $package_name = $package->package_name; $smarty->assign('package_name', $package_name); $qty = $package->package_job_qty; $smarty->assign('qty', $qty); $amount = format_number($invoice->amount); $smarty->assign('amount', $amount); $vat = "17.5"; $vat_cal = $vat / 100; $vat_cal = $vat_cal + 1; $sub_total = $amount / $vat_cal; $sub_total = format_number($sub_total); $smarty->assign('sub_total', $sub_total); $vat_amount = $sub_total / 100 * $vat;
if (!isset($_REQUEST['package_id'])) { redirect_to(BASE_URL . "employer/credits/"); } $user_id = $session->get_user_id(); $username = $session->get_username(); $user = Employer::find_by_id($user_id); $packageinvoice = new PackageInvoice(); $packageinvoice->fk_employer_id = $user_id; //$user->username; $packageinvoice->fk_package_id = (int) $_REQUEST['package_id']; if ($_REQUEST['action'] == 'post' || $_REQUEST['action'] == 'premium_post') { $pack_invoice = $packageinvoice->check_invoice(); if ($pack_invoice) { $invoice_id = $pack_invoice->id; } else { $package = Package::find_by_id($_REQUEST['package_id']); if ($package) { $status = 'Selected'; $packageinvoice->invoice_date = gmdate("Y-m-d H:i:s"); $packageinvoice->processed_date = "null"; $packageinvoice->package_status = $status; $packageinvoice->fk_employer_id = $user_id; $packageinvoice->fk_package_id = $package->id; $packageinvoice->posts_quantity = $package->package_job_qty; $packageinvoice->standard = $package->standard; $packageinvoice->spotlight = $package->spotlight; $packageinvoice->cv_views = $package->cv_views; $packageinvoice->amount = $package->package_price; $packageinvoice->item_name = $package->package_name; $packageinvoice->subscr_date = ""; $packageinvoice->payment_method = "";
<?php $_SESSION['direct_to_emp'] = "credits/"; include_once 'sessioninc.php'; $username = $session->get_username(); $user_id = $session->get_user_id(); $invoice = new PackageInvoice(); $invoice->fk_employer_id = $user_id; $recent_orders = $invoice->orders_by_user(); if ($recent_orders) { $package_list = array(); $i = 1; foreach ($recent_orders as $list) { $pack = Package::find_by_id($list->fk_package_id); $package_list[$i]['invoice_date'] = strftime(DATE_FORMAT, strtotime($list->invoice_date)); $package_list[$i]['processed_date'] = $list->processed_date == "0000-00-00 00:00:00" || $list->processed_date == 'null' ? "Not Confirmed" : strftime(DATE_FORMAT, strtotime($list->processed_date)); $package_list[$i]['id'] = $list->id; $package_list[$i]['item_name'] = $list->item_name; $package_list[$i]['package_desc'] = $pack->package_desc; $package_list[$i]['posts_quantity'] = $list->posts_quantity; $package_list[$i]['standard'] = $list->standard; $package_list[$i]['spotlight'] = $list->spotlight; $package_list[$i]['cv_views'] = $list->cv_views; $package_list[$i]['package_status'] = $list->package_status; $package_list[$i]['amount'] = $list->amount; $package_list[$i]['package_id'] = $list->fk_package_id; $i++; } $smarty->assign('recent_orders', $package_list); } $smarty->assign('dont_include_left', true);
$package->package_job_qty = $_SESSION['package']['qty'] = $_POST['txt_qty']; $package->standard = $_SESSION['package']['standard'] = $_POST['txt_standard']; $package->spotlight = $_SESSION['package']['spotlight'] = $_POST['txt_spotlight']; $package->cv_views = $_SESSION['package']['cv_views'] = $_POST['txt_cv_views']; $package->is_active = $_SESSION['package']['active'] = $_POST['txt_active']; if ($package->save()) { $session->message("<div class='success'> Package has been successfully updated. </div>"); redirect_to("list_packages.php"); die; } else { $message = "<div class='error'> following error(s) found: <ul> <li />"; $message .= join(" <li /> ", $package->errors); $message .= " </ul></div>"; } } else { $package = Package::find_by_id($_GET['id']); $_SESSION['package']['name'] = $package->package_name; $_SESSION['package']['desc'] = $package->package_desc; $_SESSION['package']['price'] = $package->package_price; $_SESSION['package']['qty'] = $package->package_job_qty; $_SESSION['package']['standard'] = $package->standard; $_SESSION['package']['spotlight'] = $package->spotlight; $_SESSION['package']['cv_views'] = $package->cv_views; $_SESSION['package']['active'] = $package->is_active; } $NoYes = get_lang("select", "NoYes"); $smarty->assign('NoYes', $NoYes); $smarty->assign('id', $_GET['id']); $_SESSION['package']['standard'] = !isset($_SESSION['package']['standard']) ? "Y" : $_SESSION['package']['standard']; $html_title = SITE_NAME . " Edit Package "; $smarty->assign('lang', $lang);