Subversion Repositories SmartDukaan

Rev

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

Rev 12133 Rev 14780
Line 223... Line 223...
223
if (ourTp-lowest_possible_tp < 0){
223
if (ourTp-lowest_possible_tp < 0){
224
	$('input#margin').removeClass().addClass("border-highlight-red");
224
	$('input#margin').removeClass().addClass("border-highlight-red");
225
	$('input#marginPer').addClass("border-highlight-red");
225
	$('input#marginPer').addClass("border-highlight-red");
226
}
226
}
227
}
227
}
-
 
228
calculateStuffVOI();
-
 
229
}
-
 
230
</script>
-
 
231
 
-
 
232
<script type="text/javascript">
-
 
233
function calculateStuffVOI()
-
 
234
{
-
 
235
$('input#minPosTpVoi').removeClass("border-highlight");
-
 
236
$('input#minPosSpVoi').removeClass("border-highlight");
-
 
237
$('input#transferPriceVOI').removeClass("border-highlight");
-
 
238
$('input#serviceTaxVOI').removeClass("border-highlight");
-
 
239
$('input#commissionVoi').removeClass("border-highlight");
-
 
240
$('input#marginVOI').removeClass();
-
 
241
$('input#marginPerVOI').removeClass();
-
 
242
var itemWeight=$('#itemWeight').val();
-
 
243
itemWeight = +itemWeight+.05;
-
 
244
console.log(itemWeight);
-
 
245
var packagingCost=$('#packagingCost').val();
-
 
246
if (itemWeight==0){
-
 
247
	var courierCost =40;
-
 
248
}
-
 
249
else{
-
 
250
var slabs = parseInt((parseFloat(itemWeight)-.001)/.5)
-
 
251
var courierCost = 40;
-
 
252
for (var i=0;i<slabs;i++)
-
 
253
{
-
 
254
	courierCost = courierCost + 30;
-
 
255
}
-
 
256
}
-
 
257
console.log(courierCost);
-
 
258
//courierCost = ((courierCost+0)*1.1236).toFixed(2);
-
 
259
var voiSellingPrice=$('#voiSellingPrice').val();
-
 
260
var nlc=$('#maxNlc').val();
-
 
261
var otherCost=$('#otherCost').val();
-
 
262
var othCost=parseFloat(otherCost);
-
 
263
var pc=parseFloat(packagingCost);
-
 
264
if ( voiSellingPrice==null || voiSellingPrice=="" || isNaN(voiSellingPrice) || nlc==null || nlc=="" || isNaN(nlc)){
-
 
265
	$('input#courierCostVoi').val('0.00');
-
 
266
	$('input#serviceTaxVoi').val('0.00');
-
 
267
	$('input#commissionVoi').val('0.00');
-
 
268
}
-
 
269
else{
-
 
270
var serviceTaxRate=$('#serviceTaxRate').val();
-
 
271
console.log(serviceTaxRate)
-
 
272
var stRate = serviceTaxRate/100;
-
 
273
var com=$('#commissionRate').val();
-
 
274
var comRate=(com/100);
-
 
275
console.log(comRate);
-
 
276
var pgVal=$('#pgFee').val();
-
 
277
var pgFeeRate=pgVal/100;
-
 
278
console.log(pgVal);
-
 
279
var emiFeeRate=$('#emiFee').val();
-
 
280
console.log(emiFeeRate);
-
 
281
var emiFee=emiFeeRate/100;
-
 
282
var closingFee=parseFloat($('#closingFee').val());
-
 
283
var returnProvision=parseFloat($('#returnProvision').val());
-
 
284
console.log(returnProvision);
-
 
285
console.log(closingFee);
-
 
286
console.log(pgFeeRate);
-
 
287
var margin=$('#margin').val();
-
 
288
var vatRate=$('#vat').val();
-
 
289
if ( vatRate==null || vatRate=="" || isNaN(vatRate)){
-
 
290
	jAlert('Please enter VAT Rate for item','ERROR');
-
 
291
	$('input#voiSellingPrice').val('0.00');
-
 
292
	return false;
-
 
293
}
-
 
294
var vat=vatRate/100;
-
 
295
if (pgFeeRate*parseFloat(voiSellingPrice)>=20){
-
 
296
	var commisionPrice=((comRate+pgFeeRate)*parseFloat(voiSellingPrice)).toFixed(2);
-
 
297
}
-
 
298
else{
-
 
299
	var commisionPrice=(comRate*parseFloat(voiSellingPrice)+20).toFixed(2);
-
 
300
	console.log("Default pg fee block");
-
 
301
}
-
 
302
console.log(+courierCost);
-
 
303
var ourTp=(parseFloat(voiSellingPrice)-parseFloat(voiSellingPrice)*(1+stRate)*((comRate)+emiFee)-((+courierCost+closingFee)*(1+stRate))-(Math.max(20,pgFeeRate*parseFloat(voiSellingPrice))*(1+stRate)));
-
 
304
var vatValue=(((voiSellingPrice/(1+vat))-(nlc/(1+vat)))*vat).toFixed(2);
-
 
305
var inHouseCost=(+vatValue+pc+((returnProvision/100)*voiSellingPrice)+othCost);
-
 
306
var lowestTp=(+nlc+inHouseCost).toFixed(2);
-
 
307
if (pgFeeRate*parseFloat(voiSellingPrice)>=20){
-
 
308
	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));	
-
 
309
}
-
 
