Allow partial discount on supplier orders #68
@ -62,10 +62,15 @@ public class RequestController {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int priceNet = a.pricePerUnitNet * order.quantity;
 | 
					        int priceNet = a.pricePerUnitNet * order.quantity;
 | 
				
			||||||
        int discount = 0;
 | 
					        int discountableNetAmount = 0;
 | 
				
			||||||
        if(dailyVolume >= s.discount.minimumDailySalesVolumeNetCent) {
 | 
					        if (dailyVolume >= s.discount.minimumDailySalesVolumeNetCent) {
 | 
				
			||||||
            discount = (priceNet * s.discount.percentDiscount) / 100;
 | 
					            // grant discount on the full price
 | 
				
			||||||
 | 
					            discountableNetAmount = priceNet;
 | 
				
			||||||
 | 
					        } else if (dailyVolume + priceNet > s.discount.minimumDailySalesVolumeNetCent) {
 | 
				
			||||||
 | 
					            // grant partial discount
 | 
				
			||||||
 | 
					            discountableNetAmount = dailyVolume + priceNet - s.discount.minimumDailySalesVolumeNetCent;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        int discount = (discountableNetAmount * s.discount.percentDiscount) / 100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        OrderConfirmation confirmation = new OrderConfirmation();
 | 
					        OrderConfirmation confirmation = new OrderConfirmation();
 | 
				
			||||||
        confirmation.articleNumber = order.articleNumber;
 | 
					        confirmation.articleNumber = order.articleNumber;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user