Esempio n. 1
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;
    }
Esempio n. 2
0
    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>&nbsp;";
                    ?>
<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;
            }
        }
    }
Esempio n. 3
0
    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>&nbsp;</td>
				<td>&nbsp;</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>&nbsp;";
                    ?>
 
<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;
    }
Esempio n. 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;
    }