Subversion Repositories SmartDukaan

Rev

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

Rev 26891 Rev 27083
Line 123... Line 123...
123
	private static final Logger LOGGER = LogManager.getLogger(OrderServiceImpl.class);
123
	private static final Logger LOGGER = LogManager.getLogger(OrderServiceImpl.class);
124
 
124
 
125
	@Autowired
125
	@Autowired
126
	@Qualifier("fofoInventoryItemRepository")
126
	@Qualifier("fofoInventoryItemRepository")
127
	private InventoryItemRepository inventoryItemRepository;
127
	private InventoryItemRepository inventoryItemRepository;
128
	
128
 
129
	@Autowired
129
	@Autowired
130
	private StateGstRateRepository stateGstRateRepository;
130
	private StateGstRateRepository stateGstRateRepository;
131
 
131
 
132
	@Autowired
132
	@Autowired
133
	private SaholicInventoryService saholicInventoryService;
133
	private SaholicInventoryService saholicInventoryService;
134
	
134
 
135
	@Autowired
135
	@Autowired
136
	private LiveDemoBillingRespository liveDemoBillingRespository;
136
	private LiveDemoBillingRespository liveDemoBillingRespository;
137
 
137
 
138
	@Autowired
138
	@Autowired
139
	private InsuranceService insuranceService;
139
	private InsuranceService insuranceService;
Line 460... Line 460...
460
			documentNumber = this.getInvoiceNumber(fofoId, fofoStoreCode);
460
			documentNumber = this.getInvoiceNumber(fofoId, fofoStoreCode);
461
		}
461
		}
462
 
462
 
463
		Customer customer = customerRepository.selectById(customCustomer.getCustomerId());
463
		Customer customer = customerRepository.selectById(customCustomer.getCustomerId());
464
 
464
 
465
		CustomerAddress customerAddress = customer.getCustomerAddress().stream().filter(x->x.getId()==customCustomer.getCustomerAddressId())
465
		CustomerAddress customerAddress = customer.getCustomerAddress().stream()
466
				.findFirst().get();
466
				.filter(x -> x.getId() == customCustomer.getCustomerAddressId()).findFirst().get();
467
 
467
 
468
		FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
468
		FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
469
				documentNumber, totalAmount, customerAddress.getId());
469
				documentNumber, totalAmount, customerAddress.getId());
470
 
470
 
471
		this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
471
		this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
Line 635... Line 635...
635
		pdfModel.setInsurancePolicies(customInsurancePolicies);
635
		pdfModel.setInsurancePolicies(customInsurancePolicies);
636
		List<String> tncs = new ArrayList<>();
636
		List<String> tncs = new ArrayList<>();
637
		tncs.add("I agree that goods received are in good working condition");
637
		tncs.add("I agree that goods received are in good working condition");
638
		tncs.add("Goods once sold cannot be exchanged or taken back");
638
		tncs.add("Goods once sold cannot be exchanged or taken back");
639
		tncs.add("Warranty for the goods received by me is the responsibility of the manufacturer only.");
639
		tncs.add("Warranty for the goods received by me is the responsibility of the manufacturer only.");
-
 
640
		tncs.add(
640
		tncs.add("Tempered Glass Replacement will be done only for the Mobile Phone which was purchased from SmartDukaan");
641
				"Tempered Glass Replacement will be done only for the Mobile Phone which was purchased from SmartDukaan");
-
 
642
		tncs.add(
641
		tncs.add("Customers requesting Tempered Glass Replacement will have to bring the broken tempered glass, either pasted on the phone or along with the phone");
643
				"Customers requesting Tempered Glass Replacement will have to bring the broken tempered glass, either pasted on the phone or along with the phone");
642
		tncs.add("Service fee of Rs.20 will be chargeable for each Tempered Glass Replacement");
644
		tncs.add("Service fee of Rs.20 will be chargeable for each Tempered Glass Replacement");
643
		if (pdfModel.getInsurancePolicies() != null && pdfModel.getInsurancePolicies().size() > 0) {
645
		if (pdfModel.getInsurancePolicies() != null && pdfModel.getInsurancePolicies().size() > 0) {
644
			tncs.add("Damage protection provided is the responisibility of Protection Provider only");
646
			tncs.add("Damage protection provided is the responisibility of Protection Provider only");
645
		}
647
		}
646
		pdfModel.setTncs(tncs);
648
		pdfModel.setTncs(tncs);
Line 1503... Line 1505...
1503
		Float sales = fofoOrderRepository.selectSaleSumGroupByFofoIds(startDate, endDate).get(fofoId);
1505
		Float sales = fofoOrderRepository.selectSaleSumGroupByFofoIds(startDate, endDate).get(fofoId);
1504
		return sales == null ? 0f : sales;
1506
		return sales == null ? 0f : sales;
1505
	}
1507
	}
1506
 
1508
 
1507
	@Override
1509
	@Override
-
 
1510
	public LocalDateTime getMaxSalesDate(int fofoId, LocalDateTime startDate, LocalDateTime endDate) {
-
 
1511
		LocalDateTime dateTime = fofoOrderRepository.selectMaxSaleDateGroupByFofoIds(startDate, endDate).get(fofoId);
-
 
1512
		return dateTime;
-
 
1513
	}
-
 
1514
 
-
 
1515
	@Override
-
 
1516
	//Only being used internally
1508
	public float getSales(int fofoId, LocalDate onDate) {
1517
	public float getSales(int fofoId, LocalDate onDate) {
1509
		LocalDateTime startTime = LocalDateTime.of(onDate, LocalTime.MIDNIGHT);
1518
		LocalDateTime startTime = LocalDateTime.of(onDate, LocalTime.MIDNIGHT);
1510
		LocalDateTime endTime = LocalDateTime.of(onDate, LocalTime.MIDNIGHT).plusDays(1);
1519
		LocalDateTime endTime = LocalDateTime.of(onDate, LocalTime.MIDNIGHT).plusDays(1);
1511
		return this.getSales(fofoId, startTime, endTime);
1520
		return this.getSales(fofoId, startTime, endTime);
1512
	}
1521
	}