Subversion Repositories SmartDukaan

Rev

Rev 10864 | Rev 13600 | 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",
10885 manish.sha 33
			        opacity : "0.20",
10864 manish.sha 34
			        overlayClose :	true,
35
			        escKey :	true,
36
			        href : $(response),
37
			        onClosed : function() {
38
			            //TODO
39
			        }
40
				});
41
	        },
42
	        error : function(response) {
43
				alert("Error in fetching Purchase Return Items");
44
			}			
45
	    });
46
	});
47
 
48
	$('#create-purchase-return').live('submit', function() {
49
		createPurchaseReturnJS($(this).serialize());
50
    	return false;
51
	});
52
 
6467 amar.kumar 53
	$(function() {
54
		purchaseReturn = $('#purchase-return-table').dataTable({
55
			"sPaginationType": "full_numbers",
56
            "aaSorting" : [ [ 1, 'desc' ] ],
57
            "bAutoWidth": true,
58
            "iDisplayLength" : 25,
59
            "sDom" : 'T<"clear">lfrtip',
60
            "oTableTools" : {
61
                "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
62
            },
63
        });
64
	});
10864 manish.sha 65
});
66
 
67
 
68
function createPurchaseReturnJS(params){
69
	$.ajax({
70
        type : 'POST',
71
        url : '/inventory/purchase-return!createPurchaseReturn',
72
        data      : params,
73
        success : function(response) {
74
        	alert(response);
75
        	document.location.href = '/inventory/purchase-return' ;
76
        },
77
        error : function() {
78
        	alert('Some Error occurred at Server End');
79
        	document.location.href = '/inventory/purchase-return';
80
        }
81
    });
82
}