From bcd44db9a2cdd97f44ee9adbc5d81505ce061037 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 27 Jun 2017 11:35:36 +0630 Subject: [PATCH 1/5] multiple invoice void --- .idea/workspace.xml | 615 ++++++++++++++---- .../origami/table_invoices_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 8 + app/views/origami/home/index.html.erb | 1 + app/views/origami/home/show.html.erb | 33 +- app/views/origami/orders/show.html.erb | 2 +- app/views/origami/payments/show.html.erb | 22 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/sales/show.html.erb | 6 +- .../origami/table_invoices/show.html.erb | 19 +- dump.rdb | Bin 18261 -> 17895 bytes 11 files changed, 568 insertions(+), 142 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d3242d5..b5dfb1c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,16 +2,17 @@ - - - - - - - - - + + + + + + + + + + @@ -27,21 +28,73 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50,33 +103,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -85,8 +113,18 @@ - - + + + + + + + + + + + + @@ -97,6 +135,8 @@ origami + table_invoice + sale_id @@ -105,11 +145,17 @@ @@ -168,6 +214,264 @@ - @@ -672,38 +998,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -712,22 +1006,6 @@ - - - - - - - - - - - - - - - - @@ -760,16 +1038,27 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -781,34 +1070,124 @@ - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 32e0ef7f..4571ba87 100644 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -25,7 +25,7 @@ class Origami::TableInvoicesController < BaseOrigamiController else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != 'void' @sale_array.push(sale) end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index bea37a21..3515b010 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -9,6 +9,14 @@ class Origami::VoidController < BaseOrigamiController sale.sale_status = 'void' sale.save + bookings = sale.bookings + bookings.each do |booking| + orders = booking.orders + orders.each do |order| + # order.status = 'void' + end + end + table_avaliable = true table = sale.bookings[0].dining_facility table.bookings.each do |booking| diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 5888bb3e..cd451e68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..84f606f8 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> @@ -287,7 +288,7 @@ - + <% else %> @@ -474,23 +475,23 @@ $('#edit').on('click',function(){ window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }) - $('#void').on('click',function () { - var sure = confirm("Are you sure want to Void"); - if (sure == true) { - var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; - $.ajax({ - type: 'POST', - url: ajax_url, - success: function () { - window.location.href = '/origami/'; - } - }) - } else { +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').val(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { - } + } - }) +}) diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index d2c065a1..b386a86d 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cef27145..4d9089b5 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -11,7 +11,7 @@ Table No <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %> - Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> + Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> Customer : <%= @sale_data.customer.name%> @@ -244,7 +244,7 @@ - + @@ -354,6 +354,23 @@ $( document ).ready(function() { } }); +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').text(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { + + } +}); + }); function update_balance(){ @@ -369,4 +386,5 @@ function update_balance(){ var result = amount_due - total; $('#balance').text(result.toFixed(2)); } + diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..77b35a40 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index cd716052..8e660261 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> @@ -185,7 +185,9 @@
- + <% if @sale.sale_status != 'void' %> + + <% end %>
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index ee66f9a3..ade1f021 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -128,6 +128,7 @@
+
diff --git a/dump.rdb b/dump.rdb index acef6aa79d6c19cf0bb0d215a80225ad58500e81..989b20db9eb66d7ef6d034695caac9e1fa5f72fb 100644 GIT binary patch delta 1616 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 U7WB;Ep@yq_Ui&27bM}k>0awo~Z~y=R From df722de0e78decb5eb1e12563a946caf616a8a99 Mon Sep 17 00:00:00 2001 From: Nweni Date: Tue, 27 Jun 2017 14:02:44 +0630 Subject: [PATCH 2/5] billed --- app/controllers/api/bill_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index f7a4070d..4fdd0c35 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -19,7 +19,7 @@ class Api::BillController < Api::ApiController @sale_id = booking.sale_id end end - + elsif (params[:order_id]) @sale = Sale.new @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee) @@ -29,12 +29,7 @@ class Api::BillController < Api::ApiController @sale_items = SaleItem.where("sale_id=?",@sale_id) unique_code = "ReceiptBillPdf" - #shop detail - shop_details = Shop.find(1) - - customer= Customer.where('customer_id=' + @sale_data.customer_id) - # get member information - member_info = Customer.get_member_account(customer) + customer= Customer.find(@sale_data.customer_id) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) @@ -43,7 +38,7 @@ class Api::BillController < Api::ApiController item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts) end From ee651763b7403f0285d1405627791172d7662373 Mon Sep 17 00:00:00 2001 From: Min Zeya Phyo Date: Wed, 28 Jun 2017 10:34:42 +0630 Subject: [PATCH 3/5] shift close and payment journal --- app/assets/javascripts/cash_mgmt.coffee | 3 ++ app/assets/javascripts/origami/shifts.coffee | 3 ++ app/assets/stylesheets/cash_mgmt.scss | 3 ++ app/assets/stylesheets/origami/shifts.scss | 3 ++ app/controllers/home_controller.rb | 24 +++++++++++++- .../origami/cash_mgmt_controller.rb | 10 ++++++ app/controllers/origami/shifts_controller.rb | 13 ++++++++ app/forms/open_shift_form.rb | 16 +++++++++ app/helpers/cash_mgmt_helper.rb | 2 ++ app/helpers/origami/shifts_helper.rb | 2 ++ app/models/payment_journal.rb | 2 ++ app/models/shift_sale.rb | 25 ++++++++++++++ app/views/origami/cash_mgmt/create.html.erb | 2 ++ app/views/origami/cash_mgmt/index.html.erb | 2 ++ app/views/origami/cash_mgmt/new.html.erb | 2 ++ app/views/origami/shifts/edit.html.erb | 2 ++ app/views/origami/shifts/index.html.erb | 2 ++ app/views/origami/shifts/new.html.erb | 2 ++ app/views/origami/shifts/show.html.erb | 2 ++ config/routes.rb | 13 ++++++++ .../20170626191519_create_shift_sales.rb | 25 ++++++++++++++ .../20170627035218_create_payment_journals.rb | 15 +++++++++ db/scaffold_structure | 2 ++ spec/controllers/cash_mgmt_controller_spec.rb | 26 +++++++++++++++ .../origami/shifts_controller_spec.rb | 33 +++++++++++++++++++ spec/helpers/cash_mgmt_helper_spec.rb | 15 +++++++++ spec/helpers/origami/shifts_helper_spec.rb | 15 +++++++++ spec/models/payment_journal_spec.rb | 5 +++ spec/models/shift_sale_spec.rb | 5 +++ spec/views/cash_mgmt/create.html.erb_spec.rb | 5 +++ spec/views/cash_mgmt/index.html.erb_spec.rb | 5 +++ spec/views/cash_mgmt/new.html.erb_spec.rb | 5 +++ .../origami/shifts/edit.html.erb_spec.rb | 5 +++ .../origami/shifts/index.html.erb_spec.rb | 5 +++ .../views/origami/shifts/new.html.erb_spec.rb | 5 +++ .../origami/shifts/show.html.erb_spec.rb | 5 +++ 36 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/cash_mgmt.coffee create mode 100644 app/assets/javascripts/origami/shifts.coffee create mode 100644 app/assets/stylesheets/cash_mgmt.scss create mode 100644 app/assets/stylesheets/origami/shifts.scss create mode 100644 app/controllers/origami/cash_mgmt_controller.rb create mode 100644 app/controllers/origami/shifts_controller.rb create mode 100644 app/forms/open_shift_form.rb create mode 100644 app/helpers/cash_mgmt_helper.rb create mode 100644 app/helpers/origami/shifts_helper.rb create mode 100644 app/models/payment_journal.rb create mode 100644 app/models/shift_sale.rb create mode 100644 app/views/origami/cash_mgmt/create.html.erb create mode 100644 app/views/origami/cash_mgmt/index.html.erb create mode 100644 app/views/origami/cash_mgmt/new.html.erb create mode 100644 app/views/origami/shifts/edit.html.erb create mode 100644 app/views/origami/shifts/index.html.erb create mode 100644 app/views/origami/shifts/new.html.erb create mode 100644 app/views/origami/shifts/show.html.erb create mode 100644 db/migrate/20170626191519_create_shift_sales.rb create mode 100644 db/migrate/20170627035218_create_payment_journals.rb create mode 100644 spec/controllers/cash_mgmt_controller_spec.rb create mode 100644 spec/controllers/origami/shifts_controller_spec.rb create mode 100644 spec/helpers/cash_mgmt_helper_spec.rb create mode 100644 spec/helpers/origami/shifts_helper_spec.rb create mode 100644 spec/models/payment_journal_spec.rb create mode 100644 spec/models/shift_sale_spec.rb create mode 100644 spec/views/cash_mgmt/create.html.erb_spec.rb create mode 100644 spec/views/cash_mgmt/index.html.erb_spec.rb create mode 100644 spec/views/cash_mgmt/new.html.erb_spec.rb create mode 100644 spec/views/origami/shifts/edit.html.erb_spec.rb create mode 100644 spec/views/origami/shifts/index.html.erb_spec.rb create mode 100644 spec/views/origami/shifts/new.html.erb_spec.rb create mode 100644 spec/views/origami/shifts/show.html.erb_spec.rb diff --git a/app/assets/javascripts/cash_mgmt.coffee b/app/assets/javascripts/cash_mgmt.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/cash_mgmt.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/origami/shifts.coffee b/app/assets/javascripts/origami/shifts.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/origami/shifts.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/cash_mgmt.scss b/app/assets/stylesheets/cash_mgmt.scss new file mode 100644 index 00000000..dfec4c04 --- /dev/null +++ b/app/assets/stylesheets/cash_mgmt.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the cash_mgmt controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/origami/shifts.scss b/app/assets/stylesheets/origami/shifts.scss new file mode 100644 index 00000000..ee1b2c4e --- /dev/null +++ b/app/assets/stylesheets/origami/shifts.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the origami/shifts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1f93e6aa..e7e960ee 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -19,7 +19,8 @@ class HomeController < ApplicationController if @employee != nil session[:session_token] = @employee.token_session - redirect_to origami_root_path + route_by_role(@employee) + else render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!" end @@ -74,4 +75,25 @@ class HomeController < ApplicationController def settings_home_params params.require(:login_form).permit(:emp_id, :password) end + + def route_by_role(employee) + if employee.role == "administrator" + redirect_to dashboard_path + elsif employee.role == "cashier" + #check if cashier has existing open cashier + + # if !ShiftSale.current_open_shift(employee).nil? + # redirect_to origami_root_path + # else + redirect_to new_origami_shift_path + # end + elsif employee.role == "checker" + redirect_to oqs_root_path + elsif employee.role == "waiter" + redirect_to oqs_root_path + elsif employee.role == "crm" + redirect_to crm_root_path + + end + end end diff --git a/app/controllers/origami/cash_mgmt_controller.rb b/app/controllers/origami/cash_mgmt_controller.rb new file mode 100644 index 00000000..aaf55c1f --- /dev/null +++ b/app/controllers/origami/cash_mgmt_controller.rb @@ -0,0 +1,10 @@ +class Origami::CashMgmtController < ApplicationController + def index + end + + def new + end + + def create + end +end diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb new file mode 100644 index 00000000..4cd17cce --- /dev/null +++ b/app/controllers/origami/shifts_controller.rb @@ -0,0 +1,13 @@ +class Origami::ShiftsController < ApplicationController + def index + end + + def show + end + + def new + end + + def edit + end +end diff --git a/app/forms/open_shift_form.rb b/app/forms/open_shift_form.rb new file mode 100644 index 00000000..019e6f3e --- /dev/null +++ b/app/forms/open_shift_form.rb @@ -0,0 +1,16 @@ +class LoginForm + include ActiveModel::Model + include ActiveModel::Validations + + attr_accessor :float_amount + validates_presence_of :float_amount + + def persisted? + false + end + + def initialize(attributes={}) + super + end + +end diff --git a/app/helpers/cash_mgmt_helper.rb b/app/helpers/cash_mgmt_helper.rb new file mode 100644 index 00000000..5c1ad77b --- /dev/null +++ b/app/helpers/cash_mgmt_helper.rb @@ -0,0 +1,2 @@ +module CashMgmtHelper +end diff --git a/app/helpers/origami/shifts_helper.rb b/app/helpers/origami/shifts_helper.rb new file mode 100644 index 00000000..ae63824e --- /dev/null +++ b/app/helpers/origami/shifts_helper.rb @@ -0,0 +1,2 @@ +module Origami::ShiftsHelper +end diff --git a/app/models/payment_journal.rb b/app/models/payment_journal.rb new file mode 100644 index 00000000..237f9cd4 --- /dev/null +++ b/app/models/payment_journal.rb @@ -0,0 +1,2 @@ +class PaymentJournal < ApplicationRecord +end diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb new file mode 100644 index 00000000..97d7ab0e --- /dev/null +++ b/app/models/shift_sale.rb @@ -0,0 +1,25 @@ + +#Description +#total_revenue = sum of all sub-total from sales table +#total_discounts = sum of all discount (overall) from sales tables +#total_taxes = sum of all taxes from sales table (Service + Goverment Tax (commercial_taxes)) +#grand_total = total_revenue - total_discounts + total_taxes +#nett_sales = grand_total - commercial_taxes +#cash_sales = cash payment total revenue +#credit_sales = credit payment total revenue +#others_sales = [Sum of each of other payment type --- mpu, jcb, visa,master, rebate, vochure] +#commercial_taxes = Total Goverment tax due +#cash_in = Payment receive +#Cash_out = Payment issues for misc payments + +class ShiftSale < ApplicationRecord + belongs_to :cashier_terminal + belongs_to :employee + + def self.current_open_shift(current_user) + #if current_user + #find open shift where is open today and is not closed and login by current cashier + @shift = ShiftSale.where("cast(shift_started_at as date) = #{DateTime.now.to_date} and shift_started_at is null and employee_id = #{current_user.id}").limit(1) + #end + end +end diff --git a/app/views/origami/cash_mgmt/create.html.erb b/app/views/origami/cash_mgmt/create.html.erb new file mode 100644 index 00000000..1b4805a2 --- /dev/null +++ b/app/views/origami/cash_mgmt/create.html.erb @@ -0,0 +1,2 @@ +

