public function storechangeAction() { /***********************************************************/ $modelCountry = new Admin_Model_DbTable_Countries(); $storeId = $this->_getParam('storeid'); if (!empty($storeId)) { $country_info = $modelCountry->fetchRow("id='{$storeId}'"); $storeId = $this->getRequest()->getCookie('sid'); $storeName = $this->getRequest()->getCookie('sname'); if (!empty($storeId) && !empty($storeName)) { setcookie("sid", $country_info->id); setcookie("sname", $country_info->country); $storeSession = new Zend_Session_Namespace('storeInfo'); $storeSession->sid = $country_info->id; $storeSession->sname = $country_info->country; } else { setcookie("sid", $country_info->id); setcookie("sname", $country_info->country); $storeSession = new Zend_Session_Namespace('storeInfo'); $storeSession->sid = $country_info->id; $storeSession->sname = $country_info->country; //$publication_store = new Zend_Auth_Storage_Session('store_type'); //$publication_store->write($country_info); } //exit; } else { $storeId = $this->getRequest()->getCookie('sid'); $storeName = $this->getRequest()->getCookie('sname'); if (empty($storeId) && empty($storeName)) { $country_info = $modelCountry->fetchRow('country="Nigeria"'); setcookie("sid", $country_info->id); setcookie("sname", $country_info->country); $storeSession = new Zend_Session_Namespace('storeInfo'); $storeSession->sid = $country_info->id; $storeSession->sname = $country_info->country; $storeSession->cid = $country_info->id; $storeSession->cname = $country_info->country; } else { $storeSession = new Zend_Session_Namespace('storeInfo'); $storeSession->sid = $storeId; $storeSession->sname = $storeName; $storeSession->cid = $storeId; $storeSession->cname = $storeName; } //exit; } /********************************************************************/ $this->_redirect('/'); }
function exportorderhistoryAction() { $productPrice = new Publisher_Model_DbTable_BookPrices(); $producturrency = new Admin_Model_DbTable_Countries(); $modelCategory = new Publisher_Model_DbTable_Books(); $order_key = $this->_request->getParam('order_key'); $to_date = $this->_request->getParam('to_date'); $from_date = $this->_request->getParam('from_date'); $subscription_name = $this->_request->getParam('subscription_name'); $user_type = $this->_request->getParam('user_type'); $formData = $this->getRequest()->getPost(); $where = ''; if (isset($order_key) && $order_key != '') { $condition .= ' and order_id="' . $order_key . '"'; } if (isset($from_date) && $from_date != '') { $condition .= ' and date(start_date) ="' . $from_date . '"'; } if (isset($to_date) && $to_date != '') { $condition .= ' and date(end_date) ="' . $to_date . '"'; } if (isset($subscription_name) && $subscription_name != '') { $condition .= ' and subscription_name ="' . $subscription_name . '"'; } if (isset($user_type) && $user_type == 'individual') { $condition .= ' and user_id > 0 and group_id=0'; } if (isset($user_type) && $user_type == 'Group') { $condition .= ' and user_id > 0 and group_id > 0'; } $formData = $this->getRequest()->getPost(); $productData = $this->modelUserSubscription->fetchAll('subscription_type > 0 ' . $condition . ''); $productPrice = new Publisher_Model_DbTable_BookPrices(); $producturrency = new Admin_Model_DbTable_Countries(); $this->modelCompanydata = new Model_DbTable_Companies(); $this->group_members = new Company_Model_DbTable_Groups(); $request_list = $productData; if (count($request_list) > 0) { $csv_output = ""; //$csv_output.="First Name".$separator."Last Name".$separator."User Name".$separator."Country".$separator."Email".$separator."Phone\n"; $content = '<table class="table-list" cellpadding="0" cellspacing="0" width="100%"> <tr> <th>Order Id</th> <th>User</h> <th>Group Name</th> <th>Company User</th> <th>Title / Brand</th> <th>Subscription Name</th> <th>Number of issues</th> <th>Number of Downloaded issues</th> <th>Subscription Price</th> <th>Start Date</th> <th>End Date</th> </tr>'; $sNumber = 1; foreach ($request_list as $row) { $this->sessCompanyInfo = $this->modelCompanydata->getInfoByUserId($row['user_id']); $this->sesscompany_user = $this->modelCompanydata->getInfoByUserId($row['company_id']); $this->sessgroup_members = $this->group_members->getInfoByGroupId($row['group_id']); $modelCategory = new Publisher_Model_DbTable_Books(); $getProductInfo = $this->modelCompany->getProductInfo($row['product_id']); $getBrandInfo = $modelCategory->getBrandInfo($getProductInfo['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $getProductInfo['title']; } if (!empty($getProductInfo['parent_brand_id'])) { $productInfo = $this->modelCompany->getProductInfo($getProductInfo['parent_brand_id']); $getParentBrandInfo = $modelCategory->getBrandInfo($productInfo['title']); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand; } } $getCurrencyName = $producturrency->getCurrencyCode($row['country']); $totNairaPrice = $producturrency->currencyconverter($getCurrencyName, "NGN", $row['subscription_price']); $content .= '<tr> <td>' . $row['order_id'] . '</td> <td>' . $this->sessCompanyInfo['first_name'] . " " . $this->sessCompanyInfo['last_name'] . '</td> <td>' . $this->sesscompany_user['first_name'] . " " . $this->sesscompany_user['last_name'] . '</td> <td>' . $this->sessgroup_members['group_name'] . '</td> <td>' . stripslashes($titleBrand) . '</td> <td>' . $row['subscription_name'] . '</td> <td>' . $row['number_of_issues'] . '</td> <td>' . $row['number_of_downloaded'] . '</td> <td>' . $producturrency->getCurrencyInfo($row['country']) . @number_format($totNairaPrice, 2) . '</td> <td>' . $row['start_date'] . '</td> <td>' . $row['end_date'] . '</td> </tr>'; $sNumber++; } } else { $content .= '<tr><td colspan="8" class="list-not-found">Data Not Found</td></tr>'; } $content .= '</table>'; $file = "subscription_report"; $filename = $file . "_" . time() . ".xls"; $test = $content; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); echo $test; exit; }
public function addpriceAction() { $createpriceURL = "http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/publisher/issues/addprice/"; $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); $parent_publication_id = $this->_request->getParam('parentid', 0); $formData = array(); $formErrors = array(); $formData = $this->getRequest()->getPost(); if ($this->getRequest()->isPost() && (!empty($formData['createprice']) && $formData['createprice'] == 'Add Price')) { if (!isset($formData['country']) || trim($formData['country']) == "") { $formErrors['country'] = "Please select country "; } if (!isset($formData['language']) || trim($formData['language']) == "") { $formErrors['language'] = "Please select language"; } if (!isset($formData['price']) || trim($formData['price']) == "") { $formErrors['price'] = "Please select price"; } if (count($formErrors) == 0) { $priceId = 0; $price_error = array(); if ($this->modelBooks->isPriceExist($formData['productid'], $formData['country'], $formData['language'], $formData['price'], "")) { //echo"<strong><font color='red'>Price already exist.</font></strong>";exit; $price_error[] = "Price already exist."; } else { if ($this->modelBooks->isGroupPriceExist($formData['productid'], $formData['country'], $formData['language'], $formData['group_price'], "")) { //echo"<strong><font color='red'>Price already exist.</font></strong>";exit; $price_error[] = "Group Price already exist."; } else { $priceData = array('product_id' => $formData['productid'], 'country_id' => $formData['country'], 'language_id' => $formData['language'], 'price' => $formData['price'], 'group_price' => $formData['group_price']); $modelPrice = new Publisher_Model_DbTable_BookPrices(); $priceId = $modelPrice->insert($priceData); } } if (empty($priceId)) { $price_error[] = "Price could not be saved."; } //echo "<strong><font color='green'>Price Added successfully</font></strong>"; ?> <form name="form-add-price" id="form-add-price" method="post" onsubmit="return validate_pricing_form('form-add-price','http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/publisher/issues/addprice/');"> <fieldset class="dashboard_fieldset"> <legend>Publication Store & Langauge</legend> <table width="99%" class="table-list publisher" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" colspan="2"><div id="priceoutput"></div></td> </tr> <tr> <td class="tdleftBold">Store<span class="required">*</span> : </td> <td> <?php $modelCountry = new Publisher_Model_DbTable_Books(); $countryList = $modelCountry->getCountryList(); ?> <select name="country" id="country" class="req" message="Please select country"> <option value="">Select Store</option> <?php for ($ii = 0; $ii < count($countryList); $ii++) { ?> <option value="<?php echo $countryList[$ii]['id']; ?> "><?php echo $countryList[$ii]['country']; ?> </option> <?php } ?> </select> <?php if (array_key_exists('country', $formErrors)) { echo '<div class="inline-error">' . $formErrors['country'] . '</div>'; } ?> </td> </tr> <tr> <td class="tdleftBold">Language<span class="required">*</span> : </td> <td> <?php $modelLanguage = new Publisher_Model_DbTable_Books(); $languageList = $modelLanguage->getLanguageList(); ?> <select name="language" id="language" class="req" message="Please select language"> <option value="">Select Language</option> <?php for ($ii = 0; $ii < count($languageList); $ii++) { ?> <option value="<?php echo $languageList[$ii]['id']; ?> "><?php echo $languageList[$ii]['language_name']; ?> </option> <?php } ?> </select> <?php if (array_key_exists('language', $formErrors)) { echo '<div class="inline-error">' . $formErrors['language'] . '</div>'; } ?> </td> </tr> <tr> <td class="tdleftBold">Price<span class="required">*</span> : </td> <td> <input type="text" name="price" id="price" class="req" message="Please enter price"/> <?php if (array_key_exists('price', $formErrors)) { echo '<div class="inline-error">' . $formErrors['price'] . '</div>'; } ?> </td> </tr> <tr> <td class="tdleftBold">Group Price : </td> <td> <input type="text" name="group_price" id="group_price" /> <?php if (array_key_exists('price', $formErrors)) { echo '<div class="inline-error">' . $formErrors['price'] . '</div>'; } ?> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"> <div style="text-align:center;"> <input type="hidden" name="createprice" value="Add Price"> <input type="hidden" name="productid" id="productid" value="<?php echo $_REQUEST['productid']; ?> " /> <input type="submit" name="createprice" id="createprice" value="Add Price" class="button-Save"/> </div> </td> </tr> </table> </fieldset> </form>77777777777 <?php echo "<table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n<td width='20%'><div align='left'><strong>Country</strong></div></td>\n<td width='20%'><div align='left'><strong>Language</strong></div></td>\n<td width='10%'><div align='left'><strong>Price</strong></div></td>\n<td width='20%'><div align='left'><strong>Group Price</strong></div></td>\n<td width='10%'><div align='left'><strong>Action</strong></div></td>\n</tr>"; $modelPrice = new Publisher_Model_DbTable_BookPrices(); $priceList = $modelPrice->getPriceList($formData['productid']); $producturrency = new Admin_Model_DbTable_Countries(); for ($jj = 0; $jj < count($priceList); $jj++) { //echo $this->view->url(); $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'issues', 'action' => 'deleteprice', 'id' => $priceList[$jj]['id'], 'parentid' => $parent_publication_id), '', true); echo "<tr><td><div align='left'>"; $modelCountry = new Publisher_Model_DbTable_Books(); $countryRecord = $modelCountry->getCountryName($priceList[$jj]['country_id']); echo $countryRecord['country']; echo "</div></td><td><div align='left'>"; $modelLanguage = new Publisher_Model_DbTable_Books(); $languageRecord = $modelLanguage->getLanguageName($priceList[$jj]['language_id']); echo $languageRecord['language_name']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($priceList[$jj]['country_id']) . $priceList[$jj]['price']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($priceList[$jj]['country_id']) . $priceList[$jj]['group_price']; echo "</div></td><td><div align='left'>"; echo "<a class='action-icon' href='" . $deletePriceUrl . "' onclick='return deleteprice(this.href);' title='Delete'>"; echo "<img src='" . $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/trash.gif' height='10' width='10'>"; echo "</a> "; ?> <a href="javascript:void(0);" onclick="return updateprice1('<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/issues/saveprice"; ?> ','<?php echo $formData['productid']; ?> ');"'<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/issues/saveprice"; ?> ','<?php echo $formData['productid']; ?> ');"> <img src="<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/icon_edit.png"; ?> " width="10" height="10"/> </a> <?php echo "</div></td></tr>"; } if (!empty($price_error)) { foreach ($price_error as $error_msg) { echo "<tr><td colspan='5'><strong><font color='red'>" . $error_msg . "</font></strong></td></tr>"; } } echo "</table>"; } } $this->view->formData = $formData; $this->view->formErrors = $formErrors; exit; }
public function deletepriceAction() { $producturrency = new Admin_Model_DbTable_Countries(); $id = $this->_request->getParam('id', 0); $modelPrice = new Publisher_Model_DbTable_BookPrices(); $currentrecord = $modelPrice->CurrentRow($id); if ($id > 0 && $modelPrice->isExist($id)) { $success = $modelPrice->delete('id=' . $id); if ($success) { echo "<table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n<td width='20%'><div align='left'><strong>Store</strong></div></td>\n<td width='20%'><div align='left'><strong>Language</strong></div></td>\n<td width='10%'><div align='left'><strong>Price</strong></div></td>\n<td width='20%'><div align='left'><strong>Group Price</strong></div></td>\n<td width='10%'><div align='left'><strong>Action</strong></div></td>\n</tr>"; $modelPrice = new Publisher_Model_DbTable_BookPrices(); $priceList = $modelPrice->getPriceList($currentrecord['product_id']); for ($jj = 0; $jj < count($priceList); $jj++) { $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'deleteprice', 'id' => $priceList[$jj]['id']), '', true); echo "<tr><td><div align='left'>"; $modelCountry = new Publisher_Model_DbTable_Books(); $countryRecord = $modelCountry->getCountryName($priceList[$jj]['country_id']); echo $countryRecord['country']; echo "</div></td><td><div align='left'>"; $modelLanguage = new Publisher_Model_DbTable_Books(); $languageRecord = $modelLanguage->getLanguageName($priceList[$jj]['language_id']); echo $languageRecord['language_name']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($priceList[$jj]['country_id']) . "" . $priceList[$jj]['price']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($priceList[$jj]['country_id']) . "" . $priceList[$jj]['group_price']; echo "</div></td><td><div align='left'>"; echo "<a class='action-icon' href='" . $deletePriceUrl . "' onclick='return deleteprice(this.href);' title='Delete'>"; echo "<img src='" . $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/trash.gif' height='10' width='10'>"; echo "</a> "; ?> <a href="javascript:void(0);" onclick="return updateprice1('<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/saveprice"; ?> ','<?php echo $currentrecord['product_id']; ?> ');"'<?php echo $priceList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/saveprice"; ?> ','<?php echo $formData['id']; ?> ');"> <img src="<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/icon_edit.png"; ?> " width="10" height="10"/> </a> <?php echo "</div></td></tr>"; } echo "</table>"; exit; } else { echo "<font color='red'><strong>Sorry!, unable to delete price</strong></font>"; exit; } } }
public function freepurchaseAction() { $producturrency = new Admin_Model_DbTable_Countries(); $modelAuthor = new Publisher_Model_DbTable_Publishers(); $tempObj = new Model_DbTable_Checkout(); $creditHistoryObj = new User_Model_DbTable_Chistory(); $transactionHistoryObj = new User_Model_DbTable_Transactionhistory(); $this->modelBooks = new Publisher_Model_DbTable_Books(); $modelImage = new Publisher_Model_DbTable_BookImages(); $modelStore = new Admin_Model_DbTable_Countries(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $orderId = time(); $subscription_store = ""; $subscription_language = ""; $subscription_issues = ""; $formDataTransApproved = array("orderId" => $orderId, "transactionType" => $transactionType, "pan" => $pan, "purchaseAmount" => $purchaseAmount, "tranDateTime" => $tranDateTime, "responseCode" => $responseCode, "responseDescription" => $responseDescription, "orderStatus" => $orderStatus, "approvalCode" => $approvalCode, "approvalCode" => $approvalCode, "merchantTranId" => $merchantTranId, "orderDescription" => $orderDescription, "approvalCodeScr" => $approvalCodeScr, "currency" => $currency, "threeDsVerification" => $threeDsVerification); $inserted_id = $transactionHistoryObj->insert($formDataTransApproved); $tempData = $tempObj->fetchAll("order_id='" . $orderIdForPurchase . "'"); foreach ($tempData as $dataDet) { $productPriceInfo = $productPrice->getPriceByStoreId($dataDet['product_id'], $dataDet['store_id']); if ($dataDet['subscription_type'] == '' || $dataDet['subscription_type'] == '0') { if ($dataDet['group_id'] > 0) { $price = $productPriceInfo['group_price']; } else { $price = $productPriceInfo['price']; } } else { $price = $dataDet['subscription_price']; $subscription_store = $dataDet['subscription_store']; $subscription_language = $dataDet['subscription_language']; $subscription_issues = $dataDet['subscription_issues']; } if ($orderStatus == 'APPROVED') { $orderSt = 1; } else { $orderSt = 0; } $product_details = $this->modelBooks->fetchRow("id='" . $dataDet['product_id'] . "'"); $getBrandInfo = $this->modelBooks->getBrandInfo($product_details['title']); if (!empty($getBrandInfo) && is_numeric($this->{$product_details}['title'])) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $product_details['title']; } if (!empty($product_details['parent_brand_id']) && $product_details['cat_id'] != '3') { $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand; } } $getCurrencyName = $producturrency->getCurrencyCode($dataDet['store_id']); $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['author_id']); $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']); $tempDatInsert = array(); $tempDatInsert['userid'] = $dataDet['user_id']; $tempDatInsert['bookid'] = $dataDet['product_id']; $tempDatInsert['store_id'] = $dataDet['store_id']; $tempDatInsert['price'] = $price; $tempDatInsert['userid'] = $dataDet['user_id']; $tempDatInsert['quantity'] = $dataDet['quntity']; $tempDatInsert['book_name'] = $titleBrand; $tempDatInsert['transaction_id'] = $inserted_id; $tempDatInsert['add_date'] = date('Y-m-d H:i:s'); $tempDatInsert['group_id'] = $dataDet['group_id']; $tempDatInsert['order_id'] = $dataDet['order_id']; $tempDatInsert['payment_status'] = $orderSt; $tempDatInsert['subscription_type'] = $dataDet['subscription_type']; $tempDatInsert['subscription_name'] = $dataDet['subscription_name']; $tempDatInsert['subscription_store'] = $dataDet['subscription_store']; $tempDatInsert['subscription_language'] = $dataDet['subscription_language']; $tempDatInsert['subscription_issues'] = $dataDet['subscription_issues']; $creditHistoryObj->insert($tempDatInsert); $total_price = $total_price + $dataDet['quntity'] * $price; $todaysdate = date('Y-m-d H:i:s'); if ($dataDet['subscription_name'] == 'Weekly') { $date = new DateTime($todaysdate); $date->modify("+7 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Monthly') { $date = new DateTime($todaysdate); $date->modify("+30 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Quarterly') { $date = new DateTime($todaysdate); $date->modify("+90 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Half Yearly') { $date = new DateTime($todaysdate); $date->modify("+182 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Yearly') { $date = new DateTime($todaysdate); $date->modify("+365 day"); $end_date = $date->format("Y-m-d H:i:s"); } } } } } $subscriptionObj = array(); $subscriptionObj['order_id'] = $orderid; $subscriptionObj['product_id'] = $dataDet['product_id']; $subscriptionObj['group_id'] = $dataDet['group_id']; $subscriptionObj['user_id'] = ''; $subscriptionObj['subscription_type'] = $dataDet['subscription_type']; $subscriptionObj['subscription_name'] = $dataDet['subscription_name']; $subscriptionObj['subscription_price'] = $price; $subscriptionObj['country'] = $dataDet['subscription_store']; $subscriptionObj['language'] = $dataDet['subscription_language']; $subscriptionObj['number_of_issues'] = $dataDet['subscription_issues']; $subscriptionObj['start_date'] = date('Y-m-d H:i:s'); $subscriptionObj['end_date'] = $end_date; $subscriptionObj['remaining_downloads'] = $dataDet['subscription_issues']; $subscriptionObj['publication_id'] = $product_details['parent_brand_id']; $UsersubObj->insert($subscriptionObj); } $tempObj->delete('order_id="' . $orderIdForPurchase . '"'); $this->_redirect('/checkout/displayorder/orderid/' . $orderIdForPurchase); //exit; }
public function freereportAction() { $producturrency = new Admin_Model_DbTable_Countries(); $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); $formData = $this->getRequest()->getPost(); $storage = new Zend_Auth_Storage_Session('publisher_type'); $sessDataIds = $storage->read(); if (isset($formData['manager']) && trim($formData['manager']) != "" && $formData['userList'] != '') { $assign_user_id = trim($formData['userList']); $publisher_id = $sessDataIds->id; if ($formData['from_date'] != '' && $formData['to_date'] != '') { $bookList = $this->modelBooks->getPublicationAssignListDateFree($publisher_id, $assign_user_id, $formData['from_date'], $formData['to_date']); } else { $bookList = $this->modelBooks->getPublicationAssignListFree($publisher_id, $assign_user_id); } } else { if ($formData['from_date'] != '' && $formData['to_date'] != '') { $bookList = $this->modelBooks->getPublicationProductListDateFree($this->parentPublisherId, $formData['from_date'], $formData['to_date']); } else { $bookList = $this->modelBooks->getPublicationProductListFree($this->parentPublisherId); } } foreach ($bookList as $bookDetails) { $getCurrencyName = $producturrency->getCurrencyCode($bookDetails['store_id']); //echo $bookDetails['purchaseAmount']."<br/>"; $price_t = $producturrency->currencyconverter($getCurrencyName, "NGN", $bookDetails['cr_price']); $totalPrice = $totalPrice + $bookDetails['best_seller'] * $price_t; } $page = $this->_getParam('page', 1); $paginator = Zend_Paginator::factory($bookList); $paginator->setItemCountPerPage(10); $paginator->setCurrentPageNumber($page); $this->view->totalCount = count($bookList); $this->view->pageSize = 10; $this->view->page = $page; $this->view->bookList = $paginator; $this->view->parentPublisherId = $this->parentPublisherId; $this->view->formData = $formData; $this->view->totalPrice = $totalPrice; }
public function init() { /*********** To check for publisher session data *********************/ $storage_publisher = new Zend_Auth_Storage_Session('publisher_type'); $publisher_data = $storage_publisher->read(); $storage_company = new Zend_Auth_Storage_Session('company_type'); $company_data = $storage_company->read(); $storage = new Zend_Auth_Storage_Session('account_type'); $userSessData = $storage->read(); if ($publisher_data && $publisher_data != null) { $this->modelPublisher = new Model_DbTable_Users(); $this->sessPublisherInfo = $this->modelPublisher->getInfoByUserId($publisher_data->id); $this->view->sessPublisherInfo = $this->sessPublisherInfo; } elseif ($company_data && $company_data != null) { $this->modelCompany = new Model_DbTable_Companies(); $this->sessCompanyInfo = $this->modelCompany->getInfoByUserId($company_data->id); $this->view->sessCompanyInfo = $this->sessCompanyInfo; } elseif ($userSessData && $userSessData != null) { $this->modelCompanies = new Company_Model_DbTable_Companies(); $this->sessUserInfo = $this->modelCompanies->getInfoByCompanyId($userSessData->id); $this->view->sessUserInfo = $this->sessUserInfo; } /************* To Set The active section and links *******************/ $controller = $this->_getParam('controller'); $action = $this->_getParam('action'); $this->view->currentController = $controller; $this->view->currentAction = $action; $this->view->class_active = 'class="active"'; /************* To Set The active section and links *******************/ $this->view->headScript()->appendFile($this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/js/banner_and_slider.js'); /******************************************************************/ //$storeId=$this->getRequest()->getCookie('sid'); //$storeName=$this->getRequest()->getCookie('sname'); $storeSession = new Zend_Session_Namespace('storeInfo'); if (!empty($storeSession->sid) && !empty($storeSession->sid) && !empty($storeSession->sname) && !empty($storeSession->sid) && !empty($storeSession->cid) && !empty($storeSession->cname)) { //echo "there"; /***********************************************************/ /****** new code ***********/ $modelCountry = new Admin_Model_DbTable_Countries(); $storeId = $storeSession->sid; $country_info = $modelCountry->fetchRow("id='{$storeId}'"); $storeSession->curId = $country_info->currency_id; $modelCurrency = new Admin_Model_DbTable_Currency(); $currency_info = $modelCurrency->fetchRow("currency_id='{$storeSession->curId}'"); $storeSession->curname = $currency_info->currency_sign; /******** end new Code *******/ $this->view->storeId = $storeSession->sid; $this->view->storeName = $storeSession->sname; //$this->_redirect('/auth/storechange/'); } else { //echo "here"; //$modelCountry = new Admin_Model_DbTable_Countries(); //$country_info = $modelCountry->fetchRow('country="Nigeria"'); //$this->_redirect('/auth/storechange/storeid/'.$country_info->id); $this->_redirect('/auth/storechange/'); } $this->modelBooks = new Publisher_Model_DbTable_Books(); $this->view->modelBooks = $this->modelBooks; $allStored = $this->modelBooks->getAllStores(); $this->view->allStored = $allStored; $this->modelCategories = new Admin_Model_DbTable_Categories(); $categoriesList = $this->modelCategories->getList(); $categoriesList = $categoriesList->toArray(); foreach ($categoriesList as $key => $catArray) { $records = $this->modelBooks->getPublicationIdsByCategoryName($storeSession->sid, $catArray['category_name'], '1', '0'); $categoriesList[$key]['total_publications'] = count($records); } $this->view->allcategories = $categoriesList; $this->modelGenres = new Admin_Model_DbTable_Genres(); $query = $this->modelBooks->select(); $query->setIntegrityCheck(false); //newspaper genres //$getnewspapers_genres = $db = Zend_Registry::get('db'); /*$query->from(array("book"=>$this->modelBooks),array('DISTINCT(product_type)')); $query->join(array("genre"=>$this->modelGenres), "book.product_type = genre.id", array('genre.genre')); $query->where('book.cat_id = ?', 1); $query->order('genre.genre asc');*/ $query = "SELECT DISTINCT (prod.product_type), gen.genre FROM pclive_products prod\n\t\t\t\t INNER JOIN pclive_genres gen ON prod.product_type = gen.id \n\t\t\t\t WHERE prod.cat_id =1 ORDER BY gen.genre ASC "; $result = $db->query($query); $getnewspapers_genres = $result->fetchAll(); //$getnewspapers_genres = $getnewspapers_genres->toArray(); $this->view->getnewspapers_genres = $getnewspapers_genres; //magazine genres $query_mag = "SELECT DISTINCT (prod.product_type), gen.genre FROM pclive_products prod\n\t\t\t\t INNER JOIN pclive_genres gen ON prod.product_type = gen.id \n\t\t\t\t WHERE prod.cat_id =2 ORDER BY gen.genre ASC "; $result_mag = $db->query($query_mag); $getmagazine_genres = $result_mag->fetchAll(); $this->view->getmagazine_genres = $getmagazine_genres; //ebook genres $query_ebook = "SELECT DISTINCT (prod.product_type), gen.genre FROM pclive_products prod\n\t\t\t\t INNER JOIN pclive_genres gen ON prod.product_type = gen.id \n\t\t\t\t WHERE prod.cat_id =2 ORDER BY gen.genre ASC "; $result_ebook = $db->query($query_ebook); $getebooks_genres = $result_ebook->fetchAll(); $this->view->getebooks_genres = $getebooks_genres; /*$this->modelGenres = new Admin_Model_DbTable_Genres(); for($x=0;$x<count($getnewspapers_genres);$x++) { $genrename = $this->modelGenres->fetchAll('id="'.$getnewspapers_genres[$x]['product_type'].'"'); } echo "<pre>"; print_r($genrename->toArray()); echo "</pre>"; //$data = $select->fetchAll();*/ /******************************************************************/ $storage_publisher = new Zend_Auth_Storage_Session('publisher_type'); $publisher_data = $storage_publisher->read(); if (count($publisher_data) > 0) { $user_id_comment = $publisher_data->id; $user_type = "4"; } $storage_company = new Zend_Auth_Storage_Session('company_type'); $company_data = $storage_company->read(); if (count($company_data) > 0) { $user_id_comment = $company_data->id; $user_type = "1"; } $storage_user = new Zend_Auth_Storage_Session('account_type'); $data_user = $storage_user->read(); if (count($data_user) > 0) { $user_id_comment = $data_user->id; $user_type = "2"; } }
public function expordetailsreportxlsAction() { $modelCategory = new Publisher_Model_DbTable_Books(); $producturrency = new Admin_Model_DbTable_Countries(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $separator = ","; $publication = $this->_request->getParam('publication'); $request_list = $this->modelBooks->gerDetailsReportsById($publication); if (count($request_list) > 0) { $csv_output = ""; //$csv_output.="First Name".$separator."Last Name".$separator."User Name".$separator."Country".$separator."Email".$separator."Phone\n"; $content = '<table class="table-list" cellpadding="0" cellspacing="0" width="100%"> <tr> <th>Publication Id</th> <th>Title / Brand</th> <th>Category</th> <th>Publisher</th> <th>Total Downloads</th> <th>Total Purchase</th> <th>Unit Price</th> <th>Total Amount</th> <th>Last Purchased</th> </tr>'; foreach ($request_list as $req) { //$req['country']; //$countryName = $this->modelUsers->getCountryInfo($req['country']); $getBrandInfo = $modelCategory->getBrandInfo($req['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $req['title']; } if (!empty($row->parent_brand_id)) { $productInfo = $this->modelPublications->fetchRow('id=' . $req['parent_brand_id']); $getParentBrandInfo = $modelCategory->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { $titleBrand = $titleBrand . ' (' . $getParentBrandInfo['brand'] . ')'; } } $title = stripslashes($titleBrand); $catInfo = $modelCategory->getCategoryInfo($req['cat_id']); $productPriceInfo = $productPrice->getPriceByStoreId($req['id'], $req['store_id']); $publiseherDetails = $this->modelPublisher->getInfoByPublisherId($req['publisher_id']); $publisherName = $publiseherDetails['publisher']; $totalDownLoad = $req['no_download']; $publication_id = $req['id']; $price = $req['price']; $quantity = $req['quantity']; $category_name = $catInfo['category_name']; $totalPurchase = $req['best_seller']; $currency = $producturrency->getCurrencyInfo($req['store_id']); $currencyN = $producturrency->getCurrencyInfo(226); if ($req['group_id'] != 0) { $price = $productPriceInfo['group_price']; } else { $price = $productPriceInfo['group_price']; } $getCurrencyName = $producturrency->getCurrencyCode($req['store_id']); $tot = $req['quantity'] * $req['price']; $totNairaPrice = $producturrency->currencyconverter($getCurrencyName, "NGN", $tot); $content .= '<tr> <td>' . $publication_id . '</td> <td>' . $title . '</td> <th>' . $category_name . '</th> <td>' . $publisherName . '</td> <td>' . $totalDownLoad . '</td> <td>' . $quantity . '</td> <td>' . $currency . $price . '</td> <td>' . $currencyN . $totNairaPrice . '</td> <td>' . $req['add_date'] . '</td> </tr>'; //$csv_output .= str_replace(",","",$req['first_name']).$separator.str_replace(",","",$req['last_name']).$separator.str_replace(",","",$req['user_name']).$separator.str_replace(",","",$countryName['country']).$separator.str_replace(",","",$req['user_email']).$separator.str_replace(",","",$req['phone'])."\n"; } } else { $content .= '<tr><td colspan="8" class="list-not-found">Data Not Found</td></tr>'; } $content .= '</table>'; $file = "report"; $filename = $file . "_" . time() . ".xls"; $test = $content; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); echo $test; exit; }