Exemplo n.º 1
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $ordersMapper = new Application_Model_OrdersMapper();
     if ($request->isPost()) {
         $request_type = $request->getParam("request_type", false);
         if ($request_type) {
             if ($request_type == "filter") {
                 $user_email = $request->getParam("user_email");
                 $del_type = $request->getParam("delivery_type");
                 $service_id = $request->getParam("service_id");
                 $del_date = $request->getParam("delivery_date");
                 $pickup_date = $request->getParam("pickup_date");
                 $filter_orders = $ordersMapper->filter($user_email, $del_type, $service_id, $del_date, $pickup_date);
                 //print_r($filter_orders);exit;
                 if (!$filter_orders) {
                     $paginator = false;
                 } else {
                     $paginator = Zend_Paginator::factory($filter_orders);
                     //$paginator->setItemCountPerPage();
                     $paginator->setItemCountPerPage('100');
                     $page = $request->getParam("page", 1);
                     if ($page) {
                         $paginator->setCurrentPageNumber($page);
                     }
                 }
                 $this->view->orders = $paginator;
                 $this->view->user_email = $user_email;
                 $this->view->del_type = $del_type;
                 $this->view->service_id = $service_id;
                 $this->view->del_date = $del_date;
                 $this->view->pickup_date = $pickup_date;
             } elseif ($request_type == "cancel_filter") {
                 $this->view->orders = $orders;
             } elseif ($request_type == "delete") {
                 $id = $request->getParam("id");
                 if ($ordersMapper->deleteOrderById($id)) {
                     $this->view->hasMessage = true;
                     $this->view->messageType = "success";
                     $this->view->message = "Order deleted successfully.";
                 } else {
                     $this->view->hasMessage = true;
                     $this->view->messageType = "danger";
                     $this->view->message = "Error occured while deleting. Please try again.";
                 }
             }
         }
     }
     $orders = $ordersMapper->getOrdersByStatus();
     if (empty($orders)) {
         $paginator = null;
     } else {
         $paginator = Zend_Paginator::factory($orders);
         $paginator->setItemCountPerPage(10);
         $page = $this->getRequest()->getParam("page", 1);
         $paginator->setCurrentPageNumber($page);
     }
     $this->view->orders = $paginator;
 }
Exemplo n.º 2
0
 public function changeStatusByOrderIdsAction()
 {
     try {
         $request = $this->getRequest();
         $status = $request->getParam("status");
         $order_ids = $request->getParam("order_ids");
         $orderMapper = new Application_Model_OrdersMapper();
         $order_ids = explode(",", $order_ids);
         foreach ($order_ids as $order_id) {
             $order = $orderMapper->getOrderById($order_id);
             $order->__set("order_status", $status);
             if ($orderMapper->updateOrder($order)) {
                 $meta = array("code" => 200, "message" => "Success");
             } else {
                 $meta = array("code" => 401, "message" => "Error While Updating");
             }
         }
     } catch (Exception $e) {
         $meta = array("code" => 200, "message" => $e->getMessage());
     }
     $json = json_encode($meta);
     echo $json;
 }
