function editHotelRates()
{
    $roomrates = new HotelRoomRates();
    $roomrates->setValues($_REQUEST);
    $localCols = $roomrates->getRateFields('Local');
    $foreignCols = $roomrates->getRateFields('Foreign');
    //INFO: Assumes that `count($foreignCols)` and `count($localCols)` are same.
    for ($i = 1; $i < count($foreignCols); $i = $i + 2) {
        $val_array_foreign[] = ($roomrates->getFieldValue($foreignCols[$i]) - $roomrates->getFieldValue($foreignCols[$i - 1])) / 100;
        $val_array_local[] = ($roomrates->getFieldValue($localCols[$i]) - $roomrates->getFieldValue($localCols[$i - 1])) / 100;
    }
    $max_foreign = max($val_array_foreign);
    $max_local = max($val_array_local);
    $min_foreign = min($val_array_foreign);
    $min_local = min($val_array_local);
    $roomrates->setDiscountRatesUpForiegn($max_foreign);
    $roomrates->setDiscountRatesUpLocal($max_local);
    $roomrates->setHotelPriceMinForiegn($min_foreign);
    $roomrates->setHotelPriceMinLocal($min_local);
    $roomrates->setModifiedDate(date('Y-m-d'));
    //INFO: Log
    /*$temp_rate1 = new HotelRoomRates();
      $temp_rate2 = $_REQUEST;
      $temp_rate1->setRoomRateId($temp_rate2['room_rate_id']);
      $temp_rate1=(array)$temp_rate1->getRatesFromRateId();*/
    //INFO: Log//
    if ($roomrates->updateHotelRoomRate()) {
        //INFO: Replaced following commented section with above  `$foreignCols` thing. As no need to re-load data and do the calculation.
        /*// update max and min
          $roomrates = new HotelRoomRates();
          $roomrates->setRoomRateId($_REQUEST['room_rate_id']);
          $query_data = $roomrates->getRateFromId();
          $ic = 0;
          foreach ($query_data as $x) {
              foreach ($x as $key => $val) {
                  if ($ic > 7 && $ic < 67) {
                      $ARRAY[$ic] = $val;
                  }
                  $ic++;
              }
          }
          for ($x = 67; $x > 7; $x--) {
              $y = ($x - 1);
              if ($x < 36) {
                  $val_array_local[] = (($ARRAY[$x] - $ARRAY[$y]) / 100);
              } else {
                  $val_array_foreign[] = (($ARRAY[$x] - $ARRAY[$y]) / 100);
              }
          }
          $max_foreign = max($val_array_foreign);
          $max_local = max($val_array_local);
          $min_foreign = min($val_array_foreign);
          $min_local = min($val_array_local);
          $roomrates->setDiscountRatesUpForiegn($max_foreign);
          $roomrates->setDiscountRatesUpLocal($max_local);
          $roomrates->setHotelPriceMinForiegn($min_foreign);
          $roomrates->setHotelPriceMinLocal($min_local);
          $roomrates->updateHotelRoomRateMax();*/
        //INFO: Log
        //$temp_rate2['discount_rates_up_foriegn']=$max_foreign;
        //$temp_rate2['discount_rates_up_local']=$max_local;
        //$temp_rate2['hotel_price_min_foriegn']=$min_foreign;
        //$temp_rate2['hotel_price_min_local']=$min_local;
        //$TransactionLog=new TransactionLog($temp_rate2['hotel_id'],Libs::getKey('hotel_sections','Hotel Rates - Edit'),'Update',Sessions::getMemberId(),'room_rates',$temp_rate1[0],$temp_rate2);
        //$TransactionLog->log();
        //$temp_hotel1=null;
        //$temp_hotel2=null;
        //INFO: Log
        //max and min
        $complete = new ProfileCompletion();
        $complete->setHotelStepId($_REQUEST['hotel_step_id']);
        $complete->setHotelStep1(1);
        $complete->updateProfileCompletionStep('6');
        //echo($_REQUEST['hotel_step_id']);
        Common::jsonSuccess("Room Rates Added Successfully!");
    } else {
        Common::jsonError("Error");
    }
}