diff --git a/Gemfile b/Gemfile index 9b04d035..8081f3b5 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'rails', '~> 5.1.0' # gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL - gem 'pg' +#gem 'pg' # redis server for cable # gem 'redis', '~> 3.0' @@ -92,4 +92,6 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -gem 'httparty', '~> 0.15.5' \ No newline at end of file +gem 'httparty', '~> 0.15.5' + +gem 'bootstrap-datepicker-rails' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 1f48bd93..1c2ad654 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -64,6 +64,8 @@ GEM bootstrap (4.0.0.alpha6) autoprefixer-rails (>= 6.0.3) sass (>= 3.4.19) + bootstrap-datepicker-rails (1.6.4.1) + railties (>= 3.0) builder (3.2.3) byebug (9.0.6) coffee-rails (4.2.2) @@ -243,6 +245,7 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) bootstrap (~> 4.0.0.alpha3) + bootstrap-datepicker-rails byebug coffee-rails (~> 4.2) cups (~> 0.0.7) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f7b2e2b0..f2ee34ba 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,3 +17,4 @@ //= require turbolinks //= require cable //= require settings/processing_items +//= require bootstrap-datepicker diff --git a/app/assets/javascripts/orgiami.js b/app/assets/javascripts/orgiami.js index fc91e269..cd8622c3 100644 --- a/app/assets/javascripts/orgiami.js +++ b/app/assets/javascripts/orgiami.js @@ -15,3 +15,88 @@ //= require jquery_ujs //= require turbolinks //= require cable + +$(document).ready(function(){ + $(".orders").on('click', function(){ + var zone_name=$(this).find(".orders-table").text(); + var receipt_no=$(this).find(".orders-receipt-no").text(); + var unique_id=$(this).find(".orders-id").text(); + + var cashier=""; + var receipt_date=""; + var sub_total=0; + var discount_amount=0; + var tax_amount=0; + var grand_total_amount=0; + + $("#order-title").text("ORDER DETAILS - " + zone_name); + // clear order items + $("#order-items-table").children("tbody").empty(); + + // AJAX call for order + $.ajax({ + type: "GET", + url: "origami/" + unique_id, + data: { 'id' : unique_id }, + success:function(result){ + for (i = 0; i < result.length; i++) { + var data = JSON.stringify(result[i]); + var parse_data = JSON.parse(data); + + // Receipt Header + receipt_no = result[i].receipt_no; + cashier = result[i].cashier_name; + receipt_date = result[i].receipt_date; + + $("#receipt_no").text(receipt_no); + $("#cashier").text(cashier==null?"":cashier); + $("#receipt_date").text(receipt_date); + + + //Receipt Charges + sub_total += (parse_data.qty*parse_data.price); + discount_amount = parse_data.discount_amount; + tax_amount = parse_data.tax_amount; + grand_total_amount = parse_data.grand_total_amount; + + $("#order-sub-total").text(sub_total); + $("#order-food").text(''); + $("#order-beverage").text(''); + $("#order-discount").text(discount_amount); + $("#order-Tax").text(tax_amount); + $("#order-grand-total").text(grand_total_amount); + + // Ordered Items + var order_items_rows = "" + + "" + parse_data.item_name + "" + + "" + parse_data.qty + "" + + "" + parse_data.qty*parse_data.price + "" + + ""; + + $("#order-items-table").children("tbody").append(order_items_rows); + } + } + }); + // End AJAX Call + + $('.orders').removeClass('selected-item'); + $(this).addClass('selected-item'); + }); + + // Bill Request + $('#request_bills').click(function() { + var order_id=$(".selected-item").find(".orders-id").text(); + window.location.href = '/origami/request_bills/'+ order_id + return false; + }); + + // Payment for Bill + $('#pay').click(function() { + var sale_id=$(".selected-item").find(".orders-id").text(); + window.location.href = '/origami/sale/'+ sale_id + "/payment" + return false; + }); +}); + + + diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 9456be10..d8101494 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -2,6 +2,7 @@ @import "bootstrap"; @import "font-awesome"; @import "theme"; +@import "bootstrap-datepicker3"; /* Show it is fixed to the top */ // body { diff --git a/app/assets/stylesheets/orgiami.scss b/app/assets/stylesheets/orgiami.scss index afefe4c7..d94bc702 100644 --- a/app/assets/stylesheets/orgiami.scss +++ b/app/assets/stylesheets/orgiami.scss @@ -19,13 +19,45 @@ color:white; cursor:pointer; } + .cashier_number:hover{ background:#A9F5F2; } + .long{ width:100% } +.sold { + background-color: red; +} + +.selected-item { + background-color: blue; +} + +/* Reciept Style */ +#order-charges-table td { + border-top: none !important; +} + +.charges-name { + width: 80%; + text-align: left; +} + +.item-name { + width: 60%; + text-align: left; +} + +.item-attr { + width: 20%; + text-align: right; +} + + +/* Colors */ .purple { background-color:#7a62d3; } diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 896d9d14..c25f6e80 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController # GET /crm/customers.json def index @crm_customers = Customer.all + @customers = Customer.new + @membership = Customer.get_member_group + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @crm_customers } + end end # GET /crm/customers/1 @@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController # GET /crm/customers/new def new @crm_customer = Customer.new - @membership = Customer.get_member_group + @membership = Customer.get_member_group() + end # GET /crm/customers/1/edit @@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController # POST /crm/customers # POST /crm/customers.json def create - @crm_customer = Customer.new(crm_customer_params) + @crm_customer = Customer.new(customer_params) respond_to do |format| if @crm_customer.save @@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController # PATCH/PUT /crm/customers/1.json def update respond_to do |format| - if @crm_customer.update(crm_customer_params) + if @crm_customer.update(customer_params) format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' } format.json { render :show, status: :ok, location: @crm_customer } else @@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController end # Never trust parameters from the scary internet, only allow the white list through. - def crm_customer_params - params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code) + def customer_params + params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code) end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 480e9204..9733e488 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -7,16 +7,18 @@ class Origami::HomeController < BaseOrigamiController def show str = [] + type=params[:id].split('-')[0]; - - if !params[:sale_id].nil? - @order_details = SaleItem.get_order_items_details(params[:sale_id]) + # Sale + if type == "SAL" + @order_details = SaleItem.get_order_items_details(params[:id]) @order_details.each do |ord_detail| str.push(ord_detail) end render :json => str.to_json + # Booking else - @order_details = OrderItem.get_order_items_details(params[:order_id]) + @order_details = OrderItem.get_order_items_details(params[:id]) @order_details.each do |ord_detail| str.push(ord_detail) end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 9ccce028..62289c89 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -1,29 +1,28 @@ class Origami::RequestBillsController < BaseOrigamiController - def show + def print @sale = Sale.new - + sale_order=SaleOrder.new booking_id = params[:id] check_booking = Booking.find_by_booking_id(booking_id) if check_booking.sale_id.nil? - #check if it doesn't exist - @status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name) - @sale_data = Sale.find_by_sale_id(check_booking.sale_id) - @sale_items = SaleItem.where("sale_id=?",check_booking.sale_id) + # Create Sale if it doesn't exist + @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name) + @sale_data = Sale.find_by_sale_id(@sale_id) + @sale_items = SaleItem.where("sale_id=?",@sale_id) else @sale_data = Sale.find_by_sale_id(check_booking.sale_id) - @sale_items = SaleItem.where("sale_id=?",check_booking.sale_id) + @sale_items = SaleItem.where("sale_id=?",@sale_id) end - unique_code="ReceiptBillPdf" + unique_code = "ReceiptBillPdf" + customer_name = Customer.select("name").where('customer_id=' + @sale_data.customer_id) print_settings=PrintSetting.find_by_unique_code(unique_code) - printer = Printer::ReceiptPrinter.new(print_settings) - - printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data) - + printer = Printer::ReceiptPrinter.new(print_settings) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name) + redirect_to origami_root_path end - end diff --git a/app/models/customer.rb b/app/models/customer.rb index 4bdc290a..95901cce 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -1,12 +1,29 @@ class Customer < ApplicationRecord - self.primary_key = "customer_id" + + #self.primary_key = :customer_id before_create :generate_custom_id has_many :orders has_many :sales - validates_presence_of :name, :contact_no + validates_presence_of :name, :contact_no, :email validates :contact_no, uniqueness: true + validates :email, uniqueness: true + + def self.get_member_group + + gateway_url = MembershipSetting.find_by_membership_type("smartpay_url") + url = gateway_url.gateway_url.to_s + "/api/get_all_member_group".to_s + response = HTTParty.get(url) + puts response.body, response.code, response.message, response.headers.inspect + + return response; + + end + +# http://192.168.1.47:3006/api/create_membership_customer +#get_all_member_group + def lastest_invoices sales.where(:customer_id => self.id).order("created_at desc").limit(5) diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb index 89967e2e..5f8b95cf 100644 --- a/app/models/menu_item.rb +++ b/app/models/menu_item.rb @@ -4,7 +4,7 @@ class MenuItem < ApplicationRecord has_many :menu_item_instances belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id" - belongs_to :account + belongs_to :account, :optional => true validates_presence_of :item_code, :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item diff --git a/app/models/order.rb b/app/models/order.rb index 29083ef3..4ddad631 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -218,17 +218,15 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.order_id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true) - .group("orders.order_id, order_items.id,dining_facilities.name") + .group("orders.order_id, order_items.order_items_id,dining_facilities.name") end - def self.get_booking_order_table booking_orders = Booking.select("sales.receipt_no,orders.status as order_status, - bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") + bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") - .joins("left join orders on orders.order_id = booking_orders.order_id") - .joins("left join sale_orders on sale_orders.order_id = orders.order_id") - .joins("left join sales on sales.sale_id = sale_orders.sale_id") + .joins("left join orders on orders.order_id = booking_orders.order_id") + .joins("left join sales on sales.sale_id = bookings.sale_id") .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") @@ -236,7 +234,8 @@ class Order < ApplicationRecord #Origami: Cashier : to view order type Room def self.get_booking_order_rooms - booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as room_name") + booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id, + sales.sale_id as sale_id,dining_facilities.name as room_name") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join orders on orders.order_id = booking_orders.order_id") @@ -249,7 +248,7 @@ class Order < ApplicationRecord #Origami: Cashier : to view order type Room def self.get_order_rooms order_rooms = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price, - order_items.id as order_items_id,dining_facilities.name as room_name") + order_items.id as order_items_id,dining_facilities.name as room_name") .joins("left join booking_orders on booking_orders.order_id = orders.order_id left join bookings on bookings.booking_id = booking_orders.order_id left join dining_facilities on dining_facilities.id = bookings.dining_facility_id @@ -263,7 +262,8 @@ class Order < ApplicationRecord def self.get_orders from = Time.now.beginning_of_day.utc to = Time.now.end_of_day.utc - orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") + orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, + bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") .joins("left join booking_orders on booking_orders.order_id = orders.order_id left join bookings on bookings.booking_id = booking_orders.order_id left join dining_facilities on dining_facilities.id = bookings.dining_facility_id @@ -271,7 +271,9 @@ class Order < ApplicationRecord left join sale_orders on sale_orders.order_id = orders.order_id left join sales on sales.sale_id = sale_orders.sale_id") .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) + .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id") + end private diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index 86d43190..d0819529 100644 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -64,12 +64,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker self.print(filename) end #Bill Receipt Print - def print_receipt_bill(printer_settings,sale_items,sale,sale_data) + def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name) #Use CUPS service #Generate PDF #Print - pdf = ReceiptBillPdf.new(printer_settings,sale_items,sale,sale_data) - pdf.render_file "tmp/receipt_bill.pdf" + pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name) + pdf.render_file "tmp/receipt_bill.pdf" self.print("tmp/receipt_bill.pdf") end end diff --git a/app/models/sale.rb b/app/models/sale.rb index bd7e5668..1a9c9a28 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -35,7 +35,7 @@ class Sale < ApplicationRecord order = booking.booking_orders.take.order puts "add sale order" link_order_sale(order.id) - return status + return status, sale_id end end @@ -76,7 +76,8 @@ class Sale < ApplicationRecord self.save! - #compute summary + + #compute sales summary compute #Update the order items that is billed @@ -218,6 +219,7 @@ class Sale < ApplicationRecord private + def product_get_unit_price(item_code) menu_item_hash =MenuItem.search_by_item_code(item_code) if (menu_instance_code) diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb index 52ab480b..1ebd1632 100644 --- a/app/models/sale_item.rb +++ b/app/models/sale_item.rb @@ -12,17 +12,22 @@ class SaleItem < ApplicationRecord def self.get_order_items_details(sale_id) - sale_orders = SaleOrder.where("sale_id=?",sale_id) - if sale_orders - sale_orders.each do |sale_order| - order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price") - .joins("left join sales on sales.id = sale_items.sale_id") - .where("sale_items.sale_id=?",sale_order.sale_id) - return order_details - end - else - return false - end + order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date, + sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price") + .joins("left join sales on sales.sale_id = sale_items.sale_id") + .where("sale_items.sale_id=?",sale_id) + + # sale_orders = SaleOrder.where("sale_id=?",sale_id) + # if sale_orders + # sale_orders.each do |sale_order| + # order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price") + # .joins("left join sales on sales.id = sale_items.sale_id") + # .where("sale_items.sale_id=?",sale_order.sale_id) + # return order_details + # end + # else + # return false + # end end private diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index ffce7da2..5853b946 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,6 +1,6 @@ class ReceiptBillPdf < 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(printer_settings, sale_items,sale, sale_data) + def initialize(printer_settings, sale_items, sale_data, customer_name) self.p_width = 200 self.page_height = 1450 self.margin = 10 @@ -19,11 +19,11 @@ class ReceiptBillPdf < Prawn::Document #setting page margin and width super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height]) self.header_font_size = 10 - self.item_font_size = 6 + self.item_font_size = 9 header( printer_settings.printer_name, printer_settings.name) stroke_horizontal_rule - cashier_info(sale.receipt_no,sale.customer, sale.receipt_date) + cashier_info(sale_data, customer_name) line_items(sale_items) all_total(sale_data) @@ -41,7 +41,7 @@ class ReceiptBillPdf < Prawn::Document end - def cashier_info(receipt_no, customer, receipt_date) + def cashier_info(sale_data, customer_name) move_down 5 move_down 2 y_position = cursor @@ -50,7 +50,7 @@ class ReceiptBillPdf < Prawn::Document end bounding_box([self.price_width, y_position], :width =>self.receipt_width) do - text "#{receipt_no}" , :size => self.item_font_size, :align => :left + text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left end move_down 5 @@ -59,7 +59,7 @@ class ReceiptBillPdf < Prawn::Document text "Customer:", :size => self.item_font_size,:align => :left end bounding_box([self.price_width,y_position], :width =>self.price_width) do - text "#{customer}" , :size => self.item_font_size,:align => :left + text "#{customer_name}" , :size => self.item_font_size,:align => :left end move_down 5 @@ -68,7 +68,7 @@ class ReceiptBillPdf < Prawn::Document text "Date:", :size => self.item_font_size,:align => :left end bounding_box([self.price_width,y_position], :width =>self.price_width) do - text "#{receipt_date}" , :size => self.item_font_size,:align => :left + text "#{sale_data.receipt_date.strftime('%Y %m %d %h:%m')}" , :size => self.item_font_size,:align => :left end # stroke_horizontal_rule move_down 5 @@ -139,7 +139,6 @@ class ReceiptBillPdf < Prawn::Document end def all_total(sale_data) - move_down 5 y_position =cursor diff --git a/app/views/api/bookings/show.json.jbuilder b/app/views/api/bookings/show.json.jbuilder index cbd1575a..27ec21b9 100644 --- a/app/views/api/bookings/show.json.jbuilder +++ b/app/views/api/bookings/show.json.jbuilder @@ -13,7 +13,6 @@ if (@booking) @total_amount = 0.00 @total_tax = 0.00 - @booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all; if @booking.booking_orders order_items = [] @booking.booking_orders.each do |bo| diff --git a/app/views/crm/customers/_form.html.erb b/app/views/crm/customers/_form.html.erb index 7c37a2fe..533710a9 100644 --- a/app/views/crm/customers/_form.html.erb +++ b/app/views/crm/customers/_form.html.erb @@ -8,7 +8,7 @@ <%= f.input :contact_no %> <%= f.input :email %> <%= f.input :date_of_birth %> - + <%= f.input :membership_id, :collection => @membership %> <%= f.input :membership_type %> <%= f.input :membership_authentication_code %> diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 5a29b74c..d866d47d 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -1,41 +1,110 @@ -

