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;
    }
Beispiel #2
0
 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;
 }
Beispiel #3
0
    function displayorderAction()
    {
        ##########################   data ###########################
        $orderIdForPurchase = $this->_getParam('orderid');
        $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();
        $productPrice = new Publisher_Model_DbTable_BookPrices();
        $modelImage = new Publisher_Model_DbTable_BookImages();
        $modelStore = new Admin_Model_DbTable_Countries();
        $productPrice = new Publisher_Model_DbTable_BookPrices();
        $modelSubscription = new Publisher_Model_DbTable_Subscriptions();
        $this->modelBooks = new Publisher_Model_DbTable_Books();
        $storage_company = new Zend_Auth_Storage_Session('company_type');
        $company_data = $storage_company->read();
        $storage = new Zend_Auth_Storage_Session('account_type');
        $data = $storage->read();
        if ($data->id) {
            $user_id = $data->id;
        } elseif ($company_data->id) {
            $user_id = $company_data->id;
        }
        if ($company_data->account_type == '1') {
            $groupObj = new Company_Model_DbTable_Groups();
            $groupList = $groupObj->getGroupList($company_data->id);
        }
        $datahistory = "<div class='top_heading'>\t\t\t\t\n\t\t    \t<div class='item'>Item(s)</div>\n\t\t        <div class='prices'>Subscription Type</div>\n\t\t        <div class='prices'>Price</div>";
        if ($company_data->account_type == '1') {
            $datahistory .= "<div class='quantity'>Qty</div>";
        } else {
            $datahistory .= "<div class='quantity'>&nbsp;</div>";
        }
        $datahistory .= "<div class='total'>Total</div>\n\t\t    </div>";
        $orderData = $creditHistoryObj->fetchAll("order_id='" . $orderIdForPurchase . "'");
        $dataDet = '';
        foreach ($orderData as $dataDet) {
            $price = $dataDet['price'];
            $subscription_data = $modelSubscription->fetchAll('id="' . $dataDet['subscription_type'] . '"');
            $product_details = $this->modelBooks->fetchRow("id='" . $dataDet['bookid'] . "'");
            $transaction_details = $transactionHistoryObj->fetchRow("id='" . $dataDet['transaction_id'] . "'");
            $catInfo = $this->modelBooks->getCategoryInfo($product_details['cat_id']);
            $getCurrencyName = $producturrency->getCurrencyCode($dataDet['store_id']);
            $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['publisher_id']);
            $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']);
            $total_price = $total_price + $producturrency->currencyconverter($getCurrencyName, "NGN", $dataDet['quantity'] * $price);
            if ($dataDet['payment_status'] == 1) {
                $orderStatus = 'Approved';
            } elseif ($dataDet['payment_status'] == 2) {
                $orderStatus = 'Declined';
            } else {
                $orderStatus = 'Pending';
            }
            if (count($subscription_data) > 0) {
                $subtype = $subscription_data[0]->subscription_type;
            } else {
                $subtype = "N/A";
            }
            $datahistory .= '<div class="cart_detail">
		    	<div class="item_content">
		   	    	<img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/' . USER_UPLOAD_DIR . 'thumb1_' . $imageInfo['image_name'] . '" width="140" height="175" alt="">
		            <h5>' . stripslashes($dataDet['book_name']) . '</h5>';
            if ($authorInfo['first_name'] != '') {
                $datahistory .= '<span><em>by: </em> ' . stripslashes($authorInfo['first_name'] . '&nbsp;' . $authorInfo['last_name']) . '</span>';
            }
            $datahistory .= '<span><em>Category: </em> ' . stripslashes($catInfo['category_name']) . '</span>
					<span><em>publisher:</em> ' . stripslashes($authorInfo['publisher']) . '</span>
		           </div>     
				  <div class="space_content"></div>
				<div class="prices_content">' . $subtype . '</div>
		        <div class="prices_content">&#x20a6;' . $producturrency->currencyconverter($getCurrencyName, "NGN", $price) . '</div>
		        <div style="float: left;padding: 5% 0;text-align: center;width: 70px;">
		        	<div class="">';
            if ($dataDet['group_id'] != 0) {
                $datahistory .= '<div >' . $dataDet['quantity'] . '</div>';
            }
            $datahistory .= '</div>
		        </div>
		        <div class="total_content">&#x20a6;' . @number_format($producturrency->currencyconverter($getCurrencyName, "NGN", $dataDet['quantity'] * $price), 2) . '</div>    
		 		</div>';
            if ($company_data->account_type == '1') {
                $finalsubprice = $finalsubprice + $dataDet['quantity'] * $price;
            } else {
                $finalsubprice = $finalsubprice + $price;
            }
        }
        $datahistory .= '<div class="shipping_total">
					<div class="row">
				    	<div class="lt">Subtotal</div>
				        <div class="rt">&#x20a6;' . @number_format($total_price, 2) . '</div>
				    </div>
				 		    
				    <div class="row" style="border:none;">
				    	<div class="lt">Tax</div>
				        <div class="rt">&#x20a6;' . '00.00</div>
				    </div>
				    
				    <div class="row subtotal">
				    	<div class="lt">Total</div>
				        <div class="rt">&#x20a6;' . @number_format($total_price, 2) . '</div>
				    </div>	
				      <div class="row subtotal">
				    	<div class="lt">Order Id</div>
				        <div class="rt">' . $orderIdForPurchase . '</div>
				    </div>
				      <div class="row subtotal">
				    	<div class="lt">Payment Status</div>
				        <div class="rt">' . $orderStatus . '</div>
				    </div>		   
				</div>';
        $this->view->datahistory = $datahistory;
        $this->view->orderId = $orderIdForPurchase;
        $this->view->transactionId = $orderData[0]['transaction_id'];
        $this->view->orderStatus = $orderStatus;
        $this->view->responseDescription = $transaction_details['responseDescription'];
    }
Beispiel #4
0
    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;
    }