310
else{
-
 
311
	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));
-
 
312
}
-
 
313
ourTp = (parseFloat(ourTp)).toFixed(2);
-
 
314
$('input#minPosTpVoi').val(lowestTp);
-
 
315
$('input#minPosSpVoi').val(parseFloat(lowestSp).toFixed(2));
-
 
316
$('input#transferPriceVOI').val(ourTp);
-
 
317
var serviceTax=(stRate*(+commisionPrice+(+courierCost))).toFixed(2);
-
 
318
lowest_possible_tp=parseFloat(lowestTp);
-
 
319
newMargin=(ourTp-lowest_possible_tp).toFixed(2);
-
 
320
marginPercentage=(((ourTp-lowest_possible_tp)/voiSellingPrice)*100).toFixed(2);
-
 
321
$('input#marginPerVOI').val(marginPercentage);
-
 
322
$('input#marginVOI').val(newMargin);
-
 
323
$('input#voiSellingPrice').val(voiSellingPrice);
-
 
324
$('input#courierCostVoi').val(courierCost);
-
 
325
$('input#commissionVoi').val(commisionPrice);
-
 
326
$('input#serviceTaxVOI').val(serviceTax);
-
 
327
$('input#minPosTpVoi').addClass("border-highlight");
-
 
328
$('input#minPosSpVoi').addClass("border-highlight");
-
 
329
$('input#transferPriceVOI').addClass("border-highlight");
-
 
330
$('input#serviceTaxVOI').addClass("border-highlight");
-
 
331
$('input#commissionVoi').addClass("border-highlight");
-
 
332
$('input#marginVOI').addClass("border-highlight");
-
 
333
$('input#marginPerVOI').addClass("border-highlight");
-
 
334
if (ourTp-lowest_possible_tp < 0){
-
 
335
	$('input#marginVOI').removeClass().addClass("border-highlight-red");
-
 
336
	$('input#marginPerVOI').addClass("border-highlight-red");
-
 
337
}
-
 