<%= notice %>

+
+
+ +
+
+
-

Crm Customers

+
+
+ +
+
+ + + + + + + + + + -
NameCompanyContact noEmail
- - - - - - - - - - - - - + + <% @crm_customers.each do |crm_customer| %> + + + + + + + + <% end %> + +
NameCompanyContact noEmailDate of birthMembershipMembership typeMembership authentication code
<%= crm_customer.name %><%= crm_customer.company %><%= crm_customer.contact_no %><%= crm_customer.email %>
+
+
- - <% @crm_customers.each do |crm_customer| %> - - <%= crm_customer.name %> - <%= crm_customer.company %> - <%= crm_customer.contact_no %> - <%= crm_customer.email %> - <%= crm_customer.date_of_birth %> - <%= crm_customer.membership_id %> - <%= crm_customer.membership_type %> - <%= crm_customer.membership_authentication_code %> - <%= link_to 'Show', crm_customer_path(crm_customer) %> - <%= link_to 'Edit', edit_crm_customer_path(crm_customer) %> - <%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %> - - <% end %> - - +
-
+
+ <%= simple_form_for crm_customers_path, :html => { :class => 'form-horizontal' } do |f| %> + +
+ <%= f.input :name, :class => "form-control col-md-6" %> +
+
+ <%= f.input :company, :class => "form-control col-md-6" %> +
+
+ <%= f.input :contact_no, :class => "form-control col-md-6" %> +
+
+ <%= f.input :email, :class => "form-control col-md-6" %> +
-<%= link_to 'New Crm Customer', new_crm_customer_path %> +
+ + <%= f.text_field :date_of_birth,:class=>"form-control datepicker",:readonly =>true, :value => @date_of_birth%> + +
+ +
+ <%= f.select :membership_id, options_for_select(@membership.collect { |member| + [member["id"].name.titleize, member["id"].id] }, 1), {}, { id: 'countries_select' } %> + +
+ + +
+ <%= f.input :membership_type, :class => "form-control col-md-6" %> +
+
+ <%= f.input :membership_authentication_code, :class => "form-control col-md-6" %> + +
+
+ <%= f.button :submit, "Submit", :class => 'btn btn-primary' , :id => 'submit_account' %> +
+ <%end%> +
+
+ + diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index 47d80f38..f2120cde 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -61,11 +61,8 @@

