diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 109d154e..629b2542 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 @@ -52,7 +51,7 @@ $(document).ready(function() { $('.datepicker').bootstrapMaterialDatePicker({ format: 'DD-MM-YYYY', - clearButton: false, + clearButton: true, weekStart: 1, time: false }); @@ -343,6 +342,7 @@ $(document).ready(function(){ } }); }); + }); diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 44ddd60e..d5ea194f 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -6,7 +6,9 @@ class Origami::DiscountsController < BaseOrigamiController sale_id = params[:id] if Sale.exists?(sale_id) @sale_data = Sale.find(sale_id) + @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) end + @member_discount = MembershipSetting.find_by_discount(1) @accounts = Account.all end diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index c402782d..c7e20ba6 100755 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -5,6 +5,7 @@ class Origami::OtherChargesController < BaseOrigamiController sale_id = params[:sale_id] if Sale.exists?(sale_id) @sale_data = Sale.find(sale_id) + @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) end end diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb new file mode 100644 index 00000000..b826cd52 --- /dev/null +++ b/app/controllers/transactions/bookings_controller.rb @@ -0,0 +1,59 @@ +class Transactions::BookingsController < ApplicationController + load_and_authorize_resource except: [:create] + before_action :set_transactions_booking, only: [:show, :edit, :update, :destroy] + + def index + + filter = params[:filter] + from = params[:from] + to = params[:to] + + if filter.nil? && from.nil? && to.nil? + @bookings = Booking.all.order("sale_id desc") + @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2) + else + sale = Sale.search(filter,from,to) + if sale.count > 0 + @bookings = sale + @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2) + else + @bookings = 0 + end + end + + 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/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 900f7442..8fa1b640 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -62,7 +62,7 @@ 0.00 - + diff --git a/app/views/origami/credit_payments/index.html.erb b/app/views/origami/credit_payments/index.html.erb index 963ec9f6..a913f579 100755 --- a/app/views/origami/credit_payments/index.html.erb +++ b/app/views/origami/credit_payments/index.html.erb @@ -112,7 +112,7 @@
- +
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 3c40c8ed..07185c7e 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -1,15 +1,14 @@
- +
-->
@@ -101,7 +100,7 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> @@ -113,14 +112,14 @@ <%= f.hidden_field :id, :class => "form-control col-md-6 " %>

- - <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%> - - <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%> - - <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%> - - <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr"%> + + <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs"%> + + <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss"%> + + <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm"%>
"> @@ -238,7 +237,10 @@
<%end%>
- + +
+ +
diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index a2fbaafb..23b83054 100755 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -13,6 +13,8 @@
+ +

Receipt No: <%=@sale_data.receipt_no rescue ' '%>

@@ -209,7 +211,7 @@
- + @@ -225,6 +227,19 @@ \ No newline at end of file diff --git a/app/views/origami/surveys/index.html.erb b/app/views/origami/surveys/index.html.erb index f61caefb..915bf20a 100755 --- a/app/views/origami/surveys/index.html.erb +++ b/app/views/origami/surveys/index.html.erb @@ -9,7 +9,7 @@
-
+
@@ -70,5 +70,22 @@ +
+ +
+ \ No newline at end of file diff --git a/app/views/origami/surveys/new.html.erb b/app/views/origami/surveys/new.html.erb index db1f68c0..bee0f843 100755 --- a/app/views/origami/surveys/new.html.erb +++ b/app/views/origami/surveys/new.html.erb @@ -1,4 +1,4 @@ -
- +
diff --git a/app/views/reports/shiftsale/index.html.erb b/app/views/reports/shiftsale/index.html.erb index 54b63caa..d8d814b8 100755 --- a/app/views/reports/shiftsale/index.html.erb +++ b/app/views/reports/shiftsale/index.html.erb @@ -145,6 +145,7 @@ // OK button is clicked $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ + console.log(date); $('#from').val(date.format("DD-MM-YYYY")) search_by_date(); }); diff --git a/app/views/transactions/bookings/index.html.erb b/app/views/transactions/bookings/index.html.erb new file mode 100755 index 00000000..997d18b5 --- /dev/null +++ b/app/views/transactions/bookings/index.html.erb @@ -0,0 +1,95 @@ + +
+
+
+
+
+ + + + + +
+ <%= form_tag transactions_orders_path, :method => :get do %> +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ <% end %> +
+
+
+
+ + + + + + + + + + + + + + + + + <% if @bookings != 0 %> + <% @bookings.each do |booking| %> + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
<%= 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") %>
<%= 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") %>

There is no data for search....

+
+ <% if @bookings != 0 %> + <%= paginate @bookings %> + <% 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") %>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + <% @transactions_sales.each do |transactions_sale| %> + + + + + + + + + + + + + + + + + + + + + + + <% end %> + +
<%= 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_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?' } %>
+ +
+ +<%= 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") %>
+
+
+ +
+
+ + + + + + + + + + + + + + + + <% @order_items.each do |order_item| %> + + + + + + + + + + + <% end %> + +
<%= 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") %>
<%= 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") %>
+
+
+
+
+ + + + + + + + + + + + + + + + + <% if @sale %> + + + + + + + + + + + + <% else %> + + <% 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") %>
<%= 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") %>

There is no data ....

+
+
+
+
+
+ + + + + + 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/credit_notes/index.html.erb b/app/views/transactions/credit_notes/index.html.erb index 9f708d8e..ac706d90 100755 --- a/app/views/transactions/credit_notes/index.html.erb +++ b/app/views/transactions/credit_notes/index.html.erb @@ -100,7 +100,9 @@
- + <% if @sales != 0 %> + <%= paginate @sales %> + <% end %>
diff --git a/app/views/transactions/orders/index.html.erb b/app/views/transactions/orders/index.html.erb index 6f146034..d78b9fbf 100755 --- a/app/views/transactions/orders/index.html.erb +++ b/app/views/transactions/orders/index.html.erb @@ -73,7 +73,7 @@
- <%if !@order.nil?%> + <%if !@orders.nil?%> <%= paginate @orders %> <%end%>
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"