Subversion Repositories SmartDukaan

Rev

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

Rev 14780 Rev 14862
Line 147... Line 147...
147
    private String minPosTpVoi;
147
    private String minPosTpVoi;
148
    private String transferPriceVOI;
148
    private String transferPriceVOI;
149
    private String serviceTaxVOI;
149
    private String serviceTaxVOI;
150
    private String courierCostVoi;
150
    private String courierCostVoi;
151
    private String commissionVoi; 
151
    private String commissionVoi; 
-
 
152
    private String courierCostMarketplaceVoi;
-
 
153
    private String commissionRateVoi;
152
    
154
    
153
    public String courierCostMarketplace() {
155
    public String courierCostMarketplace() {
154
        return courierCostMarketplace;
156
        return courierCostMarketplace;
155
    }
157
    }
156
 
158
 
Line 473... Line 475...
473
        	snapdealItem.setMinimumPossibleTpVoi(Double.parseDouble(minPosTpVoi));
475
        	snapdealItem.setMinimumPossibleTpVoi(Double.parseDouble(minPosTpVoi));
474
        	snapdealItem.setCourierCostVoi(Double.parseDouble(courierCostVoi));
476
        	snapdealItem.setCourierCostVoi(Double.parseDouble(courierCostVoi));
475
        	snapdealItem.setCommissionVoi(Double.parseDouble(commissionVoi));
477
        	snapdealItem.setCommissionVoi(Double.parseDouble(commissionVoi));
476
        	snapdealItem.setServiceTaxVoi(Double.parseDouble(serviceTaxVOI));
478
        	snapdealItem.setServiceTaxVoi(Double.parseDouble(serviceTaxVOI));
477
        	snapdealItem.setTransferPriceVoi(Double.parseDouble(transferPriceVOI));
479
        	snapdealItem.setTransferPriceVoi(Double.parseDouble(transferPriceVOI));
-
 
480
        	snapdealItem.setCourierCostMarketplaceVoi(Double.parseDouble(courierCostMarketplaceVoi));
-
 
481
        	snapdealItem.setCommissionPercentageVoi(Double.parseDouble(commissionRateVoi));
478
        }
482
        }
479
        MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
483
        MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
480
        //double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
484
        //double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
481
        //t_mpItem.setVat(vat);
485
        //t_mpItem.setVat(vat);
482
        t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
486
        t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
483
        snapdealItem.setUpdatedBy(getUserName());
487
        snapdealItem.setUpdatedBy(getUserName());
484
        snapdealItem.setMarketplaceItems(t_mpItem);
488
        snapdealItem.setMarketplaceItems(t_mpItem);
485
 
489
 
-
 
490
        if(snapdealItem.isIsListedOnSnapdeal()){
486
        if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
491
	        if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
487
            setComparsionResult("0");
492
	            setComparsionResult("0");
488
            return "snapdeal-update-result";
493
	            return "snapdeal-update-result";
-
 
494
	        }
-
 
495
	        else{
-
 
496
	            setComparsionResult("1");
-
 
497
	        }
489
        }
498
        }
-
 
499
        if(snapdealItem.isIsVoiListed()){
-
 
500
        	if(!compareParametersVOI(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
-
 
501
	            setComparsionResult("0");
-
 
502
	            return "snapdeal-update-result";
-
 
503
	        }
490
        else{
504
	        else{
491
            setComparsionResult("1");
505
	            setComparsionResult("1");
-
 
506
	        }
492
        }
507
        }
493
 
508
 
494
        if(!catalogClient.addOrUpdateSnapdealItem(snapdealItem)){
509
        if(!catalogClient.addOrUpdateSnapdealItem(snapdealItem)){
495
            throw new CatalogServiceException();
510
            throw new CatalogServiceException();
496
        }
511
        }
Line 594... Line 609...
594
 
609
 
595
    }
610
    }
596
    
611
    