- + - <% end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 7a955a8d..a8301f52 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -1,6 +1,6 @@
+
- -
- +
+
- -
- - <% if @booking_orders %> - <% @booking_orders.each do |booking_order| %> - <% if booking_order.order_status != "new" %> -
-
-

- <%=booking_order.table_name%>

- Receipt No : <%=booking_order.receipt_no%>
- Order Status : <%=booking_order.order_status %> -
-
- <% else %> -
-
-

<%=booking_order.table_name%>

- Order Status : <%=booking_order.order_status %> -
-
- <% end %> - <%end %> - <%end %> +
+ <% + @booking_orders.each do |bko| + # Assigned Id for new Order? Sale? + unique_id="" + # For CSS- Class for Order? Sale? + sale_status="" + if bko.order_status == 'new' + unique_id=bko.booking_id + else + unique_id=bko.sale_id + sale_status="sold" + end + %> +
+
+ +

<%= bko.table_name %>

+

+ Receipt No : + + <%= bko.receipt_no %> + +

+

+ Order Status : + + <%= bko.order_status %> + + +

+
+
+ <% + end + %>
- - -
- -
- - <% if @booking_rooms %> - <% @booking_rooms.each do |booking_room| %> - <% if !booking_room.order_status = 'new'%> -
-
-

