Exemple #1
0
 public function authenticate()
 {
     $mapper = new Application_Model_UsersMapper();
     $checkUser = $mapper->fetchAll($this->_user);
     if (!$checkUser) {
         $newUser = new Application_Model_Users(array('user' => $this->_user));
         $result = $mapper->create($newUser);
     }
     return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user);
 }
 public function indexAction()
 {
     //$key = (empty($this->_getParam('key'))) ? $this->_key : $this->_getParam('key');
     //$secret = (empty($this->_getParam('secret'))) ? $this->_secret : $this->_getParam('secret');
     $key = $this->_k != $this->_getParam('key') ? $this->_getParam('key') : $this->_key;
     $secret = $this->_s != $this->_getParam('secret') ? $this->_getParam('secret') : $this->_secret;
     $settings = new Application_Model_Users(array('user' => $this->_user, 'key' => $key, 'secret' => $secret, 'cid' => $this->_getParam('cid')));
     $mapper = new Application_Model_UsersMapper();
     $mapper->save($settings);
     $this->_helper->redirector('index', 'index');
 }
 public function init()
 {
     $this->_user = Zend_Auth::getInstance()->getIdentity();
     $user = new Application_Model_UsersMapper();
     $result = $user->fetchAll($this->_user);
     $this->view->user = $result->user;
     $this->_state = $result->state;
     $this->view->state = $result->state;
     $this->view->key = empty($result->key) ? '' : base64_decode($result->key);
     $this->view->secret = empty($result->secret) ? '' : base64_decode($result->secret);
     $this->view->chartId = empty($result->chart_id) ? '' : $result->chart_id;
     $siteOptions = array('default' => array('refresh', 'Default'), 'validation_error' => array('flash', 'Validation Error'), 'css_error' => array('file-text-o', 'CSS Error'), 'js_error' => array('file-code-o', 'JavsScript Error'), '404' => array('info-circle', '40x Error'), '500' => array('warning', '50x Error'), 'delay' => array('circle-o-notch fa-spin', 'Content Delay'), 'timeout' => array('spinner fa-spin', 'Timeout'), 'cookies' => array('globe', 'Cookies'), 'hosts_and_zones' => array('filter', 'Hosts & Zones'), 'chrome' => array('chrome', 'Chrome'), 'glimpse' => array('users', 'Glimpse'));
     $this->view->menu = $siteOptions;
 }
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     $this->setElementDecorators($this->elementDecorators);
     $usersMapper = new Application_Model_UsersMapper();
     $users = $usersMapper->getAllUsers();
     $user_options = array();
     if ($users) {
         foreach ($users as $user) {
             $user_options[$user->__get("user_id")] = $user->__get("user_fname") . " " . $user->__get("user_lname") . "(" . $user->__get("user_email") . ")";
         }
     }
     $this->addElement('select', 'user_id', array('label' => 'User', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select User", 'class' => 'form-control', 'multiOptions' => $user_options));
     $types_options = array("CREDIT" => "CREDIT", "DEBIT" => "DEBIT");
     $this->addElement('select', 'entry_type', array('label' => 'Type', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Type", 'class' => 'form-control', 'multiOptions' => $types_options));
     $this->addElement('text', 'entry_amount', array('label' => 'Amount', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Amount", 'class' => 'form-control'));
 }
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     $this->setElementDecorators($this->elementDecorators);
     $usersMapper = new Application_Model_UsersMapper();
     $users = $usersMapper->getAllUsers();
     if ($users) {
         foreach ($users as $user) {
             $user_options[$user->__get("user_id")] = $user->__get("user_fname") . " " . $user->__get("user_lname") . "(" . $user->__get("user_email") . ")";
         }
     }
     $this->addElement('select', 'user_id', array('label' => 'User', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select User", 'class' => 'mws-textinput', 'multiOptions' => $user_options));
     $this->addElement('text', 'gateway_transaction_id', array('label' => 'Gateway Transaction #', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Gateway Transaction #", 'class' => 'mws-textinput'));
     $this->addElement('text', 'transaction_amount', array('label' => 'Transaction Amount', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Transaction Amount", 'class' => 'mws-textinput'));
     $this->addElement('text', 'other_details', array('label' => 'Other Details', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Other Details", 'class' => 'mws-textinput'));
     $method_options = array("Credit Card" => "Credit Card", "Debit Card" => "Debit Card", "Net Banking" => "Net Banking", "Cash On Delivery" => "Cash On Delivery");
     $this->addElement('select', 'transaction_method', array('label' => 'Transaction Method', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Transaction Method", 'class' => 'mws-textinput', 'multiOptions' => $method_options));
     $status_options = array("Unapproved" => "Unapproved", "Approved" => "Approved");
     $this->addElement('select', 'transaction_status', array('label' => 'Transaction Status', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Status", 'class' => 'mws-textinput', 'multiOptions' => $status_options));
 }
 public function testAction()
 {
     if (!$this->_getParam('testid')) {
         throw new Exception('No Test ID found!');
     }
     $site = new Application_Model_UsersMapper();
     $result = $site->fetchAll($this->_user);
     $t = new Catchpoint_Pull();
     $t->override = true;
     $t->key = $result['key'];
     $t->secret = $result['secret'];
     $myArray[] = $t->fetchData('performance/favoriteCharts/' . $result['cid'] . '/data?tests=' . $this->_getParam('testid'));
     $tests = array();
     foreach ($myArray as $m) {
         foreach ($m->summary->items as $a) {
             $tests[] = array('name' => $a->breakdown_1->name, 'dns' => round($a->synthetic_metrics[0] / 1000, 3), 'wait' => round($a->synthetic_metrics[1] / 1000, 3), 'load' => round($a->synthetic_metrics[2] / 1000, 3), 'bytes' => round($a->synthetic_metrics[3] / 1000000, 2), 'doc_complete' => round($a->synthetic_metrics[4] / 1000, 2), 'webpage_response' => round($a->synthetic_metrics[5] / 1000, 2), 'items' => round($a->synthetic_metrics[6], 0));
         }
     }
     $this->session = new Zend_Session_Namespace('Catchpoint');
     $this->session->userChart = $tests[0];
     $this->session->userDetails = array($this->_getParam('name'), $this->_getParam('job_title'), $this->_getParam('contact_number'));
     $this->view->testDetails = $tests[0];
 }
 public function resetPasswordAction()
 {
     $request = $this->getRequest();
     //echo "inside function";
     $code = $request->getParam("code");
     if ($code) {
         $usersMapper = new Application_Model_UsersMapper();
         $user = $usersMapper->getUserByResetCode($code);
         if (!$user) {
             $this->view->hasMessage = true;
             $this->view->messageType = "danger";
             $this->view->message = "Invalid reset code";
         }
         if ($request->isPost()) {
             $password = $request->getParam("pass");
             $cpassword = $request->getParam("cpass");
             $errors = array();
             if (empty($password)) {
                 $errors[] = "New Password Should not be empty";
             }
             if (empty($cpassword)) {
                 $errors[] = "Confirm Password Should not be empty";
             }
             if ($password != $cpassword) {
                 $this->view->hasMessage = true;
                 $this->view->messageType = "danger";
                 $this->view->message = "Passwords doesn't match, Try again";
             } else {
                 $hashed_password = sha1($password);
                 if (count($errors) == 0) {
                     $user->__set("hashed_password", $hashed_password);
                     $user->__set("reset_code", "");
                     if ($usersMapper->updateUser($user)) {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "success";
                         $this->view->message = "Password reset successful. <a href='" . $this->view->baseUrl() . "/index/login'>Click here</a> to login.";
                     } else {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                         $this->view->message = "Error while adding admin";
                     }
                 } else {
                     $errorString = "";
                     foreach ($errors as $error) {
                         $errorString .= $error . "<br/>";
                     }
                     $this->view->hasMessage = true;
                     $this->view->messageType = "danger";
                     $this->view->message = $errorString;
                 }
             }
         }
     }
 }
 public function indexAction()
 {
     try {
         $usersMapper = new Application_Model_UsersMapper();
         $transaction_type = "";
         $id = "";
         $amount = 0;
         $request = $this->getRequest();
         $package_id = $request->getParam("package_id");
         $type = $request->getParam("transaction_type");
         $order_id = $request->getParam("order_id");
         if ($order_id) {
             $transaction_type = "Online";
             $id = $order_id;
             $ordersMapper = new Application_Model_OrdersMapper();
             $order = $ordersMapper->getOrderById($order_id);
             $amount = $order->__get("order_amount");
         }
         $namespace = new Zend_Session_Namespace('userInfo');
         //            if ($this->_auth->hasIdentity()) {
         if (!empty($namespace->user_id)) {
             //                $user_id = $this->_auth->getIdentity()->user_id;
             $user_id = $namespace->user_id;
             $user = $usersMapper->getUserById($user_id);
             if ($package_id) {
                 $transaction_type = "Package";
                 $packagesMapper = new Application_Model_PackagesMapper();
                 $package = $packagesMapper->getPackageById($package_id);
                 //$amount = $package->__get("package_price");
                 $this->view->package = $package;
                 $this->view->transaction_type = $transaction_type;
             }
             $fname = $user->__get("user_fname");
             $lname = $user->__get("user_lname");
             $email = $user->__get("user_email");
             $number = $user->__get("user_number");
         } else {
             $this->_redirect("/index/login/?redirect_url=" . $ref);
         }
         $merchant_key = "jqsdG2";
         //test key
         $merchant_key = "gtKFFx";
         $salt = "dwf1Ltip";
         //test salt
         $salt = "eCwWELxi";
         $baseUrl = "https://secure.payu.in";
         $baseUrl = "https://test.payu.in";
         $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
         $service_provider = "payu_paisa";
         //test
         $service_provider = "";
         $surl = BASE_URL . "index/orderlist?SUCC=succ";
         $furl = BASE_URL . "index/orderlist?SUCC=err";
         $posted = array();
         $posted['key'] = $merchant_key;
         $posted['txnid'] = $txnid;
         $posted['amount'] = $amount;
         $posted['firstname'] = $fname;
         $posted['email'] = $email;
         $posted['phone'] = $number;
         $posted['productinfo'] = "transaction_type:" . $transaction_type . "|user_id:" . $user_id . "|id:" . $id . "|package:" . $packageId;
         //$product_info;
         $posted['surl'] = $surl;
         $posted['furl'] = $furl;
         $posted['service_provider'] = $service_provider;
         //print_r($posted);exit;
         $hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
         $hashVarsSeq = explode('|', $hashSequence);
         $hash_string = '';
         foreach ($hashVarsSeq as $hash_var) {
             $hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
             $hash_string .= '|';
         }
         $hash_string .= $salt;
         $hash = strtolower(hash('sha512', $hash_string));
         $action = $baseUrl . '/_payment';
         $this->view->posted = $posted;
         $this->view->hash = $hash;
         $this->view->action = $action;
         $this->view->authorized = TRUE;
     } catch (Exception $ex) {
         $this->view->authorized = FALSE;
         $this->view->message = $ex->getMessage();
     }
 }
 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("info@laundrywala.co.in", $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("info@laundrywala.co.in", $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("info@laundrywala.co.in", $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("info@laundrywala.co.in", $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;
             }
         }
     }
 }
Exemple #10
0
 public function getuserAction()
 {
     $request = $this->getRequest();
     $mobileNumber = $request->getParam("mobile_number");
     $user = new Application_Model_UsersMapper();
     $userObj = $user->getUserByMobileNumber($mobileNumber);
     $retArr = array('data' => false, 'message' => 'No user found', 'success' => false);
     if ($userObj) {
         $retArr['data'] = array('first_name' => $userObj->user_fname, 'last_name' => $userObj->user_lname, 'email' => $userObj->user_email, 'house_address' => $userObj->user_address, 'city' => $userObj->user_city, 'user_id' => $userObj->user_id);
         $retArr['message'] = 'User found';
         $retArr['success'] = true;
     }
     exit(json_encode($retArr));
 }
 public function indexAction()
 {
     try {
         $request = $this->getRequest();
         $request_type = $request->getParam("request_type", FALSE);
         $user = new Zend_Session_Namespace('userInfo');
         $this->view->user_img = $user->user_img;
         $user_id = @$user->user_id;
         $usersMapper = new Application_Model_UsersMapper();
         $user = $usersMapper->getUserById($user_id);
         if ($request->isPost()) {
             if ($request_type) {
                 if ($request_type == "update") {
                     $u_fname = $request->getParam("user_fname");
                     $u_lname = $request->getParam("user_lname");
                     $u_email = $request->getParam("user_email");
                     $u_address = $request->getParam("user_address");
                     $u_address_additional = $request->getParam("user_address_additional");
                     $u_locality = $request->getParam("user_locality");
                     $u_city = $request->getParam("user_city");
                     $u_state = $request->getParam("user_state");
                     $u_country = $request->getParam("user_country");
                     $u_number = $request->getParam("user_number");
                     $u_landmark = $request->getParam("user_landmark");
                     $user->__set("user_fname", $u_fname);
                     $user->__set("user_lname", $u_lname);
                     $user->__set("user_email", $u_email);
                     $user->__set("user_address", $u_address);
                     $user->__set("user_address_additional", $u_address_additional);
                     $user->__set("user_locality", $u_locality);
                     $user->__set("user_city", $u_city);
                     $user->__set("user_state", $u_state);
                     $user->__set("user_country", $u_country);
                     $user->__set("user_number", $u_number);
                     if ($u_landmark) {
                         $user->__set("user_landmark", $u_landmark);
                     } else {
                         $user->__set("user_landmark", "");
                     }
                     $isUpdated = $usersMapper->updateUser($user);
                     if (is_object($isUpdated) && $isUpdated->success) {
                         $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 ($request_type == "change_password") {
                     $pass = $request->getParam("pass");
                     $cpaas = $request->getParam("cpass");
                     $errors = array();
                     if (empty($pass)) {
                         $errors[] = "Password Should Not Be Empty";
                     }
                     if (empty($cpaas)) {
                         $errors[] = "Confirm Password Should Not Be Empty";
                     }
                     if ($pass != $cpaas) {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                         $this->view->message = "Password don't match";
                     } else {
                         $hashed_password = $user->__get("hashed_password");
                         $hashed_password = sha1($pass);
                         if (count($errors) == 0) {
                             $user->__set("hashed_password", $hashed_password);
                             if ($usersMapper->updateUser($user)) {
                                 $this->view->hasMessage = true;
                                 $this->view->messageType = "success";
                                 $this->view->message = "Password changed successfully";
                             } else {
                                 $this->view->hasMessage = true;
                                 $this->view->messageType = "danger";
                                 $this->view->message = "Error updating password. Try again";
                             }
                         } else {
                             $errorString = "";
                             foreach ($errors as $error) {
                                 $errorString .= $error . "<br/>";
                             }
                             $this->view->hasMessage = true;
                             $this->view->messageType = "danger";
                             $this->view->message = $errorString;
                         }
                     }
                 }
             }
         }
         $user_fname = $user->__get("user_fname");
         $user_lname = $user->__get("user_lname");
         $user_email = $user->__get("user_email");
         $user_address = $user->__get("user_address");
         $user_address_additional = $user->__get("user_address_additional");
         $user_locality = $user->__get("user_locality");
         $user_city = $user->__get("user_city");
         $user_state = $user->__get("user_state");
         $user_country = $user->__get("user_country");
         $user_number = $user->__get("user_number");
         $user_landmark = $user->__get("user_landmark");
         $this->view->fname = $user_fname;
         $this->view->lname = $user_lname;
         $this->view->email = $user_email;
         $this->view->address = $user_address;
         $this->view->address_additional = $user_address_additional;
         $this->view->locality = $user_locality;
         $this->view->city = $user_city;
         $this->view->phone = $user_number;
         $this->view->state = $user_state;
         $this->view->country = $user_country;
         $this->view->landmark = $user_landmark;
         $this->view->number = $user_number;
     } catch (Exception $ex) {
     }
     $this->view->file_render = "account_profile";
 }
 public function editAction()
 {
     try {
         //$admins = new Application_Model_Admins;
         $usersMapper = new Application_Model_UsersMapper();
         $request = $this->getRequest();
         $user_form = new Application_Form_UserForm();
         $user_form->removeElement("hashed_password");
         $user_form->removeElement("cpassword");
         $user_form->removeElement("user_email");
         $elements = $user_form->getElements();
         $this->view->form = $user_form;
         $user_form_password = new Application_Form_UserForm();
         $this->view->password_form = $user_form_password;
         $user_id = $request->getParam("id");
         $secure = new My_Secure();
         $id = $secure->decode($user_id);
         $users = $usersMapper->getUserById($id);
         foreach ($elements as $element) {
             $element->setValue($users->__get($element->getName()));
         }
         if ($request->isPost()) {
             $request_type = $request->getParam("request_type", false);
             if ($request_type) {
                 if ($request_type == "edit") {
                     $params = $request->getParams();
                     if ($user_form->isValid($params)) {
                         foreach ($params as $param => $value) {
                             $users->__set($param, $value);
                         }
                         $users->__set("user_fb_id", "");
                         if ($usersMapper->updateUser($users)) {
                             $this->view->message = "User Updated successfully";
                             $this->view->hasMessage = true;
                             $this->view->messageType = "success";
                         } else {
                             $this->view->message = "Error occured while updating. Please try again";
                             $this->view->hasMessage = true;
                             $this->view->messageType = "danger";
                         }
                     } else {
                         $this->view->message = "Error occured while updating. Please fill form correctly";
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                     }
                 } elseif ($request_type == "change_password") {
                     $pass = $request->getParam("hashed_password");
                     $cpaas = $request->getParam("cpassword");
                     $errors = array();
                     if (empty($pass)) {
                         $errors[] = "Password Should Not Be Empty";
                     }
                     if (empty($cpaas)) {
                         $errors[] = "Confirm Password Should Not Be Empty";
                     }
                     if ($pass != $cpaas) {
                         $this->view->hasMessage = true;
                         $this->view->messageType = "danger";
                         $this->view->message = "Password don't match";
                     } else {
                         $hashed_password = $users->__get("hashed_password");
                         $hashed_password = sha1($pass);
                         if (count($errors) == 0) {
                             $users->__set("hashed_password", $hashed_password);
                             if ($usersMapper->updateUser($users)) {
                                 $this->view->hasMessage = true;
                                 $this->view->messageType = "success";
                                 $this->view->message = "Password changed successfully";
                             } else {
                                 $this->view->hasMessage = true;
                                 $this->view->messageType = "danger";
                                 $this->view->message = "Error updating password. Try again";
                             }
                         } else {
                             $errorString = "";
                             foreach ($errors as $error) {
                                 $errorString .= $error . "<br/>";
                             }
                             $this->view->hasMessage = true;
                             $this->view->messageType = "danger";
                             $this->view->message = $errorString;
                         }
                     }
                 }
             }
         }
         $this->authorised = true;
     } catch (Exception $ex) {
         $this->authorised = false;
         $this->view->hasMessage = true;
         $this->view->messageType = "danger";
         $this->view->message = $ex->getMessage();
     }
 }
 public function verifyorderotpAction()
 {
     $namespace = new Zend_Session_Namespace('userInfo');
     $userMapper = new Application_Model_UsersMapper();
     $orderSession = new Zend_Session_Namespace('orderSession');
     $cartSession = new Zend_Session_Namespace('laundryCart');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout->disableLayout();
     $response = array("success" => false, "message" => "");
     $otp = $this->_getParam("otp_number");
     $key = $this->_getParam("mobile_key");
     //get otp from user
     $userOtp = $userMapper->getUserOtp($namespace->user_id);
     if (isset($orderSession->{$key}) && $orderSession->{$key} == $otp && $userOtp == $otp || $this->websiteMode == 'DEBUG') {
         $cartSession->otpVerified = true;
         $response['success'] = true;
         $response['message'] = "verified";
     } else {
         $response['message'] = "OTP is not valid";
     }
     echo Zend_Json::Encode($response);
     die;
 }