Subversion Repositories SmartDukaan

Rev

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

Rev 11015 Rev 11095
Line 135... Line 135...
135
	private static String live;
135
	private static String live;
136
    private List<MarketplaceHistory> compData;
136
    private List<MarketplaceHistory> compData;
137
    private String productName;
137
    private String productName;
138
    private String startDate;
138
    private String startDate;
139
    private String endDate;
139
    private String endDate;
-
 
140
    private String courierCostMarketplace;
140
 
141
 
-
 
142
    
-
 
143
    public String courierCostMarketplace() {
-
 
144
        return courierCostMarketplace;
-
 
145
    }
-
 
146
 
-
 
147
    public void setCourierCostMarketplace(String courierCostMarketplace) {
-
 
148
        this.courierCostMarketplace = courierCostMarketplace;
-
 
149
    }
-
 
150
    
141
    public String getnDaySale() {
151
    public String getnDaySale() {
142
		return nDaySale;
152
		return nDaySale;
143
	}
153
	}
144
 
154
 
145
	public void setnDaySale(String nDaySale) {
155
	public void setnDaySale(String nDaySale) {
Line 426... Line 436...
426
		snapdealItem.setCommission(Double.valueOf(commission));
436
		snapdealItem.setCommission(Double.valueOf(commission));
427
		snapdealItem.setServiceTax(Double.valueOf(serviceTax));
437
		snapdealItem.setServiceTax(Double.valueOf(serviceTax));
428
		snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
438
		snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
429
		snapdealItem.setSkuAtSnapdeal(sdItemCode);
439
		snapdealItem.setSkuAtSnapdeal(sdItemCode);
430
		snapdealItem.setSupc(supc);
440
		snapdealItem.setSupc(supc);
-
 
441
		snapdealItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
431
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
442
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
432
		//double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
443
		//double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
433
		//t_mpItem.setVat(vat);
444
		//t_mpItem.setVat(vat);
-
 
445
		t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
434
		snapdealItem.setUpdatedBy(getUserName());
446
		snapdealItem.setUpdatedBy(getUserName());
435
		snapdealItem.setMarketplaceItems(t_mpItem);
447
		snapdealItem.setMarketplaceItems(t_mpItem);
436
 
448
 
437
		if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
449
		if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
438
			setComparsionResult("0");
450
			setComparsionResult("0");
Line 473... Line 485...
473
	public boolean compareParameters(MarketplaceItems mpItem, SnapdealItem snapdealItem, Warehouse warehouse,double weight) throws TException, JSONException, CatalogServiceException{
485
	public boolean compareParameters(MarketplaceItems mpItem, SnapdealItem snapdealItem, Warehouse warehouse,double weight) throws TException, JSONException, CatalogServiceException{
474
		double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
486
		double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
475
		double vat = (snapdealItem.getSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
487
		double vat = (snapdealItem.getSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
476
		double inHouseCost = 15+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+mpItem.getOtherCost();
488
		double inHouseCost = 15+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+mpItem.getOtherCost();
477
		double lowest_possible_tp = nlc+inHouseCost;
489
		double lowest_possible_tp = nlc+inHouseCost;
478
		double our_tp =  snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))-(Math.max(20,(mpItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(mpItem.getServiceTax()/100)));
490
		double our_tp =  snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(snapdealItem.getCourierCostMarketplace()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))-(Math.max(20,(mpItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(mpItem.getServiceTax()/100)));
479
		double commission=0.0;
491
		double commission=0.0;
480
		if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
492
		if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
481
			commission =  (((mpItem.getCommission()/100)+mpItem.getPgFee()/100)*snapdealItem.getSellingPrice());
493
			commission =  (((mpItem.getCommission()/100)+mpItem.getPgFee()/100)*snapdealItem.getSellingPrice());
482
		}
494
		}
483
		else{
495
		else{
484
			commission =  ((mpItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
496
			commission =  ((mpItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
485
		}
497
		}
486
		double service_tax = (mpItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost());
498
		double service_tax = (mpItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCostMarketplace());
487
		double lowest_possible_sp = 0.0;
499
		double lowest_possible_sp = 0.0;
488
		if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
500
		if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
489
			lowest_possible_sp = (nlc+(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100+mpItem.getPgFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
501
			lowest_possible_sp = (nlc+(snapdealItem.getCourierCostMarketplace()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100+mpItem.getPgFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
490
		}
502
		}
491
		else{
503
		else{
492
			lowest_possible_sp = (nlc+(snapdealItem.getCourierCost()+mpItem.getClosingFee()+20)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
504
			lowest_possible_sp = (nlc+(snapdealItem.getCourierCostMarketplace()+mpItem.getClosingFee()+20)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
493
		}
505
		}
494
		double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getSellingPrice(),snapdealItem.getItem_id());
506
		double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getSellingPrice(),snapdealItem.getItem_id());
495
		JSONObject x = new JSONObject();
507
		JSONObject x = new JSONObject();
496
		x.put("NLC", nlc);
508
		x.put("NLC", nlc);
497
		x.put("VAT", vat);
509
		x.put("VAT", vat);
Line 662... Line 674...
662
		snapdealItem.setServiceTax(Double.valueOf(serviceTax));
674
		snapdealItem.setServiceTax(Double.valueOf(serviceTax));
663
		snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
675
		snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
664
		snapdealItem.setSkuAtSnapdeal(sdItemCode);
676
		snapdealItem.setSkuAtSnapdeal(sdItemCode);
665
		snapdealItem.setSupc(supc);
677
		snapdealItem.setSupc(supc);
666
		snapdealItem.setUpdatedBy(getUserName());
678
		snapdealItem.setUpdatedBy(getUserName());
-
 
679
		snapdealItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
667
 
680
 
668
		MarketplaceItems mpItem = new MarketplaceItems();
681
		MarketplaceItems mpItem = new MarketplaceItems();
669
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
682
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
670
		/*double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
683
		/*double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
671
		t_mpItem.setVat(vat);*/
684
		t_mpItem.setVat(vat);*/
Line 673... Line 686...
673
		t_mpItem.setServiceTax(mpCosting.getServiceTax());
686
		t_mpItem.setServiceTax(mpCosting.getServiceTax());
674
		t_mpItem.setReturnProvision(mpCosting.getReturnProvision());
687
		t_mpItem.setReturnProvision(mpCosting.getReturnProvision());
675
		t_mpItem.setEmiFee(mpCosting.getEmiFee());
688
		t_mpItem.setEmiFee(mpCosting.getEmiFee());
676
		t_mpItem.setClosingFee(mpCosting.getClosingFee());
689
		t_mpItem.setClosingFee(mpCosting.getClosingFee());
677
		t_mpItem.setPgFee(mpCosting.getPgFee());
690
		t_mpItem.setPgFee(mpCosting.getPgFee());
-
 
691
		t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
678
		if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
692
		if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
679
			setComparsionResult("0");
693
			setComparsionResult("0");
680
			return "snapdeal-update-result";
694
			return "snapdeal-update-result";
681
		}
695
		}
682
		else{
696
		else{
Line 828... Line 842...
828
		rowhead.createCell((short) 6).setCellValue("SELLING-PRICE");
842
		rowhead.createCell((short) 6).setCellValue("SELLING-PRICE");
829
		rowhead.createCell((short) 7).setCellValue("LOWEST POSSIBLE SP");
843
		rowhead.createCell((short) 7).setCellValue("LOWEST POSSIBLE SP");
830
		rowhead.createCell((short) 8).setCellValue("LOWEST POSSIBLE TP");
844
		rowhead.createCell((short) 8).setCellValue("LOWEST POSSIBLE TP");
831
		rowhead.createCell((short) 9).setCellValue("OTHER COST");
845
		rowhead.createCell((short) 9).setCellValue("OTHER COST");
832
		rowhead.createCell((short) 10).setCellValue("COURIER-COST");
846
		rowhead.createCell((short) 10).setCellValue("COURIER-COST");
-
 
847
		rowhead.createCell((short) 11).setCellValue("COURIER-COST-Snapdeal");
833
		rowhead.createCell((short) 11).setCellValue("COMMISION");
848
		rowhead.createCell((short) 12).setCellValue("COMMISION");
834
		rowhead.createCell((short) 12).setCellValue("SERVICE-TAX");
849
		rowhead.createCell((short) 13).setCellValue("SERVICE-TAX");
835
		rowhead.createCell((short) 13).setCellValue("Suppress Inventory Feed");
850
		rowhead.createCell((short) 14).setCellValue("Suppress Inventory Feed");
836
		rowhead.createCell((short) 14).setCellValue("Suppress Price Feed");
851
		rowhead.createCell((short) 15).setCellValue("Suppress Price Feed");
837
		rowhead.createCell((short) 15).setCellValue("AUTO FAVOURITE");
852
		rowhead.createCell((short) 16).setCellValue("AUTO FAVOURITE");
838
		rowhead.createCell((short) 16).setCellValue("MANUAL FAVOURITE");
853
		rowhead.createCell((short) 17).setCellValue("MANUAL FAVOURITE");
839
		rowhead.createCell((short) 17).setCellValue("AUTO INCREMENT");
854
		rowhead.createCell((short) 18).setCellValue("AUTO INCREMENT");
840
		rowhead.createCell((short) 18).setCellValue("AUTO DECREMENT");
855
		rowhead.createCell((short) 19).setCellValue("AUTO DECREMENT");
841
		rowhead.createCell((short) 19).setCellValue("Max NLC");
856
		rowhead.createCell((short) 20).setCellValue("Max NLC");
842
		rowhead.createCell((short) 20).setCellValue("SKU @ Snapdeal");
857
		rowhead.createCell((short) 21).setCellValue("SKU @ Snapdeal");
843
		rowhead.createCell((short) 21).setCellValue("SUPC");
858
		rowhead.createCell((short) 22).setCellValue("SUPC");
844
		Client catalogClient = null;
859
		Client catalogClient = null;
845
		List<SnapdealItemDetails> snapdealItems = null;
860
		List<SnapdealItemDetails> snapdealItems = null;
846
		try {
861
		try {
847
			catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
862
			catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
848
			snapdealItems = catalogClient.getAllSnapdealItems();
863
			snapdealItems = catalogClient.getAllSnapdealItems();
Line 875... Line 890...
875
			row.createCell((short) 6).setCellValue(roundTwoDecimals(snapdealItem.getSellingPrice()));
890
			row.createCell((short) 6).setCellValue(roundTwoDecimals(snapdealItem.getSellingPrice()));
876
			row.createCell((short) 7).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleSp()));
891
			row.createCell((short) 7).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleSp()));
877
			row.createCell((short) 8).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleTp()));
892
			row.createCell((short) 8).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleTp()));
878
			row.createCell((short) 9).setCellValue(roundTwoDecimals(marketplaceItem.getOtherCost()));
893
			row.createCell((short) 9).setCellValue(roundTwoDecimals(marketplaceItem.getOtherCost()));
879
			row.createCell((short) 10).setCellValue(snapdealItem.getCourierCost());
894
			row.createCell((short) 10).setCellValue(snapdealItem.getCourierCost());
-
 
895
			row.createCell((short) 11).setCellValue(snapdealItem.getCourierCostMarketplace());
880
			row.createCell((short) 11).setCellValue(roundTwoDecimals(snapdealItem.getCommission()));
896
			row.createCell((short) 12).setCellValue(roundTwoDecimals(snapdealItem.getCommission()));
881
			row.createCell((short) 12).setCellValue(roundTwoDecimals(snapdealItem.getServiceTax()));
897
			row.createCell((short) 13).setCellValue(roundTwoDecimals(snapdealItem.getServiceTax()));
882
			if(snapdealItem.isSuppressInventoryFeed()){
898
			if(snapdealItem.isSuppressInventoryFeed()){
883
				row.createCell((short) 13).setCellValue(1);
-
 
884
			}
-
 
885
			else{
-
 
886
				row.createCell((short) 13).setCellValue(0);
-
 
887
			}
-
 
888
			if(snapdealItem.isSuppressPriceFeed()){
-
 
889
				row.createCell((short) 14).setCellValue(1);
899
				row.createCell((short) 14).setCellValue(1);
890
			}
900
			}
891
			else{
901
			else{
892
				row.createCell((short) 14).setCellValue(0);
902
				row.createCell((short) 14).setCellValue(0);
893
			}
903
			}
894
			if(marketplaceItem.isAutoFavourite()){
904
			if(snapdealItem.isSuppressPriceFeed()){
895
				row.createCell((short) 15).setCellValue(1);
905
				row.createCell((short) 15).setCellValue(1);
896
			}
906
			}
897
			else{
907
			else{
898
				row.createCell((short) 15).setCellValue(0);
908
				row.createCell((short) 15).setCellValue(0);
899
			}
909
			}
900
			if(marketplaceItem.isManualFavourite()){
910
			if(marketplaceItem.isAutoFavourite()){
901
				row.createCell((short) 16).setCellValue(1);
911
				row.createCell((short) 16).setCellValue(1);
902
			}
912
			}
903
			else{
913
			else{
904
				row.createCell((short) 16).setCellValue(0);
914
				row.createCell((short) 16).setCellValue(0);
905
			}
915
			}
906
			if(marketplaceItem.isAutoIncrement()){
916
			if(marketplaceItem.isManualFavourite()){
907
				row.createCell((short) 17).setCellValue(1);
917
				row.createCell((short) 17).setCellValue(1);
908
			}
918
			}
909
			else{
919
			else{
910
				row.createCell((short) 17).setCellValue(0);
920
				row.createCell((short) 17).setCellValue(0);
911
			}
921
			}
912
			if(marketplaceItem.isAutoDecrement()){
922
			if(marketplaceItem.isAutoIncrement()){
913
				row.createCell((short) 18).setCellValue(1);
923
				row.createCell((short) 18).setCellValue(1);
914
			}
924
			}
915
			else{
925
			else{
916
				row.createCell((short) 18).setCellValue(0);
926
				row.createCell((short) 18).setCellValue(0);
917
			}
927
			}
-
 
928
			if(marketplaceItem.isAutoDecrement()){
-
 
929
				row.createCell((short) 19).setCellValue(1);
-
 
930
			}
-
 
931
			else{
-
 
932
				row.createCell((short) 19).setCellValue(0);
-
 
933
			}
918
			row.createCell((short) 19).setCellValue(snapdealItem.getMaxNlc());
934
			row.createCell((short) 20).setCellValue(snapdealItem.getMaxNlc());
919
			row.createCell((short) 20).setCellValue(snapdealItem.getSkuAtSnapdeal());
935
			row.createCell((short) 21).setCellValue(snapdealItem.getSkuAtSnapdeal());
920
			row.createCell((short) 21).setCellValue(snapdealItem.getSupc());
936
			row.createCell((short) 22).setCellValue(snapdealItem.getSupc());
921
			iterator++;
937
			iterator++;
922
		}
938
		}
923
 
939
 
924
		FileOutputStream fileOut = null;
940
		FileOutputStream fileOut = null;
925
		try {
941
		try {
Line 1156... Line 1172...
1156
			}
1172
			}
1157
 
1173
 
1158
			warehouse = inventoryClient.getWarehouse(snapdealItem.getWarehouseId());
1174
			warehouse = inventoryClient.getWarehouse(snapdealItem.getWarehouseId());
1159
			snapdealItem.setCourierCost(courierCost);
1175
			snapdealItem.setCourierCost(courierCost);
1160
			marketplaceItem.setCourierCost(courierCost);
1176
			marketplaceItem.setCourierCost(courierCost);
-
 
1177
			if (new_item){
-
 
1178
			    snapdealItem.setCourierCostMarketplace(courierCost);
-
 
1179
			    marketplaceItem.setCourierCostMarketplace(courierCost);
-
 
1180
			}
1161
			transferPrice = roundTwoDecimals(snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+(marketplaceItem.getServiceTax()/100))-(Math.max(20,(marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(marketplaceItem.getServiceTax()/100))));
1181
			transferPrice = roundTwoDecimals(snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))-(snapdealItem.getCourierCostMarketplace()+marketplaceItem.getClosingFee())*(1+(marketplaceItem.getServiceTax()/100))-(Math.max(20,(marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(marketplaceItem.getServiceTax()/100))));