- <%=booking_room.room_name%>

- Receipt No : <%=booking_room.receipt_no%>
- Order Status : <%=booking_room.order_status %> -
-
- <% else %> -
-
-

<%=booking_room.room_name%>ddd

\ - Order Status : <%=booking_room.order_status %> -
-
- <% end %> - <%end %> - <%end %> + +
+
+ <% + @booking_rooms.each do |rmo| + # Assigned Id for new Order? Sale? + unique_id="" + # For CSS- Class for Order? Sale? + sale_status="" + if rmo.order_status == 'new' + unique_id=rmo.booking_id + else + unique_id=rmo.sale_id + sale_status="sold" + end + %> +
+
+ +

<%= rmo.room_name %>

+

+ Receipt No : + + <%= rmo.receipt_no %> + +

+

+ Order Status : + + <%= rmo.order_status %> + + +

+
+
+ <% + end + %>
- -
- - -
- - -
- - <% if @orders %> - <% @orders.each do |order| %> - <% if !order.order_status = 'new'%> -
-
-

- Order No:<%=order.order_id%>

- Receipt No : <%=order.receipt_no%>
- Order Status : <%=order.order_status %> -
-
- <% else %> -
-
-

Order No:<%=order.order_id%>

- Order Status : <%=order.order_status %> -
-
- <% end %> - <%end %> - <%end %> - + +
+
+ <% + @orders.each do |odr| + # Assigned Id for new Order? Sale? + unique_id="" + # For CSS- Class for Order? Sale? + sale_status="" + if odr.order_status == 'new' + unique_id=odr.booking_id + else + unique_id=odr.sale_id + sale_status="sold" + end + %> +
+
+ +

