Subversion Repositories SmartDukaan

Rev

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

Rev 23500 Rev 23629
Line 191... Line 191...
191
        	$("#grn-history-search-button").click();
191
        	$("#grn-history-search-button").click();
192
    	}
192
    	}
193
	});
193
	});
194
 
194
 
195
	$("#grn-history-paginated .next").live('click', function() {
195
	$("#grn-history-paginated .next").live('click', function() {
-
 
196
		var params = {};
-
 
197
		params['purchaseReference'] = grnhistory.searchText;
-
 
198
		params['searchType'] = grnhistory.searchType;
196
		var start = $( "#grn-history-paginated .start" ).text();
199
		params['startTime'] = grnhistory.startTime;
197
		var end = $( "#grn-history-paginated .end" ).text();
200
		params['endTime'] = grnhistory.endTime;
198
		getGrnHistoryNextItems(start,end,grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
201
		loadPaginatedNextItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
199
		$("#grn-history-paginated .next").blur();
202
		$(this).blur();
200
		
203
		
201
    });
204
    });
202
	
205
	
203
	$("#grn-history-paginated .previous").live('click', function() {
206
	$("#grn-history-paginated .previous").live('click', function() {
204
		var start = $( "#grn-history-paginated .start" ).text();
207
		var params = {};
205
		var end =  $( "#grn-history-paginated .end" ).text();
208
		params['purchaseReference'] = grnhistory.searchText;
206
		var size = $("#grn-history-paginated .size").text();
209
		params['searchType'] = grnhistory.searchType;
207
		if(parseInt(end) == parseInt(size)){
210
		params['startTime'] = grnhistory.startTime;
208
			var mod = parseInt(end) % 10;
211
		params['endTime'] = grnhistory.endTime;
-
 
212
		loadPaginatedPreviousItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
209
			end = parseInt(end) + (10 - mod); 
213
		$(this).blur();
210
		}
214
		
211
		var pre = end - 20;
-
 
212
		getGrnHistoryPreviousItems(start,end,pre,grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
-
 
213
		$("#grn-history-paginated .previous").blur();
-
 
214
    });
215
    });
215
	
216
	
216
	$("#grn-history-date-button").live('click', function() {
217
	$("#grn-history-date-button").live('click', function() {
217
		var dateRange = $('#reportrange span').text();
218
		var dateRange = $('#reportrange span').text();
218
		grnhistory.startTime = new Date(dateRange.split("-")[0]).getTime();
219
		grnhistory.startTime = new Date(dateRange.split("-")[0]).getTime();
Line 271... Line 272...
271
	        +"&endTime="+endTime, function(response){
272
	        +"&endTime="+endTime, function(response){
272
		$('#' + domId).html(response);
273
		$('#' + domId).html(response);
273
	});
274
	});
274
}
275
}
275
 
276
 
276
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
-
 
277
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
-
 
278
	        +"&startTime="+startTime
-
 
279
	        +"&endTime="+endTime+"&offset="+pre, function(response){
-
 
280
		$( "#grn-history-paginated .end" ).text(+end - +10);
-
 
281
		$( "#grn-history-paginated .start" ).text(+start - +10);
-
 
282
		$('#grn-history-table').html(response);
-
 
283
		$("#grn-history-paginated .next").prop('disabled', false);
-
 
284
		if (parseInt(pre)==0){
-
 
285
			$("#grn-history-paginated .previous").prop('disabled', true);
-
 
286
		}
-
 
287
	});
-
 
288
		
-
 
289
}
-
 
290
 
-
 
291
 
-
 
292
function getGrnHistoryNextItems(start, end, purchase_reference, searchType,startTime,endTime){
-
 
293
	console.log(start);
-
 
294
	console.log(end);
-
 
295
	console.log(+end + +10);
-
 
296
	console.log(+start + +10);
-
 
297
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
-
 
298
	        +"&startTime="+startTime
-
 
299
	        +"&endTime="+endTime+"&offset="+end, function(response){
-
 
300
		var size = $("#grn-history-paginated .size").text();
-
 
301
		if((parseInt(end) + 10) > parseInt(size)){
-
 
302
			console.log("(end + 10) > size == true");
-
 
303
			$( "#grn-history-paginated .end" ).text(size);
-
 
304
		}else{
-
 
305
			console.log("(end + 10) > size == false");
-
 
306
			$( "#grn-history-paginated .end" ).text(+end + +10);
-
 
307
		}
-
 
308
		$( "#grn-history-paginated .start" ).text(+start + +10);
-
 
309
		var last = $( "#grn-history-paginated .end" ).text();
-
 
310
		var temp = $( "#grn-history-paginated .size" ).text();
-
 
311
		if (parseInt(last) >= parseInt(temp)){
-
 
312
			$("#grn-history-paginated .next").prop('disabled', true);
-
 
313
			//$( "#good-inventory-paginated .end" ).text(temp);
-
 
314
		}
-
 
315
	    $('#grn-history-table').html(response);
-
 
316
	    $("#grn-history-paginated .previous").prop('disabled', false);
-
 
317
	});
-
 
318
	
-
 
319
    
-
 
320
}
-
 
321
 
-
 
322
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
-
 
323
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
-
 
324
	        +"&startTime="+startTime
-
 
325
	        +"&endTime="+endTime+"&offset="+pre, function(response){
-
 
326
		$( "#grn-history-paginated .end" ).text(+end - +10);
-
 
327
		$( "#grn-history-paginated .start" ).text(+start - +10);
-
 
328
		$('#grn-history-table').html(response);
-
 
329
		$("#grn-history-paginated .next").prop('disabled', false);
-
 
330
		if (parseInt(pre)==0)
-
 
331
		{
-
 
332
			$("#grn-history-paginated .previous").prop('disabled', true);
-
 
333
		}
-
 
334
	});
-
 
335
	
-
 
336
}
-
 
337
 
-
 
338
function loadGrnHistorySearchInfo(search_text,searchType,startTime,endTime){
277
function loadGrnHistorySearchInfo(search_text,searchType,startTime,endTime){
339
	loadGrnHistory("main-content",search_text,searchType,startTime,endTime);
278
	loadGrnHistory("main-content",search_text,searchType,startTime,endTime);
340
}
279
}
341
 
280
 
342
function findDuplicateSerialNumbers(value){
281
function findDuplicateSerialNumbers(value){