CashMgmt#create

+

Find me in app/views/cash_mgmt/create.html.erb

diff --git a/app/views/origami/cash_mgmt/index.html.erb b/app/views/origami/cash_mgmt/index.html.erb new file mode 100644 index 00000000..1f64a3df --- /dev/null +++ b/app/views/origami/cash_mgmt/index.html.erb @@ -0,0 +1,2 @@ +

CashMgmt#index

+

Find me in app/views/cash_mgmt/index.html.erb

diff --git a/app/views/origami/cash_mgmt/new.html.erb b/app/views/origami/cash_mgmt/new.html.erb new file mode 100644 index 00000000..9f22e0c3 --- /dev/null +++ b/app/views/origami/cash_mgmt/new.html.erb @@ -0,0 +1,2 @@ +

CashMgmt#new

+

Find me in app/views/cash_mgmt/new.html.erb

diff --git a/app/views/origami/shifts/edit.html.erb b/app/views/origami/shifts/edit.html.erb new file mode 100644 index 00000000..26d96cb5 --- /dev/null +++ b/app/views/origami/shifts/edit.html.erb @@ -0,0 +1,2 @@ +

Origami::Shifts#edit

+

Find me in app/views/origami/shifts/edit.html.erb

diff --git a/app/views/origami/shifts/index.html.erb b/app/views/origami/shifts/index.html.erb new file mode 100644 index 00000000..ebec0301 --- /dev/null +++ b/app/views/origami/shifts/index.html.erb @@ -0,0 +1,2 @@ +