<%= odr.table_name %>

+

+ Receipt No : + + <%= odr.receipt_no %> + +

+

+ Order Status : + + <%= odr.order_status %> + + +

+
+
+ <% + end + %>
- - +
-
- - - +
+ + -
-
-
-
ORDER DETAILS -

-
-
-
-
- - +
+
+
+
ORDER DETAILS -
+
+
+
+
+

Receipt No:

+

Cashier:

+
+
+

Date:

+
+
+
+
+ + + + + + + + +
ItemsQTY + Price +
+
+ -
- - - - - - - - - -
- - - - - -
-
-
+
+
-
-
-
- +
- - + - - - + + +
- - diff --git a/app/views/origami/home/index_old.html.erb b/app/views/origami/home/index_old.html.erb new file mode 100644 index 00000000..d480cf8d --- /dev/null +++ b/app/views/origami/home/index_old.html.erb @@ -0,0 +1,328 @@ +
+
+ + + + + + +
+ + +
+ +
+ + <% if @booking_orders %> + <% @booking_orders.each do |booking_order| %> + <% if booking_order.order_status != "new" %> +
+
+

+ <%=booking_order.table_name%>

+ Receipt No : <%=booking_order.receipt_no%>
+ Order Status : <%=booking_order.order_status %> +
+
+ <% else %> +
+
+

