| 28474 |
tejbeer |
1 |
|
|
|
2 |
<script src="https://cdn.datatables.net/plug-ins/1.10.19/api/sum().js"></script>
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
| 28005 |
tejbeer |
6 |
<div class="row">
|
|
|
7 |
|
|
|
8 |
|
| 28474 |
tejbeer |
9 |
#if(!$inStocksMap.isEmpty())
|
|
|
10 |
<div class="col-lg-8">
|
| 28005 |
tejbeer |
11 |
<table
|
|
|
12 |
class="table table-striped table-advance table-hover partner-planning-details">
|
|
|
13 |
<thead>
|
| 28474 |
tejbeer |
14 |
|
| 28005 |
tejbeer |
15 |
<tr>
|
| 28474 |
tejbeer |
16 |
<th rowspan="3">Warehouse</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
|
|
|
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())
|
| 28005 |
tejbeer |
38 |
<th>Stock</th>
|
|
|
39 |
<th>Sale</th>
|
| 28474 |
tejbeer |
40 |
<th>SD Stock</th> #end
|
| 28005 |
tejbeer |
41 |
|
|
|
42 |
</tr>
|
| 28474 |
tejbeer |
43 |
|
|
|
44 |
|
|
|
45 |
|
| 28005 |
tejbeer |
46 |
</thead>
|
|
|
47 |
<tbody>
|
| 28474 |
tejbeer |
48 |
#foreach($keyvalue in $customRetailers.entrySet())
|
| 28005 |
tejbeer |
49 |
<tr>
|
| 28020 |
tejbeer |
50 |
<td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>
|
| 28053 |
tejbeer |
51 |
<td>$fofoIdPartnerTypeMap.get($keyvalue.getKey())</td>
|
|
|
52 |
|
| 28005 |
tejbeer |
53 |
<td>$customRetailers.get($keyvalue.getKey()).getBusinessName()</td>
|
| 28474 |
tejbeer |
54 |
|
|
|
55 |
#foreach($catalog in $catalogItemMap.entrySet())
|
|
|
56 |
#if($inStocksMap.get($keyvalue.getKey()).get($catalog.getKey()))
|
|
|
57 |
<td class="instockItem" data-fofoid="$keyvalue.getKey()"
|
|
|
58 |
data-toggle="modal" data-target="#inStockItemModel">$inStocksMap.get($keyvalue.getKey()).get($catalog.getKey())</td>
|
|
|
59 |
#else
|
|
|
60 |
<td>0</td> #end
|
|
|
61 |
#if($fofoSalesMap.get($keyvalue.getKey()).get($catalog.getKey()))
|
|
|
62 |
|
| 28032 |
tejbeer |
63 |
<td class="inSaleItem"
|
|
|
64 |
data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
|
| 28474 |
tejbeer |
65 |
data-target="#inSaleItemModel">$fofoSalesMap.get($keyvalue.getKey()).get($catalog.getKey())</td>
|
| 28032 |
tejbeer |
66 |
#else
|
| 28005 |
tejbeer |
67 |
<td>0</td> #end
|
| 28474 |
tejbeer |
68 |
#if($warehouseStockMap.get($keyvalue.getValue().getWarehouseId()).get($catalog.getKey()))
|
|
|
69 |
|
| 28053 |
tejbeer |
70 |
<td class="warehouseStockItem"
|
|
|
71 |
data-warehouseid="$keyvalue.getValue().getWarehouseId()"
|
|
|
72 |
data-catalogid="$keyvalue.getValue().getWarehouseId()"
|
| 28474 |
tejbeer |
73 |
data-toggle="modal" data-target="#warehouseStockItemModel">$warehouseStockMap.get($keyvalue.getValue().getWarehouseId()).get($catalog.getKey())</td>
|
| 28053 |
tejbeer |
74 |
#else
|
| 28474 |
tejbeer |
75 |
<td>0</td> #end #end
|
| 28085 |
tejbeer |
76 |
<td><a class="selctItemQty" data-toggle="modal"
|
| 28474 |
tejbeer |
77 |
data-fofoid="$keyvalue.getKey()" data-target="#selectModelItems">
|
|
|
78 |
Add to po </a></td> #if($suggestedPoEntry.get($keyvalue))
|
| 28053 |
tejbeer |
79 |
|
| 28474 |
tejbeer |
80 |
<td><a class="podetails" data-fofoid="$keyvalue.getKey()"
|
|
|
81 |
data-datetime="$suggestedPoEntry.get($keyvalue.getKey())"
|
|
|
82 |
data-toggle="modal" data-target="#ItemsPo">$suggestedPoEntry.get($keyvalue.getKey()).format($dateTimeFormatter)</a></td>
|
| 28085 |
tejbeer |
83 |
#else
|
|
|
84 |
<td></td> #end
|
| 28053 |
tejbeer |
85 |
|
| 28005 |
tejbeer |
86 |
</tr>
|
|
|
87 |
#end
|
|
|
88 |
|
|
|
89 |
</tbody>
|
|
|
90 |
</table>
|
|
|
91 |
</div>
|
|
|
92 |
#else
|
|
|
93 |
|
|
|
94 |
<div class="col-lg-6">
|
|
|
95 |
<table
|
|
|
96 |
class="table table-striped table-advance table-hover partner-planning-details">
|
|
|
97 |
<thead>
|
|
|
98 |
<tr>
|
| 28020 |
tejbeer |
99 |
<th>Warehouse</th>
|
| 28053 |
tejbeer |
100 |
<th>Category</th>
|
| 28005 |
tejbeer |
101 |
<th>Partner Name</th>
|
|
|
102 |
<th>Item</th>
|
|
|
103 |
<th>Stock</th>
|
|
|
104 |
<th>Sale</th>
|
| 28053 |
tejbeer |
105 |
<th>Warehouse Stock</th>
|
| 28085 |
tejbeer |
106 |
<th>PO</th>
|
|
|
107 |
<th>last Po Entry</th>
|
| 28005 |
tejbeer |
108 |
|
| 28085 |
tejbeer |
109 |
|
|
|
110 |
|
| 28005 |
tejbeer |
111 |
</tr>
|
|
|
112 |
</thead>
|
|
|
113 |
<tbody>
|
|
|
114 |
#foreach($keyvalue in $inStockItemMap.entrySet())
|
|
|
115 |
<tr>
|
| 28020 |
tejbeer |
116 |
<td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>
|
| 28053 |
tejbeer |
117 |
<td>$fofoIdPartnerTypeMap.get($keyvalue.getKey().getFofoId())</td>
|
| 28020 |
tejbeer |
118 |
|
| 28005 |
tejbeer |
119 |
<td>$customRetailers.get($keyvalue.getKey().getFofoId()).getBusinessName()</td>
|
|
|
120 |
<td>$keyvalue.getValue().getBrand()
|
|
|
121 |
$keyvalue.getValue().getModelName()
|
|
|
122 |
$keyvalue.getValue().getModelNumber()</td>
|
|
|
123 |
<td>$keyvalue.getValue().getQty()</td>
|
|
|
124 |
#if($fofoSaleItem.get($keyvalue.getKey()))
|
|
|
125 |
<td>$fofoSaleItem.get($keyvalue.getKey()).getQty()</td> #else
|
|
|
126 |
<td>0</td> #end
|
| 28053 |
tejbeer |
127 |
|
|
|
128 |
|
|
|
129 |
<td>$keyvalue.getValue().getWarehouseQty()</td>
|
| 28085 |
tejbeer |
130 |
<td><a class="selctItemQty" data-toggle="modal"
|
|
|
131 |
data-fofoid="$keyvalue.getValue().getFofoId()"
|
|
|
132 |
data-target="#selectModelItems"> Add to po </a></td>
|
|
|
133 |
#if($suggestedPoEntry.get($keyvalue.getKey().getFofoId()))
|
| 28053 |
tejbeer |
134 |
|
| 28085 |
tejbeer |
135 |
<td><a class="podetails"
|
|
|
136 |
data-fofoid="$keyvalue.getKey().getFofoId()" data-toggle="modal"
|
|
|
137 |
data-target="#ItemsPo"
|
|
|
138 |
data-datetime="$suggestedPoEntry.get($keyvalue.getValue().getFofoId())">
|
|
|
139 |
$suggestedPoEntry.get($keyvalue.getKey().getFofoId()).format($dateTimeFormatter)
|
|
|
140 |
</a></td> #else
|
|
|
141 |
<td></td> #end
|
|
|
142 |
|
| 28005 |
tejbeer |
143 |
</tr>
|
|
|
144 |
#end
|
|
|
145 |
|
|
|
146 |
</tbody>
|
|
|
147 |
</table>
|
|
|
148 |
</div>
|
|
|
149 |
|
|
|
150 |
#end
|
|
|
151 |
</div>
|
|
|
152 |
|
|
|
153 |
|
| 28032 |
tejbeer |
154 |
<div id="inStockItemModel" class="modal" role="dialog">
|
|
|
155 |
<div class="modal-dialog">
|
|
|
156 |
<div class="modal-content"></div>
|
|
|
157 |
</div>
|
|
|
158 |
</div>
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
<div id="inSaleItemModel" class="modal" role="dialog">
|
|
|
162 |
<div class="modal-dialog">
|
|
|
163 |
<div class="modal-content"></div>
|
|
|
164 |
</div>
|
|
|
165 |
</div>
|
| 28053 |
tejbeer |
166 |
|
|
|
167 |
<div id="warehouseStockItemModel" class="modal" role="dialog">
|
|
|
168 |
<div class="modal-dialog">
|
|
|
169 |
<div class="modal-content"></div>
|
|
|
170 |
</div>
|
|
|
171 |
</div>
|
| 28085 |
tejbeer |
172 |
|
|
|
173 |
|
|
|
174 |
<div id="selectModelItems" class="modal" role="dialog">
|
|
|
175 |
<div class="modal-dialog">
|
|
|
176 |
<div class="modal-content"></div>
|
|
|
177 |
</div>
|
|
|
178 |
</div>
|
|
|
179 |
|
|
|
180 |
<div id="ItemsPo" class="modal" role="dialog">
|
|
|
181 |
<div class="modal-dialog">
|
|
|
182 |
<div class="modal-content"></div>
|
|
|
183 |
</div>
|
|
|
184 |
</div>
|
| 28005 |
tejbeer |
185 |
<script type="text/javascript">
|
| 28474 |
tejbeer |
186 |
var table
|
| 28020 |
tejbeer |
187 |
|
| 28474 |
tejbeer |
188 |
$(document).ready(function() {
|
| 28020 |
tejbeer |
189 |
|
| 28474 |
tejbeer |
190 |
table = $('.partner-planning-details').DataTable({
|
| 28020 |
tejbeer |
191 |
|
| 28474 |
tejbeer |
192 |
"lengthMenu" : [ 10, 25, 50, 75, 100, 250 ],
|
|
|
193 |
"pageLength" : 250,
|
|
|
194 |
"orderCellsTop" : true,
|
|
|
195 |
"fixedHeader" : true
|
|
|
196 |
});
|
| 28032 |
tejbeer |
197 |
|
| 28474 |
tejbeer |
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"
|
|
|
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 |
|
| 28475 |
tejbeer |
225 |
for (let h = 3 h < data.length - 2; h = h + 3) {
|
|
|
226 |
g = h / 3
|
| 28474 |
tejbeer |
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 |
}
|
|
|
250 |
|
|
|
251 |
}
|
|
|
252 |
|
| 28032 |
tejbeer |
253 |
$('.partner-planning-details').on(
|
|
|
254 |
'click',
|
|
|
255 |
'.instockItem',
|
|
|
256 |
function() {
|
|
|
257 |
var fofoId = $(this).data('fofoid');
|
|
|
258 |
var catalogIds = $('.criteria-item-catalogids').val();
|
|
|
259 |
console.log(catalogIds);
|
|
|
260 |
|
|
|
261 |
doGetAjaxRequestHandler(context
|
|
|
262 |
+ "/getInStockItembyFofoId?fofoId=" + fofoId
|
|
|
263 |
+ "&catalogItemIds=" + catalogIds, function(response) {
|
|
|
264 |
console.log(response)
|
|
|
265 |
$('#inStockItemModel .modal-content').html(response);
|
|
|
266 |
|
|
|
267 |
});
|
|
|
268 |
});
|
|
|
269 |
|
|
|
270 |
$('.partner-planning-details').on(
|
|
|
271 |
'click',
|
|
|
272 |
'.inSaleItem',
|
|
|
273 |
function() {
|
| 28057 |
tejbeer |
274 |
var fofoId = $(this).data('fofoid');
|
| 28032 |
tejbeer |
275 |
var catalogIds = $('.criteria-item-catalogids').val();
|
|
|
276 |
console.log(catalogIds);
|
|
|
277 |
|
|
|
278 |
doGetAjaxRequestHandler(context
|
|
|
279 |
+ "/getSaleItembyCatalogFofoId?fofoId=" + fofoId
|
|
|
280 |
+ "&catalogItemIds=" + catalogIds + "&date="
|
|
|
281 |
+ startDate, function(response) {
|
|
|
282 |
console.log(response)
|
|
|
283 |
$('#inSaleItemModel .modal-content').html(response);
|
|
|
284 |
|
|
|
285 |
});
|
|
|
286 |
});
|
| 28053 |
tejbeer |
287 |
|
|
|
288 |
$('.partner-planning-details').on(
|
|
|
289 |
'click',
|
|
|
290 |
'.warehouseStockItem',
|
|
|
291 |
function() {
|
|
|
292 |
var warehouseId = $(this).data('warehouseid');
|
|
|
293 |
var catalogIds = $('.criteria-item-catalogids').val();
|
|
|
294 |
console.log(catalogIds);
|
|
|
295 |
|
|
|
296 |
doGetAjaxRequestHandler(context
|
|
|
297 |
+ "/getWarehouseStockItem?warehouseId=" + warehouseId
|
|
|
298 |
+ "&catalogItemIds=" + catalogIds,
|
|
|
299 |
function(response) {
|
|
|
300 |
console.log(response)
|
|
|
301 |
$('#warehouseStockItemModel .modal-content').html(
|
|
|
302 |
response);
|
|
|
303 |
|
|
|
304 |
});
|
|
|
305 |
});
|
| 28085 |
tejbeer |
306 |
|
|
|
307 |
$('.partner-planning-details').on(
|
|
|
308 |
'click',
|
|
|
309 |
'.selctItemQty',
|
|
|
310 |
function() {
|
|
|
311 |
var catalogIds = $('.criteria-item-catalogids').val();
|
|
|
312 |
console.log(catalogIds);
|
|
|
313 |
var fofoId = $(this).data('fofoid');
|
|
|
314 |
|
|
|
315 |
doGetAjaxRequestHandler(context
|
|
|
316 |
+ "/selectItemColorByCatalog?catalogIds=" + catalogIds
|
|
|
317 |
|
|
|
318 |
+ "&fofoId=" + fofoId, function(response) {
|
|
|
319 |
console.log(response)
|
|
|
320 |
$('#selectModelItems .modal-content').html(response);
|
|
|
321 |
|
|
|
322 |
});
|
|
|
323 |
});
|
|
|
324 |
|
|
|
325 |
$(document).on(
|
|
|
326 |
"click",
|
|
|
327 |
".submit-item-po",
|
|
|
328 |
function(e) {
|
|
|
329 |
var seletedIds;
|
|
|
330 |
var jsonObject = {};
|
|
|
331 |
var seletedIdsJson = [];
|
|
|
332 |
var fofoId = $(this).data('fofoid');
|
|
|
333 |
|
|
|
334 |
$('#select-item').find('tr').each(function() {
|
|
|
335 |
var row = $(this);
|
|
|
336 |
|
|
|
337 |
console.log(row);
|
|
|
338 |
if (row.find('input[type="checkbox"]').is(':checked')) {
|
|
|
339 |
var currentRow = $(this).closest("tr");
|
|
|
340 |
|
|
|
341 |
var itemId = currentRow.find("td:eq(1)").html();
|
|
|
342 |
var name = currentRow.find("td:eq(2)").html();
|
|
|
343 |
var quantity = currentRow.find("td:eq(3) input").val();
|
|
|
344 |
console.log(quantity)
|
|
|
345 |
if (quantity == "") {
|
|
|
346 |
alert("Select the Quantity");
|
|
|
347 |
return false;
|
|
|
348 |
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
seletedIds = {
|
|
|
352 |
"itemId" : itemId,
|
|
|
353 |
"qty" : quantity
|
|
|
354 |
}
|
|
|
355 |
seletedIdsJson.push(seletedIds)
|
|
|
356 |
|
|
|
357 |
}
|
|
|
358 |
|
|
|
359 |
});
|
|
|
360 |
|
|
|
361 |
console.log(fofoId)
|
|
|
362 |
if (fofoId == null) {
|
|
|
363 |
alert("fofoId is required");
|
|
|
364 |
return false;
|
|
|
365 |
}
|
|
|
366 |
if (seletedIdsJson.length === 0) {
|
|
|
367 |
alert("Atleast one Item selected");
|
|
|
368 |
return false;
|
|
|
369 |
}
|
|
|
370 |
console.log(seletedIdsJson);
|
|
|
371 |
|
|
|
372 |
jsonObject['poIds'] = seletedIdsJson;
|
|
|
373 |
jsonObject['fofoId'] = fofoId;
|
|
|
374 |
console.log(jsonObject)
|
|
|
375 |
if (confirm("Are you sure you want to create po") == true) {
|
|
|
376 |
|
|
|
377 |
doPostAjaxRequestWithJsonHandler(context + "/createPo",
|
|
|
378 |
JSON.stringify(jsonObject), function(response) {
|
|
|
379 |
if (response == 'true') {
|
|
|
380 |
alert("successfully create");
|
|
|
381 |
|
|
|
382 |
$("#selectModelItems").modal("hide");
|
|
|
383 |
$("button.search-partner-stock").click();
|
|
|
384 |
}
|
|
|
385 |
});
|
|
|
386 |
}
|
|
|
387 |
|
|
|
388 |
});
|
|
|
389 |
|
|
|
390 |
$('.partner-planning-details').on(
|
|
|
391 |
'click',
|
|
|
392 |
'.podetails',
|
|
|
393 |
function() {
|
|
|
394 |
var fofoId = $(this).data('fofoid');
|
|
|
395 |
var datetime = $(this).data('datetime');
|
|
|
396 |
|
|
|
397 |
doGetAjaxRequestHandler(context
|
|
|
398 |
+ "/getSuggestedPoDetail?fofoId=" + fofoId
|
|
|
399 |
+ "&datetime=" + datetime, function(response) {
|
|
|
400 |
console.log(response)
|
|
|
401 |
$('#ItemsPo .modal-content').html(response);
|
|
|
402 |
|
|
|
403 |
});
|
|
|
404 |
});
|
| 28005 |
tejbeer |
405 |
</script>
|