diff --git a/.gitignore b/.gitignore index 5dafee53..3d6c48d5 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ dump.rdb # Fonts public/fonts/* + +# Ruby-Mine IDE folder +.idea diff --git a/.idea/.generators b/.idea/.generators index 16189766..d2c02fb2 100644 --- a/.idea/.generators +++ b/.idea/.generators @@ -5,4 +5,4 @@ You are allowed to: 2. Remove generators 3. Add installed generators To add new installed generators automatically delete this file and reload the project. ---> +--> diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks index 3577d8ad..bc783dc5 100644 --- a/.idea/.rakeTasks +++ b/.idea/.rakeTasks @@ -4,4 +4,4 @@ You are allowed to: 1. Remove rake task 2. Add existing rake tasks To add existing rake tasks automatically delete this file and reload the project. ---> +--> diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml index 586fd380..169f839c 100644 --- a/.idea/sxrestaurant.iml +++ b/.idea/sxrestaurant.iml @@ -124,14 +124,14 @@ - - - - - - - - + + + + + + + + @@ -142,6 +142,7 @@ + @@ -150,7 +151,7 @@ - + @@ -160,7 +161,7 @@ - + @@ -175,7 +176,7 @@ - + @@ -190,10 +191,10 @@ - + - + @@ -228,6 +229,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 34b4f3b1..4cdbe61f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -18,141 +39,101 @@ - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -165,6 +146,7 @@ origami table_invoice sale_id + oqs @@ -184,6 +166,11 @@ @@ -194,15 +181,16 @@ DEFINITION_ORDER + - + @@ -217,355 +205,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -578,6 +217,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -585,6 +351,7 @@ + - - + - + - - + + + @@ -948,11 +717,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -960,7 +777,6 @@ - @@ -968,7 +784,6 @@ - @@ -976,7 +791,6 @@ - @@ -984,7 +798,6 @@ - @@ -992,7 +805,6 @@ - @@ -1000,15 +812,6 @@ - - - - - - - - - @@ -1030,7 +833,6 @@ - @@ -1038,7 +840,6 @@ - @@ -1046,7 +847,6 @@ - @@ -1054,7 +854,6 @@ - @@ -1062,7 +861,6 @@ - @@ -1070,7 +868,6 @@ - @@ -1078,7 +875,6 @@ - @@ -1086,7 +882,6 @@ - @@ -1094,7 +889,6 @@ - @@ -1102,7 +896,6 @@ - @@ -1110,15 +903,6 @@ - - - - - - - - - @@ -1126,7 +910,6 @@ - @@ -1134,7 +917,6 @@ - @@ -1142,7 +924,6 @@ - @@ -1150,110 +931,185 @@ - - - - + + - - - + + - - - - - + + - - - + + - + - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index a9bdcc2b..7eda6084 100644 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -22,10 +22,50 @@ class Origami::VoucherController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + sale_id = params[:refnumber] if(Sale.exists?(sale_id)) - saleObj = Sale.find(sale_id) - sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher") + customer_data= Customer.find_by_customer_id(sale_data.customer_id) + if customer_data + membership_id = customer_data.membership_id + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") + if membership_setting.gateway_url + member_actions =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here + if member_actions.gateway_url + campaign_type_id = member_actions.additional_parameter["campaign_type_id"] + url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s + merchant_uid= member_actions.merchant_account_id + auth_token = member_actions.auth_token.to_s + # membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) + # if membership_data["status"]==true + begin + response = HTTParty.get(url, + :body => { app_token: token,membership_id:membership_id, + campaign_type_id:campaign_type_id,merchant_uid:merchant_uid, + auth_token:auth_token + }.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + + rescue OpenURI::HTTPError + response = { status: false} + + rescue SocketError + response = { status: false} + end + # end + end + end + end + if( response["status"]==true ) + saleObj = Sale.find(sale_id) + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher") + end end end diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index 8efb9dd5..5bf654ef 100644 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def print_setting_params - params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) + params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) end end diff --git a/app/controllers/settings/dining_charges_controller.rb b/app/controllers/settings/dining_charges_controller.rb index 6de504bf..31763b02 100644 --- a/app/controllers/settings/dining_charges_controller.rb +++ b/app/controllers/settings/dining_charges_controller.rb @@ -16,6 +16,9 @@ class Settings::DiningChargesController < ApplicationController # GET /dining_charges/new def new @dining_charge = DiningCharge.new + @dining_charge.minimum_free_time="00:30" + @dining_charge.charge_block="02:00" + @dining_charge.time_rounding_block="00:15" end # GET /dining_charges/1/edit @@ -29,7 +32,11 @@ class Settings::DiningChargesController < ApplicationController @dining_charge.dining_facility_id = @settings_dining_facility.id respond_to do |format| if @dining_charge.save - format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + if @table + format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + else + format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + end format.json { render :show, status: :created, location: @dining_charge } else format.html { render :new } @@ -44,7 +51,11 @@ class Settings::DiningChargesController < ApplicationController respond_to do |format| @dining_charge.dining_facility_id = @settings_dining_facility.id if @dining_charge.update(dining_charge_params) - format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + if @table + format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + else + format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + end format.json { render :show, status: :ok, location: @dining_charge } else format.html { render :edit } diff --git a/app/models/ability.rb b/app/models/ability.rb index 1938fb45..6965ab05 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -4,135 +4,135 @@ class Ability def initialize(user) user ||= Employee.new - if user.role == "administrator" + if user.role == 'administrator' - can :manage, :all + can :manage, :all - elsif user.role == "manager" + elsif user.role == 'manager' - can :manage, Menu - can :manage, MenuCategory - can :manage, MenuItemAttribute - can :manage, MenuItemInstance - can :manage, MenuItemOption - can :manage, SetMenuItem - can :manage, OrderQueueStation - can :manage, Zone - can :manage, CashierTerminal - can :manage, Employee - # can :manage, MembershipSetting - # can :manage, MembershipAction - # can :manage, PaymentMethodSetting - can :manage, TaxProfile - can :manage, PrintSetting - can :manage, Account + can :manage, Menu + can :manage, MenuCategory + can :manage, MenuItemAttribute + can :manage, MenuItemInstance + can :manage, MenuItemOption + can :manage, SetMenuItem + can :manage, OrderQueueStation + can :manage, Zone + can :manage, CashierTerminal + can :manage, Employee + # can :manage, MembershipSetting + # can :manage, MembershipAction + # can :manage, PaymentMethodSetting + can :manage, TaxProfile + can :manage, PrintSetting + can :manage, Account - can :manage, Order - can :manage, Sale + can :manage, Order + can :manage, Sale - can :manage, Customer - can :manage, DiningQueue + can :manage, Customer + can :manage, DiningQueue - can :index, :dailysale - can :index, :saleitem - can :index, :receipt_no - can :index, :shiftsale - can :index, :credit_payment - can :index, :void_sale + can :index, :dailysale + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale - can :get_customer, Customer - can :add_customer, Customer - can :update_sale_by_customer, Customer + can :get_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer - can :index, :other_charge - can :create, :other_charge - can :index, :discount - can :create, :discount - can :remove_discount_items, :discount - can :remove_all_discount, :discount + can :index, :other_charge + can :create, :other_charge + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment + can :rounding_adj, :payment - can :move_dining, :movetable - can :moving, :movetable + can :move_dining, :movetable + can :moving, :movetable - can :move_dining, :moveroom + can :move_dining, :moveroom - can :edit, :sale_edit - can :item_void, :sale_edit - can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit - can :apply_void, :sale_edit + can :edit, :sale_edit + can :item_void, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit - can :overall_void, :void + can :overall_void, :void - elsif user.role == "cashier" - - # can :overall_void, :void + elsif user.role == 'cashier' - can :read, Order - can :update, Order - - can :read, Sale - can :update, Sale - can :get_customer, Customer - can :add_customer, Customer - can :update_sale_by_customer, Customer + # can :overall_void, :void - can :index, :other_charge - can :create, :other_charge - can :index, :discount - can :create, :discount - can :remove_discount_items, :discount - can :remove_all_discount, :discount - can :member_discount, :discount + can :read, Order + can :update, Order - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :read, Sale + can :update, Sale + can :get_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer - can :move_dining, :movetable - can :moving, :movetable + can :index, :other_charge + can :create, :other_charge + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount + can :member_discount, :discount - can :move_dining, :moveroom + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment + can :rounding_adj, :payment - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment + can :move_dining, :movetable + can :moving, :movetable - can :manage, DiningQueue - - elsif user.role == "account" + can :move_dining, :moveroom - can :index, :dailysale - can :index, :saleitem - can :index, :receipt_no - can :index, :shiftsale - can :index, :credit_payment - can :index, :void_sale + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment - elsif user.role == "supervisour" + can :manage, DiningQueue - can :edit, :sale_edit - can :item_void, :sale_edit - can :item_edit, :sale_edit - can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit - can :apply_void, :sale_edit - can :overall_void, :void + elsif user.role == 'account' - can :first_bill, :payment - can :create, :payment - can :show, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :index, :dailysale + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale + + elsif user.role == 'supervisour' + + can :edit, :sale_edit + can :item_void, :sale_edit + can :item_edit, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit + can :overall_void, :void + + can :first_bill, :payment + can :create, :payment + can :show, :payment + can :reprint, :payment + can :rounding_adj, :payment end end diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 4eadf007..133d9c48 100644 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -1,8 +1,8 @@ class CloseCashierPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width def initialize(printer_settings, shift_sale,shop_details,sale_taxes) - self.page_width = 210 - self.page_height = 7000 + self.page_width = PrintSetting.where("name = ?","Close Cashier").first.page_width + self.page_height = PrintSetting.where("name = ?","Close Cashier").first.page_height self.margin = 5 self.price_width = 40 self.qty_width = 20 diff --git a/app/pdf/crm_order_pdf.rb b/app/pdf/crm_order_pdf.rb index 55d08ecc..a7f85098 100644 --- a/app/pdf/crm_order_pdf.rb +++ b/app/pdf/crm_order_pdf.rb @@ -1,8 +1,8 @@ class CrmOrderPdf < Prawn::Document attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width def initialize(booking,order_items,printer_settings) - self.p_width = 200 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width + self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height self.margin = 10 # self.price_width = self.p_width / 2 self.price_width=80 diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 20a4537c..7b2e350b 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -2,8 +2,8 @@ class OrderItemPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order_item, print_status, options, alt_name) - self.page_width = 185 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","OrderItemPdf").first.page_width + self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 244fbdfa..902c68ad 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -2,8 +2,8 @@ class OrderSummaryPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order, print_status, order_items = nil,alt_name) - self.page_width = 190 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Order Summary").first.page_width + self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/pdf/queue_no_pdf.rb b/app/pdf/queue_no_pdf.rb index 0963f55e..cda410ca 100644 --- a/app/pdf/queue_no_pdf.rb +++ b/app/pdf/queue_no_pdf.rb @@ -1,8 +1,8 @@ class QueueNoPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(printer_settings, queue) - self.page_width = 210 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width + self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height self.margin = 5 self.price_width = 35 self.qty_width = 20 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 2dca6d16..3027fb60 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -2,8 +2,8 @@ class ReceiptBillPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status) - self.page_width = 210 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width + self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height self.margin = 5 self.price_width = 40 self.qty_width = 20 diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index c2074720..571360c3 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -1,47 +1,291 @@ -
-
+
+
- <% if current_login_employee.role = "admin" %> + <% if current_login_employee.role = "admin" %> - <% elsif current_login_employee.role = "cashier" %> - <%= link_to "Cashier Station", origami_path %> + <% elsif current_login_employee.role = "cashier" %> + <%= link_to "Cashier Station", origami_path %> - <% elsif current_login_employee = "account" %> - <%= link_to "Cashier Station", oishi_path %> + <% elsif current_login_employee = "account" %> + <%= link_to "Cashier Station", oishi_path %> - <% else %> - <%= link_to "Cashier Station", oishi_path %> + <% else %> + <%= link_to "Cashier Station", oishi_path %> - <% end %> - <% shop = Shop.first %> + <% end %> + <% shop = Shop.first %> - - - - -
+
-