Subversion Repositories SmartDukaan

Rev

Rev 28085 | Rev 28475 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28085 Rev 28474
Line -... Line 1...
-
 
1
 
-
 
2
<script src="https://cdn.datatables.net/plug-ins/1.10.19/api/sum().js"></script>
-
 
3
 
-
 
4
 
-
 
5
 
1
<div class="row">
6
<div class="row">
2
 
7
 
3
 
8
 
4
	#if(!$inStock.isEmpty())
9
	#if(!$inStocksMap.isEmpty())
5
	<div class="col-lg-6">
10
	<div class="col-lg-8">
6
		<table
11
		<table
7
			class="table table-striped table-advance table-hover partner-planning-details">
12
			class="table table-striped table-advance table-hover partner-planning-details">
8
			<thead>
13
			<thead>
-
 
14
 
9
				<tr>
15
				<tr>
10
					<th>Warehouse</th>
16
					<th rowspan="3">Warehouse</th>
11
					<th>Category</th>
17
					<th rowspan="3">Category</th>
-
 
18
					<th rowspan="3">Partner Name</th> #foreach($catalog in
-
 
19
					$catalogItemMap.entrySet())
-
 
20
					<th colspan="3">WOD : <span class="wod"></span>, WOS: <span
-
 
21
						class="wos"></span>
-
 
22
					</th> #end
12
					<th>Partner Name</th>
23
					<th rowspan="3">PO</th>
-
 
24
					<th rowspan="3">last Po Entry</th>
-
 
25
 
-
 
26
				</tr>
-
 
27
 
-
 
28
				<tr>
-
 
29
					#foreach($catalog in $catalogItemMap.entrySet())
-
 
30
					<th colspan="3">$catalog.getValue().get(0).getBrand()
-
 
31
						$catalog.getValue().get(0).getModelName()
-
 
32
						$catalog.getValue().get(0).getModelNumber()</th> #end
-
 
33
 
-
 
34
 
-
 
35
				</tr>
-
 
36
				<tr>
-
 
37
					#foreach($catalog in $catalogItemMap.entrySet())
13
					<th>Stock</th>
38
					<th>Stock</th>
14
					<th>Sale</th>
39
					<th>Sale</th>
15
					<th>Warehouse Stock</th>
40
					<th>SD Stock</th> #end
16
					<th>PO</th>
-
 
17
					<th>last Po Entry</th>
-
 
18
 
41
 
19
				</tr>
42
				</tr>
-
 
43
 
-
 
44
 
-
 
45
 
20
			</thead>
46
			</thead>
21
			<tbody>
47
			<tbody>
22
				#foreach($keyvalue in $inStock.entrySet())
48
				#foreach($keyvalue in $customRetailers.entrySet())
23
				<tr>
49
				<tr>
24
					<td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>
50
					<td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>
25
					<td>$fofoIdPartnerTypeMap.get($keyvalue.getKey())</td>
51
					<td>$fofoIdPartnerTypeMap.get($keyvalue.getKey())</td>
26
 
52
 
27
					<td>$customRetailers.get($keyvalue.getKey()).getBusinessName()</td>
53
					<td>$customRetailers.get($keyvalue.getKey()).getBusinessName()</td>
-
 
54
 
28
					<td class="instockItem"
55
					#foreach($catalog in $catalogItemMap.entrySet())
29
						data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
56
					#if($inStocksMap.get($keyvalue.getKey()).get($catalog.getKey()))
-
 
57
					<td class="instockItem" data-fofoid="$keyvalue.getKey()"
30
						data-target="#inStockItemModel">$keyvalue.getValue().getQty()</td>
58
						data-toggle="modal" data-target="#inStockItemModel">$inStocksMap.get($keyvalue.getKey()).get($catalog.getKey())</td>
-
 
59
					#else
-
 
60
					<td>0</td> #end
31
					#if($fofoSale.get($keyvalue.getKey()))
61
					#if($fofoSalesMap.get($keyvalue.getKey()).get($catalog.getKey()))
-
 
62
 
32
					<td class="inSaleItem"
