Subversion Repositories SmartDukaan

Rev

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

Rev 27755 Rev 30017
Line 1... Line 1...
1
$(function() {
1
$(function () {
2
	$(document).on('click',"a.allocation_po", function() {
2
	$(document).on('click', "a.allocation_po", function () {
3
		currentFofoId = 0;
3
		currentFofoId = 0;
4
		counterSize = '';
4
		counterSize = '';
5
		loadIndent('main-content');
5
		loadIndent('main-content');
6
	});
6
	});
7
	
7
 
8
	$(document).on('click', ".partners_allocation",
8
	$(document).on('click', ".partners_allocation",
9
			function() {
9
		function () {
10
				
10
 
11
				doGetAjaxRequestHandler(context + "/getPartnerAllocation", function(response) {
11
			doGetAjaxRequestHandler(context + "/getPartnerAllocation", function (response) {
12
					$('#' + 'main-content').html(response);
12
				$('#' + 'main-content').html(response);
13
 
13
 
14
				});
-
 
15
					
-
 
16
			});
14
			});
-
 
15
 
-
 
16
		});
17
	
17
 
18
	$(document).on('click', ".partnerAllocation",
18
	$(document).on('click', ".partnerAllocation",
19
			function() {
19
		function () {
20
				
20
 
21
				var fofoId = $('#fofo-users').val()
21
			var fofoId = $('#fofo-users').val()
22
				console.log(fofoId)
22
			console.log(fofoId)
23
				var url = "/indent/loadIndent?fofoId=" + fofoId + "&counterSize="
23
			var url = "/indent/loadIndent?fofoId=" + fofoId + "&counterSize="
24
				+ "TEN_LAC";
24
				+ "TEN_LAC";
25
		              doAjaxRequestHandler(context + url, "GET", function(response) {{}
25
			doAjaxRequestHandler(context + url, "GET", function (response) {
26
			         
26
				{
27
			           
27
				}
-
 
28
 
-
 
29
 
28
			           $('.partner-indent-container').html(response);
30
				$('.partner-indent-container').html(response);
29
		               });
-
 
30
			});
31
			});
-
 
32
		});
31
	
33
 
32
	
34
 
33
	$(document).on('click', "button.mk_pause_button",
35
	$(document).on('click', "button.mk_pause_button",
34
					function() {
36
		function () {
35
						var clickedButton = $(this);
37
			var clickedButton = $(this);
36
 
38
 
37
						var description = clickedButton.data("description");
39
			var description = clickedButton.data("description");
38
						var catalogId = clickedButton.data("id");
40
			var catalogId = clickedButton.data("id");
39
						getColorsForItems(
41
			getColorsForItems(
40
								catalogId,
42
				catalogId,
41
								0,
43
				0,
42
								"Active/pause " + description,
44
				"Active/pause " + description,
43
								function(itemIds) {
45
				function (itemIds) {
44
									console.log(itemIds);
46
					console.log(itemIds);
45
									if (itemIds != null) {
47
					if (itemIds != null) {
46
										bootbox
48
						bootbox
47
												.confirm(
49
							.confirm(
48
														"Confirm Update "
50
								"Confirm Update "
49
																+ clickedButton
51
								+ clickedButton
50
																		.data("description")
52
									.data("description")
51
																+ "?",
53
								+ "?",
52
														function(result) {
54
								function (result) {
53
																	console.log(result)
55
									console.log(result)
54
															if (result) {
56
									if (result) {
55
																coloredItems
57
										coloredItems
56
																		.forEach(function(
58
											.forEach(function (
57
																				item) {
59
												item) {
58
																			item.active = itemIds
60
												item.active = itemIds
59
																					.indexOf(item.id
61
													.indexOf(item.id
60
																							+ "") >= 0;
62
														+ "") >= 0;
61
																			console
63
												console
62
																					.log(coloredItems)
64
													.log(coloredItems)
63
																		});
65
											});
64
 
66
 
65
																doPostAjaxRequestWithJsonHandler(
67
										doPostAjaxRequestWithJsonHandler(
66
																		context
68
											context
67
																				+ "/indent/confirm-pause/",
69
											+ "/indent/confirm-pause/",
68
																		JSON
70
											JSON
69
																				.stringify(coloredItems),
71
												.stringify(coloredItems),
70
																		function(
72
											function (
71
																				response) {
73
												response) {
72
																			if (response) {
74
												if (response) {
73
																				bootbox
75
													bootbox
74
																						.alert("Item/s  Updated Successfully");
76
														.alert("Item/s  Updated Successfully");
75
																			} else {
77
												} else {
76
																				bootbox
78
													bootbox
77
																						.alert("Could not pause item");
79
														.alert("Could not pause item");
78
																			}
80
												}
79
 
81
 
80
																		});
-
 
81
															}
-
 
82
														});
82
											});
83
									}
83
									}
84
								});
84
								});
-
 
85
					}
85
					});
86
				});
-
 
87
		});
86
	$(document).on('click', "button.raise_po", function() {
88
	$(document).on('click', "button.raise_po", function () {
87
		if (confirm("Please confirm the PO")) {
89
		if (confirm("Please confirm the PO")) {
88
			raisePO();
90
			raisePO();
89
		} else {
91
		} else {
90
			return;
92
			return;
91
		}
93
		}
92
	});
94
	});
93
 
95
 
94
	$(document).on('click', "li.mk_counter_size", function() {
96
	$(document).on('click', "li.mk_counter_size", function () {
95
		if ($(this).hasClass('active')) {
97
		if ($(this).hasClass('active')) {
96
			return;
98
			return;
97
		}
99
		}
98
		currentFofoId = 0;
100
		currentFofoId = 0;
99
		counterSize = $(this).find('a').html();
101
		counterSize = $(this).find('a').html();
100
		loadIndent('main-content');
102
		loadIndent('main-content');
101
	});
103
	});
102
	$(document).on('click', "li.brandLi", function() {
104
	$(document).on('click', "li.brandLi", function () {
103
		if (!$(this).hasClass('active')) {
105
		if (!$(this).hasClass('active')) {
104
			$("table.brandPerformance").toggle();
106
			$("table.brandPerformance").toggle();
105
			$("li.brandLi").removeClass('active');
107
			$("li.brandLi").removeClass('active');
106
			$(this).addClass('active');
108
			$(this).addClass('active');
107
		}
109
		}
108
	});
110
	});
109
	
111
 
110
	$(document).on('click', ".previous-month",function(){
112
	$(document).on('click', ".previous-month", function () {
111
		currentFofoId = 0;
113
		currentFofoId = 0;
112
		counterSize = '';
114
		counterSize = '';
113
		loadPreviousMonthIndent('main-content');
115
		loadPreviousMonthIndent('main-content');
114
	});
116
	});
115
	
117
 
116
	$(document).on('click', ".current-month",function(){
118
	$(document).on('click', ".current-month", function () {
117
		currentFofoId = 0;
119
		currentFofoId = 0;
118
		counterSize = '';
120
		counterSize = '';
119
		loadIndent('main-content');
121
		loadIndent('main-content');
120
	});
122
	});
121
	$(document).on('click','a.create_indent',  function() {
123
	$(document).on('click', 'a.create_indent', function () {
122
		currentFofoId = 0;
124
		currentFofoId = 0;
123
		counterSize = '';
125
		counterSize = '';
124
		loadIndent("main-content");
126
		loadIndent("main-content");
125
	});
127
	});
126
	$(document).on('click', "button.create_indent", function() {
128
	$(document).on('click', "button.create_indent", function () {
127
		loadIndent("main-content");
129
		loadIndent("main-content");
128
	});
130
	});
129
 
131
 
130
	$(document).on('click', "button.download_indent", function() {
132
	$(document).on('click', "button.download_indent", function () {
131
		downloadIndent();
133
		downloadIndent();
132
	})
134
	})
133
 
135
 
134
	$(document).on('change', "#entire-catalog-table input",
136
	$(document).on('change', "#entire-catalog-table input",
135
						function() {
137
		function () {
136
							var catalogId = parseInt($(this).data("catalog-id"));
138
			var catalogId = parseInt($(this).data("catalog-id"));
137
							var sellingPrice = parseInt($(this).data(
139
			var sellingPrice = parseInt($(this).data(
138
									"selling-price"));
140
				"selling-price"));
139
							var quantity = parseInt($(this).val());
141
			var quantity = parseInt($(this).val());
140
							if (quantity > 40) {
142
			if (quantity > 40) {
141
								alert("Quantity should not be above 40");
143
				alert("Quantity should not be above 40");
142
								if (catalogId in indentMap) {
144
				if (catalogId in indentMap) {
143
									$(this).val(indentMap[catalogId].quantity);
145
					$(this).val(indentMap[catalogId].quantity);
144
								} else {
146
				} else {
145
									$(this).val(0);
147
					$(this).val(0);
146
								}
148
				}
147
								return;
149
				return;
148
							}
150
			}
149
							brandName = $(this).data("brand-name");
151
			brandName = $(this).data("brand-name");
150
							description = $(this).data("description");
152
			description = $(this).data("description");
151
							if (!(brandName in indentMap)) {
153
			if (!(brandName in indentMap)) {
152
								indentMap[brandName] = {};
154
				indentMap[brandName] = {};
153
							}
155
			}
154
							if (catalogId in indentMap[brandName]) {
156
			if (catalogId in indentMap[brandName]) {
155
								indentMap[brandName][catalogId]["quantity"] = quantity;
157
				indentMap[brandName][catalogId]["quantity"] = quantity;
156
								indentMap[brandName][catalogId]["sellingPrice"] = sellingPrice;
158
				indentMap[brandName][catalogId]["sellingPrice"] = sellingPrice;
157
								indentMap[brandName][catalogId]["description"] = description;
159
				indentMap[brandName][catalogId]["description"] = description;
158
								indentMap[brandName][catalogId]["catalogId"] = catalogId;
160
				indentMap[brandName][catalogId]["catalogId"] = catalogId;
159
								indentMap[brandName][catalogId]["diff"] = quantity
161
				indentMap[brandName][catalogId]["diff"] = quantity
160
										- indentMap[brandName][catalogId]["initialQuantity"];
162
					- indentMap[brandName][catalogId]["initialQuantity"];
161
							} else {
163
			} else {
162
								indentMap[brandName][catalogId] = {
164
				indentMap[brandName][catalogId] = {
163
									"quantity" : quantity,
165
					"quantity": quantity,
164
									"sellingPrice" : sellingPrice,
166
					"sellingPrice": sellingPrice,
165
									"description" : description,
167
					"description": description,
166
									"catalogId" : catalogId,
168
					"catalogId": catalogId,
167
									"initialQuantity" : 0,
169
					"initialQuantity": 0,
168
									"diff" : quantity
170
					"diff": quantity
169
								};
171
				};
170
							}
172
			}
171
 
173
 
172
							console.log(indentMap);
174
			console.log(indentMap);
173
							console.log(currentFofoId)
175
			console.log(currentFofoId)
174
							doPostAjaxRequestHandler(context
176
			doPostAjaxRequestHandler(context
175
									+ "/open-indent/save?catalogId="+catalogId+"&itemQty="+quantity+"&fofoId="+currentFofoId
177
				+ "/open-indent/save?catalogId=" + catalogId + "&itemQty=" + quantity + "&fofoId=" + currentFofoId
176
									, function(response) {
178
				, function (response) {
177
								console.log(response);
179
					console.log(response);
178
								if (response == 'true') {
180
					if (response == 'true') {
179
								}
181
					}
180
							});
-
 
181
							populateIndentSummary();
-
 
182
				});
182
				});
-
 
183
			populateIndentSummary();
183
	
184
		});
184
 
185
 
185
 
186
 
186
	
-
 
187
	 /*
187
	/*
188
		 * $(document).on('click', "button.mk_submit_indent", function() {
188
		* $(document).on('click', "button.mk_submit_indent", function() {
189
		 * confirmString =[]; confirmString .push('<table class="table
189
		* confirmString =[]; confirmString .push('<table class="table
190
		 * table-striped table-condensed table-bordered"
190
		* table-striped table-condensed table-bordered"
191
		 * id="entire-catalog-table">'); confirmString.push('<tr>');
191
		* id="entire-catalog-table">'); confirmString.push('<tr>');
192
		 * confirmString .push('<th style="width:100px">Catalog Id</th>');
192
		* confirmString .push('<th style="width:100px">Catalog Id</th>');
193
		 * confirmString .push('<th style="width:250px">Description</th>');
193
		* confirmString .push('<th style="width:250px">Description</th>');
194
		 * confirmString .push('<th style="width:150px">Unit Price</th>');
194
		* confirmString .push('<th style="width:150px">Unit Price</th>');
195
		 * confirmString .push('<th style="width:150px">Quantity</th>');
195
		* confirmString .push('<th style="width:150px">Quantity</th>');
196
		 * confirmString .push('<th style="width:200px">Item total</th>');
196
		* confirmString .push('<th style="width:200px">Item total</th>');
197
		 * confirmString.push('</tr>'); changedItemIds
197
		* confirmString.push('</tr>'); changedItemIds
198
		 * .forEach(function(itemId) {
198
		* .forEach(function(itemId) {
199
		 * 
199
		*
200
		 * confirmString .push('<tr style="background-color:#9C7D7E">');
200
		* confirmString .push('<tr style="background-color:#9C7D7E">');
201
		 * confirmString.push('<td>' + itemId + '</td>');
201
		* confirmString.push('<td>' + itemId + '</td>');
202
		 * confirmString.push('<td>' +indentMap[itemId].description + '</td>');
202
		* confirmString.push('<td>' +indentMap[itemId].description + '</td>');
203
		 * confirmString .push('<td style="text-align:left">' +
203
		* confirmString .push('<td style="text-align:left">' +
204
		 * numberToComma(indentMap[itemId].sellingPrice) + '</td>');
204
		* numberToComma(indentMap[itemId].sellingPrice) + '</td>');
205
		 * confirmString.push('<td style="text-align:left">' +
205
		* confirmString.push('<td style="text-align:left">' +
206
		 * indentMap[itemId].quantity + '(' +(indentMap[itemId].diff > 0 ? '+' :
206
		* indentMap[itemId].quantity + '(' +(indentMap[itemId].diff > 0 ? '+' :
207
		 * '-') + Math.abs(indentMap[itemId].diff) + ' pcs)</td>');
207
		* '-') + Math.abs(indentMap[itemId].diff) + ' pcs)</td>');
208
		 * confirmString .push('<td style="text-align:left">'
208
		* confirmString .push('<td style="text-align:left">'
209
		 * +numberToComma(indentMap[itemId].quantity,
209
		* +numberToComma(indentMap[itemId].quantity,
210
		 * indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>');
210
		* indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>');
211
		 * });
211
		* });
212
		 * 
212
		*
213
		 * 
213
		*
214
		 * 
214
		*
215
		 * for ( var itemId in indentMap) { if(itemId.indexOf(changedItemIds) >
215
		* for ( var itemId in indentMap) { if(itemId.indexOf(changedItemIds) >
216
		 * 0) { continue; } if(indentMap[itemId].quantity > 0) {
216
		* 0) { continue; } if(indentMap[itemId].quantity > 0) {
217
		 * confirmString.push('<tr>'); confirmString.push('<td>' + itemId + '</td>');
217
		* confirmString.push('<tr>'); confirmString.push('<td>' + itemId + '</td>');
218
		 * confirmString.push('<td>' +indentMap[itemId].description + '</td>');
218
		* confirmString.push('<td>' +indentMap[itemId].description + '</td>');
219
		 * confirmString .push('<td style="text-align:left">' +
219
		* confirmString .push('<td style="text-align:left">' +
220
		 * numberToComma(indentMap[itemId].sellingPrice) + '</td>');
220
		* numberToComma(indentMap[itemId].sellingPrice) + '</td>');
221
		 * confirmString.push('<td style="text-align:left">' +
221
		* confirmString.push('<td style="text-align:left">' +
222
		 * indentMap[itemId].quantity + '</td>'); confirmString .push('<td style="text-align:left">' +
222
		* indentMap[itemId].quantity + '</td>'); confirmString .push('<td style="text-align:left">' +
223
		 * numberToComma(indentMap[itemId].quantity
223
		* numberToComma(indentMap[itemId].quantity
224
		 * ,indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>'); } }
224
		* ,indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>'); } }
225
		 * confirmString.push('</table>');
225
		* confirmString.push('</table>');
226
		 * $('#indent-container1').html(confirmString.join('')) .show();
226
		* $('#indent-container1').html(confirmString.join('')) .show();
227
		 * $('#indent-container').hide(); $('button.mk_submit_indent').hide();
227
		* $('#indent-container').hide(); $('button.mk_submit_indent').hide();
228
		 * $('button.bk_toedit_indent').show();
228
		* $('button.bk_toedit_indent').show();
229
		 * $('button.confirm_indent').show();
229
		* $('button.confirm_indent').show();
230
		 */
230
		*/
231
		  /*
231
	/*
232
			 * $(document).on('click', "button.confirm_indent", function() { var
232
	   * $(document).on('click', "button.confirm_indent", function() { var
233
			 * itemQtyList = []; for (catalogId in indentMap) { diff =
233
	   * itemQtyList = []; for (catalogId in indentMap) { diff =
234
			 * indentMap[catalogId]["quantity"] -
234
	   * indentMap[catalogId]["quantity"] -
235
			 * indentMap[catalogId]["initialQuantity"]; if (diff != 0) {
235
	   * indentMap[catalogId]["initialQuantity"]; if (diff != 0) {
236
			 * itemQtyList.push({ "quantity" : indentMap[catalogId]["quantity"],
236
	   * itemQtyList.push({ "quantity" : indentMap[catalogId]["quantity"],
237
			 * "catalogId" : indentMap[catalogId]["catalogId"] }); } }
237
	   * "catalogId" : indentMap[catalogId]["catalogId"] }); } }
238
			 * doPostAjaxRequestWithJsonHandler(context +
238
	   * doPostAjaxRequestWithJsonHandler(context +
239
			 * "/open-indent/save?fofoId=" + currentFofoId + "&counxterSize=" +
239
	   * "/open-indent/save?fofoId=" + currentFofoId + "&counxterSize=" +
240
			 * counterSize, JSON .stringify(itemQtyList), function(data) {
240
	   * counterSize, JSON .stringify(itemQtyList), function(data) {
241
			 * alert('Indent has been created Successfully!'); indentMap = {};
241
	   * alert('Indent has been created Successfully!'); indentMap = {};
242
			 * loadIndent('main-content'); }); });
242
	   * loadIndent('main-content'); }); });
243
			 */
243
	   */
244
	
244
 
245
	$(document).on('click', ".confirm_indent",
245
	$(document).on('click', ".confirm_indent",
246
			function() {
246
		function () {
247
			  if(confirm("Are you sure to confirm the indent")== true){
247
			if (confirm("Are you sure to confirm the indent") == true) {
248
			 doPostAjaxRequestHandler(context + "/open-indent/confirm?fofoId=" + currentFofoId  ,
248
				doPostAjaxRequestHandler(context + "/open-indent/confirm?fofoId=" + currentFofoId,
249
			  function(response) { 
249
					function (response) {
250
				  
250
 
251
			  console.log(response); 
251
						console.log(response);
252
			  if (response =='true') { 
252
						if (response == 'true') {
253
				  alert("successfully confirm"); 
253
							alert("successfully confirm");
254
				 // loadIndent('main-content');
254
							// loadIndent('main-content');
255
			  } 
255
						}
256
             }); 
256
					});
257
			 
257
 
258
	
258
 
259
			  }
259
			}
260
 });
260
		});
261
		
261
 
262
	/*
262
	/*
263
	 * $(document).on('click', "button.bk_toedit_indent", function() {
263
	 * $(document).on('click', "button.bk_toedit_indent", function() {
264
	 * $('button.bk_toedit_indent').hide(); $('button.confirm_indent').hide();
264
	 * $('button.bk_toedit_indent').hide(); $('button.confirm_indent').hide();
265
	 * $('button.mk_submit_indent').show(); $('#indent-container1').hide();
265
	 * $('button.mk_submit_indent').show(); $('#indent-container1').hide();
266
	 * $('#indent-container').show();
266
	 * $('#indent-container').show();
267
	 * 
267
	 *
268
	 * });
268
	 * });
269
	 */
269
	 */
270
 
270
 
271
});
271
});
272
 
