| 4687 |
mandeep.dh |
1 |
$(function() {
|
| 4754 |
mandeep.dh |
2 |
$('input#add-lineitem').live('click', function() {
|
|
|
3 |
addNewRowForLineItem($(this).parent().parent().children('table.lineitems'));
|
| 4687 |
mandeep.dh |
4 |
});
|
|
|
5 |
|
| 4754 |
mandeep.dh |
6 |
$('#remove-lineitem').live('click', function() {
|
|
|
7 |
$(this).closest('tr').remove();
|
|
|
8 |
updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
|
| 4687 |
mandeep.dh |
9 |
});
|
|
|
10 |
|
| 4754 |
mandeep.dh |
11 |
$('input[name$=itemId]').live('change', function() {
|
|
|
12 |
updateModelNameXferPrice($(this).closest('tr'), $(this).val(), $(this).attr('supplierId'));
|
|
|
13 |
});
|
|
|
14 |
|
|
|
15 |
$('input[name$=unitPrice]').live('change', function() {
|
|
|
16 |
var quantity = $(this).closest('tr').find('input[name$=quantity]');
|
|
|
17 |
var price = $(this).val();
|
|
|
18 |
$(this).closest('tr').find('#amount').html(quantity * price);
|
|
|
19 |
updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
|
|
|
20 |
});
|
|
|
21 |
|
|
|
22 |
$('input[name$=quantity]').live('change', function() {
|
|
|
23 |
var price = $(this).closest('tr').find('input[name$=unitPrice]');
|
|
|
24 |
var quantity = $(this).val();
|
| 12867 |
manish.sha |
25 |
if(quantity==0){
|
| 12868 |
manish.sha |
26 |
alert('Quantity entered by is zero for this Item. It will not be considered in PO');
|
| 12867 |
manish.sha |
27 |
}
|
| 4754 |
mandeep.dh |
28 |
$(this).closest('tr').find('#amount').html(quantity * price);
|
|
|
29 |
updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
|
|
|
30 |
});
|
|
|
31 |
|
|
|
32 |
$('form.create-purchase-order').live('submit', function() {
|
|
|
33 |
submitPurchaseOrderForm($(this));
|
|
|
34 |
return false;
|
|
|
35 |
});
|
|
|
36 |
|
|
|
37 |
$('#editAndResendPOButton').live('click', function() {
|
|
|
38 |
$(this).siblings('input[name$=resendPO]').val(1);
|
|
|
39 |
submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());
|
|
|
40 |
});
|
|
|
41 |
|
|
|
42 |
$('#editPOButton').live('click', function() {
|
|
|
43 |
$(this).siblings('input[name$=resendPO]').val(0);
|
|
|
44 |
submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());
|
|
|
45 |
});
|
|
|
46 |
|
|
|
47 |
$('.show-details').live('click', function() {
|
|
|
48 |
$(this).closest('tr').siblings().removeClass('bold');
|
|
|
49 |
$(this).closest('tr').addClass('bold');
|
|
|
50 |
$('div.lineitems').hide();
|
|
|
51 |
$('#lineitems-' + $(this).attr('supplierId')).show();
|
|
|
52 |
});
|
| 4687 |
mandeep.dh |
53 |
|
| 4754 |
mandeep.dh |
54 |
$('.lineitems #cancel').live('click', function() {
|
|
|
55 |
$('div.lineitems').hide();
|
|
|
56 |
$('#suppliers').find('tr').removeClass('bold');
|
|
|
57 |
});
|
|
|
58 |
|
|
|
59 |
$('form.edit-purchase-order').live('submit', function() {
|
|
|
60 |
return false;
|
|
|
61 |
});
|
|
|
62 |
|
|
|
63 |
$('#amendCancel').live('click', function() {
|
|
|
64 |
document.location.href = '/inventory/purchase-order/' + $(this).attr('purchaseOrderId') + '/edit';
|
|
|
65 |
});
|
| 7410 |
amar.kumar |
66 |
|
|
|
67 |
$('#close-po').live('click', function() {
|
|
|
68 |
closePO($(this).attr('poId'));
|
|
|
69 |
});
|
| 9416 |
amar.kumar |
70 |
|
| 9925 |
amar.kumar |
71 |
$('#open-po-button').live('click', function() {
|
|
|
72 |
openPO($(this).attr('poId'));
|
|
|
73 |
});
|
| 9829 |
amar.kumar |
74 |
|
|
|
75 |
$('.change-po-warehouse').live('click', function() {
|
|
|
76 |
$(this).hide();
|
|
|
77 |
$(this).siblings('.change-po-warehouse-form').show();
|
| 9416 |
amar.kumar |
78 |
});
|
| 9829 |
amar.kumar |
79 |
|
|
|
80 |
$('.cancel-change-po-warehouse').live('click', function() {
|
|
|
81 |
$(this).parent().siblings('.change-po-warehouse').show();
|
|
|
82 |
$(this).parent().hide();
|
|
|
83 |
});
|
| 10324 |
manish.sha |
84 |
|
|
|
85 |
$('.cForm-class').change(function() {
|
|
|
86 |
if ($(this).is(':checked')) {
|
|
|
87 |
$(".cstCostTypeDiv-class").show();
|
|
|
88 |
$('.cstCostType-class').val('ours');
|
|
|
89 |
$('.extraCstInputs-class').hide();
|
|
|
90 |
}
|
|
|
91 |
else{
|
|
|
92 |
$(".cstCostTypeDiv-class").hide();
|
|
|
93 |
$('.cstCostType-class').val('ours');
|
|
|
94 |
$('.extraCstInputs-class').hide();
|
|
|
95 |
}
|
|
|
96 |
});
|
|
|
97 |
|
|
|
98 |
$('.cstCostType-class').change(function() {
|
|
|
99 |
var cstCostType = $(this).val();
|
|
|
100 |
if(cstCostType=="custom"){
|
|
|
101 |
$('.extraCstInputs-class').show();
|
|
|
102 |
$('.cstBorneByUs-class').val('0.00');
|
|
|
103 |
}
|
|
|
104 |
else{
|
|
|
105 |
$('.extraCstInputs-class').hide();
|
|
|
106 |
$('.cstBorneByUs-class').val('0.00');
|
|
|
107 |
}
|
|
|
108 |
});
|
| 12867 |
manish.sha |
109 |
/*
|
|
|
110 |
$('.adjustInventoryForm').hide();
|
|
|
111 |
$('.adjustInventoryButton').attr('disabled',false);
|
|
|
112 |
|
|
|
113 |
$('.adjustInventoryButton').live('click', function() {
|
|
|
114 |
$(this).hide();
|
|
|
115 |
$('.adjustInventoryButton').attr('disabled',true);
|
|
|
116 |
$(this).siblings('.adjustInventoryForm').show();
|
|
|
117 |
});
|
|
|
118 |
|
|
|
119 |
$('.cancelButton').live('click', function() {
|
|
|
120 |
$(this).parent().parent().siblings('.adjustInventoryButton').show();
|
|
|
121 |
$('.adjustInventoryButton').attr('disabled',false);
|
|
|
122 |
$('.quantityAdjust').val('');
|
|
|
123 |
$(this).parent().parent().hide();
|
|
|
124 |
});
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
$('.setWeightForm').hide();
|
|
|
128 |
$('.setWeightButton').attr('disabled',false);
|
|
|
129 |
|
|
|
130 |
$('.setWeightButton').live('click', function() {
|
|
|
131 |
$(this).hide();
|
|
|
132 |
$('.setWeightButton').attr('disabled',true);
|
|
|
133 |
$(this).siblings('.setWeightForm').show();
|
|
|
134 |
});
|
|
|
135 |
|
|
|
136 |
$('.cancelWeightButton').live('click', function() {
|
|
|
137 |
$(this).parent().parent().siblings('.setWeightButton').show();
|
|
|
138 |
$('.setWeightButton').attr('disabled',false);
|
|
|
139 |
$('.weightVal').val('');
|
|
|
140 |
$(this).parent().parent().hide();
|
|
|
141 |
});
|
|
|
142 |
|
|
|
143 |
$('.setWeightNew').live('click', function() {
|
|
|
144 |
alert('Hi');
|
|
|
145 |
var itemId = $(this).attr('itemId');
|
|
|
146 |
var weight = $('.weightVal_'+itemId).val();
|
|
|
147 |
var poId = $('.poId').val();
|
|
|
148 |
console.log(typeof(weight));
|
|
|
149 |
alert(weight);
|
|
|
150 |
alert(poId);
|
|
|
151 |
if(weight >15.0){
|
|
|
152 |
//alert('Inside Condition');
|
|
|
153 |
var didConfirm = confirm("Weight Entered is greater than 15 Kgs.\nAre you still want to Proceed");
|
|
|
154 |
if(didConfirm==false){
|
|
|
155 |
return false;
|
|
|
156 |
}
|
|
|
157 |
}
|
|
|
158 |
submitSetWeightForm(itemId,weight,poId);
|
|
|
159 |
return false;
|
|
|
160 |
});
|
|
|
161 |
|
|
|
162 |
$('.weightVal').keypress(function(e) {
|
|
|
163 |
var a = [];
|
|
|
164 |
var k = e.which;
|
|
|
165 |
|
|
|
166 |
for (i = 46; i < 58; i++){
|
|
|
167 |
if(i == 47){
|
|
|
168 |
continue;
|
|
|
169 |
}
|
|
|
170 |
else{
|
|
|
171 |
a.push(i);
|
|
|
172 |
}
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
if (!(a.indexOf(k)>=0)){
|
|
|
176 |
e.preventDefault();
|
|
|
177 |
}
|
|
|
178 |
});*/
|
| 17403 |
manish.sha |
179 |
|
| 17424 |
manish.sha |
180 |
$('.link-requiring-itemid-for-productlabel').live('click', function(){
|
|
|
181 |
var linkurl = $(this).attr('href');
|
| 17426 |
manish.sha |
182 |
$('<form id = "tempForm" target=# onsubmit = "closeColorBox() "style = "text-align:center" method = "GET" action = "'+ linkurl +'">').appendTo('body');
|
| 17424 |
manish.sha |
183 |
|
| 17430 |
manish.sha |
184 |
$('form#tempForm').append($('<span>Item Id: </span><input type = "text" name = "productLabelItemId" /><br>'));
|
|
|
185 |
$('form#tempForm').append($('<span>Item No: </span><input type = "text" name = "productLabelItemNo" /><br>'));
|
| 17424 |
manish.sha |
186 |
$('form#tempForm').append($('<input type = "submit" value = "Submit"/>'));
|
|
|
187 |
|
|
|
188 |
$.colorbox({
|
|
|
189 |
inline : true,
|
| 17428 |
manish.sha |
190 |
width : "425px",
|
| 17403 |
manish.sha |
191 |
height : "200px",
|
| 17424 |
manish.sha |
192 |
opacity : "0.30",
|
|
|
193 |
overlayClose : true,
|
|
|
194 |
escKey : true,
|
|
|
195 |
href : "#tempForm",
|
| 17403 |
manish.sha |
196 |
onClosed : function() {
|
| 17424 |
manish.sha |
197 |
$('#tempForm').remove();
|
| 17403 |
manish.sha |
198 |
}
|
| 17424 |
manish.sha |
199 |
});
|
|
|
200 |
event.preventDefault();
|
|
|
201 |
return false;
|
|
|
202 |
|
|
|
203 |
});
|
|
|
204 |
|
|
|
205 |
function closeColorBox(){
|
| 17426 |
manish.sha |
206 |
$.colorbox.close();
|
| 17424 |
manish.sha |
207 |
var productLabelItemId = $("input[name='productLabelItemId']").val();
|
| 17403 |
manish.sha |
208 |
if(productLabelItemId==null || productLabelItemId=="")
|
|
|
209 |
{
|
|
|
210 |
alert("Please enter Item Id");
|
|
|
211 |
$('input[name=productLabelItemId]').focus();
|
|
|
212 |
return false;
|
|
|
213 |
}
|
|
|
214 |
var productLabelItemNo = $("input[name='productLabelItemNo']").val();
|
|
|
215 |
if(productLabelItemNo==null || productLabelItemNo=="")
|
|
|
216 |
{
|
|
|
217 |
alert("Please enter Item Number");
|
|
|
218 |
$('input[name=productLabelItemNo]').focus();
|
|
|
219 |
return false;
|
|
|
220 |
}
|
| 17424 |
manish.sha |
221 |
}
|
| 4687 |
mandeep.dh |
222 |
});
|