63
					<td class="inSaleItem"
33
						data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
64
						data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
34
						data-target="#inSaleItemModel">$fofoSale.get($keyvalue.getKey()).getQty()</td>
65
						data-target="#inSaleItemModel">$fofoSalesMap.get($keyvalue.getKey()).get($catalog.getKey())</td>
35
					#else
66
					#else
36
					<td>0</td> #end
67
					<td>0</td> #end
37
					#if($warehouseStocks.get($keyvalue.getValue().getWarehouseId()))
68
					#if($warehouseStockMap.get($keyvalue.getValue().getWarehouseId()).get($catalog.getKey()))
-
 
69
 
38
					<td class="warehouseStockItem"
70
					<td class="warehouseStockItem"
39
						data-warehouseid="$keyvalue.getValue().getWarehouseId()"
71
						data-warehouseid="$keyvalue.getValue().getWarehouseId()"
40
						data-catalogid="$keyvalue.getValue().getWarehouseId()"
72
						data-catalogid="$keyvalue.getValue().getWarehouseId()"
41
						data-toggle="modal" data-target="#warehouseStockItemModel">$warehouseStocks.get($keyvalue.getValue().getWarehouseId()).getQty()</td>
73
						data-toggle="modal" data-target="#warehouseStockItemModel">$warehouseStockMap.get($keyvalue.getValue().getWarehouseId()).get($catalog.getKey())</td>
42
					#else
74
					#else
43
					<td>0</td> #end
75
					<td>0</td> #end #end
44
					<td><a class="selctItemQty" data-toggle="modal"
76
					<td><a class="selctItemQty" data-toggle="modal"
45
						data-fofoid="$keyvalue.getValue().getFofoId()"
77
						data-fofoid="$keyvalue.getKey()" data-target="#selectModelItems">
46
						data-target="#selectModelItems"> Add to po </a></td>
-
 
47
					#if($suggestedPoEntry.get($keyvalue.getValue().getFofoId()))
78
							Add to po </a></td> #if($suggestedPoEntry.get($keyvalue))
48
 
79
 
49
					<td><a class="podetails"
80
					<td><a class="podetails" data-fofoid="$keyvalue.getKey()"
50
						data-fofoid="$keyvalue.getValue().getFofoId()"
-
 
51
						data-datetime="$suggestedPoEntry.get($keyvalue.getValue().getFofoId())"
81
						data-datetime="$suggestedPoEntry.get($keyvalue.getKey())"
52
						data-toggle="modal" data-target="#ItemsPo">$suggestedPoEntry.get($keyvalue.getValue().getFofoId()).format($dateTimeFormatter)</a></td>
82
						data-toggle="modal" data-target="#ItemsPo">$suggestedPoEntry.get($keyvalue.getKey()).format($dateTimeFormatter)</a></td>
53
					#else
83
					#else
54
					<td></td> #end
84
					<td></td> #end
55
 
85
 
56
				</tr>
86
				</tr>
57
				#end
87
				#end
Line 66... Line 96...
66
			class="table table-striped table-advance table-hover partner-planning-details">
96
			class="table table-striped table-advance table-hover partner-planning-details">
67
			<thead>
97
			<thead>
68
				<tr>
98
				<tr>
69
					<th>Warehouse</th>
99
					<th>Warehouse</th>
70
					<th>Category</th>
100
					<th>Category</th>
71
 
-
 
72
					<th>Partner Name</th>
101
					<th>Partner Name</th>
73
					<th>Item</th>
102
					<th>Item</th>
74
					<th>Stock</th>
103
					<th>Stock</th>
75
					<th>Sale</th>
104
					<th>Sale</th>
76
					<th>Warehouse Stock</th>
105
					<th>Warehouse Stock</th>
Line 152... Line 181...
152
	<div class="modal-dialog">
181
	<div class="modal-dialog">
153
		<div class="modal-content"></div>
182
		<div class="modal-content"></div>
154
	</div>
183
	</div>
155
</div>
184
</div>
156
<script type="text/javascript">
185
<script type="text/javascript">
-
 
