Subversion Repositories SmartDukaan

Rev

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

Rev 22488 Rev 22523
Line 79... Line 79...
79
            $('#' + domId).html(response);
79
            $('#' + domId).html(response);
80
        }
80
        }
81
    });  
81
    });  
82
}
82
}
83
 
83
 
-
 
84
function getInventoryItemAgingByInterval(domId, searchContent){
-
 
85
	jQuery.ajax({
-
 
86
        type : "POST",
-
 
87
        url : context+"/getInventoryItemAgingByInterval?searchContent="+searchContent,
-
 
88
        cache: false,
-
 
89
        contentType: "application/json",
-
 
90
        processData: false,
-
 
91
        async: false,
-
 
92
        data : JSON.stringify([5,15,30,45]),
-
 
93
        success : function(response) {
-
 
94
            $('#' + domId).html(response);
-
 
95
        },
-
 
96
        error : function() {
-
 
97
			alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
-
 
98
		},
-
 
99
    });  
-
 
100
}
-
 
101
 
84
function downloadAgingReport(){
102
function downloadAgingReport(){
85
	data = JSON.stringify([5,10,15,20,25,30,35,40]),
103
	data = JSON.stringify([5,15,30,45]),
86
	xhttp = new XMLHttpRequest();
104
	xhttp = new XMLHttpRequest();
87
	xhttp.onreadystatechange = function() {
105
	xhttp.onreadystatechange = function() {
88
	    var a;
106
	    var a;
89
	    if (xhttp.readyState === 4 && xhttp.status === 200) {
107
	    if (xhttp.readyState === 4 && xhttp.status === 200) {
90
	        // Trick for making downloadable link
108
	        // Trick for making downloadable link
Line 103... Line 121...
103
	// You should set responseType as blob for binary responses
121
	// You should set responseType as blob for binary responses
104
	xhttp.responseType = 'blob';
122
	xhttp.responseType = 'blob';
105
	xhttp.send(data);
123
	xhttp.send(data);
106
}
124
}
107
 
125
 
-
 
126
function downloadItemLedgerReport(){
-
 
127
	//data = JSON.stringify([5,10,15,20,25,30,35,40]),
-
 
128
	xhttp = new XMLHttpRequest();
-
 
129
	xhttp.onreadystatechange = function() {
-
 
130
	    var a;
-
 
131
	    if (xhttp.readyState === 4 && xhttp.status === 200) {
-
 
132
	        // Trick for making downloadable link
-
 
133
	        a = document.createElement('a');
-
 
134
	        a.href = window.URL.createObjectURL(xhttp.response);
-
 
135
	        // Give filename you wish to download
-
 
136
	        a.download = "ItemCompleteLedegerReport.xlsx";
-
 
137
	        a.style.display = 'none';
-
 
138
	        document.body.appendChild(a);
-
 
139
	        a.click();
-
 
140
	    }
-
 
141
	};
-
 
142
	// Post data to URL which handles post request
-
 
143
	xhttp.open("GET", context+"/itemLedger/complete/download");
-
 
144
	//xhttp.setRequestHeader("Content-Type", "application/json");
-
 
145
	// You should set responseType as blob for binary responses
-
 
146
	xhttp.responseType = 'blob';
-
 
147
	xhttp.send(null);
-
 
148
}
-
 
149
 
-
 
150
function getItemAgingNextPreviousItems(offset, searchContent){
-
 
151
	
-
 
152
	jQuery.ajax({
-
 
153
		type : "POST",
-
 
154
        url : context+"/getInventoryItemAgingByInterval?offset="+offset+"&searchContent="+searchContent,
-
 
155
        cache: false,
-
 
156
        contentType: "application/json",
-
 
157
        processData: false,
-
 
158
        async: false,
-
 
159
        data : JSON.stringify([5,15,30,45]),
-
 
160
		beforeSend: function(){
-
 
161
			//$('#ajax-spinner').show();
-
 
162
        },
-
 
163
        complete: function(){
-
 
164
        	//$('#ajax-spinner').hide();
-
 
165
        },
-
 
166
        success : function(response) {
-
 
167
        	$('#main-content').html(response);
-
 
168
        },
-
 
169
		error : function() {
-
 
170
			alert("Unable to fetch items");
-
 
171
		 },
-
 
172
    });
-
 
173
}
-
 
174
 
-
 
175
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
-
 
176
	jQuery.ajax({
-
 
177
	        type : "GET",
-
 
178
	        url : context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
-
 
179
	        +"&startTime="+startTime
-
 
180
	        +"&endTime="+endTime+"&offset="+pre,
-
 
181
			beforeSend: function(){
-
 
182
	        //$('#ajax-spinner').show();
-
 
183
	        },
-
 
184
	        complete: function(){
-
 
185
	        //$('#ajax-spinner').hide();
-
 
186
	        },
-
 
187
	        success : function(response) {
-
 
188
	        	$( "#grn-history-paginated .end" ).text(+end - +10);
-
 
189
	        	$( "#grn-history-paginated .start" ).text(+start - +10);
-
 
190
	        	$('#grn-history-table').html(response);
-
 
191
	        	$("#grn-history-paginated .next").prop('disabled', false);
-
 
192
				if (parseInt(pre)==0)
-
 
193
				{
-
 
194
					$("#grn-history-paginated .previous").prop('disabled', true);
-
 
195
				}
-
 
196
				
-
 
197
	        },
-
 
198
			error : function() {
-
 
199
				alert("Unable to fetch items");
-
 
200
			 },
-
 
201
	    });
-
 
202
}
-
 
203
 
108
function loadBadInventory(domId, search_text){
204
function loadBadInventory(domId, search_text){
109
	jQuery.ajax({
205
	jQuery.ajax({
110
        type : "GET",
206
        type : "GET",
111
        url : context+"/getBadInventorySnapshot/?searchTerm="+search_text,
207
        url : context+"/getBadInventorySnapshot/?searchTerm="+search_text,
112
        success : function(response) {
208
        success : function(response) {
Line 217... Line 313...
217
	            $('#grn-history-table').html(response);
313
	            $('#grn-history-table').html(response);
218
	            $("#grn-history-paginated .previous").prop('disabled', false);
314
	            $("#grn-history-paginated .previous").prop('disabled', false);
219
	        },
315
	        },
220
			error : function() {
316
			error : function() {
221
				alert("Unable to fetch items");
317
				alert("Unable to fetch items");
222
			 },
318
			},
223
	    });  
319
	    });  
224
	}
320
	}
225
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
321
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
226
	jQuery.ajax({
322
	jQuery.ajax({
227
	        type : "GET",
323
	        type : "GET",