Exemplo n.º 1
0
 public function subscriptionsAction()
 {
     $idvalue = $this->_request->getParams('id');
     $bookDetail = $this->modelPublications->getInfoByPublisherId($idvalue['id']);
     $subscriptions_data = $this->modelSubscriptions->fetchAll('product_id=' . $idvalue['id'] . '');
     $this->view->subscriptiondata = $subscriptions_data;
     $whrcls = 'id=' . $idvalue['id'] . '';
     $get_publicationname = $this->modelPublications->getListWhere($whrcls);
     $modelCategory = new Publisher_Model_DbTable_Books();
     $getBrandInfo = $modelCategory->getBrandInfo($get_publicationname[0]->title);
     if (!empty($getBrandInfo)) {
         $titleBrand = $getBrandInfo['brand'];
     } else {
         $titleBrand = $get_publicationname[0]->title;
     }
     $this->view->publicationname = $titleBrand;
 }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
    public function exportfreereportxlsAction()
    {
        $category = $this->_request->getParam('category');
        $brand = $this->_request->getParam('brand');
        $productid = $this->_request->getParam('productid');
        $frmdate = $this->_request->getParam('frmdate');
        $todate = $this->_request->getParam('todate');
        $publisher_id = $this->_request->getParam('publisher');
        $modelCategory = new Publisher_Model_DbTable_Books();
        $brand_exp = explode("**", $brand);
        $request_list = $this->modelBooks->getProductReport($category, $brand_exp[0], $productid, $frmdate, $todate, $publisher_id);
        $request_list = $this->modelBooks->getProductFreeReport($category, $brand_exp[0], $productid, $frmdate, $todate, $publisher_id);
        $separator = ",";
        // separate column in csv
        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>
				 </tr>';
            foreach ($request_list as $req) {
                $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 = $getParentBrandInfo['brand'] . " - " . $titleBrand;
                    }
                }
                $title = stripslashes($titleBrand);
                $catInfo = $modelCategory->getCategoryInfo($req['cat_id']);
                $publiseherDetails = $this->modelPublisher->getInfoByPublisherId($req['publisher_id']);
                $publisherName = $publiseherDetails['publisher'];
                $totalDownLoad = $req['no_download'];
                $publication_id = $req['id'];
                $price = $req['price'];
                $quantity = $req['total_count'];
                $category_name = $catInfo['category_name'];
                $totalPurchase = $req['best_seller'];
                $content .= '<tr>
								<td>' . $publication_id . '</td>							
					 			<td>' . stripslashes($title) . '</td>
								<th>' . $category_name . '</th>
				 				<td>' . $publisherName . '</td>
				  				<td>' . $totalDownLoad . '</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="5" class="list-not-found">Data Not Found</td></tr>';
        }
        $content .= '</table>';
        $file = "freereport";
        $filename = $file . "_" . time() . ".xls";
        $test = $content;
        header("Content-type: application/vnd.ms-excel");
        header("Content-Disposition: attachment; filename={$filename}");
        echo $test;
        exit;
    }