Version Notes
First stable version
Download this release
Release Info
Developer | BrainSINS |
Extension | Vtrio |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 1.0.0
- app/code/community/Vtrio/CustomReports/Helper/Data.php +12 -9
- app/code/community/Vtrio/CustomReports/Model/Collection.php +61 -0
- app/code/community/Vtrio/CustomReports/etc/config.xml +1 -1
- app/design/adminhtml/default/default/template/vtrio/customreports/gridproduct.phtml +343 -313
- app/etc/modules/Vtrio_CustomReports.xml +1 -1
- package.xml +10 -13
app/code/community/Vtrio/CustomReports/Helper/Data.php
CHANGED
@@ -13,9 +13,7 @@ class Vtrio_CustomReports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
13 |
|
14 |
public function exportReportToCSV($reportArr,$report_period)
|
15 |
{
|
16 |
-
|
17 |
-
$headers = array('Period', 'Product Name', 'SKU', 'Total Price', 'Quantity Ordered');
|
18 |
-
|
19 |
$fp = fopen('php://output', 'w');
|
20 |
if ($fp && $reportArr) {
|
21 |
//echo "in";
|
@@ -24,12 +22,12 @@ class Vtrio_CustomReports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
24 |
header('Pragma: no-cache');
|
25 |
header('Expires: 0');
|
26 |
fputcsv($fp, $headers);
|
27 |
-
|
28 |
foreach ($reportArr as $arr_row) {
|
29 |
$values = array();
|
30 |
-
|
31 |
$totalQty = $totalQty+$arr_row['qty_ordered'];
|
32 |
$totalPrice = $totalPrice+$arr_row['price'];
|
|
|
|
|
33 |
if($report_period == 'month'){
|
34 |
$dateVal1 = explode("-",$arr_row['created_at']);
|
35 |
$createdDate = $dateVal1[1]."/".$dateVal1[0];
|
@@ -40,11 +38,9 @@ class Vtrio_CustomReports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
40 |
$date = date_create($arr_row['created_at']);
|
41 |
$createdDate = date_format($date,"M d, Y");
|
42 |
}
|
43 |
-
|
44 |
-
array_push($values,$createdDate,$arr_row['name'],$arr_row['sku'],number_format($arr_row['price'], 2, '.', ''),number_format($arr_row['qty_ordered'], 2, '.', ''));
|
45 |
fputcsv($fp, $values);
|
46 |
}
|
47 |
-
|
48 |
$values = array();
|
49 |
array_push($values,'','','','','');
|
50 |
fputcsv($fp, $values);
|
@@ -52,12 +48,19 @@ class Vtrio_CustomReports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
52 |
array_push($values,'','Total','',number_format($totalPrice, 2, '.', ''),number_format($totalQty, 2, '.', ''));
|
53 |
fputcsv($fp, $values);
|
54 |
|
|
|
|
|
55 |
die;
|
|
|
56 |
}
|
|
|
57 |
else {
|
|
|
58 |
echo "no result";
|
|
|
59 |
}
|
60 |
-
|
|
|
61 |
|
62 |
public function nestedSubCategory($subcatId,$space,$selectedId = null)
|
63 |
{
|
13 |
|
14 |
public function exportReportToCSV($reportArr,$report_period)
|
15 |
{
|
16 |
+
$headers = array('Period', 'Product Name', 'SKU', 'Total Price', 'Quantity Ordered', 'Billing Address', 'Shipping Address');
|
|
|
|
|
17 |
$fp = fopen('php://output', 'w');
|
18 |
if ($fp && $reportArr) {
|
19 |
//echo "in";
|
22 |
header('Pragma: no-cache');
|
23 |
header('Expires: 0');
|
24 |
fputcsv($fp, $headers);
|
|
|
25 |
foreach ($reportArr as $arr_row) {
|
26 |
$values = array();
|
|
|
27 |
$totalQty = $totalQty+$arr_row['qty_ordered'];
|
28 |
$totalPrice = $totalPrice+$arr_row['price'];
|
29 |
+
$shippingAddr = $arr_row['shipping_address'];
|
30 |
+
$billingAddr = $arr_row['billing_address'];
|
31 |
if($report_period == 'month'){
|
32 |
$dateVal1 = explode("-",$arr_row['created_at']);
|
33 |
$createdDate = $dateVal1[1]."/".$dateVal1[0];
|
38 |
$date = date_create($arr_row['created_at']);
|
39 |
$createdDate = date_format($date,"M d, Y");
|
40 |
}
|
41 |
+
array_push($values,$createdDate,$arr_row['name'],$arr_row['sku'],number_format($arr_row['price'], 2, '.', ''),number_format($arr_row['qty_ordered'], 2, '.', ''),$billingAddr,$shippingAddr);
|
|
|
42 |
fputcsv($fp, $values);
|
43 |
}
|
|
|
44 |
$values = array();
|
45 |
array_push($values,'','','','','');
|
46 |
fputcsv($fp, $values);
|
48 |
array_push($values,'','Total','',number_format($totalPrice, 2, '.', ''),number_format($totalQty, 2, '.', ''));
|
49 |
fputcsv($fp, $values);
|
50 |
|
51 |
+
|
52 |
+
|
53 |
die;
|
54 |
+
|
55 |
}
|
56 |
+
|
57 |
else {
|
58 |
+
|
59 |
echo "no result";
|
60 |
+
|
61 |
}
|
62 |
+
|
63 |
+
}
|
64 |
|
65 |
public function nestedSubCategory($subcatId,$space,$selectedId = null)
|
66 |
{
|
app/code/community/Vtrio/CustomReports/Model/Collection.php
CHANGED
@@ -137,6 +137,67 @@ class Vtrio_CustomReports_Model_Collection extends Mage_Core_Model_Abstract
|
|
137 |
|
138 |
$reportArr = array();
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
if($from && $to){
|
141 |
|
142 |
$fromExp = explode('/',$from);
|
137 |
|
138 |
$reportArr = array();
|
139 |
|
140 |
+
if($from && $to){
|
141 |
+
|
142 |
+
$fromExp = explode('/',$from);
|
143 |
+
$toExp = explode('/',$to);
|
144 |
+
|
145 |
+
if(!empty($order_statuses)){
|
146 |
+
$status = " and sfo.status in (";
|
147 |
+
for($i = 0;$i<count($order_statuses);$i++){
|
148 |
+
|
149 |
+
if($i==count($order_statuses)-1){
|
150 |
+
$status .= "'".$order_statuses[$i]."')";
|
151 |
+
}else{
|
152 |
+
$status .= "'".$order_statuses[$i]."',";
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}else{
|
156 |
+
$status = "";
|
157 |
+
}
|
158 |
+
|
159 |
+
$fromDate = $fromExp[2]."-".$fromExp[0]."-".$fromExp[1]." 00:00:00";
|
160 |
+
$toDate = $toExp[2]."-".$toExp[0]."-".$toExp[1]." 23:59:00";
|
161 |
+
|
162 |
+
$store_id = (trim($store_id))?" and sfoi.store_id='$store_id'":'';
|
163 |
+
$catalog_category_table= Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
|
164 |
+
if($catId){
|
165 |
+
$category = " left join $catalog_category_table as ccp on ccp.product_id=sfoi.product_id ";
|
166 |
+
if($subCatId){
|
167 |
+
$categoryWhere = (trim($subCatId))?" and ccp.category_id='$subCatId'":'';
|
168 |
+
}else{
|
169 |
+
$categoryWhere = (trim($catId))?" and ccp.category_id='$catId'":'';
|
170 |
+
}
|
171 |
+
}else{
|
172 |
+
$category = "";
|
173 |
+
$categoryWhere = "";
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
$sale_flat_table= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_item');
|
178 |
+
$sales_flat_order_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
179 |
+
|
180 |
+
$sql = "SELECT sfoi.created_at as date, sfoi.name, sfoi.sku, sfoi.price, sfoi.qty_ordered,
|
181 |
+
(select CONCAT(sfoa.firstname,' ',sfoa.lastname,'\n',sfoa.street,'\n',sfoa.city,', ',sfoa.region,', ',sfoa.postcode,'\n',sfoa.country_id) from sales_flat_order_address as sfoa where sfoa.entity_id=sfo.shipping_address_id) as shipping_address,
|
182 |
+
(select CONCAT(sfoa1.firstname,' ',sfoa1.lastname,'\n',sfoa1.street,'\n',sfoa1.city,', ',sfoa1.region,', ',sfoa1.postcode,'\n',sfoa1.country_id) from sales_flat_order_address as sfoa1 where sfoa1.entity_id=sfo.billing_address_id) as billing_address
|
183 |
+
FROM $sale_flat_table as sfoi
|
184 |
+
left join $sales_flat_order_table as sfo on sfo.entity_id=sfoi.order_id
|
185 |
+
$category
|
186 |
+
WHERE sfoi.created_at between '$fromDate' and '$toDate' $store_id $categoryWhere $status and sfoi.price >0 and sfoi.base_price >0
|
187 |
+
order by sfoi.created_at";
|
188 |
+
|
189 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
190 |
+
$reportArr = $connection->fetchAll($sql);
|
191 |
+
}
|
192 |
+
return $reportArr;
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
public function getReportCSV1($catId,$subCatId,$from,$to,$report_period,$store_id,$order_statuses){
|
198 |
+
|
199 |
+
$reportArr = array();
|
200 |
+
|
201 |
if($from && $to){
|
202 |
|
203 |
$fromExp = explode('/',$from);
|
app/code/community/Vtrio/CustomReports/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Vtrio_CustomReports>
|
5 |
-
<version>
|
6 |
</Vtrio_CustomReports>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Vtrio_CustomReports>
|
5 |
+
<version>1.0.0</version>
|
6 |
</Vtrio_CustomReports>
|
7 |
</modules>
|
8 |
<global>
|
app/design/adminhtml/default/default/template/vtrio/customreports/gridproduct.phtml
CHANGED
@@ -1,326 +1,356 @@
|
|
1 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('vtriocustomreport/pagination.css');?>" />
|
2 |
<?php
|
|
|
3 |
if($this->getRequest()->getParams()){
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
30 |
}
|
31 |
-
|
32 |
-
$
|
33 |
-
$
|
34 |
-
$
|
35 |
-
$
|
36 |
-
$
|
37 |
-
|
38 |
-
$
|
39 |
-
$
|
|
|
|
|
|
|
40 |
?>
|
|
|
41 |
<?php echo $this->getStoreSwitcherHtml() ?>
|
42 |
<div class="entry-edit">
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
<
|
177 |
-
<option value="
|
178 |
-
<option value="
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
200 |
</div>
|
|
|
201 |
<!-- ----------------------- Grid ---------------------- --->
|
202 |
-
|
203 |
-
<
|
204 |
-
<
|
205 |
-
|
206 |
-
|
207 |
-
<?php
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
278 |
</div>
|
|
|
279 |
<script type="text/javascript">
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
var newArrivals = "";
|
296 |
-
$url = '<?php echo $this->getUrl("customreports/report_index/getsubcategory");?>?catId='+catId;
|
297 |
-
new Ajax.Request($url, {
|
298 |
-
onSuccess: function(response) {
|
299 |
-
console.log(response);
|
300 |
-
document.getElementById('getSubCategory').innerHTML = response.responseText;
|
301 |
}
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
</script>
|
|
|
|
|
|
1 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('vtriocustomreport/pagination.css');?>" />
|
2 |
<?php
|
3 |
+
|
4 |
if($this->getRequest()->getParams()){
|
5 |
+
$key = ($this->getRequest()->getParam('key'))?$this->getRequest()->getParam('key'):'';
|
6 |
+
$catId = ($this->getRequest()->getParam('category'))?$this->getRequest()->getParam('category'):'';
|
7 |
+
$subCatId = ($this->getRequest()->getParam('subcategory'))?$this->getRequest()->getParam('subcategory'):'';
|
8 |
+
$from = ($this->getRequest()->getParam('from'))?$this->getRequest()->getParam('from'):'';
|
9 |
+
$to = ($this->getRequest()->getParam('to'))?$this->getRequest()->getParam('to'):'';
|
10 |
+
$report_period = ($this->getRequest()->getParam('report_period'))?$this->getRequest()->getParam('report_period'):'';
|
11 |
+
$store_ids = ($this->getRequest()->getParam('store_ids'))?$this->getRequest()->getParam('store_ids'):'';
|
12 |
+
$website1 = ($this->getRequest()->getParam('website'))?$this->getRequest()->getParam('website'):'';
|
13 |
+
$website2 = ($this->getRequest()->getParam('store'))?$this->getRequest()->getParam('store'):'';
|
14 |
+
$website3 = ($this->getRequest()->getParam('group'))?$this->getRequest()->getParam('group'):'';
|
15 |
+
$export = ($this->getRequest()->getParam('export'))?$this->getRequest()->getParam('export'):'';
|
16 |
+
$showOrderStatus = ($this->getRequest()->getParam('show_order_statuses'))?$this->getRequest()->getParam('show_order_statuses'):'';
|
17 |
+
if($showOrderStatus == '1'){
|
18 |
+
$order_statuses= ($this->getRequest()->getParam('order_statuses'))?$this->getRequest()->getParam('order_statuses'):'';
|
19 |
+
|
20 |
+
}else{
|
21 |
+
$order_statuses= "";
|
22 |
+
}
|
23 |
+
|
24 |
+
if(trim($website1)){
|
25 |
+
$website = $website1;
|
26 |
+
}else if($website2){
|
27 |
+
$website = $website2;
|
28 |
+
}else{
|
29 |
+
$website = $website3;
|
30 |
+
}
|
31 |
+
|
32 |
+
$page = ($this->getRequest()->getParam('page'))?$this->getRequest()->getParam('page'):'';
|
33 |
+
$limit = ($this->getRequest()->getParam('limit'))?$this->getRequest()->getParam('limit'):50;
|
34 |
}
|
35 |
+
|
36 |
+
$helper = Mage::helper('customreports');
|
37 |
+
$paginationArr = $helper->paginationCtrl($catId,$subCatId,$from,$to,$report_period,$store_ids,$order_statuses,$limit,$page);
|
38 |
+
$start = $paginationArr['start'];
|
39 |
+
$limit = ($paginationArr['limit'])?$paginationArr['limit']:$limit;
|
40 |
+
$pagination = $paginationArr['paginationLink'];
|
41 |
+
|
42 |
+
$model = Mage::getModel('customreports/collection');
|
43 |
+
$reportArr = $model->getReport($catId,$subCatId,$from,$to,$report_period,$store_ids,$order_statuses,$start,$limit);
|
44 |
+
$gridColSpan = $model->gridColSpan($reportArr,$report_period);
|
45 |
+
$orderStatus = $model->getOrderStatus();
|
46 |
+
|
47 |
?>
|
48 |
+
|
49 |
<?php echo $this->getStoreSwitcherHtml() ?>
|
50 |
<div class="entry-edit">
|
51 |
+
<form method="post" action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" id="filter_form">
|
52 |
+
<div></div>
|
53 |
+
<div class="entry-edit-head">
|
54 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Filter</h4>
|
55 |
+
<div class="form-buttons"></div>
|
56 |
+
</div>
|
57 |
+
<div id="sales_report_base_fieldset" class="fieldset ">
|
58 |
+
<div class="hor-scroll">
|
59 |
+
<table cellspacing="0" class="form-list">
|
60 |
+
<tbody>
|
61 |
+
<tr>
|
62 |
+
<td class="hidden" colspan="2">
|
63 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
64 |
+
<input type="hidden" value="<?php echo $website;?>" name="store_ids" id="sales_report_store_ids">
|
65 |
+
<input type="hidden" value="<?php echo $limit;?>" name="limit" id="limit">
|
66 |
+
<input type="hidden" value="<?php echo $page;?>" name="page" id="page">
|
67 |
+
</td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<td class="label"><label for="sales_report_period_type">Category</label></td>
|
71 |
+
<td class="value">
|
72 |
+
<select class=" select" title="Period" name="category" id="category" onchange="categoryChange(this)">
|
73 |
+
<option value="">----------------------Please Select----------------------</option>
|
74 |
+
<?php
|
75 |
+
$category = Mage::getModel('catalog/category');
|
76 |
+
$tree = $category->getTreeModel();
|
77 |
+
$tree->load();
|
78 |
+
|
79 |
+
$ids = $tree->getCollection()->getAllIds();
|
80 |
+
if ($ids){
|
81 |
+
foreach ($ids as $id){
|
82 |
+
$cat = Mage::getModel('catalog/category');
|
83 |
+
$cat->load($id);
|
84 |
+
if($cat->getLevel()==2 && $cat->getIsActive()==1){
|
85 |
+
$selected = ($catId == $cat->getId())?'selected = true':'';
|
86 |
+
?>
|
87 |
+
<option value=<?php echo $cat->getId();?> <?php echo $selected;?>><?php echo $cat->getName();?></option>
|
88 |
+
<?php }
|
89 |
+
}
|
90 |
+
}?>
|
91 |
+
</select>
|
92 |
+
</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<td class="label"><label for="sales_report_period_type">Sub-Category</label></td>
|
96 |
+
<td class="value">
|
97 |
+
<div id="getSubCategory">
|
98 |
+
<select class=" select" title="Period" name="subcategory" id="subcategory">
|
99 |
+
<option value="">----------------------Please Select----------------------</option>
|
100 |
+
<?php
|
101 |
+
$catId = $this->getRequest()->getParam('category');
|
102 |
+
$children = Mage::getModel('catalog/category')->getCategories($catId);
|
103 |
+
$helper = Mage::helper('customreports');
|
104 |
+
foreach ($children as $subCategory) {
|
105 |
+
$selectedSubCategory = ($subCatId == $subCategory->getId())?'selected = true':'';
|
106 |
+
$id = $subCategory->getId();
|
107 |
+
$name = $subCategory->getName();
|
108 |
+
$option .= "<option value='$id' $selectedSubCategory>$name</option>";
|
109 |
+
$option .= $helper->nestedSubCategory($id,3,$subCatId);
|
110 |
+
}
|
111 |
+
echo $option;
|
112 |
+
?>
|
113 |
+
</select>
|
114 |
+
</div>
|
115 |
+
</td>
|
116 |
+
</tr>
|
117 |
+
<tr>
|
118 |
+
<td class="label"><label for="sales_report_show_order_statuses">Order Status</label></td>
|
119 |
+
<td class="value">
|
120 |
+
<select class=" select" name="show_order_statuses" id="sales_report_show_order_statuses" onChange="getStatus()">
|
121 |
+
<option selected="selected" value="0" <?php echo ($showOrderStatus == '0')?'selected=true':'';?>>Any</option>
|
122 |
+
<option value="1" <?php echo ($showOrderStatus == '1')?'selected=true':'';?>>Specified</option>
|
123 |
+
</select>
|
124 |
+
<p id="note_show_order_statuses" class="note"><span>Applies to Any of the Specified Order Statuses</span></p>
|
125 |
+
</td>
|
126 |
+
</tr>
|
127 |
+
<tr style="<?php echo ($showOrderStatus == '0' || $showOrderStatus == '')?'display:none':'';?>" id="orderStatus">
|
128 |
+
<td class="label"></td>
|
129 |
+
<td class="value">
|
130 |
+
<select multiple="multiple" class=" select multiselect" size="10" name="order_statuses[]" id="sales_report_order_statuses">
|
131 |
+
<?php
|
132 |
+
foreach ($orderStatus as $orderStatus_row) {
|
133 |
+
$statusName = $orderStatus_row['status'];
|
134 |
+
$statuslabel = $orderStatus_row['label'];
|
135 |
+
$selected = (in_array($statusName, $order_statuses))?'selected=true':'';
|
136 |
+
|
137 |
+
?>
|
138 |
+
<option value="<?php echo $statusName;?>" <?php echo $selected;?>><?php echo $statuslabel;?></option>
|
139 |
+
<?php } ?>
|
140 |
+
</select>
|
141 |
+
</td>
|
142 |
+
</tr>
|
143 |
+
<tr>
|
144 |
+
<td class="label"><label for="sales_report_from">From <span class="required">*</span></label></td>
|
145 |
+
<td class="value">
|
146 |
+
<input type="text" style="width:110px !important;" class=" required-entry input-text" title="From" value="<?php echo $from;?>" id="sales_report_from" name="from"> <img style="" title="Select Date" id="sales_report_from_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>/skin/adminhtml/default/default/images/grid-cal.gif">
|
147 |
+
<div id="period_date_from_advaice"></div>
|
148 |
+
<script type="text/javascript">
|
149 |
+
//<![CDATA[
|
150 |
+
Calendar.setup({
|
151 |
+
inputField: "sales_report_from",
|
152 |
+
ifFormat: "%m/%e/%Y",
|
153 |
+
showsTime: false,
|
154 |
+
button: "sales_report_from_trig",
|
155 |
+
align: "Bl",
|
156 |
+
singleClick : true
|
157 |
+
});
|
158 |
+
//]]>
|
159 |
+
</script>
|
160 |
+
</td>
|
161 |
+
</tr>
|
162 |
+
<tr>
|
163 |
+
<td class="label"><label for="sales_report_to">To <span class="required">*</span></label></td>
|
164 |
+
<td class="value">
|
165 |
+
<input type="text" style="width:110px !important;" class=" required-entry input-text" title="To" value="<?php echo $to;?>" id="sales_report_to" name="to"> <img style="" title="Select Date" id="sales_report_to_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>skin/adminhtml/default/default/images/grid-cal.gif">
|
166 |
+
<div id="period_date_to_advaice"></div>
|
167 |
+
<script type="text/javascript">
|
168 |
+
//<![CDATA[
|
169 |
+
Calendar.setup({
|
170 |
+
inputField: "sales_report_to",
|
171 |
+
ifFormat: "%m/%e/%Y",
|
172 |
+
showsTime: false,
|
173 |
+
button: "sales_report_to_trig",
|
174 |
+
align: "Bl",
|
175 |
+
singleClick : true
|
176 |
+
});
|
177 |
+
//]]>
|
178 |
+
</script>
|
179 |
+
</td>
|
180 |
+
</tr>
|
181 |
+
<tr>
|
182 |
+
<td class="label"><label for="sales_report_to">Period</label></td>
|
183 |
+
<td class="value">
|
184 |
+
<select name="report_period" id="report_period" class="select">
|
185 |
+
<option value="day" <?php echo ($report_period == 'day')?'selected="true"':'';?>>Day</option>
|
186 |
+
<option value="month" <?php echo ($report_period == 'month')?'selected="true"':'';?>>Month</option>
|
187 |
+
<option value="year" <?php echo ($report_period == 'year')?'selected="true"':'';?>>Year</option>
|
188 |
+
</td>
|
189 |
+
</tr>
|
190 |
+
</tbody>
|
191 |
+
</table>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
|
195 |
+
<table cellspacing="0" class="actions">
|
196 |
+
<tr>
|
197 |
+
<td>
|
198 |
+
<?php echo $pagination;?>
|
199 |
+
</td>
|
200 |
+
<td class=" a-right">
|
201 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
202 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
203 |
+
<option value="csv">CSV</option>
|
204 |
+
</select>
|
205 |
+
<button style="" onclick="doExport()" class="scalable task" type="button" title="Export" id="export">Export</button>
|
206 |
+
</td>
|
207 |
+
</tr>
|
208 |
+
</table>
|
209 |
+
|
210 |
+
</form>
|
211 |
</div>
|
212 |
+
|
213 |
<!-- ----------------------- Grid ---------------------- --->
|
214 |
+
|
215 |
+
<div class="grid">
|
216 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
217 |
+
<col/>
|
218 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
219 |
+
<col <?php echo $_column->getHtmlProperty() ?>/>
|
220 |
+
<?php endforeach; ?>
|
221 |
+
|
222 |
+
<thead>
|
223 |
+
<tr class="headings">
|
224 |
+
<th class="no-link" style="width:100px"><span class="no-br"><?php echo $this->getPeriodText() ?></span></th>
|
225 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
226 |
+
<th <?php echo $_column->getHeaderHtmlProperty() ?>><span class="no-br"><?php echo $_column->getHeaderHtml() ?></span></th>
|
227 |
+
<?php endforeach; ?>
|
228 |
+
</tr>
|
229 |
+
</thead>
|
230 |
+
<?php if(count($reportArr) == 0):?>
|
231 |
+
<tbody>
|
232 |
+
<tr class="even">
|
233 |
+
<td colspan="5" class="empty-text a-center">No records found.</td>
|
234 |
+
</tr>
|
235 |
+
</tbody>
|
236 |
+
<?php else: ?>
|
237 |
+
<tbody>
|
238 |
+
<?php
|
239 |
+
$totalQty = 0;
|
240 |
+
$totalPrice = 0;
|
241 |
+
$i = 0;
|
242 |
+
$j = 0;
|
243 |
+
$k = 0;
|
244 |
+
foreach ($reportArr as $arr_row) {
|
245 |
+
$totalQty = $totalQty+$arr_row['qty_ordered'];
|
246 |
+
$totalPrice = $totalPrice+$arr_row['price'];
|
247 |
+
if($report_period == 'month'){
|
248 |
+
$dateVal1 = explode("-",$arr_row['created_at']);
|
249 |
+
$createdDate = $dateVal1[1]."/".$dateVal1[0];
|
250 |
+
}else if($report_period == 'year'){
|
251 |
+
$dateVal1 = explode("-",$arr_row['created_at']);
|
252 |
+
$createdDate = $dateVal1[0];
|
253 |
+
}else{
|
254 |
+
$date = date_create($arr_row['created_at']);
|
255 |
+
$createdDate = date_format($date,"M d, Y");
|
256 |
+
}
|
257 |
+
|
258 |
+
if($gridColSpan[$k] == $i){
|
259 |
+
$i = 0;$k++;
|
260 |
+
}
|
261 |
+
if($i == 0){ ?>
|
262 |
+
<tr title="#" class="pointer">
|
263 |
+
<td class=" " rowspan="<?php echo $gridColSpan[$k];?>"><span class="nobr"><?php echo $createdDate;?></span></td>
|
264 |
+
<td class=" "><?php echo $arr_row['name'];?></td>
|
265 |
+
<td class=" a-right "><?php echo $arr_row['sku'];?></td>
|
266 |
+
<td class=" a-right "><?php echo number_format($arr_row['price'], 2, '.', '');?></td>
|
267 |
+
<td class=" a-right last"><?php echo number_format($arr_row['qty_ordered'], 2, '.', '');?></td>
|
268 |
+
</tr>
|
269 |
+
|
270 |
+
<?php }else{ ?>
|
271 |
+
<tr class="">
|
272 |
+
<td class=" "><?php echo $arr_row['name'];?></td>
|
273 |
+
<td class=" a-right "><?php echo $arr_row['sku'];?></td>
|
274 |
+
<td class=" a-right "><?php echo number_format($arr_row['price'], 2, '.', '');?></td>
|
275 |
+
<td class=" a-right last"><?php echo number_format($arr_row['qty_ordered'], 2, '.', '');?></td>
|
276 |
+
</tr/>
|
277 |
+
<?php
|
278 |
+
}
|
279 |
+
$i++;
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
</tbody>
|
283 |
+
<tfoot>
|
284 |
+
<tr class="totals">
|
285 |
+
<th class="">Total </th>
|
286 |
+
<th class=""> </th>
|
287 |
+
<th class=" a-right"> </th>
|
288 |
+
<th class=" a-right"><?php echo number_format($totalPrice, 2, '.', '');?> </th>
|
289 |
+
<th class=" a-right"><?php echo number_format($totalQty, 2, '.', '');?> </th>
|
290 |
+
</tr>
|
291 |
+
</tfoot>
|
292 |
+
<?php endif; ?>
|
293 |
+
</table>
|
294 |
</div>
|
295 |
+
|
296 |
<script type="text/javascript">
|
297 |
+
|
298 |
+
function filterFormSubmit() {
|
299 |
+
|
300 |
+
var filters = $$('#sales_report_from', '#sales_report_to');
|
301 |
+
var elements = [];
|
302 |
+
for(var i in filters){
|
303 |
+
if(filters[i].value && filters[i].value.length && !filters[i].disabled) elements.push(filters[i]);
|
304 |
+
}
|
305 |
+
|
306 |
+
var validator = new Validation('filter_form');
|
307 |
+
if (validator.validate()) {
|
308 |
+
document.getElementById("export").value= '';
|
309 |
+
document.getElementById("page").value= '';
|
310 |
+
document.forms["filter_form"].submit();
|
311 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
}
|
313 |
+
|
314 |
+
function categoryChange(cat){
|
315 |
+
var catId = cat.value;
|
316 |
+
var newArrivals = "";
|
317 |
+
|
318 |
+
$url = '<?php echo $this->getUrl("customreports/report_index/getsubcategory");?>?catId='+catId;
|
319 |
+
new Ajax.Request($url, {
|
320 |
+
onSuccess: function(response) {
|
321 |
+
console.log(response);
|
322 |
+
document.getElementById('getSubCategory').innerHTML = response.responseText;
|
323 |
+
}
|
324 |
+
});
|
325 |
+
}
|
326 |
+
|
327 |
+
function doExport(){
|
328 |
+
var exportType = document.getElementById("customReport_export").value;
|
329 |
+
$parm = '?period=<?php echo $report_period;?>&catId=<?php echo $catId;?>&subCatId=<?php echo $subCatId;?>&from=<?php echo $from;?>&to=<?php echo $to;?>&store_id=<?php echo $store_id;?>&order_statuses=<?php echo $order_statuses;?>';
|
330 |
+
$url = '<?php echo $this->getUrl("customreports/report_index/csv_export");?>'+$parm;
|
331 |
+
document.location.href= $url;
|
332 |
+
}
|
333 |
+
|
334 |
+
function getStatus(){
|
335 |
+
if(document.getElementById("sales_report_show_order_statuses").value == '1'){
|
336 |
+
document.getElementById("orderStatus").style.display='';
|
337 |
+
}else{
|
338 |
+
document.getElementById("orderStatus").style.display="none";
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
function getPaginationLimit(val){
|
343 |
+
var limit = val.value;
|
344 |
+
document.getElementById("limit").value= limit;
|
345 |
+
document.forms["filter_form"].submit();
|
346 |
+
}
|
347 |
+
|
348 |
+
function setPage(page){
|
349 |
+
document.getElementById("page").value= page;
|
350 |
+
document.forms["filter_form"].submit();
|
351 |
+
}
|
352 |
+
|
353 |
</script>
|
354 |
+
|
355 |
+
|
356 |
+
|
app/etc/modules/Vtrio_CustomReports.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Vtrio_CustomReports>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
<version>
|
8 |
</Vtrio_CustomReports>
|
9 |
</modules>
|
10 |
</config>
|
4 |
<Vtrio_CustomReports>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
<version>1.0.0</version>
|
8 |
</Vtrio_CustomReports>
|
9 |
</modules>
|
10 |
</config>
|
package.xml
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
-
<name>
|
4 |
-
<version>
|
5 |
-
<stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">MITL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>VReport
|
10 |
-
<description>VReport
|
11 |
-
|
12 |
-
· Using the filter user could choose which category needs to have a search and report done. The drop down box is comprehensive and lists down all the Product Main Categories. So reports could be generated in detail, like which product category has been ordered from which date to which date and how many orders are in what statuses.
|
13 |
-
Sub Category – Lists down each Category’s division and is even more widespread. This search enables the user to get reports for each sub category under each product. This gives a better understanding of things due to its detailed listing.</description>
|
14 |
-
<notes>First development release</notes>
|
15 |
<authors><author><name>Developer</name><user>Developer</user><email>dev@vtrio.com</email></author></authors>
|
16 |
-
<date>2016-
|
17 |
-
<time>
|
18 |
-
<contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="vtriocustomreport"><file name="pagination.css" hash="3e61bea82df74a73e3b00c1952aa9770"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="vtrio"><dir name="customreports"><file name="gridproduct.phtml" hash="
|
19 |
<compatible/>
|
20 |
-
<dependencies><required><php><min>5.3.0</min><max>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
+
<name>VReport</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">MITL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>VReport module helps users to generate reports in more user friendly and business prospective way.</summary>
|
10 |
+
<description>VReport module helps users to generate reports in more user friendly and business prospective way. The report can be generated Category and Sub Categories wise. Additionaly the module provides time based and Order Status based filters and export options.Export file contains details like Product Name,SKU,total Price,Quantity Ordered, shipping and billing addres. The report will help store owners in setting business plans based on order status and category.</description>
|
11 |
+
<notes>First stable version</notes>
|
|
|
|
|
|
|
12 |
<authors><author><name>Developer</name><user>Developer</user><email>dev@vtrio.com</email></author></authors>
|
13 |
+
<date>2016-03-11</date>
|
14 |
+
<time>05:11:05</time>
|
15 |
+
<contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="vtriocustomreport"><file name="pagination.css" hash="3e61bea82df74a73e3b00c1952aa9770"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="vtrio"><dir name="customreports"><file name="gridproduct.phtml" hash="07dedcdaff3a17bc8510bb1f38e257e0"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Vtrio"><dir name="CustomReports"><dir name="Block"><dir name="Report"><dir name="Custom"><file name="Grid.php" hash="97be1eeaff2eabf3ed16dd4214a3abf9"/></dir><file name="Custom.php" hash="53ca9fae5564ba0c877c1a8e6e89e5e1"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4fe236db0b3efb39c7283593a14dbbfe"/></dir><dir name="Model"><file name="Collection.php" hash="b479f4ec0e9b3c131b57910f227f634c"/></dir><dir name="controllers"><dir name="Report"><file name="IndexController.php" hash="1afc4f670300dfe40466ebe75c182420"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="08112c6bf1a058fce42ee7a8f87b34c5"/><file name="config.xml" hash="0eb9f31ed975e9ef178a34a191009eda"/></dir></dir></dir></dir></dir><dir name="etc"><dir><dir name="modules"><file name="Vtrio_CustomReports.xml" hash="b476d1292e2a46bac9e48dcefa7672a8"/></dir></dir></dir></dir><dir name="modules"><file name="Vtrio_CustomReports.xml" hash=""/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php></required></dependencies>
|
18 |
</package>
|