Origami::Shifts#index

+

Find me in app/views/origami/shifts/index.html.erb

diff --git a/app/views/origami/shifts/new.html.erb b/app/views/origami/shifts/new.html.erb new file mode 100644 index 00000000..4a216f69 --- /dev/null +++ b/app/views/origami/shifts/new.html.erb @@ -0,0 +1,2 @@ +

Origami::Shifts#new

+

Find me in app/views/origami/shifts/new.html.erb

diff --git a/app/views/origami/shifts/show.html.erb b/app/views/origami/shifts/show.html.erb new file mode 100644 index 00000000..189c3d62 --- /dev/null +++ b/app/views/origami/shifts/show.html.erb @@ -0,0 +1,2 @@ +

Origami::Shifts#show

+

Find me in app/views/origami/shifts/show.html.erb

diff --git a/config/routes.rb b/config/routes.rb index b6535034..36b23aea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -96,6 +96,19 @@ Rails.application.routes.draw do post "/:id/request_bills" => "request_bills#print",:as => "request_bill" ,:defaults => { :format => 'json' } get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' } + + #---------Shift ---------------# + resources :shifts, only: [:index, :show, :new, :create, :edit, :update] + #shift - index (open/close shift landing page) + #shift - show (sales summary display) + #shift - new (open shift) + #shift - edit (close shift) + + resources :cash_mgmt, only: [:new, :create] + #payment - accepting or expending money from cashier - [Cash Journal] + #payment - Incoming payments - [accept all payment types (cash, other payments (except rebate)) + #payment - Outing payments - Cash only [ *Misc expeness tracking] + #--------- Payment ------------# get 'sale/:sale_id/payment' => 'payments#show' diff --git a/db/migrate/20170626191519_create_shift_sales.rb b/db/migrate/20170626191519_create_shift_sales.rb new file mode 100644 index 00000000..762b4fc3 --- /dev/null +++ b/db/migrate/20170626191519_create_shift_sales.rb @@ -0,0 +1,25 @@ +class CreateShiftSales < ActiveRecord::Migration[5.1] + def change + create_table :shift_sales do |t| + t.references :cashier_terminal, foreign_key: true, :null => false + t.datetime :shift_started_at + t.datetime :shift_closed_at + t.references :employee, foreign_key: true #cashier + t.decimal :opening_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :closing_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_revenue, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_discounts, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_taxes, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :nett_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :credit_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.json :other_sales + t.decimal :commercial_taxes, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_in, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_out, :precision => 10, :scale => 2, :null => false, :default => 0.00 + + t.timestamps + end + end +end diff --git a/db/migrate/20170627035218_create_payment_journals.rb b/db/migrate/20170627035218_create_payment_journals.rb new file mode 100644 index 00000000..e7f4c903 --- /dev/null +++ b/db/migrate/20170627035218_create_payment_journals.rb @@ -0,0 +1,15 @@ +class CreatePaymentJournals < ActiveRecord::Migration[5.1] + def change + create_table :payment_journals do |t| + t.string :payment_references,:null => false + t.string :remark + t.decimal :credit_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :debit_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.string :payment_method,:null => false, :default => "CASH" + t.string :payment_status,:null => false, :default => "NEW" + t.string :payment_method_references + + t.timestamps + end + end +end diff --git a/db/scaffold_structure b/db/scaffold_structure index 064f62d4..cd8a52c0 100644 --- a/db/scaffold_structure +++ b/db/scaffold_structure @@ -22,3 +22,5 @@ rails generate scaffold_controller Setup/CashierTerminal name:string is_active:b rails generate scaffold_controller Settings/OrderQueueStation station_name:string is_active:boolean processing_items:json print_copy:boolean printer_name:string font_size:integer cut_per_item:boolean use_alternate_name:boolean created_by:string --no-migration rails generate scaffold_controller transactions/Sale cashier:references cashier_name:string requested_by:string requested_at:datetime receipt_no:string receipt_date:datetime customer:references payment_status:string sale_status:string total_amount:decimal total_discount:decimal total_tax:decimal tax_type:string grand_total:decimal rounding_adjustment:decimal amount_received:decimal amount_changed:decimal --no-migration + +rails g model shift_sale cashier_terminal:references shift_started_at:datetime shift_closed_at:datetime employee:references opening_balance:decimal closing_balance:decimal total_revenue:decimal total_discounts:decimal total_taxes:decimal grand_total:decimal nett_sales:decimal cash_sales:decimal credit_sales:decimal other_sales:decimal commercial_taxes:decimal cash_in:decimal cash_out:decimal diff --git a/spec/controllers/cash_mgmt_controller_spec.rb b/spec/controllers/cash_mgmt_controller_spec.rb new file mode 100644 index 00000000..0772e07e --- /dev/null +++ b/spec/controllers/cash_mgmt_controller_spec.rb @@ -0,0 +1,26 @@ +require 'rails_helper' + +RSpec.describe CashMgmtController, type: :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + + describe "GET #new" do + it "returns http success" do + get :new + expect(response).to have_http_status(:success) + end + end + + describe "GET #create" do + it "returns http success" do + get :create + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/controllers/origami/shifts_controller_spec.rb b/spec/controllers/origami/shifts_controller_spec.rb new file mode 100644 index 00000000..6bc402b9 --- /dev/null +++ b/spec/controllers/origami/shifts_controller_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +RSpec.describe Origami::ShiftsController, type: :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + + describe "GET #show" do + it "returns http success" do + get :show + expect(response).to have_http_status(:success) + end + end + + describe "GET #new" do + it "returns http success" do + get :new + expect(response).to have_http_status(:success) + end + end + + describe "GET #edit" do + it "returns http success" do + get :edit + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/helpers/cash_mgmt_helper_spec.rb b/spec/helpers/cash_mgmt_helper_spec.rb new file mode 100644 index 00000000..c1b99e8f --- /dev/null +++ b/spec/helpers/cash_mgmt_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the CashMgmtHelper. For example: +# +# describe CashMgmtHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe CashMgmtHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/origami/shifts_helper_spec.rb b/spec/helpers/origami/shifts_helper_spec.rb new file mode 100644 index 00000000..52cd53cc --- /dev/null +++ b/spec/helpers/origami/shifts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Origami::ShiftsHelper. For example: +# +# describe Origami::ShiftsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Origami::ShiftsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/payment_journal_spec.rb b/spec/models/payment_journal_spec.rb new file mode 100644 index 00000000..1d69ec1b --- /dev/null +++ b/spec/models/payment_journal_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PaymentJournal, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/shift_sale_spec.rb b/spec/models/shift_sale_spec.rb new file mode 100644 index 00000000..18b726dc --- /dev/null +++ b/spec/models/shift_sale_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ShiftSale, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/create.html.erb_spec.rb b/spec/views/cash_mgmt/create.html.erb_spec.rb new file mode 100644 index 00000000..99f19970 --- /dev/null +++ b/spec/views/cash_mgmt/create.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/create.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/index.html.erb_spec.rb b/spec/views/cash_mgmt/index.html.erb_spec.rb new file mode 100644 index 00000000..47aac0d1 --- /dev/null +++ b/spec/views/cash_mgmt/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/index.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/new.html.erb_spec.rb b/spec/views/cash_mgmt/new.html.erb_spec.rb new file mode 100644 index 00000000..75ceeb52 --- /dev/null +++ b/spec/views/cash_mgmt/new.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/new.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/edit.html.erb_spec.rb b/spec/views/origami/shifts/edit.html.erb_spec.rb new file mode 100644 index 00000000..3e38121f --- /dev/null +++ b/spec/views/origami/shifts/edit.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/edit.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/index.html.erb_spec.rb b/spec/views/origami/shifts/index.html.erb_spec.rb new file mode 100644 index 00000000..6a148d25 --- /dev/null +++ b/spec/views/origami/shifts/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/index.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/new.html.erb_spec.rb b/spec/views/origami/shifts/new.html.erb_spec.rb new file mode 100644 index 00000000..60e9a23c --- /dev/null +++ b/spec/views/origami/shifts/new.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/new.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/show.html.erb_spec.rb b/spec/views/origami/shifts/show.html.erb_spec.rb new file mode 100644 index 00000000..372203e3 --- /dev/null +++ b/spec/views/origami/shifts/show.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/show.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end From f01e1b1ce36288c0c01e3294d25cd800d295338f Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 28 Jun 2017 12:57:39 +0630 Subject: [PATCH 4/5] edit login --- app/controllers/home_controller.rb | 4 +- app/models/employee.rb | 4 ++ app/views/home/show.html.erb | 64 +++++++++++++++++++----------- 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1f93e6aa..8f36bd8f 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,7 +2,7 @@ class HomeController < ApplicationController skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy] def index - @employees = Employee.all.order("name asc") + @employees = Employee.all_emp_except_waiter.order("name asc") @login_form = LoginForm.new() end @@ -19,6 +19,8 @@ class HomeController < ApplicationController if @employee != nil session[:session_token] = @employee.token_session + #if cashier => already opening cahshier? + redirect_to origami_root_path else render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!" diff --git a/app/models/employee.rb b/app/models/employee.rb index 69eb3fae..1816c2e3 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -6,6 +6,10 @@ class Employee < ApplicationRecord validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true validates :password, numericality: true, length: {in: 3..9}, allow_blank: true + def self.all_emp_except_waiter + Employee.where('role!=?','waiter') + end + def self.collection Employee.select("id, name").map { |e| [e.name, e.id] } end diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb index 84b6f199..b9418d22 100644 --- a/app/views/home/show.html.erb +++ b/app/views/home/show.html.erb @@ -1,14 +1,24 @@ @@ -23,21 +33,29 @@ <%= f.input :password, label: "Access PIN", required: false, class: "form-control" %> -
- - - - - - - - - - - - - +
+
+
+
1
+
2
+
3
+
+
+
4
+
5
+
6
+
+
+
7
+
8
+
9
+
+
CLR
+
0
+
ENT
+
+
From 986655052a79081dd5e86e24be1a5858a4d21d86 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 28 Jun 2017 15:29:44 +0630 Subject: [PATCH 5/5] shift --- app/controllers/home_controller.rb | 18 +++---- app/controllers/origami/home_controller_bk.rb | 10 ++-- app/controllers/origami/shifts_controller.rb | 10 +++- app/models/sale.rb | 1 - app/models/sale_payment.rb | 4 ++ app/models/shift_sale.rb | 28 ++++++++++- app/views/origami/shifts/create.json.jbuilder | 1 + app/views/origami/shifts/new.html.erb | 48 ++++++++++++++++++- config/routes.rb | 2 +- 9 files changed, 100 insertions(+), 22 deletions(-) create mode 100644 app/views/origami/shifts/create.json.jbuilder diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 84d72f66..0700ce0b 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -19,10 +19,6 @@ class HomeController < ApplicationController if @employee != nil session[:session_token] = @employee.token_session - - #if cashier => already opening cahshier? - - redirect_to origami_root_path route_by_role(@employee) else render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!" @@ -41,7 +37,7 @@ class HomeController < ApplicationController redirect_to dashboard_path elsif @employee.role == "cashier" session[:session_token] = @employee.token_session - redirect_to origami_root_path + route_by_role(@employee) elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path @@ -84,13 +80,13 @@ class HomeController < ApplicationController redirect_to dashboard_path elsif employee.role == "cashier" #check if cashier has existing open cashier - - # if !ShiftSale.current_open_shift(employee).nil? - # redirect_to origami_root_path - # else + shift = ShiftSale.current_open_shift(employee) + if !shift.nil? + redirect_to origami_root_path + else redirect_to new_origami_shift_path - # end - elsif employee.role == "checker" + end + elsif employee.role == "manager" redirect_to oqs_root_path elsif employee.role == "waiter" redirect_to oqs_root_path diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb index 1aca9b2d..5496cca5 100644 --- a/app/controllers/origami/home_controller_bk.rb +++ b/app/controllers/origami/home_controller_bk.rb @@ -19,9 +19,9 @@ class Origami::HomeController < BaseOrigamiController @orders = Order.get_orders() end - def item_show - selection(params[:booking_id],1) - end + # def item_show + # selection(params[:booking_id],1) + # end def selection(selected_id, is_ajax) str = [] @@ -37,8 +37,8 @@ class Origami::HomeController < BaseOrigamiController @order_details = OrderItem.get_order_items_details(params[:booking_id]) @order_details.each do |ord_detail| str.push(ord_detail) - end - end + end + end if is_ajax == 1 render :json => str.to_json diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 4cd17cce..b20c4d7b 100644 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -1,4 +1,5 @@ -class Origami::ShiftsController < ApplicationController +class Origami::ShiftsController < BaseOrigamiController + def index end @@ -6,6 +7,13 @@ class Origami::ShiftsController < ApplicationController end def new + @float = Lookup.where('lookup_type=?','float') + end + + def create + opening_balance = params[:opening_balance] + @shift = ShiftSale.new + @shift.create(opening_balance,current_user) end def edit diff --git a/app/models/sale.rb b/app/models/sale.rb index 8f7f17d8..cac1308b 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -263,7 +263,6 @@ class Sale < ApplicationRecord end - private def product_get_unit_price(item_code) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 8b28c946..7f39aa18 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -247,6 +247,10 @@ class SalePayment < ApplicationRecord end self.sale.sale_status = "completed" self.sale.save! + shift = ShiftSale.current_open_shift(self.sale.cashier_id) + if shift + shift.update(self.sale) + end table_update_status(sObj) rebat(sObj) end diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index 97d7ab0e..ea7f1132 100644 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -19,7 +19,33 @@ class ShiftSale < ApplicationRecord def self.current_open_shift(current_user) #if current_user #find open shift where is open today and is not closed and login by current cashier - @shift = ShiftSale.where("cast(shift_started_at as date) = #{DateTime.now.to_date} and shift_started_at is null and employee_id = #{current_user.id}").limit(1) + today_date = DateTime.now.strftime("%Y-%m-%d") + shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user.id}",today_date).take + + return shift #end end + + def create(opening_balance,current_user) + self.cashier_terminal_id = CashierTerminal.first.id + self.shift_started_at = DateTime.now + self.employee_id = current_user.id + self.opening_balance = opening_balance + self.save + end + + def update(sale) + saleobj = Sale.find(sale) + self.total_revenue = self.total_revenue + saleobj.total_amount + self.total_discounts = self.total_discounts + saleobj.total_discount + self.total_taxes = self.total_taxes + saleobj.total_tax + self.grand_total = self.grand_total + saleobj.grand_total + # self.nett_sales = + # self.cash_sales = + # self.credit_sales = + # self.other_sales = + # self.commercial_taxes = + self.save + + end end diff --git a/app/views/origami/shifts/create.json.jbuilder b/app/views/origami/shifts/create.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/shifts/create.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/shifts/new.html.erb b/app/views/origami/shifts/new.html.erb index 4a216f69..16c2aa10 100644 --- a/app/views/origami/shifts/new.html.erb +++ b/app/views/origami/shifts/new.html.erb @@ -1,2 +1,46 @@ -

Origami::Shifts#new

-

Find me in app/views/origami/shifts/new.html.erb

+

Open Cashier

+
+
+
+ + <% @float.each do |float| %> + + + + + <% end %> + + + + +
<%= float.name %>
Total
+
+
+
+ +
+
+
+
+ diff --git a/config/routes.rb b/config/routes.rb index 36b23aea..cbd6b878 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,7 +89,7 @@ Rails.application.routes.draw do get 'room/:room_id' => 'rooms#show' get 'order/:order_id' => "orders#show" - post '/:booking_id' => 'home#item_show' + # post '/:booking_id' => 'home#item_show' get "/:id/discount" => "discounts#index" post "/:id/discount" => "discounts#create"