if (@customer)
  json.id @customer.customer_id
  json.name @customer.name
  json.email @customer.email
  json.contact_no @customer.contact_no
  json.date_of_birth @customer.date_of_birth

  
  @total_amount = 0.00
  @total_tax = 0.00
  
  if @customer.orders
    order_items = []
    @customer.orders.each do |bo|
      order = Order.find(bo.order_id)
      #if (order.status == "new")
        order_items = order_items + order.order_items
      #end
    end

    json.order_items order_items do |item|
        json.item_instance_code    item.item_code
        json.item_name             item.item_name
        json.price                 item.price
        json.qty                   item.qty
        json.options               item.options
        json.remark                item.remark
        json.item_status           item.order_item_status
        @total_amount = @total_amount + (item.price * item.qty)
    end

  end

  json.sub_total @total_amount
  json.commerical_tax @total_amount * 0.05
  json.total @total_amount + (@total_amount * 0.05)

end