338
}
228
}
339
}
229
</script>
340
</script>
230
<script type="text/javascript">
341
<script type="text/javascript">
231
$('#populateStuff').live('click', function(){
342
$('#populateStuff').live('click', function(){
232
	var itemId=$('#itemId').val();
343
	var itemId=$('#itemId').val();
Line 267... Line 378...
267
		$('input#returnProvision').val(parsedData.ReturnProvision);
378
		$('input#returnProvision').val(parsedData.ReturnProvision);
268
		$('input#emiFee').val(parsedData.EmiFee);
379
		$('input#emiFee').val(parsedData.EmiFee);
269
		$('input#closingFee').val(parsedData.ClosingFee);
380
		$('input#closingFee').val(parsedData.ClosingFee);
270
		$('input#serviceTaxRate').val(parsedData.ServiceTaxRate);
381
		$('input#serviceTaxRate').val(parsedData.ServiceTaxRate);
271
		$('input#sellingPrice').val(sellingPrice);
382
		$('input#sellingPrice').val(sellingPrice);
-
 
383
		$('input#voiSellingPrice').val(sellingPrice);
272
		$('input#transferPrice').val('0.0');
384
		$('input#transferPrice').val('0.0');
-
 
385
		$('input#transferPriceVOI').val('0.0');
273
		$('input#exceptionPrice').val('0.0');
386
		$('input#exceptionPrice').val('0.0');
274
		$('input#commission').val('0.0');
387
		$('input#commission').val('0.0');
275
		$('input#serviceTax').val('0.0');
388
		$('input#serviceTax').val('0.0');
-
 
389
		$('input#serviceTaxVOI').val('0.0');
276
		$('input#courierCost').val('0.0');
390
		$('input#courierCost').val('0.0');
-
 
391
		$('input#courierCostVoi').val('0.0');
277
		$('input#maxNlc').val(parsedData.MaxNlc);
392
		$('input#maxNlc').val(parsedData.MaxNlc);
278
		$('input#warehouseId').val(whId);
393
		$('input#warehouseId').val(whId);
279
		$('input#vat').val(parsedData.VatRate);
394
		$('input#vat').val(parsedData.VatRate);
280
		$('input#pgFee').val(parsedData.PgFee);
395
		$('input#pgFee').val(parsedData.PgFee);
281
		$('input#packagingCost').val(parsedData.PackagingCost);
396
		$('input#packagingCost').val(parsedData.PackagingCost);
Line 349... Line 464...
349
<td class="detail">Snapdeal Selling Price</td>
464
<td class="detail">Snapdeal Selling Price</td>
350
<td class="value">
465
<td class="value">
351
	<input id="sellingPrice" name="sellingPrice" value='' type="text" onkeyup="calculateStuff()"></td>
466
	<input id="sellingPrice" name="sellingPrice" value='' type="text" onkeyup="calculateStuff()"></td>
352
</tr>
467
</tr>
353
<tr>
468
<tr>
-
 
469
<td class="detail">Snapdeal VOI Selling Price</td>
-
 
470
<td class="value">
-
 
471
	<input id="voiSellingPrice" name="voiSellingPrice" value='' type="text" onkeyup="calculateStuff()"></td>
-
 
472
</tr>
-
 
473
<tr>
354
<td class="detail">Transfer Price</td>
474
<td class="detail">Transfer Price</td>
355
<td class="value"><input id="transferPrice" name="transferPrice" value='' type="text" readonly/></td>
475
<td class="value"><input id="transferPrice" name="transferPrice" value='' type="text" readonly/></td>
356
</tr>
476
</tr>
357
<tr>
477
<tr>
-
 
478
<td class="detail">Transfer Price VOI</td>
-
 
479
<td class="value"><input id="transferPriceVOI" name="transferPriceVOI" value='' type="text" readonly/></td>
-
 
480
</tr>
-
 
481
<tr>
358
<td class="detail">Other Cost</td>
482
<td class="detail">Other Cost</td>
359
<td class="value">
483
<td class="value">
360
	<input id="otherCost" name="otherCost" value='0.0' type="text" onkeyup="calculateStuff()" style="width:20%;" />
484
	<input id="otherCost" name="otherCost" value='0.0' type="text" onkeyup="calculateStuff()" style="width:20%;" />
361
	<span style="font-weight:bold;color:black;">Packaging Cost</span>
485
	<span style="font-weight:bold;color:black;">Packaging Cost</span>
362
	<input id="packagingCost" name="packagingCost" value='0.0' type="text" style="width:20%;" readonly/>
486
	<input id="packagingCost" name="packagingCost" value='0.0' type="text" style="width:20%;" readonly/>
Line 371... Line 495...
371
<td class="value">
495
<td class="value">
372
	<input id="minPosTp" name="minPosTp" value='' type="text" readonly/>
496
	<input id="minPosTp" name="minPosTp" value='' type="text" readonly/>
373
</td>
497
</td>
374
</tr>
498
</tr>
375
<tr>
499
<tr>
-
 
500
<td class="detail">Minimum Possible SP VOI(Calculated)</td>
-
 
501
<td class="value"><input id="minPosSpVoi" name="minPosSpVoi" value='' type="text" readonly/></td><!--Inventory details end-->
-
 
502
</tr>
-
 
503
<tr>
-
 
504
<td class="detail">Minimum Possible TP VOI(Calculated)</td>
-
 
505
<td class="value">
-
 
506
	<input id="minPosTpVoi" name="minPosTpVoi" value='' type="text" readonly/>
-
 
507
</td>
-
 
508
</tr>
-
 
509
<tr>
376
<td class="detail">Website MRP</td>
510
<td class="detail">Website MRP</td>
377
<td class="value"><input id="webisteMrp" name="webisteMrp" value='' type="text" disabled/></td>
511
<td class="value"><input id="webisteMrp" name="webisteMrp" value='' type="text" disabled/></td>
378
</tr>
512
</tr>
379
<tr>
513
<tr>
380
<td class="detail">Website Selling Price</td>
514
<td class="detail">Website Selling Price</td>
381
<td class="value"><input id="webisteSellingPrice" name="webisteSellingPrice" value='' type="text" disabled/></td>
515
<td class="value"><input id="webisteSellingPrice" name="webisteSellingPrice" value='' type="text" disabled/></td>
382
</tr>
516
</tr>
-
 
517
<tr>
-
 
518
<td class="detail">SUPC Code</td>
-
 
519
<td class="value"><input id="supc" name="supc" value='' type="text"></td>
-
 
520
</tr>
-
 
521
<tr>
-
 
522
<td class="detail"></td>
-
 
523
<td class="value"></td>
-
 
524
</tr>
383
</tbody>
525
</tbody>
384
</table>
526
</table>
385
</div>
527
</div>
386
<div class="left" style="float: right; width: 48%;">
528
<div class="left" style="float: right; width: 48%;">
387
<table id="upload" style="text-align: center;width: 100%;height:200px;">
529
<table id="upload" style="text-align: center;width: 100%;height:200px;">
Line 393... Line 535...
393
<td class="value"><input id="margin" name="margin" value=''type="text" style="width:20%;" disabled/>
535
<td class="value"><input id="margin" name="margin" value=''type="text" style="width:20%;" disabled/>
394
<span style="font-weight:bold;color:black;">Margin&nbsp;&#37;</span><input id="marginPer" name="marginPer" value='' type="text" style="width:20%;" disabled/></td>
536
<span style="font-weight:bold;color:black;">Margin&nbsp;&#37;</span><input id="marginPer" name="marginPer" value='' type="text" style="width:20%;" disabled/></td>
395
</td>
537
</td>
396
</tr>
538
</tr>
397
<tr>
539
<tr>
-
 
540
<td class="detail">Margin VOI</td>
-
 
541
<td class="value"><input id="marginVOI" name="marginVOI" value=''type="text" style="width:20%;" disabled/>
-
 
542
<span style="font-weight:bold;color:black;">Margin&nbsp;&#37;</span><input id="marginPerVOI" name="marginPerVOI" value='' type="text" style="width:20%;" disabled/></td>
-
 
543
</td>
-
 
544
</tr>
-
 
545
<tr>
398
<td class="detail">Maximum Selling Price</td>
546
<td class="detail">Maximum Selling Price</td>
399
<td class="value"><input id="maxSp" name="maxSp" value='' type="text"></td>
547
<td class="value"><input id="maxSp" name="maxSp" value='' type="text"></td>
400
</tr>
548
</tr>
401
<tr>
549
<tr>
402
<td class="detail">Suppress Inventory Feed</td>
550
<td class="detail">Suppress Inventory Feed</td>
Line 409... Line 557...
409
<td class="value">
557
<td class="value">
410
      <select name="isSuppressPriceFeed" selectType="1"><option selected="selected" value="True">Active</option><option selected="selected" value="False">InActive</option></select>
558
      <select name="isSuppressPriceFeed" selectType="1"><option selected="selected" value="True">Active</option><option selected="selected" value="False">InActive</option></select>
411
</td>
559
</td>
412
</tr>
560
</tr>
413
<tr>
561
<tr>
-
 
562
<td class="detail">Suppress VOI Pricing Feed</td>
-
 
563
<td class="value">
-
 
564
      <select name="isSuppressVoiPriceFeed" selectType="1" class="border-highlight-red"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
-
 
565
</td>
-
 
566
</tr>
-
 
567
<tr>
414
<td class="detail">Snapdeal Listed</td>
568
<td class="detail">Snapdeal Listed</td>
415
<td class="value">
569
<td class="value">
416
      <select name="isListedOnSnapdeal" selectType="2"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
570
      <select name="isListedOnSnapdeal" selectType="2"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
417
</td>
571
</td>
418
</tr>
572
</tr>
419
<tr>
573
<tr>
-
 
574
<td class="detail">Snapdeal VOI Listed</td>
-
 
575
<td class="value">
-
 
576
      <select name="isVoiListedOnSnapdeal" selectType="2"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
-
 
577
</td>
-
 
578
</tr>
-
 
579
<tr>
420
<td class="detail">Manual Favourite</td>
580
<td class="detail">Manual Favourite</td>
421
<td class="value">
581
<td class="value">
422
      <select name="isManualFavourite" selectType="3"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
582
      <select name="isManualFavourite" selectType="3"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
423
</td>
583
</td>
424
</tr>
584
</tr>
Line 445... Line 605...
445
<tr>
605
<tr>
446
<td class="detail">Commission</td>
606
<td class="detail">Commission</td>
447
<td class="value"><input id="commission" name="commission" value='' type="text" readonly/></td>
607
<td class="value"><input id="commission" name="commission" value='' type="text" readonly/></td>
448
</tr>
608
</tr>
449
<tr>
609
<tr>
-
 
610
<td class="detail">Commission VOI</td>
-
 
611
<td class="value"><input id="commissionVoi" name="commissionVoi" value='' type="text" readonly/></td>
-
 
612
</tr>
-
 
613
<tr>
450
<td class="detail">VAT&nbsp;&#37;</td>
614
<td class="detail">VAT&nbsp;&#37;</td>
451
<td class="value"><input id="vat" name="vat" value='' type="text" onkeyup="calculateStuff()"></td>
615
<td class="value"><input id="vat" name="vat" value='' type="text" onkeyup="calculateStuff()"></td>
452
</tr>
616
</tr>
453
<tr>
617
<tr>
454
<td class="detail">Service Tax</td>
618
<td class="detail">Service Tax</td>
455
<td class="value"><input id="serviceTax" name="serviceTax" value='' type="text" readonly/></td>
619
<td class="value"><input id="serviceTax" name="serviceTax" value='' type="text" readonly/></td>
456
</tr>
620
</tr>
457
<tr>
621
<tr>
-
 
622
<td class="detail">Service Tax VOI</td>
-
 
623
<td class="value"><input id="serviceTaxVOI" name="serviceTaxVOI" value='' type="text" readonly/></td>
-
 
624
</tr>
-
 
625
<tr>
458
<td class="detail">Courier Cost</td>
626
<td class="detail">Courier Cost</td>
459
<td class="value"><input id="courierCost" name="courierCost" value='' type="text" style="width:20%;" readonly/>
627
<td class="value"><input id="courierCost" name="courierCost" value='' type="text" style="width:20%;" readonly/>
460
<span style="font-weight:bold;color:black;">Snapdeal</span>
628
<span style="font-weight:bold;color:black;">Snapdeal</span>
461
<input id="courierCostMarketplace" name="courierCostMarketplace" value='' type="text" style="width:20%;" onkeyup="calculateStuff()">
629
<input id="courierCostMarketplace" name="courierCostMarketplace" value='' type="text" style="width:20%;" onkeyup="calculateStuff()">
462
</td>
630
</td>
463
</tr>
631
</tr>
464
<tr>
632
<tr>
-
 
633
<td class="detail">Courier Cost VOI</td>
-
 
634
<td>
-
 
635
<input id="courierCostVoi" name="courierCostVoi" value='' type="text" style="width:20%;" readonly/>
-
 
636
</td>
-
 
637
</tr>
-
 
638
<tr>
465
<td class="detail">Item Id &#64; Snapdeal</td>
639
<td class="detail">Item Id &#64; Snapdeal</td>
466
<td class="value"><input id="sdItemCode" name="sdItemCode" value='' type="text">
640
<td class="value"><input id="sdItemCode" name="sdItemCode" value='' type="text">
467
</td>
641
</td>
468
</tr>
642
</tr>
469
<tr>
643
<tr>
470
<td class="detail">SUPC Code</td>
644
<td class="detail">Item Id &#64; Snapdeal VOI</td>
471
<td class="value"><input id="supc" name="supc" value='' type="text"></td>
645
	<td class="value"><input id="sdVoiItemCode" name="sdVoiItemCode" value='' type="text"></td>
472
</tr>
646
</tr>
473
<tr>
647
<tr>
474
<td class="detail">Action</td>
648
<td class="detail">Action</td>
475
<td class="value"><input type="submit" value="Update" name="upload" style="width: 25%;">
649
<td class="value"><input type="submit" value="Update" name="upload" style="width: 25%;">
476
<input type="button" style="padding-left: 5px; margin-left: 10px;width: 25%;" id="cancelbutton" name="cancel" value="Cancel">
650
<input type="button" style="padding-left: 5px; margin-left: 10px;width: 25%;" id="cancelbutton" name="cancel" value="Cancel">