1162
			snapdealItem.setTransferPrice(transferPrice);
1182
			snapdealItem.setTransferPrice(transferPrice);
1163
			marketplaceItem.setCurrentTp(transferPrice);
1183
			marketplaceItem.setCurrentTp(transferPrice);
1164
			if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
1184
			if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
1165
				commission =  (((marketplaceItem.getCommission()/100)+marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice());
1185
				commission =  (((marketplaceItem.getCommission()/100)+marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice());
1166
			}
1186
			}
1167
			else{
1187
			else{
1168
				commission =  ((marketplaceItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
1188
				commission =  ((marketplaceItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
1169
			}
1189
			}
1170
			commission = roundTwoDecimals(commission);
1190
			commission = roundTwoDecimals(commission);
1171
			snapdealItem.setCommission(commission);
1191
			snapdealItem.setCommission(commission);
1172
			serviceTax = roundTwoDecimals((marketplaceItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost())); 
1192
			serviceTax = roundTwoDecimals((marketplaceItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCostMarketplace())); 
1173
			snapdealItem.setServiceTax(serviceTax);
1193
			snapdealItem.setServiceTax(serviceTax);
1174
			double vatRate = catalogClientProd.getVatPercentageForItem(snapdealItem.getItem_id(),warehouse.getStateId(),snapdealItem.getSellingPrice());
1194
			double vatRate = catalogClientProd.getVatPercentageForItem(snapdealItem.getItem_id(),warehouse.getStateId(),snapdealItem.getSellingPrice());
1175
			marketplaceItem.setVat(vatRate);
1195
			marketplaceItem.setVat(vatRate);
1176
			double vat = roundTwoDecimals((snapdealItem.getSellingPrice()/(1+(marketplaceItem.getVat()/100))-(snapdealItem.getMaxNlc()/(1+(marketplaceItem.getVat()/100))))*(marketplaceItem.getVat()/100));
1196
			double vat = roundTwoDecimals((snapdealItem.getSellingPrice()/(1+(marketplaceItem.getVat()/100))-(snapdealItem.getMaxNlc()/(1+(marketplaceItem.getVat()/100))))*(marketplaceItem.getVat()/100));
1177
			double inHouseCost = roundTwoDecimals(15+vat+(marketplaceItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+marketplaceItem.getOtherCost());
1197
			double inHouseCost = roundTwoDecimals(15+vat+(marketplaceItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+marketplaceItem.getOtherCost());
1178
			double lowest_possible_tp = roundTwoDecimals(snapdealItem.getMaxNlc()+inHouseCost);
1198
			double lowest_possible_tp = roundTwoDecimals(snapdealItem.getMaxNlc()+inHouseCost);
1179
			marketplaceItem.setMinimumPossibleTp(lowest_possible_tp);
1199
			marketplaceItem.setMinimumPossibleTp(lowest_possible_tp);
1180
			double lowest_possible_sp=0.0;
1200
			double lowest_possible_sp=0.0;
1181
			if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
1201
			if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
1182
				lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100+marketplaceItem.getPgFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
1202
				lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCostMarketplace()+marketplaceItem.getClosingFee())*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100+marketplaceItem.getPgFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
1183
			}
1203
			}
1184
			else{
1204
			else{
1185
				lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee()+20)*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
1205
				lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCostMarketplace()+marketplaceItem.getClosingFee()+20)*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
1186
			}
1206
			}
1187
			marketplaceItem.setMinimumPossibleSp(lowest_possible_sp);
1207
			marketplaceItem.setMinimumPossibleSp(lowest_possible_sp);
1188
			snapdealItem.setUpdatedBy(updatedBy);
1208
			snapdealItem.setUpdatedBy(updatedBy);
1189
			snapdealItem.setMarketplaceItems(marketplaceItem);
1209
			snapdealItem.setMarketplaceItems(marketplaceItem);
1190
			//logger.info(snapdealItem.toString());
1210
			//logger.info(snapdealItem.toString());
Line 1571... Line 1591...
1571
 
1591
 
1572
	public String getVaildName(String name){
1592
	public String getVaildName(String name){
1573
		return name!=null?name:"";
1593
		return name!=null?name:"";
1574
	}
1594
	}
1575
 
1595
 
1576
 
-
 
1577
 
-
 
1578
}
1596
}