| 20900 |
amit.gupta |
1 |
var files;
|
|
|
2 |
|
|
|
3 |
// Add events
|
|
|
4 |
$('input[type=file]').on('change', prepareUpload);
|
|
|
5 |
|
|
|
6 |
// Grab the files and set them to our variable
|
|
|
7 |
function prepareUpload(event)
|
|
|
8 |
{
|
|
|
9 |
files = event.target.files;
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
|
| 6467 |
amar.kumar |
13 |
$(function() {
|
|
|
14 |
$('#add-nonserialized-return').live('click', function(){
|
|
|
15 |
$('<br/><label>ItemId : </label><input class = "return-itemId" name = "returnItemId" type = "textbox"/>'
|
|
|
16 |
+'<label>Quantity : </label><input class = "return-qty" name = "returnQty" type = "textbox"/>').appendTo('#nonserialized-items-container');
|
|
|
17 |
});
|
|
|
18 |
|
|
|
19 |
$('#add-serialized-return').live('click', function(){
|
|
|
20 |
$('<br/><label>IMEI Number : </label><input class = "imei-number" name = "returnImeiNumber" type = "textbox"/>').appendTo('#serialized-items-container')
|
|
|
21 |
});
|
|
|
22 |
|
| 13600 |
manish.sha |
23 |
/*$('.settlePurchaseReturn').live('click', function(){
|
| 6467 |
amar.kumar |
24 |
purchaseReturnId = $(this).attr('id');
|
|
|
25 |
$.ajax({
|
|
|
26 |
type : "GET",
|
|
|
27 |
url : "/inventory/purchase-return!markSettled?purchaseReturnId="+purchaseReturnId,
|
|
|
28 |
success : function(response) {
|
|
|
29 |
alert("Purchase Return Settled");
|
|
|
30 |
document.location.reload(true);
|
|
|
31 |
}
|
|
|
32 |
});
|
| 13600 |
manish.sha |
33 |
});*/
|
| 6467 |
amar.kumar |
34 |
|
| 10864 |
manish.sha |
35 |
$('.detailPurchaseReturn').live('click', function(){
|
|
|
36 |
purchaseReturnId = $(this).attr('id');
|
|
|
37 |
$.ajax({
|
|
|
38 |
type : "GET",
|
|
|
39 |
url : "/inventory/purchase-return!getItemDetailsForPurchaseReturn?purchaseReturnId="+purchaseReturnId,
|
|
|
40 |
success : function(response) {
|
|
|
41 |
$.colorbox({
|
|
|
42 |
inline : true,
|
|
|
43 |
width : "500px",
|
|
|
44 |
height : "500px",
|
| 10885 |
manish.sha |
45 |
opacity : "0.20",
|
| 10864 |
manish.sha |
46 |
overlayClose : true,
|
|
|
47 |
escKey : true,
|
|
|
48 |
href : $(response),
|
|
|
49 |
onClosed : function() {
|
|
|
50 |
//TODO
|
|
|
51 |
}
|
|
|
52 |
});
|
|
|
53 |
},
|
|
|
54 |
error : function(response) {
|
|
|
55 |
alert("Error in fetching Purchase Return Items");
|
|
|
56 |
}
|
|
|
57 |
});
|
|
|
58 |
});
|
|
|
59 |
|
| 13600 |
manish.sha |
60 |
$('.purchaseReturnSettlementDetails').live('click',function(){
|
|
|
61 |
purchaseReturnId = $(this).attr('id');
|
|
|
62 |
$.ajax({
|
|
|
63 |
type : "GET",
|
|
|
64 |
url : "/inventory/purchase-return!getPurchaseReturnSettlements?purchaseReturnId="+purchaseReturnId,
|
|
|
65 |
success : function(response) {
|
|
|
66 |
$.colorbox({
|
|
|
67 |
inline : true,
|
|
|
68 |
width : "600px",
|
|
|
69 |
height : "500px",
|
|
|
70 |
opacity : "0.20",
|
|
|
71 |
overlayClose : true,
|
|
|
72 |
escKey : true,
|
|
|
73 |
href : $(response),
|
|
|
74 |
onClosed : function() {
|
|
|
75 |
//TODO
|
|
|
76 |
}
|
|
|
77 |
});
|
|
|
78 |
},
|
|
|
79 |
error : function(response) {
|
|
|
80 |
alert("Error in fetching Purchase Return Items");
|
|
|
81 |
}
|
|
|
82 |
});
|
|
|
83 |
});
|
| 17405 |
manish.sha |
84 |
/*
|
| 16411 |
manish.sha |
85 |
$("#prReasonType").change(function () {
|
|
|
86 |
var prReasonType = $(this).val();
|
|
|
87 |
if(prReasonType=='WRONG_GRN'){
|
|
|
88 |
$('div#grnIdDiv').show();
|
|
|
89 |
}else{
|
|
|
90 |
$('div#grnIdDiv').hide();
|
|
|
91 |
}
|
| 17405 |
manish.sha |
92 |
});*/
|
| 16411 |
manish.sha |
93 |
|
| 13600 |
manish.sha |
94 |
$('.settlePurchaseReturnForm').hide();
|
|
|
95 |
$('.settlePurchaseReturn').attr('disabled',false);
|
|
|
96 |
|
|
|
97 |
$('.settledAmount').keypress(function(e) {
|
|
|
98 |
var a = [];
|
|
|
99 |
var k = e.which;
|
|
|
100 |
|
|
|
101 |
for (i = 48; i < 58; i++){
|
|
|
102 |
a.push(i);
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
if (!(a.indexOf(k)>=0)){
|
|
|
106 |
e.preventDefault();
|
|
|
107 |
}
|
|
|
108 |
});
|
|
|
109 |
|
|
|
110 |
$('.settlePurchaseReturn').live('click', function() {
|
|
|
111 |
$(this).hide();
|
|
|
112 |
$('.settlePurchaseReturn').attr('disabled',true);
|
|
|
113 |
$(this).siblings('.settlePurchaseReturnForm').show();
|
|
|
114 |
});
|
|
|
115 |
|
|
|
116 |
$('.cancelSettlementButton').live('click', function() {
|
|
|
117 |
$(this).parent().siblings('.settlePurchaseReturn').show();
|
|
|
118 |
$('.settlePurchaseReturn').attr('disabled',false);
|
|
|
119 |
$('.settledAmount').val('');
|
|
|
120 |
$('.settlementType').val('CREDIT_NOTE');
|
|
|
121 |
$('.documentNumber').val('');
|
|
|
122 |
$(this).parent().hide();
|
|
|
123 |
});
|
|
|
124 |
|
|
|
125 |
$('.settledPR').live('click', function() {
|
|
|
126 |
var purchaseReturnId = $(this).attr('purchaseReturnId');
|
|
|
127 |
var settledAmount = $('.settledAmount_'+purchaseReturnId).val();
|
|
|
128 |
var settlementType = $('.settlementType_'+purchaseReturnId).val();
|
|
|
129 |
var documentNumber = $('.documentNumber_'+purchaseReturnId).val();
|
|
|
130 |
submitSettlePRForm(purchaseReturnId, settledAmount, settlementType, documentNumber);
|
|
|
131 |
return false;
|
|
|
132 |
});
|
|
|
133 |
|
|
|
134 |
/*$('#prAcceptRejectLink').live('click', function() {
|
|
|
135 |
$("div#prAcceptRejectDiv").show();
|
|
|
136 |
$('#purchaseReturnId').val('');
|
|
|
137 |
$.colorbox({
|
|
|
138 |
inline : true,
|
|
|
139 |
width : "400px",
|
|
|
140 |
height : "200px",
|
|
|
141 |
href : "div#prAcceptRejectDiv",
|
|
|
142 |
onClosed : function() {
|
|
|
143 |
$("div#prAcceptRejectDiv").hide();
|
|
|
144 |
}
|
|
|
145 |
});
|
|
|
146 |
});*/
|
|
|
147 |
|
| 10864 |
manish.sha |
148 |
$('#create-purchase-return').live('submit', function() {
|
| 16411 |
manish.sha |
149 |
$('#campaignListUpdate1').val('-1');
|
| 20900 |
amit.gupta |
150 |
var data = new FormData();
|
|
|
151 |
$.each(files, function(key, value)
|
|
|
152 |
{
|
|
|
153 |
data.append(key, value);
|
|
|
154 |
});
|
|
|
155 |
|
|
|
156 |
createPurchaseReturnJS(data);
|
| 10864 |
manish.sha |
157 |
return false;
|
|
|
158 |
});
|
|
|
159 |
|
| 6467 |
amar.kumar |
160 |
$(function() {
|
|
|
161 |
purchaseReturn = $('#purchase-return-table').dataTable({
|
|
|
162 |
"sPaginationType": "full_numbers",
|
|
|
163 |
"aaSorting" : [ [ 1, 'desc' ] ],
|
|
|
164 |
"bAutoWidth": true,
|
|
|
165 |
"iDisplayLength" : 25,
|
|
|
166 |
"sDom" : 'T<"clear">lfrtip',
|
|
|
167 |
"oTableTools" : {
|
|
|
168 |
"sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
|
|
|
169 |
},
|
|
|
170 |
});
|
|
|
171 |
});
|
| 10864 |
manish.sha |
172 |
});
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
function createPurchaseReturnJS(params){
|
|
|
176 |
$.ajax({
|
|
|
177 |
type : 'POST',
|
|
|
178 |
url : '/inventory/purchase-return!createPurchaseReturn',
|
|
|
179 |
data : params,
|
|
|
180 |
success : function(response) {
|
|
|
181 |
alert(response);
|
|
|
182 |
document.location.href = '/inventory/purchase-return' ;
|
|
|
183 |
},
|
|
|
184 |
error : function() {
|
|
|
185 |
alert('Some Error occurred at Server End');
|
|
|
186 |
document.location.href = '/inventory/purchase-return';
|
|
|
187 |
}
|
|
|
188 |
});
|
| 13600 |
manish.sha |
189 |
}
|
|
|
190 |
|
|
|
191 |
function submitSettlePRForm(purchaseReturnId, settledAmount, settlementType, documentNumber){
|
|
|
192 |
$.ajax({
|
|
|
193 |
type : "GET",
|
|
|
194 |
url : "/inventory/purchase-return!settlePurchaseReturn?purchaseReturnId="+purchaseReturnId+"&settledAmount="+settledAmount+"&settlementType="+settlementType+"&documentNumber="+documentNumber,
|
|
|
195 |
success : function(response) {
|
|
|
196 |
alert(response);
|
|
|
197 |
document.location.reload(true);
|
|
|
198 |
},
|
|
|
199 |
error : function() {
|
|
|
200 |
alert('Some Error occurred at Server End');
|
|
|
201 |
document.location.reload(true);
|
|
|
202 |
}
|
|
|
203 |
});
|
| 10864 |
manish.sha |
204 |
}
|