public function deletepriceAction() { $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>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($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 "\$" . $priceList[$jj]['price']; echo "</div></td><td><div align='left'>"; echo "\$" . $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 exportusercsvAction() { $bookname = $this->_request->getParam('searchword'); $booktype = $this->_request->getParam('booktype'); $isbnnumber = $this->_request->getParam('searchisbn'); if (isset($bookname) && (trim($bookname) != "" || trim($booktype) != "" || trim($isbnnumber) != "")) { $bookname = trim($bookname); $booktype = trim($booktype); $isbnnumber = trim($isbnnumber); $getBrandIds = $this->modelBrand->getBrandIds($bookname); $whrcls = ""; if ($bookname != "") { $whrcls .= " title LIKE '%" . $bookname . "%'"; if (!empty($getBrandIds)) { $whrcls .= " OR title in(" . $getBrandIds . ")"; } } if ($booktype != "") { if ($bookname != "") { $whrcls .= " AND product_type LIKE '%" . $booktype . "%'"; } else { $whrcls .= " product_type LIKE '%" . $booktype . "%'"; } } if (!empty($isbnnumber)) { if ($bookname != "") { $whrcls .= " AND isbn_number LIKE '%" . $isbnnumber . "%'"; } elseif ($booktype != "") { $whrcls .= " AND isbn_number LIKE '%" . $isbnnumber . "%'"; } else { $whrcls .= " isbn_number LIKE '%" . $isbnnumber . "%'"; } } // $prodList=$this->modelPublications->getListWhere($whrcls); $sql = "select id,title,product_type,parent_brand_id,author_id,publish_time,publisher,publisher_id,admin_approve,isbn_number,is_featured from pclive_products where {$whrcls} order by id desc"; //$request_list=$this->modelconnections->fetchAll("intro_id='".$_SESSION['Zend_Auth']['storage']->user_id."' and conn_linkedin_id!=''"); $request_list = $this->modelPublications->getAdapter()->fetchAll($sql); } else { //$prodList=$this->modelPublications->getList(); $sql = "select id,title,parent_brand_id,product_type,author_id,publish_time,publisher,publisher_id,admin_approve,isbn_number,is_featured from pclive_products order by id desc"; //$request_list=$this->modelconnections->fetchAll("intro_id='".$_SESSION['Zend_Auth']['storage']->user_id."' and conn_linkedin_id!=''"); $request_list = $this->modelPublications->getAdapter()->fetchAll($sql); } $separator = ","; // separate column in csv $modelCategory = new Publisher_Model_DbTable_Books(); $productPrice = new Publisher_Model_DbTable_BookPrices(); if (count($request_list) > 0) { $csv_output = ""; $csv_output .= "Title / Brand" . $separator . "Genre" . $separator . "Author / Publisher" . $separator . "ISBN / ISSN" . $separator . "Publish Time" . $separator . "Status" . $separator . "Featured\n"; $content = '<table class="table-list" cellpadding="0" cellspacing="0" width="100%"> <tr> <th>Title / Brand</th> <th>Genre</th> <th>Author / Publisher</th> <th>ISBN / ISSN</th> <th>Publish Time</th> <th>Price</th> <th>Account Number</th> <th>Account Holder Name</th> <th>Banker</th> <th>Status</th> <th>Featured</th> </tr>'; foreach ($request_list as $req) { $productPriceInfo = array(); $productPriceInfo = $productPrice->getPriceList($req['id']); $price_details = ''; foreach ($productPriceInfo as $priceDet) { $countryDet = $modelCategory->getCountryName($priceDet['country_id']); if ($priceDet['price'] != '') { $price_details .= $priceDet['price'] . "(P) "; } if ($priceDet['group_price'] != '') { $price_details .= $priceDet['group_price'] . "(GP) "; } $price_details .= "in " . $countryDet['country'] . "<br/>"; } $getBrandInfo = $modelCategory->getBrandInfo($req['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $req['title']; } if (!empty($req['parent_brand_id'])) { $productInfo = $this->modelPublications->fetchRow('id=' . $req['parent_brand_id']); $getParentBrandInfo = $modelCategory->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand; } } $title = stripslashes($titleBrand); $genreInfo = $this->modelGenre->getGenreInfo($req['product_type']); $genre = $genreInfo['genre']; $publisher_info_array = array(); $publisher_info_array = $this->modelPublications->getPublisherInfo($req['publisher_id']); $account_det = " Account No:" . $publisher_info_array['account_no'] . " Account Holder Name:" . $publisher_info_array['account_no'] . " Bank Name:" . $publisher_info_array['banker']; /* if(!empty($publisher_info_array)) { $publisherName =$publisher_info_array['first_name']." ".$publisher_info_array['last_name']; } else { $publisherName = $req['publisher']; } */ $publisherName = $req['publisher']; $isbnNumber = $req['isbn_number']; $pubTime = $req['publish_time']; if ($req['admin_approve'] == '1') { $status = "Aproved"; } else { $status = "Not Aproved"; } if ($req['is_featured'] == '1') { $featured = "Yes"; } else { $featured = "No"; } $content .= '<tr> <td>' . str_replace(",", "", $title) . '</td> <td>' . str_replace(",", "", $genre) . '</td> <td>' . stripslashes($publisherName) . '</td> <td>' . $isbnNumber . '</td> <td>' . $pubTime . '</td> <td>' . $price_details . '</td> <td>' . $publisher_info_array['account_no'] . '</td> <td>' . $publisher_info_array['account_holder_name'] . '</td> <td>' . $publisher_info_array['banker'] . '</td> <td>' . $status . '</td> <td>' . $featured . '</td> </tr>'; $csv_output .= str_replace(",", "", $title) . $separator . str_replace(",", "", $genre) . $separator . str_replace(",", "", $publisherName) . $separator . str_replace(",", "", $isbnNumber) . $separator . str_replace(",", "", $pubTime) . $separator . str_replace(",", "", $status) . $separator . $featured . "\n"; } } else { $content .= '<tr><td colspan="8" class="list-not-found">Data Not Found</td></tr>'; } $content .= '</table>'; $file = "publications"; $filename = $file . "_" . time() . ".xls"; $test = $content; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); echo $test; exit; /*header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-type: application/vnd.ms-excel"); header("Content-type: application/vnd.ms-excel"); header("Content-type: application/xls"); //header("Content-disposition: excel".time().".csv"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header( "Content-disposition: filename=".$filename.".xls"); print $csv_output; exit;*/ }
public function deletepriceAction() { $id = $this->_request->getParam('id', 0); $parent_publication_id = $this->_request->getParam('parentid', 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='50%'><div align='left'><strong>Country</strong></div></td>\n<td width='30%'><div align='left'><strong>Language</strong></div></td>\n<td width='10%'><div align='left'><strong>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' => '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 $priceList[$jj]['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> "; echo "</div></td></tr>"; } echo "</table>"; exit; } else { echo "<font color='red'><strong>Sorry!, unable to delete price</strong></font>"; exit; } } }
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; }