<%=booking_order.table_name%>

+ Order Status : <%=booking_order.order_status %> +
+
+ <% end %> + <%end %> + <%end %> +
+
+ + +
+ +
+ + <% if @booking_rooms %> + <% @booking_rooms.each do |booking_room| %> + <% if !booking_room.order_status = 'new'%> +
+
+

+ <%=booking_room.room_name%>

+ Receipt No : <%=booking_room.receipt_no%>
+ Order Status : <%=booking_room.order_status %> +
+
+ <% else %> +
+
+

<%=booking_room.room_name%>ddd

\ + Order Status : <%=booking_room.order_status %> +
+
+ <% end %> + <%end %> + <%end %> +
+
+ + +
+ + +
+ + <% if @orders %> + <% @orders.each do |order| %> + <% if !order.order_status = 'new'%> +
+
+

+ Order No:<%=order.order_id%>

+ Receipt No : <%=order.receipt_no%>
+ Order Status : <%=order.order_status %> +
+
+ <% else %> +
+
+

Order No:<%=order.order_id%>

+ Order Status : <%=order.order_status %> +
+
+ <% end %> + <%end %> + <%end %> +
+
+ +
+ +
+ +
+
+
+
ORDER DETAILS +

+
+
+
+
+ + + + + + +
ItemsQTY + Price +
+
+
+ + + + + + + + + +
+ + + + + +
+
+ + +
+
+
+ +
+ + + + + + + + + + + + +
+
+ + diff --git a/config/routes.rb b/config/routes.rb index f227f7e3..f917162f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,14 +72,7 @@ Rails.application.routes.draw do resources :customers, only: [:index,:new, :create ] #add customer type end - resources :request_bills, only: [:show] - get 'sale/:sale_id/payment' => 'request_bills#show' - - get 'sale/:sale_id/payment' => 'payments#show' - post 'payment_process' => 'payments#create' - - get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" - get 'sale/:sale_id/payment/others_payment' => "others_payments#index" + get "/request_bills/:id" => "request_bills#print" get 'sale/:sale_id/payment' => 'payments#show' post 'payment_process' => 'payments#create' diff --git a/db/migrate/20170331024747_create_accounts.rb b/db/migrate/20170531024747_create_accounts.rb similarity index 100% rename from db/migrate/20170331024747_create_accounts.rb rename to db/migrate/20170531024747_create_accounts.rb diff --git a/db/seeds.rb b/db/seeds.rb index 02fa39fb..78d927a4 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -136,3 +136,14 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o #Create Adminstrator employee admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) + +#Account for Menu Item Type (eg: Food, Beverage) +food = Account.create({title: "Food", account_type: "0"}) +beverage = Account.create({title: "Beverage", account_type: "1"}) + +shop = Shop.create( + {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon", + country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license", + activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"} + ) + diff --git a/dump.rdb b/dump.rdb index 60850de8..61ec8a21 100644 Binary files a/dump.rdb and b/dump.rdb differ