diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 109d154e..8136a5cc 100755
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -16,7 +16,6 @@
//= require bootstrap/js/popper.min
//= require bootstrap/js/bootstrap-material-design.min
//= require jquery_nested_form
-//= require cable
//= require momentjs/moment
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker
//= require multi-select/js/jquery.multi-select.js
@@ -24,6 +23,15 @@
//= require bootstrap-notify/bootstrap-notify.js
//= require node-waves/waves.js
//= require sweetalert/sweetalert.min.js
+//=require jquery-datatable/jquery.dataTables.js
+//=require jquery-datatable/skin/bootstrap/js/dataTables.bootstrap.js
+//=require jquery-datatable/extensions/export/dataTables.buttons.min.js
+//=require jquery-datatable/extensions/export/buttons.flash.min.js
+//=require jquery-datatable/extensions/export/jszip.min.js
+//=require jquery-datatable/extensions/export/pdfmake.min.js
+//=require jquery-datatable/extensions/export/vfs_fonts.js
+//=require jquery-datatable/extensions/export/buttons.html5.min.js
+//=require jquery-datatable/extensions/export/buttons.print.min.js
//= require autosize/autosize.js
//= require jquery-countto/jquery.countTo.js
//= require raphael/raphael.min
@@ -343,6 +351,21 @@ $(document).ready(function(){
}
});
});
+ $(function () {
+ $('.js-basic-example').DataTable({
+ responsive: true,
+bLengthChange: false
+ });
+
+ //Exportable table
+ $('.js-exportable').DataTable({
+ dom: 'Bfrtip',
+ responsive: true,
+ buttons: [
+ 'copy', 'csv', 'excel', 'pdf', 'print'
+ ]
+ });
+});
});
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index b7bcb027..ff1757aa 100755
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -5,6 +5,7 @@
@import "animate-css/animate";
@import "sweetalert/sweetalert.css";
@import "multi-select/css/multi-select.css";
+@import "jquery-datatable/skin/bootstrap/css/dataTables.bootstrap.css";
@import "bootstrap-material-datetimepicker/css/bootstrap-material-datetimepicker";
@import "morrisjs/morris";
@import "fileinput.min";
diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb
new file mode 100644
index 00000000..dfce77e2
--- /dev/null
+++ b/app/controllers/transactions/bookings_controller.rb
@@ -0,0 +1,44 @@
+class Transactions::BookingsController < ApplicationController
+ load_and_authorize_resource except: [:create]
+ before_action :set_transactions_booking, only: [:show, :edit, :update, :destroy]
+
+ def index
+
+ @bookings = Booking.all.order("booking_id desc")
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @bookings }
+ end
+
+ end
+
+ # GET /transactions/bookings/1
+ # GET /transactions/bookings/1.json
+ def show
+
+ @booking = Booking.find(params[:id])
+
+ @order_items = []
+ @booking.booking_orders.each do |booking_order|
+ @order = Order.find(booking_order.order_id)
+ #if (order.status == "new")
+ @order_items = @order_items + @order.order_items
+ #end
+ end
+ if @booking.sale_id.present?
+ @sale = Sale.find(@booking.sale_id)
+ end
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @booking }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_transactions_booking
+ @transactions_booking = Booking.find(params[:id])
+ end
+end
diff --git a/app/models/booking.rb b/app/models/booking.rb
index e3d94a37..b65063a4 100755
--- a/app/models/booking.rb
+++ b/app/models/booking.rb
@@ -41,6 +41,22 @@ class Booking < ApplicationRecord
return new_dining.type
end
+ def self.search(filter,from,to)
+ if filter.blank?
+ keyword = ''
+ else
+ keyword = "booking_id LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%"
+ end
+
+ if from.present? && to.present?
+ sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
+ query = sale.where(keyword)
+ else
+ where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
+ end
+
+ end
+
private
def generate_custom_id
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
diff --git a/app/views/transactions/bookings/index.html.erb b/app/views/transactions/bookings/index.html.erb
new file mode 100755
index 00000000..f0e6aea2
--- /dev/null
+++ b/app/views/transactions/bookings/index.html.erb
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+ | <%= t("views.right_panel.detail.booking_id") %> |
+ <%= t("views.right_panel.detail.sale_id") %> |
+ <%= t("views.right_panel.detail.table") %> |
+ <%= t("views.right_panel.detail.checkin_time") %> |
+ <%= t("views.right_panel.detail.checkout_time") %> |
+ <%= t("views.right_panel.detail.checkin_by") %> |
+ <%= t("views.right_panel.detail.checkout_by") %> |
+ <%= t("views.right_panel.detail.booking_status") %> |
+ <%= t("views.right_panel.detail.booking_date") %> |
+
+
+
+
+ <% if @bookings != 0 %>
+ <% @bookings.each do |booking| %>
+
+ | <%= link_to booking.booking_id, transactions_booking_path(booking) %> |
+ <%= link_to booking.sale_id, transactions_sale_path(booking.sale_id) rescue '-' %> |
+ <%= booking.dining_facility.name %> |
+ <%= booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> |
+ <%= booking.checkout_at.utc.getlocal.strftime("%I:%M %p") rescue '-' %> |
+ <%= booking.checkin_by rescue '-' %> |
+ <%= booking.checkout_by rescue '-' %> |
+ <%= booking.booking_status %> |
+ <%= booking.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> |
+
+ <% end %>
+ <% else %>
+ There is no data for search.... |
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/transactions/bookings/index.json.jbuilder b/app/views/transactions/bookings/index.json.jbuilder
new file mode 100755
index 00000000..a67adc38
--- /dev/null
+++ b/app/views/transactions/bookings/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @transactions_sales, partial: 'transactions_sales/transactions_sale', as: :transactions_sale
diff --git a/app/views/transactions/bookings/indexback.html.erb b/app/views/transactions/bookings/indexback.html.erb
new file mode 100755
index 00000000..fe8c820a
--- /dev/null
+++ b/app/views/transactions/bookings/indexback.html.erb
@@ -0,0 +1,59 @@
+<%= notice %>
+
+<%= t("views.right_panel.header.transactions_sales") %>
+
+
+
+
+ | <%= t :cashier %> |
+ <%= t :cashier %> <%= t("views.right_panel.detail.name_txt2") %> |
+ <%= t("views.right_panel.detail.requested_by") %> |
+ <%= t("views.right_panel.detail.requested_at") %> |
+ <%= t("views.right_panel.detail.receipt_no") %> |
+ <%= t("views.right_panel.detail.receipt_date") %> |
+ <%= t :customer %> |
+ <%= t("views.right_panel.detail.payment_status") %> |
+ <%= t("views.right_panel.detail.sale_status") %> |
+ <%= t("views.right_panel.detail.total_amount") %> |
+ <%= t("views.right_panel.detail.total_discount") %> |
+ <%= t("views.right_panel.detail.total_tax") %> |
+ <%= t("views.right_panel.detail.tax_type") %> |
+ <%= t("views.right_panel.detail.grand_total") %> |
+ <%= t("views.right_panel.detail.rnd_adj") %> |
+ <%= t("views.right_panel.detail.amt_received") %> |
+ <%= t("views.right_panel.detail.amt_changed") %> |
+ |
+
+
+
+
+ <% @transactions_sales.each do |transactions_sale| %>
+
+ | <%= transactions_sale.cashier %> |
+ <%= transactions_sale.cashier_name %> |
+ <%= transactions_sale.requested_by %> |
+ <%= transactions_sale.requested_at %> |
+ <%= transactions_sale.receipt_no %> |
+ <%= transactions_sale.receipt_date %> |
+ <%= transactions_sale.customer %> |
+ <%= transactions_sale.payment_status %> |
+ <%= transactions_sale.sale_status %> |
+ <%= transactions_sale.total_amount %> |
+ <%= transactions_sale.total_discount %> |
+ <%= transactions_sale.total_tax %> |
+ <%= transactions_sale.tax_type %> |
+ <%= transactions_sale.grand_total %> |
+ <%= transactions_sale.rounding_adjustment %> |
+ <%= transactions_sale.amount_received %> |
+ <%= transactions_sale.amount_changed %> |
+ <%= link_to t("views.btn.show"), transactions_sale %> |
+ <%= link_to t("views.btn.edit"), edit_transactions_sale_path(transactions_sale) %> |
+ <%= link_to t("views.btn.delete"), transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+ <% end %>
+
+
+
+
+
+<%= link_to 'New Transactions Sale', new_transactions_sale_path %>
diff --git a/app/views/transactions/bookings/show.html.erb b/app/views/transactions/bookings/show.html.erb
new file mode 100755
index 00000000..06668d5e
--- /dev/null
+++ b/app/views/transactions/bookings/show.html.erb
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | <%= t("views.right_panel.detail.booking_id") %> |
+ <%= t("views.right_panel.detail.sale_id") %> |
+ <%= t("views.right_panel.detail.table") %> |
+ <%= t("views.right_panel.detail.checkin_time") %> |
+ <%= t("views.right_panel.detail.checkout_time") %> |
+ <%= t("views.right_panel.detail.checkin_by") %> |
+ <%= t("views.right_panel.detail.checkout_by") %> |
+ <%= t("views.right_panel.detail.booking_status") %> |
+ <%= t("views.right_panel.detail.booking_date") %> |
+
+
+
+
+
+ | <%= @booking.booking_id%> |
+ <%= link_to @booking.sale_id, transactions_sale_path(booking.sale_id) rescue '-' %> |
+ <%= @booking.dining_facility.name %> |
+ <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> |
+ <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") rescue '-' %> |
+ <%= @booking.checkin_by rescue '-' %> |
+ <%= @booking.checkout_by rescue '-' %> |
+ <%= @booking.booking_status %> |
+ <%= @booking.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> |
+
+
+
+
+
+
+
+
+
+
+
+ | <%= t("views.right_panel.detail.order_id") %> |
+ <%= t("views.right_panel.header.menu_item") %> |
+ <%= t("views.right_panel.detail.qty") %> |
+ <%= t("views.right_panel.detail.unit_price") %> |
+ <%= t("views.right_panel.detail.option") %> |
+ <%= t("views.right_panel.detail.status") %> |
+ <%= t("views.right_panel.detail.waiter") %> |
+ <%= t("views.right_panel.detail.created_at") %> |
+
+
+
+
+ <% @order_items.each do |order_item| %>
+
+ | <%= link_to order_item.order_id, transactions_order_path(order_item.order_id) %><%= %> |
+ <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.price %> |
+ <%= order_item.options %> |
+ <%= order_item.order_item_status %> |
+ <%= order_item.item_order_by %> |
+ <%= order_item.created_at.strftime("%d-%m-%y %I:%M %p") %> |
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+ | <%= t("views.right_panel.detail.sale_id") %> |
+ <%= t("views.right_panel.detail.receipt_no") %> |
+ <%= t("views.right_panel.detail.total_discount") %> |
+ <%= t("views.right_panel.detail.tax_amount") %> |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= t("views.right_panel.detail.grand_total") %> |
+ <%= t :cashier %> |
+ <%= t("views.right_panel.detail.sales_status") %> |
+ <%= t("views.right_panel.detail.receipt_date") %> |
+
+
+
+
+ <% if @sale %>
+
+ | <%= link_to @sale.sale_id, transactions_sale_path(@sale) %> |
+ <%= @sale.receipt_no %> |
+ <%= @sale.total_discount %> |
+ <%= @sale.total_tax %> |
+ <%= @sale.total_amount %> |
+ <%= @sale.grand_total rescue '-' %> |
+ <%= @sale.cashier_name rescue '-' %> |
+ <%= @sale.sale_status %> |
+ <%= @sale.receipt_date.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> |
+
+ <% else %>
+ There is no data .... |
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/transactions/bookings/show.json.jbuilder b/app/views/transactions/bookings/show.json.jbuilder
new file mode 100755
index 00000000..48c70528
--- /dev/null
+++ b/app/views/transactions/bookings/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "transactions_sales/transactions_sale", transactions_sale: @transactions_sale
diff --git a/app/views/transactions/sales/_form.html.erb b/app/views/transactions/sales/_form.html.erb
deleted file mode 100755
index e83e3202..00000000
--- a/app/views/transactions/sales/_form.html.erb
+++ /dev/null
@@ -1,27 +0,0 @@
-<%= simple_form_for(@transactions_sale) do |f| %>
- <%= f.error_notification %>
-
-
- <%= f.association :cashier %>
- <%= f.input :cashier_name %>
- <%= f.input :requested_by %>
- <%= f.input :requested_at %>
- <%= f.input :receipt_no %>
- <%= f.input :receipt_date %>
- <%= f.association :customer %>
- <%= f.input :payment_status %>
- <%= f.input :sale_status %>
- <%= f.input :total_amount %>
- <%= f.input :total_discount %>
- <%= f.input :total_tax %>
- <%= f.input :tax_type %>
- <%= f.input :grand_total %>
- <%= f.input :rounding_adjustment %>
- <%= f.input :amount_received %>
- <%= f.input :amount_changed %>
-
-
-
- <%= f.button :submit %>
-
-<% end %>
diff --git a/app/views/transactions/sales/_transactions_sale.json.jbuilder b/app/views/transactions/sales/_transactions_sale.json.jbuilder
deleted file mode 100755
index 869b3cf7..00000000
--- a/app/views/transactions/sales/_transactions_sale.json.jbuilder
+++ /dev/null
@@ -1,2 +0,0 @@
-json.extract! transactions_sale, :id, :cashier_id, :cashier_name, :requested_by, :requested_at, :receipt_no, :receipt_date, :customer_id, :payment_status, :sale_status, :total_amount, :total_discount, :total_tax, :tax_type, :grand_total, :rounding_adjustment, :amount_received, :amount_changed, :created_at, :updated_at
-json.url transactions_sale_url(transactions_sale, format: :json)
diff --git a/app/views/transactions/sales/edit.html.erb b/app/views/transactions/sales/edit.html.erb
deleted file mode 100755
index eb3fe12a..00000000
--- a/app/views/transactions/sales/edit.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-Editing Transactions Sale
-
-<%= render 'form', transactions_sale: @transactions_sale %>
-
-<%= link_to t("views.btn.show"), @transactions_sale %> |
-<%= link_to 'Back', transactions_sales_path %>
diff --git a/app/views/transactions/sales/new.html.erb b/app/views/transactions/sales/new.html.erb
deleted file mode 100755
index 1f479747..00000000
--- a/app/views/transactions/sales/new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-New Transactions Sale
-
-<%= render 'form', transactions_sale: @transactions_sale %>
-
-<%= link_to 'Back', transactions_sales_path %>
diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb
index 69757c0d..bd6ce960 100755
--- a/app/views/transactions/sales/show.html.erb
+++ b/app/views/transactions/sales/show.html.erb
@@ -142,7 +142,7 @@
<% @order_items.each do |order_item| %>
- | <%= order_item.order_id %> |
+ <%= link_to order_item.order_id, transactions_order_path(order_item.order_id) %><%= %> |
<%= order_item.item_name %> |
<%= order_item.qty %> |
<%= order_item.price %> |
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a63c5d78..907da5f9 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -63,6 +63,7 @@ en:
customer_details: "Customer Details"
order_details: "Order Details"
sale_details: "Sale Details"
+ booking_details: "Booking Details"
inventory_definitions: "Inventory Definitions"
sale_audits: "Sale Audits"
diff --git a/config/locales/mm.yml b/config/locales/mm.yml
index b17ba8de..097b1861 100755
--- a/config/locales/mm.yml
+++ b/config/locales/mm.yml
@@ -63,6 +63,7 @@ mm:
customer_details: "စားသုံးသူကိုယ်ရေးအသေးစိတ်"
order_details: "မှာကြားမှုအသေးစိတ်"
sale_details: "ရောင်းရငွေအသေးစိတ်"
+ booking_details: "ရောင်းရငွေအသေးစိတ်"
inventory_definitions: "ကုန်လှောင်ရုံပစ္စည်းဖွင့်ဆိုချက်များ"
sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ"
diff --git a/config/routes.rb b/config/routes.rb
index 86556491..64f68262 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -335,6 +335,7 @@ scope "(:locale)", locale: /en|mm/ do
resources :sales
resources :orders
resources :credit_notes
+ resources :bookings
get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale"
get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"