272
 
273
function populateIndentSummary() {
273
function populateIndentSummary() {
274
	$planSummary = $("#plansummary");
274
	$planSummary = $("#plansummary");
275
 
275
 
276
	$planSummary.html('');
276
	$planSummary.html('');
277
	changedItemIds=[];
277
	changedItemIds = [];
278
	htmArr = [];
278
	htmArr = [];
279
	$('button.confirm_indent').hide();
279
	$('button.confirm_indent').hide();
280
	for ( var brandName in indentMap) {
280
	for (var brandName in indentMap) {
-
 
281
 
281
 
282
 
282
		
-
 
283
		allZero = true;
283
		allZero = true;
284
		trArray = [];
284
		trArray = [];
285
	
285
 
286
		for ( var itemId in indentMap[brandName]) {
286
		for (var itemId in indentMap[brandName]) {
287
			var description = indentMap[brandName][itemId]['description'];
287
			var description = indentMap[brandName][itemId]['description'];
288
 
288
 
289
			var itemQty = indentMap[brandName][itemId]['quantity'];
289
			var itemQty = indentMap[brandName][itemId]['quantity'];
290
		
290
 
291
			
291
 
292
			var sellingPrice = indentMap [brandName][itemId]['sellingPrice'];
292
			var sellingPrice = indentMap [brandName][itemId]['sellingPrice'];
293
			  var sellPrice = itemQty*sellingPrice;
293
			var sellPrice = itemQty * sellingPrice;
294
			
294
 
295
			if (itemQty != 0) {
295
			if (itemQty != 0) {
296
				allZero = false;
296
				allZero = false;
297
				
297
 
298
				trString = `<tr>
298
				trString = `<tr>
299
							<td style = "width:80%">${description}</td>
299
							<td style = "width:80%">${description}</td>
300
							<td>${itemQty}</td>
300
							<td>${itemQty}</td>
301
							<td class ="currency" >${sellPrice}</td>
301
							<td class ="currency" >${sellPrice}</td>
302
						</tr>`
302
						</tr>`
303
				trArray.push(trString);
303
				trArray.push(trString);
304
				
304
 
305
			} 
305
			}
306
			
306
 
307
 
307
 
308
		}
308
		}
309
		if(!allZero) {
309
		if (!allZero) {
310
			$('button.confirm_indent').show();
310
			$('button.confirm_indent').show();
311
			htmArr.push('<div>');
311
			htmArr.push('<div>');
312
			htmArr.push('<h4>' + brandName + '</h4>');
312
			htmArr.push('<h4>' + brandName + '</h4>');
313
			htmArr.push('<table class="table table-condensed" id = "planning-table">');
313
			htmArr.push('<table class="table table-condensed" id = "planning-table">');
314
			htmArr.push(trArray.join(' '));
314
			htmArr.push(trArray.join(' '));
315
			htmArr.push('</table>');
315
			htmArr.push('</table>');
316
			htmArr.push('</div>');
316
			htmArr.push('</div>');
317
		
317
 
318
			
318
 
319
		}
319
		}
320
 
320
 
321
	}
321
	}
322
 
322
 
323
			
-
 
324
	
-
 
325
	
-
 
326
	
323
 
327
	$planSummary.html(htmArr.join(""));
324
	$planSummary.html(htmArr.join(""));
328
	var total= 0;
325
	var total = 0;
329
	$('#planning-table tr').each(function() {
326
	$('#planning-table tr').each(function () {
330
		 
327
 
331
		
328
 
332
		 var value = parseInt($('td', this).eq(2).text());
329
		var value = parseInt($('td', this).eq(2).text());
333
		 if (!isNaN(value)) {
330
		if (!isNaN(value)) {
334
             total += value;
331
			total += value;
335
         }
332
		}
336
         
333
 
337
         console.log(total);
334
		console.log(total);
338
       
335
 
339
	 });
336
	});
340
	
337
 
341
	divString = `<div style ="float:right"><b>Total:-</b><span class="currency">${total}</span></div>`
338
	divString = `<div style ="float:right"><b>Total:-</b><span class="currency">${total}</span></div>`
342
	 htmArr.push(divString);
339
	htmArr.push(divString);
343
	 	 $planSummary.html(htmArr.join(""));
340
	$planSummary.html(htmArr.join(""));
344
	
341
 
345
	  
342
 
346
	// $('#planning-table tfoot td').eq(2).text('Total: ' + total);
343
	// $('#planning-table tfoot td').eq(2).text('Total: ' + total);
347
	
344
 
348
}
345
}
-
 
