@Override
public int getCalculatedDiscount() throws ClipsServerException {
checkCommandAccessibility(COMMAND_READ);
ServiceRender entity = getExistentEntity();
DiscountCard discountCard = entity.getDiscountCard();
PacketService packetService = entity.getPacketService();
if (discountCard != null || packetService != null) {
//по дисконтной карте или по пакету услуг
int cardID = discountCard == null ? 0 : discountCard.getId();
int packetID = packetService == null ? 0 : packetService.getPacketTemplate().getId();
return CalcDiscount.calculateDiscount(manager, cardID, entity.getService().getId(), packetID);
} else {
return entity.getDiscount();
}