Subversion Repositories SmartDukaan

Rev

Rev 10218 | Rev 10885 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6467 amar.kumar 1
$(function() {
2
	$('#add-nonserialized-return').live('click', function(){
3
		$('<br/><label>ItemId : </label><input class = "return-itemId" name = "returnItemId" type = "textbox"/>'
4
				+'<label>Quantity : </label><input class = "return-qty" name = "returnQty" type = "textbox"/>').appendTo('#nonserialized-items-container');
5
	});
6
 
7
	$('#add-serialized-return').live('click', function(){
8
		$('<br/><label>IMEI Number : </label><input class = "imei-number" name = "returnImeiNumber" type = "textbox"/>').appendTo('#serialized-items-container')
9
	});
10
 
11
	$('.settlePurchaseReturn').live('click', function(){
12
		purchaseReturnId = $(this).attr('id');
13
		$.ajax({
14
	        type : "GET",
15
	        url : "/inventory/purchase-return!markSettled?purchaseReturnId="+purchaseReturnId,
16
	        success : function(response) {
17
	            alert("Purchase Return Settled");
18
	            document.location.reload(true);
19
	        }
20
	    });
21
	});
22
 
10864 manish.sha 23
	$('.detailPurchaseReturn').live('click', function(){
24
		purchaseReturnId = $(this).attr('id');
25
		$.ajax({
26
	        type : "GET",
27
	        url : "/inventory/purchase-return!getItemDetailsForPurchaseReturn?purchaseReturnId="+purchaseReturnId,
28
	        success : function(response) {
29
	        	$.colorbox({
30
					inline : true,
31
			        width : "500px",
32
			        height : "500px",
33
			        overlayClose :	true,
34
			        escKey :	true,
35
			        href : $(response),
36
			        onClosed : function() {
37
			            //TODO
38
			        }
39
				});
40
	        },
41
	        error : function(response) {
42
				alert("Error in fetching Purchase Return Items");
43
			}			
44
	    });
45
	});
46
 
47
	$('#create-purchase-return').live('submit', function() {
48
		createPurchaseReturnJS($(this).serialize());
49
    	return false;
50
	});
51
 
6467 amar.kumar 52
	$(function() {
53
		purchaseReturn = $('#purchase-return-table').dataTable({
54
			"sPaginationType": "full_numbers",
55
            "aaSorting" : [ [ 1, 'desc' ] ],
56
            "bAutoWidth": true,
57
            "iDisplayLength" : 25,
58
            "sDom" : 'T<"clear">lfrtip',
59
            "oTableTools" : {
60
                "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
61
            },
62
        });
63
	});
10864 manish.sha 64
});
65
 
66
 
67
function createPurchaseReturnJS(params){
68
	$.ajax({
69
        type : 'POST',
70
        url : '/inventory/purchase-return!createPurchaseReturn',
71
        data      : params,
72
        success : function(response) {
73
        	alert(response);
74
        	document.location.href = '/inventory/purchase-return' ;
75
        },
76
        error : function() {
77
        	alert('Some Error occurred at Server End');
78
        	document.location.href = '/inventory/purchase-return';
79
        }
80
    });
81
}