346
 
349
function loadIndent(domId) {
347
function loadIndent(domId) {
350
	var url = "/indent/loadIndent?fofoId=" + currentFofoId + "&counterSize="
348
	var url = "/indent/loadIndent?fofoId=" + currentFofoId + "&counterSize="
351
			+ counterSize;
349
		+ counterSize;
352
	doAjaxRequestHandler(context + url, "GET", function(response) {{}
350
	doAjaxRequestHandler(context + url, "GET", function (response) {
-
 
351
		{
-
 
352
		}
353
		$('#' + domId).html(response);
353
		$('#' + domId).html(response);
354
	});
354
	});
355
}
355
}
356
 
356
 
357
function loadPreviousMonthIndent(domId) {
357
function loadPreviousMonthIndent(domId) {
358
	var url = "/indent/loadIndentPreviousMonth?fofoId=" + currentFofoId + "&counterSize="
358
	var url = "/indent/loadIndentPreviousMonth?fofoId=" + currentFofoId + "&counterSize="
359
			+ counterSize;
359
		+ counterSize;
360
	doAjaxRequestHandler(context + url, "GET", function(response) {{}
360
	doAjaxRequestHandler(context + url, "GET", function (response) {
-
 
361
		{
-
 
362
		}
361
		$('#' + domId).html(response);
363
		$('#' + domId).html(response);
362
	});
364
	});
363
}
365
}
-
 
366
 
364
function downloadIndent() {
367
function downloadIndent() {
365
	var url = "/indent/download?fofoId=" + currentFofoId + "&counterSize="
368
	var url = "/indent/download?fofoId=" + currentFofoId + "&counterSize="
366
			+ counterSize;
369
		+ counterSize;
367
	doAjaxGetDownload(url, "indent.csv")
370
	doAjaxGetDownload(url, "indent.csv")
368
}
371
}
-
 
372
 
369
function raisePO() {
373
function raisePO() {
370
	doPostAjaxRequestWithJsonHandler(context + "/indent/create-po", {},
374
	doPostAjaxRequestWithJsonHandler(context + "/indent/create-po", {},
371
			function(response) {
375
		function (response) {
372
				if (response) {
376
			if (response) {
373
					alert("PO Created Successfully");
377
				alert("PO Created Successfully");
374
					$('a.allocation_po').click();
378
				$('a.allocation_po').click();
375
				} else {
379
			} else {
376
					alert("Problem while creating PO");
380
				alert("Problem while creating PO");
377
				}
381
			}
378
			});
382
		});
379
 
383
 
380
}
384
}
381
385