186
	var table
-
 
187
 
157
	$(document).ready(
188
	$(document).ready(function() {
-
 
189
 
-
 
190
		table = $('.partner-planning-details').DataTable({
-
 
191
 
-
 
192
			"lengthMenu" : [ 10, 25, 50, 75, 100, 250 ],
-
 
193
			"pageLength" : 250,
-
 
194
			"orderCellsTop" : true,
-
 
195
			"fixedHeader" : true
-
 
196
		});
-
 
197
 
-
 
198
		datatableSum()
-
 
199
 
-
 
200
		table.on('search.dt', function() {
-
 
201
			console.log('Currently applied global search: ' + table.search());
-
 
202
 
-
 
203
			datatableSum();
-
 
204
 
-
 
205
		});
-
 
206
	});
-
 
207
 
-
 
208
	function datatableSum() {
-
 
209
		let wod = [];
-
 
210
		let wos = [];
-
 
211
		table.rows({
-
 
212
			"search" : "applied"
158
			function() {
213
		}).every(function() {
-
 
214
			var data = this.data();
-
 
215
			for (let i = 3; i < data.length - 2; i = i + 3) {
-
 
216
				j = i / 3
-
 
217
				if (wod[j] == undefined) {
-
 
218
					wod[j] = 0;
-
 
219
				}
-
 
220
				if (parseInt(data[i]) > 0) {
-
 
221
					wod[j]++;
-
 
222
				}
-
 
223
			}
-
 
224
 
-
 
225
			for (let h = 4; h < data.length - 2; h = h + 3) {
-
 
226
				g = Math.floor(h / 3)
-
 
227
				if (wos[g] == undefined) {
-
 
228
					wos[g] = parseInt(data[h]);
-
 
229
				} else {
-
 
230
					wos[g] += parseInt(data[h]);
-
 
231
				}
-
 
232
			}
-
 
233
 
-
 
234
		});
-
 
235
 
-
 
236
		console.log(wod);
-
 
237
		console.log(wos);
-
 
238
		for (let m = 3; m < wod.length + 2; m++) {
-
 
239
			let indexNum = m + 1;
-
 
240
			var stockHeader = $(`.partner-planning-details thead tr th:nth-child(${indexNum})`)
-
 
241
			stockHeader.find('.wod').html(wod[m - 2])
-
 
242
		}
-
 
243
 
-
 
244
		for (let l = 3; l < wos.length + 2; l++) {
-
 
245
			let indexNum = l + 1;
-
 
246
			console.log(indexNum)
-
 
247
			var stockHeader = $(`.partner-planning-details thead tr th:nth-child(${indexNum})`)
-
 
248
			stockHeader.find('.wos').html(wos[l - 2])
-
 
249
		}
159
 
250
 
160
				$('.partner-planning-details thead tr').clone(true).appendTo(
-
 
161
						'.partner-planning-details thead');
-
 
162
				$('.partner-planning-details thead tr:eq(1) th').each(
-
 
163
						function(i) {
-
 
164
							var title = $(this).text();
-
 
165
							$(this).html(
-
 
166
									'<input type="text" style = "width:60%;" placeholder="Search '
-
 
167
											+ title + '" />');
-
 
168
 
251
	}
169
							$('input', this).on('keyup change', function() {
-
 
170
								if (table.column(i).search() !== this.value) {
-
 
171
									table.column(i).search(this.value).draw();
-
 
172
								}
-
 
173
							});
-
 
174
						});
-
 
175
				var table = $('.partner-planning-details').DataTable({
-
 
176
 
-
 
177
					"lengthMenu" : [ 10, 25, 50, 75, 100, 250 ],
-
 
178
					"pageLength" : 250,
-
 
179
					"orderCellsTop" : true,
-
 
180
					"fixedHeader" : true
-
 
181
				});
-
 
182
			});
-
 
183
 
252
 
184
	$('.partner-planning-details').on(
253
	$('.partner-planning-details').on(
185
			'click',
254
			'click',
186
			'.instockItem',
255
			'.instockItem',
187
			function() {
256
			function() {