// calculate amount
  public Reconciliation calculateamt(String logstr, ReconciliationDto tobemerged) throws Exception {
    // TODO Auto-generated method stub
    int qty;
    double fprice, amt = 0;
    Date date = new Date();
    // if (tobemerged.getOrderid() == null)
    //		throw new ReconcileException("Order item list is empty");

    // Finding all order to the perticular user
    List<OrderItem> orderRecords =
        orderItemRepository.findByUidAndOid(tobemerged.getUserid(), tobemerged.getOrderid());
    if (orderRecords == null) {
      logger.debug(logstr + "Reconciliation record does not exist according to oid and uid");
      throw new Exception();
    }

    for (OrderItem orderItem : orderRecords) {
      FoodItem foodItem = foodItemRepository.findOne(orderItem.getItem_id());
      amt = amt + orderItem.getQty() * foodItem.getPrice();
    }

    // Create Reconcile entity
    Reconciliation reconciliation = new Reconciliation();

    logger.debug(logstr + "create reconciliation entry" + reconciliation.fetchLogDetails());
    // reconciliation.setDate(getDate);
    reconciliation.setOrderid(tobemerged.getOrderid());
    reconciliation.setOrdercost(amt);
    reconciliation.setAmountpaid(tobemerged.getAmtpaid());
    reconciliation.setUserid(tobemerged.getUserid());
    reconciliation.setStatus("processed");
    reconciliation.setDate(date);

    // new update for another update by same user
    Reconciliation recRecords =
        reconciliationRepository.findByUseridAndOrderid(
            tobemerged.getUserid(), tobemerged.getOrderid());
    if (recRecords != null) {
      reconciliation.setId(recRecords.getId());
      reconciliation.setAmountpaid(tobemerged.getAmtpaid() + recRecords.getAmountpaid());
      update(logstr, reconciliation);
    } else {
      reconciliation = reconciliationRepository.save(reconciliation);
    }
    logger.debug(logstr + "created reconciliation entry " + reconciliation.fetchLogDetails());
    return reconciliation;
  }