Exemplo n.º 3
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     $this->setElementDecorators($this->elementDecorators);
     $ordersMapper = new Application_Model_OrdersMapper();
     $orders = $ordersMapper->getOrdersByStatus();
     $order_options = array('Select Order');
     if ($orders) {
         foreach ($orders as $order) {
             $order_options[$order->__get("order_id")] = $order->__get("order_id");
         }
     }
     $delboyMapper = new Application_Model_DeliveryBoyMapper();
     $delboys = $delboyMapper->getAllDeliveryBoys();
     $delboy_options = array('Select Delivery Boy');
     if ($delboys) {
         foreach ($delboys as $delboy) {
             $delboy_options[$delboy->__get("delboy_id")] = $delboy->__get("delboy_fname") . " " . $delboy->__get('delboy_lname');
         }
     }
     $this->addElement('select', 'orders', array('label' => 'Order', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Order", 'class' => 'mws-textinput', 'multiOptions' => $order_options));
     $this->addElement('select', 'delboy_id', array('label' => 'Choose Delivery Boy', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Choose Delivery boy", 'class' => 'mws-textinput', 'multiOptions' => $delboy_options));
 }
 public function saveorderAction()
 {
     //check session
     $laundryCart = new Zend_Session_Namespace('laundryCart');
     $userInfo = new Zend_Session_Namespace('userInfo');
     $model = new Application_Model_OrdersMapper();
     $itemModel = new Application_Model_ItemsMapper();
     $itemPrice = new Application_Model_ItemPriceMapper();
     $orders = new Application_Model_Orders();
     $orderItem = new Application_Model_OrderItems();
     $orderItemModel = new Application_Model_OrderItemsMapper();
     if (isset($laundryCart->service)) {
         $totalPrice = 0;
         foreach ($laundryCart->itemprice as $key => $prices) {
             $totalPrice += $prices * $laundryCart->items[$key];
         }
         //                && isset($userInfo)){
         $orders->__set('order_user_id', 9);
         $orders->__set('order_first_name', 'Ankit');
         $orders->__set('order_last_name', 'Sharma');
         $orders->__set('order_user_email', '*****@*****.**');
         $orders->__set('order_address', 'AH 70');
         //            $orders->__set('order_phone', '123456455');
         $orders->__set('order_city', 'Ghaziabad');
         $orders->__set('order_pincode', '123456');
         $orders->__set('order_delivery_type', $laundryCart->delivery_type);
         $orders->__set('order_pickup', date('Y-m-d', strtotime($laundryCart->pickup_date)));
         $orders->__set('order_delivery', date('Y-m-d', strtotime($laundryCart->delivery_date)));
         $orders->__set('order_delivery_time', $laundryCart->delivery);
         $orders->__set('order_pickup_time', $laundryCart->pickup);
         $orders->__set('order_amount', $totalPrice);
         $orders->__set('order_payment_type', 'cash on delivery');
         $orders->__set('order_payment_status', 'unpaid');
         $orders->__set('order_service_type', implode(',', $laundryCart->service));
         if ($orderId = $model->addNewOrder($orders)) {
             //add products now
             if (isset($laundryCart->items)) {
                 foreach ($laundryCart->items as $item => $quantity) {
                     //get item details
                     $itemDetails = $itemModel->getItemById($item);
                     //save product item
                     $orderItem->__set('order_id', $orderId);
                     $orderItem->__set('order_product_name', $itemDetails->__get('item_name'));
                     $orderItem->__set('order_item_id', $itemDetails->__get('item_id'));
                     $orderItem->__set('order_type', 'service');
                     $orderItem->__set('order_service_name', $laundryCart->itemservice[$item]);
                     $orderItem->__set('order_category_name', $laundryCart->itemcategory[$item]);
                     $orderItem->__set('unit_price', $laundryCart->itemprice[$item]);
                     $orderItem->__set('total_price', $laundryCart->itemprice[$item] * $quantity);
                     $orderItem->__set('quantity', $quantity);
                     $orderItemModel->addNewOrderItem($orderItem);
                 }
             }
             $this->view->message = "Admin added successfully";
             $this->view->hasMessage = true;
             $this->view->messageType = "success";
             //session destroy
             $laundryCart->unsetAll();
             $this->_redirect('');
         } else {
             $this->view->message = "Error occured while adding. Please try again";
             $this->view->hasMessage = true;
             $this->view->messageType = "danger";
         }
     } else {
         exit("error occurred");
     }
 }
Exemplo n.º 5
0
 public function successAction()
 {
     try {
         //            $userWalletMapper = new Application_Model_UserWalletMapper();
         //            $userWallet = new Application_Model_UserWallet();
         //            $userPackagesMapper = new Application_Model_UserPackagesMapper();
         //            $userPackages = new Application_Model_UserPackages();
         $userTrackMapper = new Application_Model_UserTrackMapper();
         $userTrack = new Application_Model_UserTrack();
         $ordersMapper = new Application_Model_OrdersMapper();
         //            $packagesMapper = new Application_Model_PackagesMapper();
         $userTransactionsMapper = new Application_Model_UserTransactionsMapper();
         $userTransactions = new Application_Model_UserTransactions();
         $request = $this->getRequest();
         $status = $request->getParam("status");
         $fname = $request->getParam("firstname");
         $amount = $request->getParam("amount");
         $txnid = $request->getParam("txnid");
         $posted_hash = $request->getParam("hash");
         $product_info = $request->getParam("productinfo");
         $key = $request->getParam("key");
         $email = $request->getParam("email");
         $code = $request->getParam("bankcode");
         $salt = "dwf1Ltip";
         //test salt
         $salt = "GQs7yium";
         $retHashSeq = $salt . '|' . $status . '|||||||||||' . $email . '|' . $fname . '|' . $product_info . '|' . $amount . '|' . $txnid . '|' . $key;
         $hash = hash("sha512", $retHashSeq);
         $infos = explode("|", $product_info);
         $transaction_type = explode(":", $infos[0]);
         $transaction_type = $transaction_type[1];
         //echo $transaction_type;exit;
         $user_id = explode(":", $infos[1]);
         $user_id = $user_id[1];
         $id = explode(":", $infos[2]);
         $id = $id[1];
         $package_id = explode(":", $infos[3]);
         $package_id = $package_id[1];
         if ($user_id != 0) {
             $userTransactions->__set("trnx_user_id", $user_id);
             $userTransactions->__set("other_details", $transaction_type);
             $userTransactions->__set("gateway_transaction_id", $txnid);
             $userTransactions->__set("trnx_amount", $amount);
             $userTransactions->__set("trnx_method", $code);
             $userTransactions->__set("trnx_status", $status);
             $userTransactions->__set("trnx_order_id", $id);
             $userTransactionsMapper->addNewUserTransaction($userTransactions);
         }
         if ($hash != $posted_hash) {
             throw new Exception("Invalid Transaction");
         } else {
             $flag = TRUE;
             $this->view->flag = $flag;
             if ($transaction_type == "Package") {
                 //echo "in";
                 $package = $packagesMapper->getPackageById($package_id);
                 $number_clothes = $package->__get("no_of_clothes");
                 $number_pickups = $package->__get("no_of_pickups");
                 //echo $number_pickups;exit;
                 $validity = $package->__get("validity");
                 //echo $validity;exit;
                 $zend_date = new Zend_Date();
                 $date = $zend_date->addMonth($validity);
                 $new_date = $date->toString("dd-MM-yyyy");
                 $userTrack->__set("usertrack_user_id", $user_id);
                 $userTrack->__set("track_type", 'package');
                 $userTrack->__set("usertrack_package_id", $package_id);
                 $userTrack->__set("clothes_left", $number_clothes);
                 $userTrack->__set("clothes_availed", $number_clothes);
                 $userTrack->__set("pickups_left", $number_pickups);
                 $userTrack->__set("pickups_availed", $number_pickups);
                 $userTrack->__set("usertrack_start_date", date('Y-m-d'));
                 $userTrack->__set("usertrack_expiry_date", $new_date);
                 if ($userTrackMapper->addNewTrack(addNewTrack)) {
                     $this->view->hasMessage = true;
                     $this->view->messageType = "success";
                     $this->view->message = "Profile Updated successfully";
                 } else {
                     $this->view->hasMessage = true;
                     $this->view->messageType = "danger";
                     $this->view->message = "Error while updating";
                 }
             } elseif ($transaction_type == "Online") {
                 $order = $ordersMapper->getOrderById($id);
                 $order->__set("order_payment_status", "Paid");
                 $ordersMapper->updateOrder($order);
             }
             $this->_redirect('index/orderlist');
         }
     } catch (Exception $e) {
         $e->getMessage();
     }
 }
Exemplo n.º 6
0
 public function checkoutAction()
 {
     $user_id = 0;
     if ($this->_auth->hasIdentity()) {
         $user_id = $this->_auth->getIdentity()->user_id;
         $this->view->user_id = $user_id;
     }
     $errors = array();
     $request = $this->getRequest();
     //$delivery_type = $request->getParam("delivery_type");
     //$service_name = $request->getParam("service_name");
     //$pickup_date = $request->getParam("pickup_date");
     //$pickup_time = $request->getParam("pickup_time");
     //$delivery_date = $request->getParam("del_date");
     //$delivery_time = $request->getParam("del_time");
     $date_session = new Zend_Session_Namespace("date");
     //print_r($_SESSION);exit;
     $pickup_date = $date_session->pick_date;
     $pickup_time = $date_session->pick_time;
     $delivery_date = $date_session->del_date;
     $delivery_time = $date_session->del_time;
     $service_name = $date_session->service_id;
     $delivery_type = $date_session->del_name;
     $user_package_id = $request->getParam("user_package_id");
     $this->view->user_package_id = $user_package_id;
     //$this->view->del_name = $delivery_type;
     //$this->view->service_id = $service_name;
     //$this->view->date = $pickup_date;
     //$this->view->time = $pickup_time;
     //$this->view->del_time = $delivery_time;
     //$this->view->del_date = $delivery_date;
     $request_type = $request->getParam("request_type", false);
     $addressMapper = new Application_Model_SavedAddressesMapper();
     $usersWalletMapper = new Application_Model_UserWalletMapper();
     $userWallet = new Application_Model_UserWallet();
     $payment_type = $request->getParam("payment_type");
     if ($user_id) {
         $credit_amount = $usersWalletMapper->getUserWalletCreditByUserId($user_id);
         $debit_amount = $usersWalletMapper->getUserWalletDebitByUserId($user_id);
         $wallet_amount = $credit_amount - $debit_amount;
         $wallet_session = new Zend_Session_Namespace("wallet");
         $wallet_session->amount = $wallet_amount;
         $this->view->wallet_amount = $wallet_amount;
         $userPackagesMapper = new Application_Model_UserPackagesMapper();
         $userPackages = $userPackagesMapper->getUserPackageByUserId($user_id);
         $this->view->userPackages = $userPackages;
     }
     if ($request_type) {
         if ($request_type == "item_details") {
             $session_quantity = $request->getParam("qty");
             $session_price = $request->getParam("price");
             $session_items = $request->getParam("items");
             //print_r($session_items);exit;
             $session = new Zend_Session_Namespace("order");
             //print_r($session_quantity);
             $total = 0;
             $i = 0;
             $quantity_total = 0;
             $actual_items = array();
             $actual_qty = array();
             $actual_price = array();
             foreach ($session_items as $item) {
                 $item_id = $item;
                 $qty = $session_quantity[$i];
                 $new_price = $session_price[$i];
                 if ($qty != 0) {
                     $actual_items[] = $item_id;
                     $actual_qty[] = $qty;
                     $actual_price[] = $new_price;
                 }
                 $item_total = $qty * $new_price;
                 $total += $item_total;
                 $quantity_total += $qty;
                 $i++;
             }
             $session->quantity = $actual_qty;
             $session->price = $actual_price;
             $session->items = $actual_items;
             $session->total = $total;
             $session->quantity_total = $quantity_total;
             //print_r($actual_items);exit;
             //print_r($actual_qty);exit;
             //$this->view->actual_qty = $actual_qty;
             //$this->view->actual_items = $actual_items;
             //print_r($_SESSION);
             //exit;
         } elseif ($request_type == "payment_type") {
             $ordersMapper = new Application_Model_OrdersMapper();
             $orders = new Application_Model_Orders();
             $orderItemsMapper = new Application_Model_OrderItemsMapper();
             $orderItems = new Application_Model_OrderItems();
             $savedAddressMapper = new Application_Model_SavedAddressesMapper();
             $session = new Zend_Session_Namespace("order");
             $quantity = $session->quantity;
             $price = $session->price;
             $items = $session->items;
             //print_r($items);exit;
             $i = 0;
             if (empty($payment_type)) {
                 $errors[] = "Select a Payment Type";
             }
             if (count($errors) == 0) {
                 $add_session = new Zend_Session_Namespace("address");
                 $user_name = $add_session->username;
                 $pincode = $add_session->pincode;
                 $landmark = $add_session->landmark;
                 $city = $add_session->city;
                 $address = $add_session->address;
                 $state = $add_session->state;
                 $number = $add_session->phone;
                 $guest_email = $add_session->email;
                 $revised_amount = $request->getParam("revised_amount");
                 $discount_amount = $request->getParam("discount_amount");
                 //$number = $saved->__get("contact_person_phn");
                 //$address = $saved->__get("saved_address");
                 //$locality = $saved->__get("address_locality");
                 //$landmark = $saved->__get("address_landmark");
                 //$city = $saved->__get("address_city");
                 //$state- = $saved->__get("address_state");
                 //$pincode = $saved->__get("address_pincode");
                 //$country = $saved->__get("address_country");
                 if ($user_id) {
                     $usersMapper = new Application_Model_UsersMapper();
                     $user = $usersMapper->getUserById($user_id);
                     $fname = $user->__get("user_fname");
                     $lname = $user->__get("user_lname");
                     $user_email = $user->__get("user_email");
                     $number = $user->__get("user_number");
                     $orders->__set("user_fname", $fname);
                     $orders->__set("user_lname", $lname);
                     $orders->__set("user_email", $user_email);
                     $orders->__set("user_phn_number", $number);
                     $orders->__set("user_address", $address);
                     $orders->__set("address_locality", "");
                     $orders->__set("address_street", "");
                     $orders->__set("address_landmark", $landmark);
                     $orders->__set("address_city", $city);
                     $orders->__set("address_state", $state);
                     $orders->__set("address_country", "India");
                     $orders->__set("address_pincode", $pincode);
                     $orders->__set("payment_method", $payment_type);
                     $orders->__set("payment_status", "Unpaid");
                     $orders->__set("order_status", "New");
                     $orders->__set("order_total", 0);
                     $orders->__set("delivery_type", $delivery_type);
                     $orders->__set("service", $service_name);
                     //echo $pickup_date;exit;
                     $zend_date = new Zend_Date($pickup_date, "dd/MM/yyyy");
                     $pickup_date_new = $zend_date->toString("dd-MMM-yyyy");
                     $orders->__set("pickup_date", $pickup_date_new);
                     $orders->__set("pickup_time", $pickup_time);
                     if ($delivery_type == "Regular") {
                         $zendDate = new Zend_Date($delivery_date, "dd/MM/yyyy");
                         $delivery_date_new = $zendDate->toString("dd-MMM-yyyy");
                     } else {
                         $z_date = $zend_date->addDay(1);
                         $delivery_date_new = $z_date->toString("dd-MMM-yyyy");
                     }
                     if ($delivery_type == "Regular") {
                         $delivery_time = $delivery_time;
                     } else {
                         //$zendDate = new Zend_Date($pickup_time);
                         $delivery_time = "";
                         //echo $delivery_time;exit;
                     }
                     $orders->__set("delivery_date", $delivery_date_new);
                     $orders->__set("delivery_time", $delivery_time);
                 } else {
                     $orders->__set("user_fname", $user_name);
                     $orders->__set("user_lname", "");
                     $orders->__set("user_email", $guest_email);
                     $orders->__set("user_phn_number", $number);
                     $orders->__set("user_address", $address);
                     $orders->__set("address_locality", "");
                     $orders->__set("address_street", "");
                     $orders->__set("address_landmark", $landmark);
                     $orders->__set("address_city", $city);
                     $orders->__set("address_state", $state);
                     $orders->__set("address_country", "India");
                     $orders->__set("address_pincode", $pincode);
                     $orders->__set("payment_method", $payment_type);
                     $orders->__set("payment_status", "Unpaid");
                     $orders->__set("order_status", "New");
                     $orders->__set("order_total", 0);
                     $orders->__set("delivery_type", $delivery_type);
                     $orders->__set("service", $service_name);
                     $zend_date = new Zend_Date($pickup_date, "dd/MM/yyyy");
                     $pickup_date_new = $zend_date->toString("dd-MMM-yyyy");
                     $orders->__set("pickup_date", $pickup_date_new);
                     $orders->__set("pickup_time", $pickup_time);
                     if ($delivery_type == "Regular") {
                         $zendDate = new Zend_Date($delivery_date, "dd/MM/yyyy");
                         $delivery_date_new = $zendDate->toString("dd-MMM-yyyy");
                     } else {
                         $z_date = $zend_date->addDay(1);
                         $delivery_date_new = $z_date->toString("dd-MMM-yyyy");
                     }
                     if ($delivery_type == "Regular") {
                         $delivery_time = $delivery_time;
                     } else {
                         //$zendDate = new Zend_Date($pickup_time);
                         $delivery_time = "";
                         //echo $delivery_time;exit;
                     }
                     $orders->__set("delivery_date", $delivery_date_new);
                     $orders->__set("delivery_time", $delivery_time);
                 }
                 if ($payment_type == "wallet") {
                     $session = new Zend_Session_Namespace("order");
                     $total = $session->total;
                     $q_total = $total = $session->quantity_total;
                     if ($total > $wallet_amount) {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "Danger";
                         $this->view->message = "Insufficient Fund in your Wallet.";
                     } else {
                         $order_id = $ordersMapper->addNewOrder($orders);
                         $total = 0;
                         foreach ($items as $item) {
                             $item_id = $item;
                             $qty = $quantity[$i];
                             $new_price = $price[$i];
                             $item_total = $qty * $new_price;
                             $total += $item_total;
                             $i++;
                             if ($order_id) {
                                 $orderItems->__set("order_id", $order_id);
                                 $orderItems->__set("item_id", $item_id);
                                 $orderItems->__set("quantity", $qty);
                                 $orderItems->__set("total_price", $item_total);
                                 $orderItems->__set("unit_price", $new_price);
                                 $orderItemsMapper->addNewOrderItem($orderItems);
                             }
                         }
                         $orders = $ordersMapper->getOrderById($order_id);
                         if ($total <= 100) {
                             $total_new = $total + 50;
                         } else {
                             $total_new = $total;
                         }
                         $orders->__set("order_total", $total_new);
                         $orders->__set("payment_status", "Paid");
                         $service = $orders->__get("service");
                         $d_date = $orders->__get("delivery_date");
                         if ($discount_amount && $revised_amount) {
                             $orders->__set("discount_price", $discount_amount);
                             $orders->__set("revised_price", $revised_amount);
                             $total_new = $revised_amount;
                         }
                         $sms = "Dear " . $fname . ", Your order " . $order_id . " with QTY " . $q_total . " and amount " . $total_new . " will be ready on " . $d_date . ". Thanks LaundryWala";
                         $sms_result = $this->_smsNotification($number, $sms);
                         $userWallet->__set("user_id", $user_id);
                         $userWallet->__set("entry_type", "DEBIT");
                         $userWallet->__set("entry_amount", $total);
                         $usersWalletMapper->addNewUserWallet($userWallet);
                         $subject = "Order Details From LaundryWala";
                         $message = "<table style='font-size:12px;'>";
                         $message .= "<tbody>";
                         $message .= "<tr><td>Dear Customer ,<br><br></td></tr>";
                         $message .= "<tr><td>Thank you for your association with LaundryWala.We are pleased to provide you details around your recent transaction with us.<br><br></td></tr>";
                         $message .= "<tr><td><strong>Invoice No :</strong>" . $order_id . "</td></tr>";
                         $message .= "<tr><td><strong>Customer Name :</strong>" . $fname . "</td></tr>";
                         $message .= "<tr><td><strong>Address :</strong>" . $address . "</td></tr>";
                         $message .= "<tr><td><strong>Phone No. :</strong><a>" . $number . "</a></td></tr>";
                         if ($orders) {
                             $email = $orders->__get("user_email");
                             $address = $orders->__get("user_address");
                             $city = $orders->__get("address_city");
                             $state = $orders->__get("address_state");
                             $pincode = $orders->__get("address_pincode");
                             $date = $orders->__get("timestamp");
                             $zendDate = new Zend_Date($date, "dd-MMM-yyyy");
                             $date_new = $zendDate->toString("dd-MMM-yyyy");
                             $number = $orders->__get("user_phn_number");
                             $method = $orders->__get("payment_method");
                             $del_date = $orders->__get("delivery_date");
                             $message .= "<tr><td><strong>Booking Date :</strong>" . $date_new . "<br><strong>Payment Mode:</strong>" . $method . "</td></tr>";
                             $message .= "<tr><td><strong>Total Amount Due Rs.:</strong>" . $total_new . "<br></td></tr>";
                             $message .= "<tr><td><strong>Due Delivery Date :</strong>" . $del_date . "</td></tr>";
                             $message .= "<tr><td><strong>Total Pcs. :</strong>" . $q_total . "</td></tr>";
                             $message .= "<tr style='font-size:12px'>";
                             $message .= "<td colspan='4'>";
                             $message .= "<table style='width:7.9in'>";
                             $message .= "<tbody>";
                             $message .= "<tr>";
                             $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>S.No.</td>";
                             $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>Qty</td>";
                             $message .= "<td style='width:5.0in;font-weight:bold;font-size:12px' align='left'>Particular's</td>";
                             $message .= "<td style='width:1.0in;font-weight:bold' align='right'></td>";
                             $message .= "<td style='width:1.0in;font-weight:bold;font-size:12px' align='right'>Amount</td>";
                             $message .= "</tr>";
                             $message .= "<tr style='font-size:9px'>";
                             $message .= "<td colspan='5' style='font-weight:bold;border-top-style:solid;border-top-width:thin;border-top-color:#000000'></td>";
                             $message .= "</tr>";
                             $orderItemsMapper = new Application_Model_OrderItemsMapper();
                             $items_new = $orderItemsMapper->getOrderItemByOrderId($orders->__get("order_id"));
                             $i = 1;
                             if ($items_new) {
                                 foreach ($items_new as $item) {
                                     $itemsMapper = new Application_Model_ItemsMapper();
                                     $item_name = $itemsMapper->getItemById($item->__get("item_id"));
                                     if ($item_name) {
                                         $name = $item_name->__get("item_name");
                                     } else {
                                         $name = "None";
                                     }
                                     $message .= "<tr style='font-size:12px'>";
                                     $message .= "<td>" . $i++ . "</td>";
                                     $message .= "<td>" . $item->__get("quantity") . "</td>";
                                     $message .= "<td colspan='2'><span style='font-family:arial black;font-size:11px'>" . $name . "</span></td>";
                                     //$message.= "<td align='right'></td>";
                                     $message .= "<td align='right'>Rs." . $item->__get("total_price") . "&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</td>";
                                     $message .= "</tr>";
                                 }
                             }
                         }
                         $message .= "<tr style='font-size:10px'><td colspan='5'></td></tr>";
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='2'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Subtotal</td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total . "</td>";
                         $message .= "</tr>";
                         if ($total <= 100) {
                             $message .= "<tr style='font-size:10px'>";
                             $message .= "<td colspan='3'></td>";
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Delivery Charges</td>";
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                             $message .= "</tr>";
                         } else {
                             $message .= "<tr style='font-size:10px'>";
                             $message .= "<td colspan='3'></td>";
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Discount</td>";
                             if ($discount_amount) {
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $revised_amount . "</td>";
                             } else {
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                             }
                             $message .= "</tr>";
                         }
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='3'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                         $message .= "</tr>";
                         $message .= "<tr><td nowrap='' colspan='3'>Assuring you of our best service.</td></tr>";
                         $message .= "<tr><td colspan='3'>Warm Regards.</td></tr>";
                         $message .= "<tr><td colspan='3'>LaundryWala</td></tr>";
                         $message .= "</tbody></table></td></tr></tbody></table>";
                         $this->getMailAction($email, $subject, $message);
                         $this->getMailAction("*****@*****.**", $subject, $message);
                         if ($ordersMapper->updateOrder($orders)) {
                             $this->_helper->redirector('notification', 'checkout');
                             $this->view->hasMessage = true;
                             $this->view->messageType = "success";
                             $this->view->message = "Your Order added sucessfully";
                         } else {
                             $this->view->hasMessage = true;
                             $this->view->messageType = "danger";
                             $this->view->message = "Error";
                         }
                     }
                 } elseif ($payment_type == "package") {
                     $session = new Zend_Session_Namespace("order");
                     $total = $session->total;
                     $quantity_total = $session->quantity_total;
                     if ($user_package_id) {
                         $userPackage = $userPackagesMapper->getUserPackageById($user_package_id);
                         if ($userPackage) {
                             $number_clothes = $userPackage->__get("clothes_left");
                             $number_pickups = $userPackage->__get("pickups_left");
                             if ($quantity_total > $number_clothes) {
                                 $this->view->hasMessage = true;
                                 $this->view->messageType = "Danger";
                                 $this->view->message = "Insufficient Number of clothes.";
                             } else {
                                 $order_id = $ordersMapper->addNewOrder($orders);
                                 $total = 0;
                                 foreach ($items as $item) {
                                     $item_id = $item;
                                     $qty = $quantity[$i];
                                     $new_price = $price[$i];
                                     $item_total = $qty * $new_price;
                                     $total += $item_total;
                                     $i++;
                                     if ($order_id) {
                                         $orderItems->__set("order_id", $order_id);
                                         $orderItems->__set("item_id", $item_id);
                                         $orderItems->__set("quantity", $qty);
                                         $orderItems->__set("total_price", $item_total);
                                         $orderItems->__set("unit_price", $new_price);
                                         $orderItemsMapper->addNewOrderItem($orderItems);
                                     }
                                 }
                                 $orders = $ordersMapper->getOrderById($order_id);
                                 if ($total <= 100) {
                                     $total_new = $total + 50;
                                 } else {
                                     $total_new = $total;
                                 }
                                 $orders->__set("order_total", $total_new);
                                 $orders->__set("payment_status", "Paid");
                                 $service = $orders->__get("service");
                                 $d_date = $orders->__get("delivery_date");
                                 if ($discount_amount && $revised_amount) {
                                     $orders->__set("discount_price", $discount_amount);
                                     $orders->__set("revised_price", $revised_amount);
                                     $total_new = $revised_amount;
                                 }
                                 $sms = "Dear " . $fname . ", Your order " . $order_id . " with QTY " . $quantity_total . " and amount " . $total_new . " will be ready on " . $d_date . ". Thanks LaundryWala";
                                 //$sms_result = $this->_smsNotification($number, $sms);
                                 $clothes_left = $number_clothes - $quantity_total;
                                 $pickups_left = $number_pickups - 1;
                                 $userPackage->__set("clothes_left", $clothes_left);
                                 $userPackage->__set("pickups_left", $pickups_left);
                                 $userPackagesMapper->updateUserPackage($userPackage);
                                 $subject = "Order Details From LaundryWala";
                                 $message = "<table style='font-size:12px;'>";
                                 $message .= "<tbody>";
                                 $message .= "<tr><td>Dear Customer ,<br><br></td></tr>";
                                 $message .= "<tr><td>Thank you for your association with LaundryWala.We are pleased to provide you details around your recent transaction with us.<br><br></td></tr>";
                                 $message .= "<tr><td><strong>Invoice No :</strong>" . $order_id . "</td></tr>";
                                 $message .= "<tr><td><strong>Customer Name :</strong>" . $fname . "</td></tr>";
                                 $message .= "<tr><td><strong>Address :</strong>" . $address . "</td></tr>";
                                 $message .= "<tr><td><strong>Phone No. :</strong><a>" . $number . "</a></td></tr>";
                                 if ($orders) {
                                     $email = $orders->__get("user_email");
                                     $address = $orders->__get("user_address");
                                     $city = $orders->__get("address_city");
                                     $state = $orders->__get("address_state");
                                     $pincode = $orders->__get("address_pincode");
                                     $date = $orders->__get("timestamp");
                                     $zendDate = new Zend_Date($date, "dd-MMM-yyyy");
                                     $date_new = $zendDate->toString("dd-MMM-yyyy");
                                     $number = $orders->__get("user_phn_number");
                                     $method = $orders->__get("payment_method");
                                     $del_date = $orders->__get("delivery_date");
                                     $message .= "<tr><td><strong>Booking Date :</strong>" . $date_new . "<br><strong>Payment Mode:</strong>" . $method . "</td></tr>";
                                     $message .= "<tr><td><strong>Total Amount Due Rs.:</strong>" . $total_new . "<br></td></tr>";
                                     $message .= "<tr><td><strong>Due Delivery Date :</strong>" . $del_date . "</td></tr>";
                                     $message .= "<tr><td><strong>Total Pcs. :</strong>" . $quantity_total . "</td></tr>";
                                     $message .= "<tr style='font-size:12px'>";
                                     $message .= "<td colspan='4'>";
                                     $message .= "<table style='width:7.9in'>";
                                     $message .= "<tbody>";
                                     $message .= "<tr>";
                                     $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>S.No.</td>";
                                     $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>Qty</td>";
                                     $message .= "<td style='width:5.0in;font-weight:bold;font-size:12px' align='left'>Particular's</td>";
                                     $message .= "<td style='width:1.0in;font-weight:bold' align='right'></td>";
                                     $message .= "<td style='width:1.0in;font-weight:bold;font-size:12px' align='right'>Amount</td>";
                                     $message .= "</tr>";
                                     $message .= "<tr style='font-size:9px'>";
                                     $message .= "<td colspan='5' style='font-weight:bold;border-top-style:solid;border-top-width:thin;border-top-color:#000000'></td>";
                                     $message .= "</tr>";
                                     $orderItemsMapper = new Application_Model_OrderItemsMapper();
                                     $items_new = $orderItemsMapper->getOrderItemByOrderId($orders->__get("order_id"));
                                     $i = 1;
                                     if ($items_new) {
                                         foreach ($items_new as $item) {
                                             $itemsMapper = new Application_Model_ItemsMapper();
                                             $item_name = $itemsMapper->getItemById($item->__get("item_id"));
                                             if ($item_name) {
                                                 $name = $item_name->__get("item_name");
                                             } else {
                                                 $name = "None";
                                             }
                                             $message .= "<tr style='font-size:12px'>";
                                             $message .= "<td>" . $i++ . "</td>";
                                             $message .= "<td>" . $item->__get("quantity") . "</td>";
                                             $message .= "<td><span style='font-family:arial black;font-size:11px'>" . $name . "</span></td>";
                                             $message .= "<td align='right'></td>";
                                             $message .= "<td align='right'>Rs." . $item->__get("total_price") . "&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</td>";
                                             $message .= "</tr>";
                                         }
                                     }
                                 }
                                 $message .= "<tr style='font-size:10px'><td colspan='5'></td></tr>";
                                 $message .= "<tr style='font-size:10px'>";
                                 $message .= "<td colspan='3'></td>";
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Subtotal</td>";
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total . "</td>";
                                 $message .= "</tr>";
                                 if ($total <= 100) {
                                     $message .= "<tr style='font-size:10px'>";
                                     $message .= "<td colspan='3'></td>";
                                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Delivery Charges</td>";
                                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                                     $message .= "</tr>";
                                 } else {
                                     $message .= "<tr style='font-size:10px'>";
                                     $message .= "<td colspan='3'></td>";
                                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Discount</td>";
                                     if ($discount_amount) {
                                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $revised_amount . "</td>";
                                     } else {
                                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                                     }
                                     $message .= "</tr>";
                                 }
                                 $message .= "<tr style='font-size:10px'>";
                                 $message .= "<td colspan='3'></td>";
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                                 $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                                 $message .= "</tr>";
                                 $message .= "<tr><td nowrap='' colspan='3'>Assuring you of our best service.</td></tr>";
                                 $message .= "<tr><td colspan='3'>Warm Regards.</td></tr>";
                                 $message .= "<tr><td colspan='3'>LaundryWala</td></tr>";
                                 $message .= "</tbody></table></td></tr></tbody></table>";
                                 $this->getMailAction($email, $subject, $message);
                                 $this->getMailAction("*****@*****.**", $subject, $message);
                                 if ($ordersMapper->updateOrder($orders)) {
                                     $this->_helper->redirector('notification', 'checkout');
                                     $this->view->hasMessage = true;
                                     $this->view->messageType = "success";
                                     $this->view->message = "Your Order added sucessfully";
                                 } else {
                                     $this->view->hasMessage = true;
                                     $this->view->messageType = "danger";
                                     $this->view->message = "Error";
                                 }
                             }
                         }
                     } else {
                         echo "<script>alert('No Package Selected or Available');</script>";
                     }
                     //print_r($userPackage);exit;
                 } elseif ($payment_type == "online-payment") {
                     $session = new Zend_Session_Namespace("order");
                     $total = $session->total;
                     $q_total = $total = $session->quantity_total;
                     $order_id = $ordersMapper->addNewOrder($orders);
                     $total = 0;
                     foreach ($items as $item) {
                         $item_id = $item;
                         $qty = $quantity[$i];
                         $new_price = $price[$i];
                         $item_total = $qty * $new_price;
                         $total += $item_total;
                         $i++;
                         if ($order_id) {
                             $orderItems->__set("order_id", $order_id);
                             $orderItems->__set("item_id", $item_id);
                             $orderItems->__set("quantity", $qty);
                             $orderItems->__set("total_price", $item_total);
                             $orderItems->__set("unit_price", $new_price);
                             $orderItemsMapper->addNewOrderItem($orderItems);
                         }
                     }
                     $orders = $ordersMapper->getOrderById($order_id);
                     if ($total <= 100) {
                         $total_new = $total + 50;
                     } else {
                         $total_new = $total;
                     }
                     $orders->__set("order_total", $total_new);
                     $orders->__set("payment_status", "Unpaid");
                     $service = $orders->__get("service");
                     $d_date = $orders->__get("delivery_date");
                     if ($discount_amount && $revised_amount) {
                         $orders->__set("discount_price", $discount_amount);
                         $orders->__set("revised_price", $revised_amount);
                         $total_new = $revised_amount;
                     }
                     $sms = "Dear " . $fname . ", Your order " . $order_id . " with QTY " . $q_total . " and amount " . $total_new . " will be ready on " . $d_date . ". Thanks LaundryWala";
                     $sms_result = $this->_smsNotification($number, $sms);
                     $subject = "Order Details From LaundryWala";
                     $message = "<table style='font-size:12px;'>";
                     $message .= "<tbody>";
                     $message .= "<tr><td>Dear Customer ,<br><br></td></tr>";
                     $message .= "<tr><td>Thank you for your association with LaundryWala.We are pleased to provide you details around your recent transaction with us.<br><br></td></tr>";
                     $message .= "<tr><td><strong>Invoice No :</strong>" . $order_id . "</td></tr>";
                     $message .= "<tr><td><strong>Customer Name :</strong>" . $fname . "</td></tr>";
                     $message .= "<tr><td><strong>Address :</strong>" . $address . "</td></tr>";
                     $message .= "<tr><td><strong>Phone No. :</strong><a>" . $number . "</a></td></tr>";
                     if ($orders) {
                         $email = $orders->__get("user_email");
                         $address = $orders->__get("user_address");
                         $city = $orders->__get("address_city");
                         $state = $orders->__get("address_state");
                         $pincode = $orders->__get("address_pincode");
                         $date = $orders->__get("timestamp");
                         $zendDate = new Zend_Date($date, "dd-MMM-yyyy");
                         $date_new = $zendDate->toString("dd-MMM-yyyy");
                         $number = $orders->__get("user_phn_number");
                         $method = $orders->__get("payment_method");
                         $del_date = $orders->__get("delivery_date");
                         $message .= "<tr><td><strong>Booking Date :</strong>" . $date_new . "<br><strong>Payment Mode:</strong>" . $method . "</td></tr>";
                         $message .= "<tr><td><strong>Total Amount Due Rs.:</strong>" . $total_new . "<br></td></tr>";
                         $message .= "<tr><td><strong>Due Delivery Date :</strong>" . $del_date . "</td></tr>";
                         $message .= "<tr><td><strong>Total Pcs. :</strong>" . $q_total . "</td></tr>";
                         $message .= "<tr style='font-size:12px'>";
                         $message .= "<td colspan='4'>";
                         $message .= "<table style='width:7.9in'>";
                         $message .= "<tbody>";
                         $message .= "<tr>";
                         $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>S.No.</td>";
                         $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>Qty</td>";
                         $message .= "<td style='width:5.0in;font-weight:bold;font-size:12px' align='left'>Particular's</td>";
                         $message .= "<td style='width:1.0in;font-weight:bold' align='right'></td>";
                         $message .= "<td style='width:1.0in;font-weight:bold;font-size:12px' align='right'>Amount</td>";
                         $message .= "</tr>";
                         $message .= "<tr style='font-size:9px'>";
                         $message .= "<td colspan='5' style='font-weight:bold;border-top-style:solid;border-top-width:thin;border-top-color:#000000'></td>";
                         $message .= "</tr>";
                         $orderItemsMapper = new Application_Model_OrderItemsMapper();
                         $items_new = $orderItemsMapper->getOrderItemByOrderId($orders->__get("order_id"));
                         $i = 1;
                         if ($items_new) {
                             foreach ($items_new as $item) {
                                 $itemsMapper = new Application_Model_ItemsMapper();
                                 $item_name = $itemsMapper->getItemById($item->__get("item_id"));
                                 if ($item_name) {
                                     $name = $item_name->__get("item_name");
                                 } else {
                                     $name = "None";
                                 }
                                 $message .= "<tr style='font-size:12px'>";
                                 $message .= "<td>" . $i++ . "</td>";
                                 $message .= "<td>" . $item->__get("quantity") . "</td>";
                                 $message .= "<td><span style='font-family:arial black;font-size:11px'>" . $name . "</span></td>";
                                 $message .= "<td align='right'></td>";
                                 $message .= "<td align='right'>Rs." . $item->__get("total_price") . "&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</td>";
                                 $message .= "</tr>";
                             }
                         }
                     }
                     $message .= "<tr style='font-size:10px'><td colspan='5'></td></tr>";
                     $message .= "<tr style='font-size:10px'>";
                     $message .= "<td colspan='3'></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Subtotal</td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total . "</td>";
                     $message .= "</tr>";
                     if ($total <= 100) {
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='3'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Delivery Charges</td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                         $message .= "</tr>";
                     } else {
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='3'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Discount</td>";
                         if ($discount_amount) {
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $revised_amount . "</td>";
                         } else {
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                         }
                         $message .= "</tr>";
                     }
                     $message .= "<tr style='font-size:10px'>";
                     $message .= "<td colspan='3'></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                     $message .= "</tr>";
                     $message .= "<tr><td nowrap='' colspan='3'>Assuring you of our best service.</td></tr>";
                     $message .= "<tr><td colspan='3'>Warm Regards.</td></tr>";
                     $message .= "<tr><td colspan='3'>LaundryWala</td></tr>";
                     $message .= "</tbody></table></td></tr></tbody></table>";
                     $this->getMailAction($email, $subject, $message);
                     $this->getMailAction("*****@*****.**", $subject, $message);
                     if ($ordersMapper->updateOrder($orders)) {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "success";
                         $this->view->message = "Your Order added sucessfully";
                     } else {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                         $this->view->message = "Error";
                     }
                     if ($guest_email) {
                         $this->_redirect('/payment/index/order_id/' . $order_id . '/email/' . $guest_email . '/name/' . $user_name . '/number/' . $number);
                     } else {
                         $this->_redirect('/payment/index/order_id/' . $order_id);
                     }
                 } else {
                     $order_id = $ordersMapper->addNewOrder($orders);
                     $session = new Zend_Session_Namespace("order");
                     $q_total = $total = $session->quantity_total;
                     $total = 0;
                     foreach ($items as $item) {
                         $item_id = $item;
                         $qty = $quantity[$i];
                         $new_price = $price[$i];
                         $item_total = $qty * $new_price;
                         $total += $item_total;
                         $i++;
                         $amount_session = new Zend_Session_Namespace("total_amount");
                         $amount_session->total_amount = $total;
                         if ($order_id) {
                             $orderItems->__set("order_id", $order_id);
                             $orderItems->__set("item_id", $item_id);
                             $orderItems->__set("quantity", $qty);
                             $orderItems->__set("total_price", $item_total);
                             $orderItems->__set("unit_price", $new_price);
                             $orderItemsMapper->addNewOrderItem($orderItems);
                         }
                     }
                     $orders = $ordersMapper->getOrderById($order_id);
                     if ($total <= 100) {
                         $total_new = $total + 50;
                     } else {
                         $total_new = $total;
                     }
                     $orders->__set("order_total", $total_new);
                     $orders->__set("payment_status", "Unpaid");
                     $service = $orders->__get("service");
                     $d_date = $orders->__get("delivery_date");
                     if ($discount_amount && $revised_amount) {
                         $orders->__set("discount_price", $discount_amount);
                         $orders->__set("revised_price", $revised_amount);
                         $total_new = $revised_amount;
                     }
                     $sms = "Dear " . $fname . ", Your order " . $order_id . " with QTY " . $q_total . " and amount Rs. " . $total_new . " will be ready on " . $d_date . ". Thanks LaundryWala";
                     //$sms = "Dear Divya, Your order 12 with QTY 12 and amount Rs. 200 will be ready on 12. Thanks LaundryWala";
                     $sms_result = $this->_smsNotification($number, $sms);
                     $subject = "Order Details From LaundryWala";
                     $message = "<table style='font-size:12px;'>";
                     $message .= "<tbody>";
                     $message .= "<tr><td>Dear Customer ,<br><br></td></tr>";
                     $message .= "<tr><td>Thank you for your association with LaundryWala.We are pleased to provide you details around your recent transaction with us.<br><br></td></tr>";
                     $message .= "<tr><td><strong>Invoice No :</strong>" . $order_id . "</td></tr>";
                     $message .= "<tr><td><strong>Customer Name :</strong>" . $fname . "</td></tr>";
                     $message .= "<tr><td><strong>Address :</strong>" . $address . "</td></tr>";
                     $message .= "<tr><td><strong>Phone No. :</strong><a>" . $number . "</a></td></tr>";
                     if ($orders) {
                         $email = $orders->__get("user_email");
                         $address = $orders->__get("user_address");
                         $city = $orders->__get("address_city");
                         $state = $orders->__get("address_state");
                         $pincode = $orders->__get("address_pincode");
                         $date = $orders->__get("timestamp");
                         $zendDate = new Zend_Date($date, "dd-MMM-yyyy");
                         $date_new = $zendDate->toString("dd-MMM-yyyy");
                         $number = $orders->__get("user_phn_number");
                         $method = $orders->__get("payment_method");
                         $del_date = $orders->__get("delivery_date");
                         $message .= "<tr><td><strong>Booking Date :</strong>" . $date_new . "<br><strong>Payment Mode:</strong>" . $method . "</td></tr>";
                         $message .= "<tr><td><strong>Total Amount Due Rs.:</strong>" . $total_new . "<br></td></tr>";
                         $message .= "<tr><td><strong>Due Delivery Date :</strong>" . $del_date . "</td></tr>";
                         $message .= "<tr><td><strong>Total Pcs. :</strong>" . $q_total . "</td></tr>";
                         $message .= "<tr style='font-size:12px'>";
                         $message .= "<td colspan='4'>";
                         $message .= "<table style='width:7.9in'>";
                         $message .= "<tbody>";
                         $message .= "<tr>";
                         $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>S.No.</td>";
                         $message .= "<td style='width:0.5in;font-weight:bold;font-size:12px'>Qty</td>";
                         $message .= "<td style='width:5.0in;font-weight:bold;font-size:12px' align='left'>Particular's</td>";
                         $message .= "<td style='width:1.0in;font-weight:bold' align='right'></td>";
                         $message .= "<td style='width:1.0in;font-weight:bold;font-size:12px' align='right'>Amount</td>";
                         $message .= "</tr>";
                         $message .= "<tr style='font-size:9px'>";
                         $message .= "<td colspan='5' style='font-weight:bold;border-top-style:solid;border-top-width:thin;border-top-color:#000000'></td>";
                         $message .= "</tr>";
                         $orderItemsMapper = new Application_Model_OrderItemsMapper();
                         $items_new = $orderItemsMapper->getOrderItemByOrderId($orders->__get("order_id"));
                         $i = 1;
                         if ($items_new) {
                             foreach ($items_new as $item) {
                                 $itemsMapper = new Application_Model_ItemsMapper();
                                 $item_name = $itemsMapper->getItemById($item->__get("item_id"));
                                 if ($item_name) {
                                     $name = $item_name->__get("item_name");
                                 } else {
                                     $name = "None";
                                 }
                                 $message .= "<tr style='font-size:12px'>";
                                 $message .= "<td>" . $i++ . "</td>";
                                 $message .= "<td>" . $item->__get("quantity") . "</td>";
                                 $message .= "<td><span style='font-family:arial black;font-size:11px'>" . $name . "</span></td>";
                                 $message .= "<td align='right'></td>";
                                 $message .= "<td align='right'>Rs." . $item->__get("total_price") . "&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</td>";
                                 $message .= "</tr>";
                             }
                         }
                     }
                     $message .= "<tr style='font-size:10px'><td colspan='5'></td></tr>";
                     $message .= "<tr style='font-size:10px'>";
                     $message .= "<td colspan='3'></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Subtotal</td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total . "</td>";
                     $message .= "</tr>";
                     if ($total <= 100) {
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='3'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Delivery Charges</td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                         $message .= "</tr>";
                     } else {
                         $message .= "<tr style='font-size:10px'>";
                         $message .= "<td colspan='3'></td>";
                         $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Amount after Discount</td>";
                         if ($discount_amount) {
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $revised_amount . "</td>";
                         } else {
                             $message .= "<td align='right' style='font-size:12px;font-weight:bold'>Rs." . $total_new . "</td>";
                         }
                         $message .= "</tr>";
                     }
                     $message .= "<tr style='font-size:10px'>";
                     $message .= "<td colspan='3'></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                     $message .= "<td align='right' style='font-size:12px;font-weight:bold'><br></td>";
                     $message .= "</tr>";
                     $message .= "<tr><td nowrap='' colspan='3'>Assuring you of our best service.</td></tr>";
                     $message .= "<tr><td colspan='3'>Warm Regards.</td></tr>";
                     $message .= "<tr><td colspan='3'>LaundryWala</td></tr>";
                     $message .= "</tbody></table></td></tr></tbody></table>";
                     $this->getMailAction($email, $subject, $message);
                     $this->getMailAction("*****@*****.**", $subject, $message);
                     if ($ordersMapper->updateOrder($orders)) {
                         $this->_helper->redirector('notification', 'checkout');
                         $this->view->hasMessage = true;
                         $this->view->messageType = "success";
                         $this->view->message = "Your Order added sucessfully";
                     } else {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                         $this->view->message = "Error";
                     }
                 }
             } else {
                 $errorString = "";
                 foreach ($errors as $error) {
                     $errorString .= $error . "<br/>";
                 }
                 $this->view->hasMessage = true;
                 $this->view->messageType = "danger";
                 $this->view->message = $errorString;
             }
         }
     }
 }
Exemplo n.º 7
0
 public function allotOrder($params, $orderType = 'pickup')
 {
     $orderMapper = new Application_Model_OrdersMapper();
     $orderModel = new Application_Model_Orders();
     if ($orderType == 'pickup') {
         $orderModel->__set('order_pickup_boy', $params['delboy_id']);
     } else {
         $orderModel->__set('order_delivery_boy', $params['delboy_id']);
     }
     $orderModel->__set('order_status', 'alloted');
     $orderModel->__set('order_id', $params['orders']);
     $orderMapper->allotOrder($orderModel, $orderType);
 }
Exemplo n.º 8
0
 public function orderDetailsAction()
 {
     $request = $this->getRequest();
     $order_id = $request->getParam("id");
     $ordersMapper = new Application_Model_OrdersMapper();
     $orderItemsMapper = new Application_Model_OrderItemsMapper();
     $order = $ordersMapper->getOrderById($order_id);
     $this->view->order = $order;
     $items = $orderItemsMapper->getOrderItemByOrderId($order_id);
     $this->view->items = $items;
 }
Exemplo n.º 9
0
 public function printorderAction()
 {
     $this->_helper->layout->disableLayout();
     error_reporting(0);
     $orderId = $this->_getParam("order");
     $i = '1';
     $ordersMapper = new Application_Model_OrdersMapper();
     $orderDetail = $ordersMapper->getOrderById($orderId);
     $orderItemsMapper = new Application_Model_OrderItemsMapper();
     $orderItems = $orderItemsMapper->getOrderItemByOrderId($orderId);
     if (empty($orderDetail)) {
         echo "Order Not Found";
         die;
     }
     //echo $orderItems[0]->order_service_name;
     $code = $orderId . '-0000-' . $orderDetail->order_user_id;
     $bc = new Barcode39($code);
     $bc->draw("public/barcode/barcode_" . $orderId . '_' . $orderDetail->order_user_id . ".gif");
     $barcode = '<img src="../../public/barcode/barcode_' . $orderId . '_' . $orderDetail->order_user_id . '.gif">';
     $print = '';
     $print .= '<div id="divToPrint" ><div style="width:290px;background-color:#ffffff;border:1px solid #ccc;padding:4px;font-size:12px;"><h2 style="text-align:center;" >Laundrywala<hr></h2><table  cellspacing="4"  cellpadding="4" style="padding:4px; font-size:12px;"><tr><td> Address :</td><td>A-109Q,2nd Flr,<br>Sec-80 </td></tr><tr><td>State :</td><td>Noida-201305</td></tr><tr><td>Contact :</td><td>9953180071</td></tr><tr><td>Mail :</td><td>info@laundrywala.co.in </td></tr><tr><td>TIN No :</td><td>NA </td></tr><tr><td>Service Tax No :</td><td>NA </td></tr><tr><td>CIN No: </td><td>NA</td></tr><tr></table>';
     $print .= '<hr><h4 style="text-align:center;">Customer Details</h4><table  cellspacing="4"  cellpadding="4" style="padding:4px; font-size:12px;">';
     $print .= '<tr><td>Name :</td><td>' . $orderDetail->order_first_name . ' ' . $orderDetail->order_last_name . '</td></tr><tr><td>Address :</td><td>' . $orderDetail->order_address . '</td></tr><tr><td>City/State</td><td>' . $orderDetail->order_city . '</td></tr><tr><td>Contact No. </td><td>' . $orderDetail->order_mobile_number . '</td></tr><tr></table><hr>';
     $print .= '<h4 style="text-align:center;">Order Details</h4><table border="1" cellpadding="1" cellspacing="0"  style=" font-size:10px;padding:2px; width:100%;" > <tr style="border:1px solid #000"><td>SN</td><td>Service</td><td>Product</td><td>QTY</td><td>Amount</td><td>Total</td></tr>';
     foreach ($orderItems as $orderItems) {
         $print .= '<tr style="border:1px solid #000"><td>' . $i . '</td><td>' . $orderItems->order_service_name . '</td><td>' . $orderItems->order_product_name . '</td><td>' . $orderItems->quantity . '</td><td>' . $orderItems->unit_price . '</td><td>' . $orderItems->total_price . '</td></tr>';
         $i++;
     }
     $print .= '<tr ><td></td><td></td><td></td><td></td><td>Delivery Charges</td><td>' . $orderDetail->delivery_charge . '</td>';
     $print .= '</tr><tr ><td></td><td></td><td></td><td></td><td>Service Tax(15%)</td><td>' . $orderDetail->service_tax . '</td></tr>';
     $print .= '<tr style="border:1px solid #000" ><td></td><td></td><td></td><td></td><td>Total</td><td>' . $orderDetail->order_amount . '</td></tr></table>';
     $print .= '<div style="text-align:center;" >' . $barcode . '</div></div></div>';
     $fp = trim($print);
     echo $fp;
     exit;
 }
Exemplo n.º 10
0
 private function isCouponAllowedToUse($userId, $couponId)
 {
     $response = array("allowed" => false, "message" => "");
     $CouponsMapperModel = new Application_Model_CouponsMapper();
     $couponData = $CouponsMapperModel->getCouponById($couponId);
     if (strtotime($couponData->__get("coupon_last_date")) > strtotime(date("Y-m-d")) && $couponData->__get("coupon_status") == 1) {
         $orderMapper = new Application_Model_OrdersMapper();
         $orderCount = $orderMapper->getOrders(array("user_id" => $userId, "coupon_id" => $couponId, "order_count" => true));
         if ($orderCount < $couponData->__get("coupon_occourence")) {
             $response['allowed'] = true;
         } else {
             $response['message'] = "Coupon max limit exceed";
         }
     } else {
         $response['message'] = "Coupon expired";
     }
     return (object) $response;
 }