merge with august spring
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
//= require jquery.datetimepicker
|
||||
//= require dataTables/jquery.dataTables
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.datepicker').datepicker({
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@import "jquery-ui";
|
||||
@import "bootstrap-datepicker3";
|
||||
@import "jquery.datetimepicker";
|
||||
@import "dataTables/jquery.dataTables";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
|
||||
@@ -60,4 +60,31 @@ ul.dropdown-menu li a{
|
||||
|
||||
.padding-10 {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Colors */
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color:#FF7F50;
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color:#ff0000;
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00;
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
/* End Colors */
|
||||
@@ -1,75 +0,0 @@
|
||||
class Origami::CommissionersController < BaseOrigamiController
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
def index
|
||||
@commissioners = Commissioner.all.order("id asc")
|
||||
end
|
||||
|
||||
# GET /commissioners/1
|
||||
# GET /commissioners/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissioners/new
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissioners
|
||||
# POST /commissioners.json
|
||||
def create
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commissioner }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissioners/1
|
||||
# PATCH/PUT /commissioners/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commissioner.update(commissioner_params)
|
||||
format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commissioner }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissioners/1
|
||||
# DELETE /commissioners/1.json
|
||||
def destroy
|
||||
@commissioner.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commissioner
|
||||
@commissioner = Commissioner.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commissioner_params
|
||||
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -8,9 +8,10 @@ class Origami::InJutiesController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def index_in_juty
|
||||
@juties_in= InJuty.where("dinning_id=?",params[:table_id])
|
||||
@juty_in= InJuty.where("dinning_id=?",params[:table_id])
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@in_juty = InJuty.new
|
||||
@juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10)
|
||||
|
||||
end
|
||||
# GET /in_juties/1
|
||||
@@ -31,6 +32,9 @@ class Origami::InJutiesController < BaseOrigamiController
|
||||
def edit_in_juty
|
||||
@in_juty = InJuty.find(params[:id])
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@commissioner = @in_juty.commissioner
|
||||
|
||||
render json: {in_juty: @in_juty, commissioner: @commissioner}
|
||||
end
|
||||
|
||||
def assign_in_juty
|
||||
@@ -89,12 +93,19 @@ class Origami::InJutiesController < BaseOrigamiController
|
||||
end
|
||||
|
||||
|
||||
def update_for_in_juty
|
||||
@in_juty.dinning_id = params[:dining_id]
|
||||
@in_juty.commissioner_ids = params[:commissioner_ids]
|
||||
@in_juty.in_time = params[:in_time]
|
||||
@in_juty.out_time = params[:out_time]
|
||||
@in_juty.save
|
||||
def update_for_in_juty
|
||||
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
|
||||
@in_juty.in_time = in_juty_params[:in_time]
|
||||
@in_juty.out_time = in_juty_params[:out_time]
|
||||
respond_to do |format|
|
||||
if @in_juty.save
|
||||
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @in_juty }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /in_juties/1
|
||||
@@ -125,6 +136,6 @@ class Origami::InJutiesController < BaseOrigamiController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def in_juty_params
|
||||
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time)
|
||||
params.require(:in_juty).permit(:id,:dinning_id,:commissioner_ids,:in_time,:out_time)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,15 +62,16 @@ class Origami::ProductCommissionsController < ApplicationController
|
||||
end
|
||||
|
||||
def set_commissioner_to_sale_item
|
||||
# byebug
|
||||
deselect = false
|
||||
sale_item_id = params[:sale_item_id]
|
||||
commissioner_id = params[:commissioner_id]
|
||||
@sale_item = SaleItem.find(sale_item_id)
|
||||
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
||||
@commission = Commission.where('product_id = ? AND is_active = ?', @menu_item.id, true).take
|
||||
@commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.id, true).take
|
||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
||||
# byebug
|
||||
|
||||
if !@product_commission.nil?
|
||||
if @product_commission.commissioner_id == @commissioner.id
|
||||
@product_commission.destroy
|
||||
@@ -81,7 +82,8 @@ class Origami::ProductCommissionsController < ApplicationController
|
||||
end
|
||||
else
|
||||
@product_commission = ProductCommission.new
|
||||
@product_commission.product_id = @menu_item.id
|
||||
@product_commission.product_code = @menu_item.id
|
||||
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
||||
unless @commission.nil?
|
||||
@product_commission.commission_id = @commission.id
|
||||
if @commission.commission_type == 'Percentage'
|
||||
|
||||
50
app/controllers/reports/commission_controller.rb
Normal file
50
app/controllers/reports/commission_controller.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
class Reports::CommissionController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
|
||||
def index
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
@shift = ShiftSale.find(params[:shift_name])
|
||||
end
|
||||
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
|
||||
@from = from
|
||||
@to = to
|
||||
if @shift.present?
|
||||
|
||||
@shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = @shift
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
93
app/controllers/settings/commissioners_controller.rb
Normal file
93
app/controllers/settings/commissioners_controller.rb
Normal file
@@ -0,0 +1,93 @@
|
||||
class Settings::CommissionersController < ApplicationController
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
def index
|
||||
@commissioners = Commissioner.all.order("id asc")
|
||||
end
|
||||
|
||||
# GET /commissioners/1
|
||||
# GET /commissioners/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissioners/new
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissioners
|
||||
# POST /commissioners.json
|
||||
def create
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
unless @commissioner.joined_date.nil?
|
||||
@commissioner.joined_date = @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
unless @commissioner.resigned_date.nil?
|
||||
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commissioner}
|
||||
else
|
||||
format.html {render :new}
|
||||
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissioners/1
|
||||
# PATCH/PUT /commissioners/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commissioner.update(commissioner_params)
|
||||
format.html {redirect_to settings_commissioner_path(@commissioner), notice: 'Commissioner was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commissioner}
|
||||
else
|
||||
format.html {render :edit}
|
||||
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissioners/1
|
||||
# DELETE /commissioners/1.json
|
||||
def destroy
|
||||
@commissioner.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully destroyed.'}
|
||||
format.json {head :no_content}
|
||||
end
|
||||
end
|
||||
|
||||
def get_transaction_by_commissioner
|
||||
commissioner_id = params[:commissioner_id]
|
||||
@transactions = []
|
||||
@product_commissions = ProductCommission.where(commissioner_id: commissioner_id).order('updated_at desc')
|
||||
@product_commissions.each_with_index do |p, i|
|
||||
@transactions[i] = []
|
||||
@transactions[i] << p
|
||||
@transactions[i] << p.commission.menu_item.name
|
||||
end
|
||||
render json: @transactions
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commissioner
|
||||
@commissioner = Commissioner.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commissioner_params
|
||||
params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::CommissionsController < BaseOrigamiController
|
||||
class Settings::CommissionsController < ApplicationController
|
||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissions
|
||||
@@ -27,10 +27,11 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
# POST /commissions.json
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
@commission.product_type = 'menu_item'
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commission}
|
||||
else
|
||||
format.html {render :new}
|
||||
@@ -44,7 +45,7 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commission.update(commission_params)
|
||||
format.html {redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commission}
|
||||
else
|
||||
format.html {render :edit}
|
||||
@@ -58,7 +59,7 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
def destroy
|
||||
@commission.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.json {head :no_content}
|
||||
end
|
||||
end
|
||||
@@ -96,6 +97,6 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.require(:commission).permit(:product_id, :amount, :commission_type, :is_active)
|
||||
params.require(:commission).permit(:product_type, :product_code, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,16 @@
|
||||
class Commission < ApplicationRecord
|
||||
belongs_to :menu_item, foreign_key: 'product_id'
|
||||
self.primary_key = 'commission_id'
|
||||
|
||||
# primary key - need to be unique
|
||||
before_create :generate_custom_id
|
||||
|
||||
belongs_to :menu_item, foreign_key: 'product_code'
|
||||
has_many :commissioners
|
||||
has_many :product_commissions
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Commissioner < ApplicationRecord
|
||||
belongs_to :employee, foreign_key: 'emp_id'
|
||||
belongs_to :commission, foreign_key: 'commission_type'
|
||||
belongs_to :commission, foreign_key: 'commission_id'
|
||||
has_many :in_juties
|
||||
has_many :product_commissions
|
||||
scope :active, -> { where(is_active: true) }
|
||||
|
||||
@@ -5,7 +5,5 @@ class ProductCommission < ApplicationRecord
|
||||
belongs_to :sale_item, foreign_key: 'sale_item_id'
|
||||
belongs_to :sale, foreign_key: 'sale_id'
|
||||
|
||||
def self.check_product_commission(sale_item_id)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,7 +69,7 @@ class Promotion < ApplicationRecord
|
||||
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
|
||||
elsif promo.promo_type == Promotion::PROMO_TYPE4
|
||||
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
give_promotion_discount(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,8 +138,8 @@ class Promotion < ApplicationRecord
|
||||
sale_item.remark = type
|
||||
sale_item.qty = foc_qty * (-1)
|
||||
|
||||
sale_item.unit_price = item_price * (-1)
|
||||
sale_item.taxable_price = item_price * (-1)
|
||||
sale_item.unit_price = item_price # * (-1)
|
||||
sale_item.taxable_price = item_price # * (-1)
|
||||
sale_item.price = foc_qty * item_price * (-1)
|
||||
|
||||
sale_item.is_taxable = false
|
||||
@@ -170,8 +170,8 @@ class Promotion < ApplicationRecord
|
||||
|
||||
if same
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
price = item.price - promo_product.net_price
|
||||
item = OrderItem.find_by_item_code(orderitem[0]) # need to specify with menu item instance
|
||||
price = item.price.to_i - promo_product.net_price.to_i
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
@@ -187,13 +187,15 @@ class Promotion < ApplicationRecord
|
||||
if same
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
total = orderitem[1].to_i * item.price
|
||||
# total = orderitem[1].to_i * item.price
|
||||
total = item.price
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_code(promo_product.item_code)
|
||||
total = item.price * foc_qty
|
||||
# total = item.price * foc_qty
|
||||
total = item.price
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
||||
end
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissions", origami_commissions_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissions", settings_commissions_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissioners", settings_commissioners_path , :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
@@ -55,6 +55,7 @@
|
||||
<li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %></li>
|
||||
<!--<li><% link_to "Commission Report", reports_commission_index_path, :tabindex =>"-1" %></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li class="navbar-nav mr-auto">
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami, @commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.label :emp_id %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %><br/>
|
||||
<%= f.label :commission_type %>
|
||||
<%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
|
||||
<br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div><br/>
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,47 +0,0 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Commissioner</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="width:20%">Name</td>
|
||||
<td><%= @commissioner.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Employee Name</td>
|
||||
<td>
|
||||
<%= @commissioner.employee.name rescue '-' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commission Type</td>
|
||||
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Active</td>
|
||||
<td><%= @commissioner.is_active %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Created By</td>
|
||||
<td><%= Employee.find(@commissioner.created_by).name %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,9 +1,12 @@
|
||||
<%= simple_form_for @in_juty,:url => origami_create_for_in_juty_path, :method => :post do |f| %>
|
||||
<%= simple_form_for @in_juty,:url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
|
||||
<span class="patch_method"></span>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-inputs">
|
||||
|
||||
<%= f.hidden_field :dinning_id,:value => @table.id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<label>Dining Name:</label>
|
||||
<%= @table.name %>
|
||||
<br/>
|
||||
@@ -12,14 +15,14 @@
|
||||
<label>Commissioner Name:</label>
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/><br/>
|
||||
<label>In time</label>
|
||||
<%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%><br/>
|
||||
<%= f.text_field :in_time, :value=>'',:class=>"form-control datepicker"%><br/>
|
||||
<label>Out time</label>
|
||||
<%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
|
||||
<%= f.text_field :out_time, :value=>'',:class=>"form-control datepicker"%>
|
||||
</div><br>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Create",:class => 'btn btn-primary ', :id => 'create' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'disabled', :id => 'update' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
|
||||
@@ -30,11 +33,18 @@
|
||||
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
format : 'yyyy-mm-dd',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
|
||||
$('#reset').click(function() {
|
||||
|
||||
// window.location.href = '/origami/assign_in_juty/'+ table_id;
|
||||
location.reload();
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
@@ -2,8 +2,7 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :dinning_id %>
|
||||
<%= f.input :commissioner_ids %>
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/><br/>
|
||||
<%= f.input :in_time %>
|
||||
<%= f.input :out_time %>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Dining Facility Name</th>
|
||||
<th>Commissioner Ids</th>
|
||||
<th>In time</th>
|
||||
@@ -21,13 +22,12 @@
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Back', origami_path(in_juty.dining_facility.id) %></td>
|
||||
<td><%= link_to 'Edit', origami_edit_in_juty_path(in_juty.dining_facility.id,in_juty) %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id,in_juty),method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
@@ -35,40 +35,45 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click',".injuty_tr",function(){
|
||||
debugger;
|
||||
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
$('#in_juty_commissioner_ids').val(data.commissioner.name);
|
||||
$('#in_juty_in_time').val(data.in_time);
|
||||
$('#in_juty_out_time').val(data.out_time);
|
||||
|
||||
$('#in_juty_id').val(data.in_juty.id);
|
||||
$('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
$('#in_juty_in_time').val(data.in_juty.in_time.split('T')[0]);
|
||||
$('#in_juty_out_time').val(data.in_juty.out_time.split('T')[0]);
|
||||
|
||||
$('#update').removeAttr('disabled');
|
||||
$('#update').removeAttr('disabled').val('');
|
||||
$('#update').attr('value', 'Update');
|
||||
$('#create').attr('disabled','disabled');
|
||||
|
||||
$("#new_in_juty").attr('class', 'simple_form new_in_juty');
|
||||
var id = customer_id;
|
||||
$("#new_customer").attr('id', id);
|
||||
$("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
var id = "edit_in_juty_" + in_juty_id;
|
||||
$("#new_in_juty").attr('id', id);
|
||||
|
||||
$(".edit_customer").attr('id', id);
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_in_juty").attr('id', id);
|
||||
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
}
|
||||
});
|
||||
@@ -76,4 +81,9 @@ $(document).on('click',".injuty_tr",function(){
|
||||
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/table/'+ "<%= @table.id %>";
|
||||
})
|
||||
</script>
|
||||
119
app/views/reports/commission/_commission_report_filter.html.erb
Normal file
119
app/views/reports/commission/_commission_report_filter.html.erb
Normal file
@@ -0,0 +1,119 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||
<% if period_type != false %>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-2">
|
||||
<label>Select Period</label>
|
||||
<select name="period" id="sel_period" class="form-control">
|
||||
<option value="0">Today</option>
|
||||
<option value="1">Yesterday</option>
|
||||
<option value="2">This week</option>
|
||||
<option value="3">Last week</option>
|
||||
<option value="4">Last 7 days</option>
|
||||
<option value="5">This month</option>
|
||||
<option value="6">Last month</option>
|
||||
<option value="7">Last 30 days</option>
|
||||
<option value="8">This year</option>
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
$('#custom_excel').click(function(){
|
||||
var url = $('#custom_excel').attr('data-url');
|
||||
$('#frm_report').attr('action',url)
|
||||
$('#frm_report').submit();
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
<% end %>
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
211
app/views/reports/commission/index.html.erb
Normal file
211
app/views/reports/commission/index.html.erb
Normal file
@@ -0,0 +1,211 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Commission Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'commission_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_commission_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_commission_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<!-- <div class="span11">
|
||||
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||
</div> -->
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Cashier Station</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Shift Name</th>
|
||||
<!-- <th>Void Amount</th> -->
|
||||
<th>Cash Payment</th>
|
||||
<!-- <th>Credit Charges</th> -->
|
||||
<th>Credit Payment</th>
|
||||
<!-- <th>FOC Payment</th> -->
|
||||
<th>Other Payment</th>
|
||||
<!-- <th>Grand Total
|
||||
<br/>Rounding Adj</th> -->
|
||||
<!-- <th>Rounding Adj</th> -->
|
||||
<th>Grand Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
<% accept_credit = 0%>
|
||||
<% foc = 0%>
|
||||
<% card = 0%>
|
||||
<% total = 0%>
|
||||
<% rounding_adj = 0%>
|
||||
<% g_total = 0 %>
|
||||
|
||||
<% @sale_data.each do |result|%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result.cashier_terminal.name rescue '-'%>
|
||||
</td>
|
||||
<td>
|
||||
<%= result.employee.name rescue '-'%>
|
||||
</td>
|
||||
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
|
||||
|
||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||
<% grand_total = result.grand_total.to_f %>
|
||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||
</tr>
|
||||
<% cash += result.cash_sales.to_f %>
|
||||
<% credit += result.credit_sales.to_f %>
|
||||
<% card += result.other_sales.to_f %>
|
||||
|
||||
<% total += result.grand_total.to_f %>
|
||||
<% g_total += grand_total.to_f %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
var check_arr = [];
|
||||
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
$('#from').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
$('#to').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
var from = $('#from').val();
|
||||
var to = $('#to').val();
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
|
||||
check_arr.push(to);
|
||||
|
||||
console.log(check_arr.length)
|
||||
if(check_arr.length == 1){
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
|
||||
str = '<option value="0">--- All Shift ---</option>';
|
||||
$(data.message).each(function(index){
|
||||
|
||||
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
||||
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
var shift_id = data.message[index].shift_id ;
|
||||
if(param_shift != ''){
|
||||
if(shift_id == param_shift){
|
||||
selected = 'selected = "selected"';
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
}else{
|
||||
selected = '';
|
||||
}
|
||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
shift.append(str);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
100
app/views/reports/commission/index.xls.erb
Normal file
100
app/views/reports/commission/index.xls.erb
Normal file
@@ -0,0 +1,100 @@
|
||||
<div class="container margin-top-20">
|
||||
<!-- <div class="span11">
|
||||
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||
</div> -->
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<th>Cashier Station</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Shift Name</th>
|
||||
<!-- <th>Void Amount</th> -->
|
||||
<th>Cash Payment</th>
|
||||
<!-- <th>Credit Charges</th> -->
|
||||
<th>Credit Payment</th>
|
||||
<!-- <th>FOC Payment</th> -->
|
||||
<th>Other Payment</th>
|
||||
<!-- <th>Grand Total
|
||||
<br/>Rounding Adj</th> -->
|
||||
<!-- <th>Rounding Adj</th> -->
|
||||
<th>Grand Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
<% accept_credit = 0%>
|
||||
<% foc = 0%>
|
||||
<% card = 0%>
|
||||
<% total = 0%>
|
||||
<% rounding_adj = 0%>
|
||||
<% g_total = 0 %>
|
||||
|
||||
<% @sale_data.each do |result|%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result.cashier_terminal.name rescue '-'%>
|
||||
</td>
|
||||
<td>
|
||||
<%= result.employee.name rescue '-'%>
|
||||
</td>
|
||||
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
|
||||
|
||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||
<% grand_total = result.grand_total.to_f %>
|
||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||
</tr>
|
||||
<% cash += result.cash_sales.to_f %>
|
||||
<% credit += result.credit_sales.to_f %>
|
||||
<% card += result.other_sales.to_f %>
|
||||
|
||||
<% total += result.grand_total.to_f %>
|
||||
<% g_total += grand_total.to_f %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
42
app/views/settings/commissioners/_form.html.erb
Normal file
42
app/views/settings/commissioners/_form.html.erb
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:settings, @commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.label :emp_id, 'Employee' %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
|
||||
<br/>
|
||||
<%= f.label :commission_id, 'Commission' %><br/>
|
||||
<%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
|
||||
<br/>
|
||||
<%= f.label :joined_date %><br/>
|
||||
<%= f.text_field :joined_date, {class: 'form-control', id: 'joined_date', readonly: true} %><br/>
|
||||
<%= f.label :resigned_date %><br/>
|
||||
<%= f.text_field :resigned_date, {class: 'form-control', id: 'resigned_date', readonly: true} %><br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#joined_date').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$('#resigned_date').datepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
autoclose: true
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li>Commissioner</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path, :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commissioner_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -16,8 +16,10 @@
|
||||
<th>Name</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Commission type</th>
|
||||
<th>Joined Date</th>
|
||||
<th>Resigned Date</th>
|
||||
<th>Active</th>
|
||||
<th colspan="3"></th>
|
||||
<th colspan="4"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -29,10 +31,12 @@
|
||||
<%= commissioner.employee.name rescue '-' %>
|
||||
</td>
|
||||
<td><%= commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
<td><%= commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
<td><%= commissioner.is_active %></td>
|
||||
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= link_to 'Show', settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
132
app/views/settings/commissioners/show.html.erb
Normal file
132
app/views/settings/commissioners/show.html.erb
Normal file
@@ -0,0 +1,132 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= settings_commissioner_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioner_path %>">Commissioners</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#info" role="tab">Info</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#transaction" id="transaction_tab" role="tab">Transaction</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Info -->
|
||||
<div class="tab-pane active" id="info" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:20%">Name</td>
|
||||
<td><%= @commissioner.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Employee Name</td>
|
||||
<td><%= @commissioner.employee.name rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commission Type</td>
|
||||
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Joined Date</td>
|
||||
<td><%= @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Resigned Date</td>
|
||||
<td><%= @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Active</td>
|
||||
<td><%= @commissioner.is_active %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Created By</td>
|
||||
<td><%= Employee.find(@commissioner.created_by).name %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--- Panel 1 - Transaction -->
|
||||
<div class="tab-pane" id="transaction" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
|
||||
<table class="table" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= 'Product Type' %></th>
|
||||
<th><%= 'Product Name' %></th>
|
||||
<th><%= 'Qty' %></th>
|
||||
<th><%= 'Price' %></th>
|
||||
<th><%= 'Amount' %></th>
|
||||
<th><%= 'Date' %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#transaction_tab").click(function () {
|
||||
get_transaction();
|
||||
});
|
||||
|
||||
function get_transaction() {
|
||||
var commissioner_id = <%= @commissioner.id %>
|
||||
paramlist = 'commissioner_id=' + commissioner_id ;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= settings_get_transaction_by_commissioner_path() %>',
|
||||
data: paramlist,
|
||||
success: function (data) {
|
||||
// $('#myTable').DataTable().destroy();
|
||||
$('#myTable tbody > tr').remove();
|
||||
$.each(data, function (i, item) {
|
||||
tr = "<tr>" + "<td>" + data[i][0].product_type + "</td>" + "<td>" + data[i][1] + "</td>" + "<td>" + data[i][0].qty + "</td>" + "<td>" + data[i][0].price + "</td>" + "<td>" + data[i][0].amount + "</td>" + "<td>" + new Date(data[i][0].updated_at).toISOString().split('T')[0] + "</td>" + "</tr>";
|
||||
$('#myTable tbody').append(tr);
|
||||
});
|
||||
// $('#myTable').DataTable({
|
||||
// data: data,
|
||||
// columns: [
|
||||
// {data: 'product_type'},
|
||||
// {data: 'product_code'},
|
||||
// {data: 'commission_id'},
|
||||
// {data: 'qty'},
|
||||
// {data: 'price'},
|
||||
// {data: 'amount'}
|
||||
// ],
|
||||
// "order": [[0, "desc"]]
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,17 +1,17 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@commission]) do |f| %>
|
||||
<%= simple_form_for([:settings,@commission]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.label :product_id %>
|
||||
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
|
||||
<%= f.input :amount %>
|
||||
<%= f.label :product_code, 'Product' %>
|
||||
<%= f.collection_select :product_code, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
|
||||
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
|
||||
<%= f.input :amount %>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
|
||||
</div><br>
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li>Commissions</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commission_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -14,8 +14,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Product Name</th>
|
||||
<th>Commission Type</th>
|
||||
<th>Amount</th>
|
||||
<th>Commission type</th>
|
||||
<th>Active</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
@@ -25,12 +25,12 @@
|
||||
<% @commissions.each do |commission| %>
|
||||
<tr>
|
||||
<td><%= commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= commission.amount rescue '-' %></td>
|
||||
<td><%= commission.commission_type rescue '-' %></td>
|
||||
<td><%= commission.amount rescue '-' %></td>
|
||||
<td><%= commission.is_active rescue '-' %></td>
|
||||
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= link_to 'Show', settings_commissions_path(commission) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Destroy', settings_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
@@ -32,9 +32,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_commission_path(@commission), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
|
||||
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_settings_commission_path(@commission), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', settings_commissions_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user