Subversion Repositories SmartDukaan

Rev

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

Rev 14780 Rev 14862
Line 157... Line 157...
157
}
157
}
158
}
158
}
159
console.log(courierCost);
159
console.log(courierCost);
160
//courierCost = ((courierCost+0)*1.1236).toFixed(2);
160
//courierCost = ((courierCost+0)*1.1236).toFixed(2);
161
var voiSellingPrice=$('#voiSellingPrice').val();
161
var voiSellingPrice=$('#voiSellingPrice').val();
-
 
162
var courierCostSnapdeal=$('#courierCostMarketplaceVoi').val();
162
var nlc=$('#maxNlc').val();
163
var nlc=$('#maxNlc').val();
163
var otherCost=$('#otherCost').val();
164
var otherCost=$('#otherCost').val();
164
var othCost=parseFloat(otherCost);
165
var othCost=parseFloat(otherCost);
165
var pc=parseFloat(packagingCost);
166
var pc=parseFloat(packagingCost);
166
if ( voiSellingPrice==null || voiSellingPrice=="" || isNaN(voiSellingPrice) || nlc==null || nlc=="" || isNaN(nlc)){
167
if ( voiSellingPrice==null || voiSellingPrice=="" || isNaN(voiSellingPrice) || nlc==null || nlc=="" || isNaN(nlc)){
Line 170... Line 171...
170
}
171
}
171
else{
172
else{
172
var serviceTaxRate=$('#serviceTaxRate').val();
173
var serviceTaxRate=$('#serviceTaxRate').val();
173
console.log(serviceTaxRate)
174
console.log(serviceTaxRate)
174
var stRate = serviceTaxRate/100;
175
var stRate = serviceTaxRate/100;
175
var com=$('#commissionRate').val();
176
var com=$('#commissionRateVoi').val();
176
var comRate=(com/100);
177
var comRate=(com/100);
177
console.log(comRate);
178
console.log(comRate);
178
var pgVal=$('#pgFee').val();
179
var pgVal=$('#pgFee').val();
179
var pgFeeRate=pgVal/100;
180
var pgFeeRate=pgVal/100;
180
console.log(pgVal);
181
console.log(pgVal);
Line 184... Line 185...
184
var closingFee=parseFloat($('#closingFee').val());
185
var closingFee=parseFloat($('#closingFee').val());
185
var returnProvision=parseFloat($('#returnProvision').val());
186
var returnProvision=parseFloat($('#returnProvision').val());
186
console.log(returnProvision);
187
console.log(returnProvision);
187
console.log(closingFee);
188
console.log(closingFee);
188
console.log(pgFeeRate);
189
console.log(pgFeeRate);
-
 
190
console.log(courierCostSnapdeal);
189
var margin=$('#margin').val();
191
var margin=$('#margin').val();
190
var vatRate=$('#vat').val();
192
var vatRate=$('#vat').val();
191
if ( vatRate==null || vatRate=="" || isNaN(vatRate)){
193
if ( vatRate==null || vatRate=="" || isNaN(vatRate)){
192
	jAlert('Please enter VAT Rate for item','ERROR');
194
	jAlert('Please enter VAT Rate for item','ERROR');
193
	$('input#voiSellingPrice').val('0.00');
195
	$('input#voiSellingPrice').val('0.00');
Line 200... Line 202...
200
else{
202
else{
201
	var commisionPrice=(comRate*parseFloat(voiSellingPrice)+20).toFixed(2);
203
	var commisionPrice=(comRate*parseFloat(voiSellingPrice)+20).toFixed(2);
202
	console.log("Default pg fee block");
204
	console.log("Default pg fee block");
203
}
205
}
204
console.log(+courierCost);
206
console.log(+courierCost);
205
var ourTp=(parseFloat(voiSellingPrice)-parseFloat(voiSellingPrice)*(1+stRate)*((comRate)+emiFee)-((+courierCost+closingFee)*(1+stRate))-(Math.max(20,pgFeeRate*parseFloat(voiSellingPrice))*(1+stRate)));
207
var ourTp=(parseFloat(voiSellingPrice)-parseFloat(voiSellingPrice)*(1+stRate)*((comRate)+emiFee)-((+courierCostSnapdeal+closingFee)*(1+stRate))-(Math.max(20,pgFeeRate*parseFloat(voiSellingPrice))*(1+stRate)));
206
var vatValue=(((voiSellingPrice/(1+vat))-(nlc/(1+vat)))*vat).toFixed(2);
208
var vatValue=(((voiSellingPrice/(1+vat))-(nlc/(1+vat)))*vat).toFixed(2);
207
var inHouseCost=(+vatValue+pc+((returnProvision/100)*voiSellingPrice)+othCost);
209
var inHouseCost=(+vatValue+pc+((returnProvision/100)*voiSellingPrice)+othCost);
208
var lowestTp=(+nlc+inHouseCost).toFixed(2);
210
var lowestTp=(+nlc+inHouseCost).toFixed(2);
209
if (pgFeeRate*parseFloat(voiSellingPrice)>=20){
211
if (pgFeeRate*parseFloat(voiSellingPrice)>=20){
210
	var lowestSp=(+nlc+(+courierCost+closingFee)*(1+stRate)*(1+vat)+(pc+othCost)*(1+vat))/(1-(comRate+emiFee+pgFeeRate)*(1+stRate)*(1+vat)-(returnProvision/100)*(1+vat));	
212
	var lowestSp=(+nlc+(+courierCostSnapdeal+closingFee)*(1+stRate)*(1+vat)+(pc+othCost)*(1+vat))/(1-(comRate+emiFee+pgFeeRate)*(1+stRate)*(1+vat)-(returnProvision/100)*(1+vat));	
211
}
213
}
212
else{
214
else{
213
	var lowestSp=(+nlc+(+courierCost+closingFee+20)*(1+stRate)*(1+vat)+(pc+othCost)*(1+vat))/(1-(comRate+emiFee)*(1+stRate)*(1+vat)-(returnProvision/100)*(1+vat));
215
	var lowestSp=(+nlc+(+courierCostSnapdeal+closingFee+20)*(1+stRate)*(1+vat)+(pc+othCost)*(1+vat))/(1-(comRate+emiFee)*(1+stRate)*(1+vat)-(returnProvision/100)*(1+vat));
214
}
216
}
215
ourTp = (parseFloat(ourTp)).toFixed(2);
217
ourTp = (parseFloat(ourTp)).toFixed(2);
216
$('input#minPosTpVoi').val(lowestTp);
218
$('input#minPosTpVoi').val(lowestTp);
217
$('input#minPosSpVoi').val(parseFloat(lowestSp).toFixed(2));
219
$('input#minPosSpVoi').val(parseFloat(lowestSp).toFixed(2));
218
$('input#transferPriceVOI').val(ourTp);
220
$('input#transferPriceVOI').val(ourTp);
219
var serviceTax=(stRate*(+commisionPrice+(+courierCost))).toFixed(2);
221
var serviceTax=(stRate*(+commisionPrice+(+courierCostSnapdeal))).toFixed(2);
220
lowest_possible_tp=parseFloat(lowestTp);
222
lowest_possible_tp=parseFloat(lowestTp);
221
newMargin=(ourTp-lowest_possible_tp).toFixed(2);
223
newMargin=(ourTp-lowest_possible_tp).toFixed(2);
222
marginPercentage=(((ourTp-lowest_possible_tp)/voiSellingPrice)*100).toFixed(2);
224
marginPercentage=(((ourTp-lowest_possible_tp)/voiSellingPrice)*100).toFixed(2);
223
$('input#marginPerVOI').val(marginPercentage);
225
$('input#marginPerVOI').val(marginPercentage);
224
$('input#marginVOI').val(newMargin);
226
$('input#marginVOI').val(newMargin);
Line 558... Line 560...
558
<td class="detail">Maximum Selling Price</td>
560
<td class="detail">Maximum Selling Price</td>
559
<td class="value">
561
<td class="value">
560
	<input id="maxSp" name="maxSp" value='$mpDetail.getMaximumSellingPrice()' type="text"></td>
562
	<input id="maxSp" name="maxSp" value='$mpDetail.getMaximumSellingPrice()' type="text"></td>
561
</tr>
563
</tr>
562
<tr>
564
<tr>
563
<td class="detail"></td>
565
<td class="detail">SUPC Code</td>
564
<td class="value"></td>
566
#if($itemDetail.getSupc())
-
 
567
	<td class="value"><input id="supc" name="supc" value='$itemDetail.getSupc()' type="text"></td>
-
 
568
#else
-
 
569
	<td class="value"><input id="supc" name="supc" value='' type="text"></td>
-
 
570
#end
565
</tr>
571
</tr>
566
</tbody>
572
</tbody>
567
</table>
573
</table>
568
</div>
574
</div>
569
<div class="left" style="float: right; width: 48%;">
575
<div class="left" style="float: right; width: 48%;">
Line 666... Line 672...
666
<tr>
672
<tr>
667
<td class="detail">Commission&nbsp;&#37;</td>
673
<td class="detail">Commission&nbsp;&#37;</td>
668
<td class="value"><input id="commissionRate" name="commissionRate" value='$mpDetail.getCommission()'type="text" disabled/></td>
674
<td class="value"><input id="commissionRate" name="commissionRate" value='$mpDetail.getCommission()'type="text" disabled/></td>
669
</tr>
675
</tr>
670
<tr>
676
<tr>
-
 
677
<td class="detail">Commission VOI &nbsp;&#37;</td>
-
 
678
<td class="value"><input id="commissionRateVoi" name="commissionRateVoi" value='$sdItem.getCommissionPercentageVoi()'type="text" onkeyup="calculateStuff()" /></td>
-
 
679
</tr>
-
 
680
<tr>
671
<td class="detail">Exception Price</td>
681
<td class="detail">Exception Price</td>
672
<td class="value"><input id="exceptionPrice" name="exceptionPrice" value='$itemDetail.getExceptionPrice()'type="text"/></td>
682
<td class="value"><input id="exceptionPrice" name="exceptionPrice" value='$itemDetail.getExceptionPrice()'type="text"/></td>
673
</tr>
683
</tr>
674
<tr>
684
<tr>
675
<td class="detail">Commission</td>
685
<td class="detail">Commission</td>
Line 694... Line 704...
694
<input id="courierCostMarketplace" name="courierCostMarketplace" value='$itemDetail.getCourierCostMarketplace()'type="text" style="width:20%;" onkeyup="calculateStuff()">
704
<input id="courierCostMarketplace" name="courierCostMarketplace" value='$itemDetail.getCourierCostMarketplace()'type="text" style="width:20%;" onkeyup="calculateStuff()">
695
</td>
705
</td>
696
</tr>
706
</tr>
697
<tr>
707
<tr>
698
<td class="detail">Courier Cost VOI</td>
708
<td class="detail">Courier Cost VOI</td>
699
<td>
-
 
-
 
709
<td class="value"><input id="courierCostVoi" name="courierCostVoi" value='$sdItem.getCourierCostVoi()' type="text" style="width:20%;" readonly/>
-
 
710
<span style="font-weight:bold;color:black;">Snapdeal VOI</span>
700
<input id="courierCostVoi" name="courierCostVoi" value='$sdItem.getCourierCostVoi()' type="text" style="width:20%;" onkeyup="calculateStuff()"/>
711
<input id="courierCostMarketplaceVoi" name="courierCostMarketplaceVoi" value='$sdItem.getCourierCostMarketplaceVoi()'type="text" style="width:20%;" onkeyup="calculateStuff()">
701
</td>
712
</td>
702
</tr>
713
</tr>
703
<tr>
714
<tr>
704
<td class="detail">VAT&nbsp;&#37;</td>
715
<td class="detail">VAT&nbsp;&#37;</td>
705
<td class="value"><input id="vat" name="vat" value='$mpDetail.getVat()' type="text" onkeyup="calculateStuff()"></td>
716
<td class="value"><input id="vat" name="vat" value='$mpDetail.getVat()' type="text" onkeyup="calculateStuff()"></td>
Line 719... Line 730...
719
#else
730
#else
720
	<td class="value"><input id="sdVoiItemCode" name="sdVoiItemCode" value='' type="text"></td>
731
	<td class="value"><input id="sdVoiItemCode" name="sdVoiItemCode" value='' type="text"></td>
721
#end
732
#end
722
</tr>
733
</tr>
723
<tr>
734
<tr>
724
<td class="detail">SUPC Code</td>
-
 
725
#if($itemDetail.getSupc())
-
 
726
	<td class="value"><input id="supc" name="supc" value='$itemDetail.getSupc()' type="text"></td>
-
 
727
#else
-
 
728
	<td class="value"><input id="supc" name="supc" value='' type="text"></td>
-
 
729
#end
-
 
730
</tr>
-
 
731
<tr>
-
 
732
<td class="detail">Action</td>
735
<td class="detail">Action</td>
733
<td class="value"><input type="submit" value="Update" name="upload" style="width: 25%;">
736
<td class="value"><input type="submit" value="Update" name="upload" style="width: 25%;">
734
<input type="button" style="padding-left: 5px; margin-left: 10px;width: 25%;" id="cancelbutton" name="cancel" value="Cancel">
737
<input type="button" style="padding-left: 5px; margin-left: 10px;width: 25%;" id="cancelbutton" name="cancel" value="Cancel">
735
</td>
738
</td>
736
</tr>
739
</tr>