597
    public boolean compareParametersVOI(MarketplaceItems mpItem,SnapdealItem snapdealItem, Warehouse warehouse,double weight, Long categoryId) throws TException, JSONException, CatalogServiceException{
612
    public boolean compareParametersVOI(MarketplaceItems mpItem,SnapdealItem snapdealItem, Warehouse warehouse,double weight, Long categoryId) throws TException, JSONException, CatalogServiceException{
598
    	double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
613
    	double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
599
    	double courierCostMp = getCourierCostVOI(weight);
614
    	double courierCostMp = snapdealItem.getCourierCostMarketplaceVoi();
600
        double vat = (snapdealItem.getVoiSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
615
        double vat = (snapdealItem.getVoiSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
601
        double inHouseCost = mpItem.getPackagingCost()+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getVoiSellingPrice()+mpItem.getOtherCost();
616
        double inHouseCost = mpItem.getPackagingCost()+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getVoiSellingPrice()+mpItem.getOtherCost();
602
        double lowest_possible_tp = nlc+inHouseCost;
617
        double lowest_possible_tp = nlc+inHouseCost;
603
        double our_tp =  snapdealItem.getVoiSellingPrice()- snapdealItem.getVoiSellingPrice()*((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(courierCostMp+mpItem.getClosingFee())*(1+(Double.parseDouble(serviceTaxVOI)/100))-(Math.max(20,(mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice())*(1+(Double.parseDouble(serviceTaxVOI)/100)));
618
        double our_tp =  snapdealItem.getVoiSellingPrice()- snapdealItem.getVoiSellingPrice()*((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(courierCostMp+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))-(Math.max(20,(mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice())*(1+(mpItem.getServiceTax()/100)));
604
        double commission=0.0;
619
        double commission=0.0;
605
        if ((mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice()>=20){
620
        if ((mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice()>=20){
606
            commission =  (((mpItem.getCommission()/100)+mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice());
621
            commission =  (((snapdealItem.getCommissionPercentageVoi()/100)+mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice());
607
        }
622
        }
608
        else{
623
        else{
609
            commission =  ((mpItem.getCommission()/100)*snapdealItem.getVoiSellingPrice()+20);
624
            commission =  ((snapdealItem.getCommissionPercentageVoi()/100)*snapdealItem.getVoiSellingPrice()+20);
610
        }
625
        }
611
        double service_tax = (Double.parseDouble(serviceTaxVOI)/100)*(snapdealItem.getCommission()+courierCostMp);
626
        double service_tax = (mpItem.getServiceTax()/100)*(snapdealItem.getCommission()+courierCostMp);
612
        double lowest_possible_sp = 0.0;
627
        double lowest_possible_sp = 0.0;
613
        if ((mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice()>=20){
628
        if ((mpItem.getPgFee()/100)*snapdealItem.getVoiSellingPrice()>=20){
614
            lowest_possible_sp = (nlc+(courierCostMp+mpItem.getClosingFee())*(1+(Double.parseDouble(serviceTaxVOI)/100))*(1+(mpItem.getVat()/100))+(mpItem.getPackagingCost()+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100+mpItem.getPgFee()/100)*(1+(Double.parseDouble(serviceTaxVOI)/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
629
            lowest_possible_sp = (nlc+(courierCostMp+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(mpItem.getPackagingCost()+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((snapdealItem.getCommissionPercentageVoi()/100)+mpItem.getEmiFee()/100+mpItem.getPgFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
615
        }
630
        }
616
        else{
631
        else{
617
            lowest_possible_sp = (nlc+(courierCostMp+mpItem.getClosingFee()+20)*(1+(Double.parseDouble(serviceTaxVOI)/100))*(1+(mpItem.getVat()/100))+(mpItem.getPackagingCost()+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(Double.parseDouble(serviceTaxVOI)/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
632
            lowest_possible_sp = (nlc+(courierCostMp+mpItem.getClosingFee()+20)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(mpItem.getPackagingCost()+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((snapdealItem.getCommissionPercentageVoi()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
618
        }
633
        }
619
        double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getVoiSellingPrice(),snapdealItem.getItem_id());
634
        double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getVoiSellingPrice(),snapdealItem.getItem_id());
620
        JSONObject x = new JSONObject();
635
        JSONObject x = new JSONObject();
621
        x.put("NLC", nlc);
636
        x.put("NLC", nlc);
622
        x.put("VAT", vat);
637
        x.put("VAT", vat);
623
        x.put("COURIER COST",getCourierCost(weight));
638
        x.put("COURIER COST",getCourierCostVOI(weight));
624
        x.put("LOWEST POS TP", lowest_possible_tp);
639
        x.put("LOWEST POS TP", lowest_possible_tp);
625
        x.put("TP", our_tp);
640
        x.put("TP", our_tp);
626
        x.put("COMMISSION", commission);
641
        x.put("COMMISSION", commission);
627
        x.put("SERVICE TAX", service_tax);
642
        x.put("SERVICE TAX", service_tax);
628
        x.put("LOWEST POS SP", lowest_possible_sp);
643
        x.put("LOWEST POS SP", lowest_possible_sp);
Line 815... Line 830...
815
        	snapdealItem.setMinimumPossibleTpVoi(Double.parseDouble(minPosTpVoi));
830
        	snapdealItem.setMinimumPossibleTpVoi(Double.parseDouble(minPosTpVoi));
816
        	snapdealItem.setCourierCostVoi(Double.parseDouble(courierCostVoi));
831
        	snapdealItem.setCourierCostVoi(Double.parseDouble(courierCostVoi));
817
        	snapdealItem.setCommissionVoi(Double.parseDouble(commissionVoi));
832
        	snapdealItem.setCommissionVoi(Double.parseDouble(commissionVoi));
818
        	snapdealItem.setServiceTaxVoi(Double.parseDouble(serviceTaxVOI));
833
        	snapdealItem.setServiceTaxVoi(Double.parseDouble(serviceTaxVOI));
819
        	snapdealItem.setTransferPriceVoi(Double.parseDouble(transferPriceVOI));
834
        	snapdealItem.setTransferPriceVoi(Double.parseDouble(transferPriceVOI));
-
 
835
        	snapdealItem.setCourierCostMarketplaceVoi(Double.parseDouble(courierCostMarketplaceVoi));
-
 
836
        	snapdealItem.setCommissionPercentageVoi(Double.parseDouble(commissionRateVoi));
820
        }
837
        }
821
 
838
 
822
        MarketplaceItems mpItem = new MarketplaceItems();
839
        MarketplaceItems mpItem = new MarketplaceItems();
823
        MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
840
        MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
824
        /*double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
841
        /*double vat = catalogClientProd.getVatPercentageForItem(Long.valueOf(itemId), warehouse.getStateId(), Double.valueOf(sellingPrice));
Line 829... Line 846...
829
        t_mpItem.setEmiFee(mpCosting.getEmiFee());
846
        t_mpItem.setEmiFee(mpCosting.getEmiFee());
830
        t_mpItem.setClosingFee(mpCosting.getClosingFee());
847
        t_mpItem.setClosingFee(mpCosting.getClosingFee());
831
        t_mpItem.setPgFee(mpCosting.getPgFee());
848
        t_mpItem.setPgFee(mpCosting.getPgFee());
832
        t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
849
        t_mpItem.setCourierCostMarketplace(Double.valueOf(courierCostMarketplace));
833
        t_mpItem.setPackagingCost(Double.valueOf(packagingCost));
850
        t_mpItem.setPackagingCost(Double.valueOf(packagingCost));
-
 
851
        if(snapdealItem.isIsListedOnSnapdeal()){
834
        if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
852
	        if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
835
            setComparsionResult("0");
853
	            setComparsionResult("0");
836
            return "snapdeal-update-result";
854
	            return "snapdeal-update-result";
-
 
855
	        }
-
 
856
	        else{
-
 
857
	            setComparsionResult("1");
-
 
858
	        }
837
        }
859
        }
-
 
860
        if(snapdealItem.isIsVoiListed()){
-
 
861
        	if(!compareParametersVOI(t_mpItem,snapdealItem,warehouse,item.getWeight(),item.getCategory())){
-
 
862
	            setComparsionResult("0");
-
 
863
	            return "snapdeal-update-result";
-
 
864
	        }
838
        else{
865
	        else{
839
            setComparsionResult("1");
866
	            setComparsionResult("1");
-
 
867
	        }
840
        }
868
        }
841
        snapdealItem.setMarketplaceItems(t_mpItem);
869
        snapdealItem.setMarketplaceItems(t_mpItem);
842
        Long timestamp = System.currentTimeMillis();
870
        Long timestamp = System.currentTimeMillis();
843
        boolean result = catalogClient.addOrUpdateSnapdealItem(snapdealItem);
871
        boolean result = catalogClient.addOrUpdateSnapdealItem(snapdealItem);
844
        if(!result){
872
        if(!result){
Line 1827... Line 1855...
1827
 
1855
 
1828
	public void setCommissionVoi(String commissionVoi) {
1856
	public void setCommissionVoi(String commissionVoi) {
1829
		this.commissionVoi = commissionVoi;
1857
		this.commissionVoi = commissionVoi;
1830
	}
1858
	}
1831
 
1859
 
-
 
1860
	public String getCourierCostMarketplaceVoi() {
-
 
1861
		return courierCostMarketplaceVoi;
-
 
1862
	}
-
 
1863
 
-
 
1864
	public void setCourierCostMarketplaceVoi(String courierCostMarketplaceVoi) {
-
 
1865
		this.courierCostMarketplaceVoi = courierCostMarketplaceVoi;
-
 
1866
	}
-
 
1867
 
-
 
1868
	public String getCommissionRateVoi() {
-
 
1869
		return commissionRateVoi;
-
 
1870
	}
-
 
1871
 
-
 
1872
	public void setCommissionRateVoi(String commissionRateVoi) {
-
 
1873
		this.commissionRateVoi = commissionRateVoi;
-
 
1874
	}
-
 
1875
 
1832
}
1876
}