merge with august_spring
This commit is contained in:
837
.idea/workspace.xml
generated
837
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,272 @@
|
||||
// Place all the styles related to the inventory_definitions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
@import "jquery-ui";
|
||||
@import "bootstrap-datepicker3";
|
||||
@import "select2";
|
||||
@import "jquery.datetimepicker";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
.card-columns {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.others-payment{
|
||||
line-height:100px;
|
||||
text-align:center;
|
||||
color:white;
|
||||
width:300px;
|
||||
height:100px;
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
.orders-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cashier_number{
|
||||
width: 33%;
|
||||
height:70px;
|
||||
line-height:70px;
|
||||
text-align:center;
|
||||
background:#54A5AF;
|
||||
// float:left;
|
||||
// margin:2px;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
// cursor:pointer;
|
||||
}
|
||||
|
||||
.del_cashier_number{
|
||||
opacity:0.6,
|
||||
}
|
||||
|
||||
.pay{
|
||||
width: 98%;
|
||||
height:211px;
|
||||
line-height:211px;
|
||||
text-align:center;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.payment{
|
||||
height:70px;line-height:70px;
|
||||
align:center;
|
||||
color:white;
|
||||
font-size:16px;
|
||||
margin-top:5px;
|
||||
}
|
||||
|
||||
.cash-color{
|
||||
background-color:#80CBC4;
|
||||
}
|
||||
|
||||
.credit-color{
|
||||
background-color:#FFCCBC;
|
||||
}
|
||||
|
||||
.other-payment-color{
|
||||
background-color:#E1BEE7;
|
||||
}
|
||||
|
||||
.cashier_number:hover{
|
||||
background:#A9F5F2;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
white-space: normal !important;
|
||||
height: 60px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.bottom-5 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fluid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.style2 {
|
||||
border-top: 3px double #8c8b8b;
|
||||
}
|
||||
|
||||
.long{
|
||||
width:49%;
|
||||
}
|
||||
|
||||
.sold {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.paid {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.selected-item {
|
||||
color: #fff !important;
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
.selected-account {
|
||||
color: #fff !important;
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
.item-attr-edit{
|
||||
width: 10%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.display-none{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.text-white{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
|
||||
.left{
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
.bottom{
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
/*----- Reset -----*/
|
||||
|
||||
select.form-control {
|
||||
height: inherit !important;
|
||||
}
|
||||
|
||||
.form-horizontal .form-group {
|
||||
margin-right: 0px !important;
|
||||
}
|
||||
|
||||
/* Discount */
|
||||
|
||||
.discount-item-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
tr.discount-item-row:hover {
|
||||
background-color: #e3e3e3 !important;
|
||||
}
|
||||
.required abbr{
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
/* Jquery Confirm */
|
||||
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important;
|
||||
margin-top:-40px !important;
|
||||
}
|
||||
|
||||
#sxModal {
|
||||
display: none;
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1100;
|
||||
}
|
||||
|
||||
#sxModal-Content {
|
||||
position: relative;
|
||||
left: 42%;
|
||||
top: 30%;
|
||||
background-color: #d9534f;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
padding-top: 5%;
|
||||
border-radius: 100px;
|
||||
z-index: 1101;
|
||||
}
|
||||
|
||||
/*Loading gif for payment*/
|
||||
|
||||
#loading_wrapper{
|
||||
|
||||
position: fixed;
|
||||
background-color: #C8C8C8 ;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
opacity: 0.6;
|
||||
top: 0;
|
||||
z-index: 9999999;
|
||||
}
|
||||
#loading{
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-image: url('../../../image/loading-ajax.gif');
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100); /* ie */
|
||||
-moz-opacity: 1; /* mozilla */
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
|
||||
# POST /inventory_definitions.json
|
||||
def create
|
||||
@inventory_definition = InventoryDefinition.new(inventory_definition_params)
|
||||
|
||||
@inventory_definition.created_by = current_user.id
|
||||
respond_to do |format|
|
||||
if @inventory_definition.save
|
||||
format.html { redirect_to inventory_path, notice: 'Inventory definition was successfully created.' }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Inventory::StockChecksController < BaseInventoryController
|
||||
|
||||
def index
|
||||
@check = StockCheck.new
|
||||
@inventory_definitions = InventoryDefinition.active.all
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -28,87 +28,86 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
stockcheck = StockCheck.find(stock_id)
|
||||
stockcheck_items = stockcheck.stock_check_items
|
||||
member_info = nil
|
||||
unique_code = "StockPrint"
|
||||
|
||||
unique_code = 'StockPrint'
|
||||
|
||||
shop_details = Shop.find(1)
|
||||
checker = Employee.find(stockcheck.check_by)
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker.name, shop_details)
|
||||
|
||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
||||
end
|
||||
|
||||
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /stock_checks
|
||||
# GET /stock_checks.json
|
||||
# def index
|
||||
# @stock_checks = StockCheck.all
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1
|
||||
# # GET /stock_checks/1.json
|
||||
# def show
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/new
|
||||
# def new
|
||||
# @stock_check = StockCheck.new
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1/edit
|
||||
# def edit
|
||||
# end
|
||||
#
|
||||
# # POST /stock_checks
|
||||
# # POST /stock_checks.json
|
||||
# def create
|
||||
# @stock_check = StockCheck.new(stock_check_params)
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @stock_check.save
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully created.' }
|
||||
# format.json { render :show, status: :created, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :new }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # PATCH/PUT /stock_checks/1
|
||||
# # PATCH/PUT /stock_checks/1.json
|
||||
# def update
|
||||
# respond_to do |format|
|
||||
# if @stock_check.update(stock_check_params)
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully updated.' }
|
||||
# format.json { render :show, status: :ok, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :edit }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # DELETE /stock_checks/1
|
||||
# # DELETE /stock_checks/1.json
|
||||
# def destroy
|
||||
# @stock_check.destroy
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to stock_checks_url, notice: 'Stock check was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# private
|
||||
# # Use callbacks to share common setup or constraints between actions.
|
||||
# def set_stock_check
|
||||
# @stock_check = StockCheck.find(params[:id])
|
||||
# end
|
||||
#
|
||||
# # Never trust parameters from the scary internet, only allow the white list through.
|
||||
# def stock_check_params
|
||||
# params.fetch(:stock_check, {})
|
||||
# end
|
||||
# def index
|
||||
# @stock_checks = StockCheck.all
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1
|
||||
# # GET /stock_checks/1.json
|
||||
# def show
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/new
|
||||
# def new
|
||||
# @stock_check = StockCheck.new
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1/edit
|
||||
# def edit
|
||||
# end
|
||||
#
|
||||
# # POST /stock_checks
|
||||
# # POST /stock_checks.json
|
||||
# def create
|
||||
# @stock_check = StockCheck.new(stock_check_params)
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @stock_check.save
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully created.' }
|
||||
# format.json { render :show, status: :created, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :new }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # PATCH/PUT /stock_checks/1
|
||||
# # PATCH/PUT /stock_checks/1.json
|
||||
# def update
|
||||
# respond_to do |format|
|
||||
# if @stock_check.update(stock_check_params)
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully updated.' }
|
||||
# format.json { render :show, status: :ok, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :edit }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # DELETE /stock_checks/1
|
||||
# # DELETE /stock_checks/1.json
|
||||
# def destroy
|
||||
# @stock_check.destroy
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to stock_checks_url, notice: 'Stock check was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# private
|
||||
# # Use callbacks to share common setup or constraints between actions.
|
||||
# def set_stock_check
|
||||
# @stock_check = StockCheck.find(params[:id])
|
||||
# end
|
||||
#
|
||||
# # Never trust parameters from the scary internet, only allow the white list through.
|
||||
# def stock_check_params
|
||||
# params.fetch(:stock_check, {})
|
||||
# end
|
||||
end
|
||||
|
||||
170
app/controllers/origami/in_duties_controller.rb
Normal file
170
app/controllers/origami/in_duties_controller.rb
Normal file
@@ -0,0 +1,170 @@
|
||||
class Origami::InDutiesController < BaseOrigamiController
|
||||
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
||||
|
||||
# GET /in_duties
|
||||
# GET /in_duties.json
|
||||
def index
|
||||
@in_duties = InDuty.all
|
||||
end
|
||||
|
||||
def index_in_duty
|
||||
@duty_in = InDuty.where('dinning_id=?', params[:table_id])
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@in_duty = InDuty.new
|
||||
@duties_in = Kaminari.paginate_array(@duty_in).page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
# GET /in_duties/1
|
||||
# GET /in_duties/1.json
|
||||
def show; end
|
||||
|
||||
# GET /in_duties/new
|
||||
def new
|
||||
# this one use for new
|
||||
@in_duty = InDuty.new
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@commissioner = @in_duty.commissioner
|
||||
render partial: 'form'
|
||||
end
|
||||
|
||||
# GET /in_duties/1/edit
|
||||
def edit; end
|
||||
|
||||
def edit_in_duty
|
||||
@in_duty = InDuty.find(params[:id])
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@commissioner = @in_duty.commissioner
|
||||
|
||||
# render json: {in_duty: @in_duty, commissioner: @commissioner}
|
||||
render partial: 'form'
|
||||
end
|
||||
|
||||
def assign_in_duty
|
||||
@in_duty = InDuty.new
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
end
|
||||
|
||||
# POST /in_duties
|
||||
# POST /in_duties.json
|
||||
def create
|
||||
@in_duty = InDuty.new(in_duty_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @in_duty.save
|
||||
format.html { redirect_to origami_in_duties_path, notice: 'In duty was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @in_duty }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @in_duty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_for_in_duty
|
||||
# this one use for create and update
|
||||
in_duty = in_duty_params
|
||||
in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_duty = InDuty.new
|
||||
in_duty_id = in_duty[:id]
|
||||
unless in_duty_id.empty?
|
||||
@in_duty = InDuty.find(in_duty_id.to_i)
|
||||
end
|
||||
|
||||
@in_duty.dinning_id = in_duty_params[:dinning_id]
|
||||
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
|
||||
@in_duty.in_time = in_time
|
||||
@in_duty.out_time = out_time
|
||||
|
||||
respond_to do |format|
|
||||
if @in_duty.save
|
||||
if in_duty_id.nil?
|
||||
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @in_duty }
|
||||
else
|
||||
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' }
|
||||
format.json { render :show, status: :created, location: @in_duty }
|
||||
end
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @in_duty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /in_duties/1
|
||||
# PATCH/PUT /in_duties/1.json
|
||||
def update
|
||||
in_duty = in_duty_params
|
||||
in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
|
||||
@in_duty.in_time = in_time
|
||||
@in_duty.out_time = out_time
|
||||
respond_to do |format|
|
||||
if @in_duty.save
|
||||
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @in_duty }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @in_duty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_for_in_duty
|
||||
in_duty = in_duty_params
|
||||
in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
|
||||
@in_duty.in_time = in_time
|
||||
@in_duty.out_time = out_time
|
||||
respond_to do |format|
|
||||
if @in_duty.save
|
||||
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @in_duty }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @in_duty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /in_duties/1
|
||||
# DELETE /in_duties/1.json
|
||||
def destroy
|
||||
@in_duty.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_in_duties_path, notice: 'In duty was successfully removed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_in_duty
|
||||
@table_id = params[:table_id]
|
||||
@in_duty.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_index_in_duty_path(@table_id), notice: 'In duty was successfully removed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_in_duty
|
||||
@in_duty = InDuty.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def in_duty_params
|
||||
params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time)
|
||||
end
|
||||
end
|
||||
@@ -1,170 +0,0 @@
|
||||
class Origami::InJutiesController < BaseOrigamiController
|
||||
before_action :set_in_juty, only: %i[show edit update edit_in_juty update_for_in_juty destroy destroy_in_juty]
|
||||
|
||||
# GET /in_juties
|
||||
# GET /in_juties.json
|
||||
def index
|
||||
@in_juties = InJuty.all
|
||||
end
|
||||
|
||||
def index_in_juty
|
||||
@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
|
||||
# GET /in_juties/1.json
|
||||
def show; end
|
||||
|
||||
# GET /in_juties/new
|
||||
def new
|
||||
# this one use for new
|
||||
@in_juty = InJuty.new
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@commissioner = @in_juty.commissioner
|
||||
render partial: 'form'
|
||||
end
|
||||
|
||||
# GET /in_juties/1/edit
|
||||
def edit; end
|
||||
|
||||
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}
|
||||
render partial: 'form'
|
||||
end
|
||||
|
||||
def assign_in_juty
|
||||
@in_juty = InJuty.new
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
end
|
||||
|
||||
# POST /in_juties
|
||||
# POST /in_juties.json
|
||||
def create
|
||||
@in_juty = InJuty.new(in_juty_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @in_juty.save
|
||||
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @in_juty }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_for_in_juty
|
||||
# this one use for create and update
|
||||
in_juty = in_juty_params
|
||||
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_juty = InJuty.new
|
||||
in_juty_id = in_juty[:id]
|
||||
unless in_juty_id.empty?
|
||||
@in_juty = InJuty.find(in_juty_id.to_i)
|
||||
end
|
||||
|
||||
@in_juty.dinning_id = in_juty_params[:dinning_id]
|
||||
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
|
||||
@in_juty.in_time = in_time
|
||||
@in_juty.out_time = out_time
|
||||
|
||||
respond_to do |format|
|
||||
if @in_juty.save
|
||||
if in_juty_id.nil?
|
||||
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @in_juty }
|
||||
else
|
||||
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: :created, location: @in_juty }
|
||||
end
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /in_juties/1
|
||||
# PATCH/PUT /in_juties/1.json
|
||||
def update
|
||||
in_juty = in_juty_params
|
||||
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
|
||||
@in_juty.in_time = in_time
|
||||
@in_juty.out_time = 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
|
||||
|
||||
def update_for_in_juty
|
||||
in_juty = in_juty_params
|
||||
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
|
||||
in_time = in_time.change(offset: '+06:30')
|
||||
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
|
||||
out_time = out_time.change(offset: '+06:30')
|
||||
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
|
||||
@in_juty.in_time = in_time
|
||||
@in_juty.out_time = 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
|
||||
# DELETE /in_juties/1.json
|
||||
def destroy
|
||||
@in_juty.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully removed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_in_juty
|
||||
@table_id = params[:table_id]
|
||||
@in_juty.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_index_in_juty_path(@table_id), notice: 'In juty was successfully removed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_in_juty
|
||||
@in_juty = InJuty.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def in_juty_params
|
||||
params.require(:in_juty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time)
|
||||
end
|
||||
end
|
||||
50
app/controllers/reports/stock_check_controller.rb
Normal file
50
app/controllers/reports/stock_check_controller.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
class Reports::StockCheckController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
|
||||
def index
|
||||
from_date = DateTime.now.beginning_of_day.utc.getlocal
|
||||
to_date = DateTime.now.end_of_day.utc.getlocal
|
||||
unless params[:daterange].blank?
|
||||
from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
|
||||
to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
|
||||
@daterange = params[:daterange]
|
||||
end
|
||||
commissioner = params[:commissioner].to_i
|
||||
@com_id = commissioner
|
||||
@commissioner = Commissioner.active.all
|
||||
@inventory_definitions = InventoryDefinition.active.all
|
||||
|
||||
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
|
||||
@from = from_date
|
||||
@to = to_date
|
||||
|
||||
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
|
||||
|
||||
@@ -69,6 +69,9 @@ class Settings::PromotionsController < ApplicationController
|
||||
# DELETE /promotions/1
|
||||
# DELETE /promotions/1.json
|
||||
def destroy
|
||||
@promotion.promotion_products.each do |pp|
|
||||
pp.destroy
|
||||
end
|
||||
@promotion.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
|
||||
@@ -87,6 +90,21 @@ class Settings::PromotionsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def find_parent_item
|
||||
res = []
|
||||
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item.nil?
|
||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
||||
res.push(product.name)
|
||||
res.push(product.item_code)
|
||||
else
|
||||
# menu_item = item.menu_item.pluck(:name,:item_code)
|
||||
res.push(item.item_instance_name)
|
||||
res.push(item.menu_item.item_code)
|
||||
end
|
||||
render json: res
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_promotion
|
||||
|
||||
2
app/helpers/origami/in_duties_helper.rb
Normal file
2
app/helpers/origami/in_duties_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Origami::InDutiesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module Origami::InJutiesHelper
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class InJuty < ApplicationRecord
|
||||
class InDuty < ApplicationRecord
|
||||
belongs_to :dining_facility, foreign_key: 'dinning_id'
|
||||
belongs_to :commissioner, foreign_key: 'commissioner_ids'
|
||||
end
|
||||
@@ -6,14 +6,24 @@ class MenuItemInstance < ApplicationRecord
|
||||
# before_create :generate_menu_item_instance_code
|
||||
|
||||
def self.findParentCategory(item)
|
||||
if item.menu_category_id
|
||||
return item.menu_category_id
|
||||
if item.menu_category_id
|
||||
item.menu_category_id
|
||||
else
|
||||
parentitem = MenuItem.find(item.menu_item_id)
|
||||
findParentCategory(parentitem)
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_item_name(item_code)
|
||||
menu_item = MenuItemInstance.find_by_item_instance_code(item_code)
|
||||
if menu_item.nil?
|
||||
item_name = Product.find_by_item_code(item_code).name
|
||||
else
|
||||
item_name = menu_item.menu_item.name + ' - ' + menu_item.item_instance_name
|
||||
end
|
||||
item_name
|
||||
end
|
||||
|
||||
# private
|
||||
|
||||
# def generate_menu_item_instance_code
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Promotion < ApplicationRecord
|
||||
validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_day,:promo_type,:original_product,:min_qty
|
||||
validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_type,:original_product,:min_qty
|
||||
|
||||
has_many :promotion_products
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ class StockCheck < ApplicationRecord
|
||||
|
||||
has_many :stock_check_items
|
||||
|
||||
def create(user, eason, item_list)
|
||||
def create(user, reason, item_list)
|
||||
self.reason = reason
|
||||
self.check_by = user.id
|
||||
self.check_start = Time.now
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class StockResultPdf < 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
|
||||
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,stockcheck, stockcheck_items,checker_name, shop_details)
|
||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
def initialize(printer_settings, stockcheck, stockcheck_items, checker_name, shop_details)
|
||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
@@ -27,66 +27,68 @@ class StockResultPdf < Prawn::Document
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 8
|
||||
|
||||
header( shop_details)
|
||||
header(shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
detail(stockcheck,stockcheck_items, checker_name)
|
||||
detail(stockcheck, stockcheck_items, checker_name)
|
||||
end
|
||||
|
||||
def header (shop_details)
|
||||
move_down 7
|
||||
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size, :align => :center
|
||||
move_down 5
|
||||
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||
text "#{shop_details.address}", :size => self.item_font_size, :align => :center
|
||||
# move_down self.item_height
|
||||
move_down 5
|
||||
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
||||
text "#{shop_details.phone_no}", :size => self.item_font_size, :align => :center
|
||||
move_down 5
|
||||
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
def detail(stockcheck, stockcheck_items, checker_name)
|
||||
move_down 7
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Checker : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{checker_name}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
move_down 7
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "Checker : ", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{checker_name}", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Check Start Time : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "Check Start Time : ", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Check End Time ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "Check End Time ", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }", :size => self.item_font_size, :align => :left
|
||||
end
|
||||
|
||||
if stockcheck_items.length > 0
|
||||
stockcheck_items.each do |st|
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ st.item_code }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{st.stock_count.to_i}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
if stockcheck_items.length > 0
|
||||
stockcheck_items.each do |st|
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
y_position = cursor
|
||||
|
||||
item_name = MenuItemInstance.get_item_name(st.item_code)
|
||||
|
||||
bounding_box([0, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||
text item_name.to_s, :size => self.item_font_size, :align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width, y_position], :width => self.label_width) do
|
||||
text "#{st.stock_count.to_i}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td><%= item.item_code rescue ""%></td>
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(item.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<%= Product.find_by_item_code(item.item_code).name rescue "-" %>
|
||||
<% else %>
|
||||
<%= menu_item.menu_item.name rescue "-" %>
|
||||
- <%= menu_item.item_instance_name rescue "-" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= item.min_order_level %></td>
|
||||
<td><%= item.max_stock_level %></td>
|
||||
<td><%= item.created_by%></td>
|
||||
<td><%= item.created_at%></td>
|
||||
<td><%= Employee.find(item.created_by).name rescue '-' %></td>
|
||||
<td><%= item.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<%= render 'inventory_list' %>
|
||||
<%= render 'inventory_list' %>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<%end%>
|
||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking </button>
|
||||
<% if current_login_employee.role == "administrator" || current_login_employee.role == 'manager' %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
||||
<% end %>
|
||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking</button>
|
||||
<button id="stock_check_report" type="button" class="btn btn-block btn-primary"> Stock Check Report</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#stock_taking').on('click',function(){
|
||||
window.location.href = '/inventory/stock_checks';
|
||||
})
|
||||
$('#stock_check_report').on('click', function(){
|
||||
window.location.href = '';
|
||||
})
|
||||
$('#stock_taking').on('click', function () {
|
||||
window.location.href = '<%= inventory_stock_checks_path %>';
|
||||
});
|
||||
|
||||
$('#stock_check_report').on('click', function () {
|
||||
window.location.href = '<%= reports_stock_check_index_path %>';
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '<%= dashboard_path %>';
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,56 +1,84 @@
|
||||
<%= simple_form_for([:inventory, @inventory_definition]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<%= simple_form_for([:inventory,@inventory_definition]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code %>
|
||||
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place">
|
||||
<% if !@inventory_definition.item_code.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @inventory_definition.item_code %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<div class="form-inputs">
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name, :item_code) %>
|
||||
<% Product.order("name desc").pluck(:name, :item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place" id="item">
|
||||
<% if !@inventory_definition.item_code.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code) %>
|
||||
<% if menuiteminstance.nil? %>
|
||||
<% code = @inventory_definition.item_code %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value=""></option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1] %>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1] %>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if @inventory_definition.item_code.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?", @inventory_definition.item_code).pluck(:item_instance_name, :item_instance_code) %>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?", @inventory_definition.item_code).pluck(:name, :item_code) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3"><%= f.input :item_code, collection: sample %></div>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if @inventory_definition.item_code.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@inventory_definition.item_code).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@inventory_definition.item_code).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3"><%= f.input :item_code, collection: sample %></div>
|
||||
<!-- <div class="col-md-6"><%= f.input :item_code, collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
|
||||
<div class="col-md-6"><%= f.input :min_qty %></div>
|
||||
<%= f.input :min_order_level %>
|
||||
<%= f.input :max_stock_level %>
|
||||
</div>
|
||||
|
||||
<%= f.input :min_order_level %>
|
||||
<%= f.input :max_stock_level %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', inventory_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".item_code_place").select2({
|
||||
placeholder: 'Select Item'
|
||||
});
|
||||
$("select#inventory_definition_item_code").select2();
|
||||
|
||||
$(".item_code_place").on('change', function (event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#inventory_definition_item_code").empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist = "<option value ='" + result[i][1] + "'>" + result[i][0] + "</option>";
|
||||
$("select#inventory_definition_item_code").append(itemlist);
|
||||
}
|
||||
// $("select#inventory_definition_item_code").append(itemlist);
|
||||
$("select#inventory_definition_item_code").select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1,6 +1,10 @@
|
||||
<h1>Editing Inventory Definition</h1>
|
||||
|
||||
<%= render 'form', inventory_definition: @inventory_definition %>
|
||||
|
||||
<%= link_to 'Show', @inventory_definition %> |
|
||||
<%= link_to 'Back', inventory_definitions_path %>
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= inventory_path %>">Product Inventory</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', inventory: @inventory_definition %>
|
||||
</div>
|
||||
|
||||
@@ -7,17 +7,29 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type='text' id='stock_check_reason' class='form-control' placeholder="Set Stock Check Reason" value=''></input>
|
||||
</div>
|
||||
<input type='text' id='stock_check_reason' class='form-control' placeholder="Set Stock Check Reason" value=''/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-2">
|
||||
Product
|
||||
Item
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Product Name" id='product_sku' value=''></input>
|
||||
<select class='form-control' id='product_sku'>
|
||||
<option value="">Select Product</option>
|
||||
<% @inventory_definitions.each do |id| %>
|
||||
<option value="<%= id.item_code %>">
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(id.item_code) %>
|
||||
<% if menu_item.nil? %>
|
||||
<%= Product.find_by_item_code(id.item_code).name rescue "-" %>
|
||||
<% else %>
|
||||
<%= menu_item.menu_item.name rescue '-' %> - <%= menu_item.item_instance_name rescue '-' %>
|
||||
<% end %>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@@ -27,14 +39,14 @@
|
||||
Qty
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Qty" id='product_qty' value=''></input>
|
||||
<input type='text' class='form-control' placeholder="Qty" id='product_qty' value=''/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4"></div>
|
||||
<div class="col-md-7">
|
||||
<button class="btn btn-primary form-control" id='save_to_stock_check'> Save </button>
|
||||
<button class="btn btn-primary form-control" id='save_to_stock_check'> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,9 +56,10 @@
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped" id='stock_item'>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<!--<th>#</th>-->
|
||||
<th>Product</th>
|
||||
<th>Balance</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -54,49 +67,69 @@
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="row">
|
||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish </button>
|
||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='back'> Back</button>
|
||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var count = 0
|
||||
$(document).ready(function () {
|
||||
$('#product_sku').select2({
|
||||
allowClear: true,
|
||||
placeholder: 'Select Product'
|
||||
})
|
||||
});
|
||||
|
||||
$('#save_to_stock_check').on('click', function(){
|
||||
count += 1;
|
||||
product_sku = $('#product_sku').val();
|
||||
product_qty = $('#product_qty').val();
|
||||
var tr = '<tr>'
|
||||
+ '<td>'+ count +'</td>'
|
||||
+ '<td><input type=text value="'+ product_sku +'" id="item_sku_'+ count +'" name='+count+'></input></td>'
|
||||
+ '<td><input type=text value="'+ product_qty +'" id="item_qty_'+ count +'" name='+count+'></input></td>'
|
||||
+ '</tr>'
|
||||
$('#stock_item').append(tr)
|
||||
$('#product_sku').val('');
|
||||
var count = 0;
|
||||
|
||||
$('#save_to_stock_check').on('click', function () {
|
||||
count += 1;
|
||||
product_sku = $('#product_sku').val();
|
||||
product_qty = $('#product_qty').val();
|
||||
product_name = $("#product_sku").find("option:selected").text();
|
||||
var tr = '<tr>'
|
||||
//+ '<td>' + count + '</td>'
|
||||
+ '<td><input type=hidden value="' + product_sku + '" id="item_sku_' + count + '" name=' + count + '/>'
|
||||
+ product_name + '</td>'
|
||||
+ '<td><input type=text value="' + product_qty + '" id="item_qty_' + count + '" name=' + count + '/></td>'
|
||||
+ '<td><input type=button value="X" id="item_remove_' + count + '" name=' + count + ' onclick="remove_row('+ count +')"/></td>'
|
||||
+ '</tr>';
|
||||
$('#stock_item').append(tr);
|
||||
// $('#product_sku').val('');
|
||||
$('#product_qty').val('');
|
||||
})
|
||||
});
|
||||
|
||||
$('#finish').on('click',function(){
|
||||
var reason = $('#stock_check_reason').val();
|
||||
var arr = [];
|
||||
var jsonStr = ''
|
||||
$('#finish').on('click', function () {
|
||||
var reason = $('#stock_check_reason').val();
|
||||
var arr = [];
|
||||
var jsonStr = '';
|
||||
|
||||
for(var i = 1; i <= count; i++){
|
||||
itemname = $('#item_sku_'+i ).val();
|
||||
itemqty = $('#item_qty_'+i ).val();
|
||||
arr.push({sku:itemname, qty:itemqty})
|
||||
jsonStr = JSON.stringify(arr)
|
||||
for (var i = 1; i <= count; i++) {
|
||||
itemname = $('#item_sku_' + i).val();
|
||||
itemqty = $('#item_qty_' + i).val();
|
||||
if(itemname !== undefined){
|
||||
arr.push({sku: itemname, qty: itemqty});
|
||||
}
|
||||
jsonStr = JSON.stringify(arr);
|
||||
}
|
||||
console.log(jsonStr);
|
||||
$.ajax({
|
||||
type: 'Post',
|
||||
url: '<%= inventory_stock_check_save_path %>',
|
||||
data: 'stock_item=' + jsonStr + '&reason=' + reason,
|
||||
success: function (data) {
|
||||
window.location.href = '/inventory/stock_checks/' + data['stock_id'];
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/inventory';
|
||||
});
|
||||
|
||||
function remove_row(row) {
|
||||
$("#item_remove_"+row).parent().parent().remove();
|
||||
}
|
||||
console.log(jsonStr)
|
||||
$.ajax({
|
||||
type: 'Post',
|
||||
url: '<%= inventory_stock_check_save_path %>',
|
||||
data:'stock_item='+ jsonStr + '&reason='+ reason,
|
||||
success:function(data){
|
||||
alert(data['stock_id'])
|
||||
window.location.href = '/inventory/stock_checks/'+ data['stock_id'];
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
@@ -3,81 +3,96 @@
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check by
|
||||
Check by
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.check_by %>
|
||||
<%= Employee.find(@check.check_by).name rescue '' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check At
|
||||
Check At
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.created_at %></div>
|
||||
<%= @check.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Reason
|
||||
Reason
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.reason %>
|
||||
<%= @check.reason %>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<table class="table table-striped col-md-12">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
<%
|
||||
count = 0
|
||||
@check.stock_check_items.each do |item|
|
||||
count += 1
|
||||
%>
|
||||
<table class="table table-striped col-md-12">
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td><%= item.item_code %></td>
|
||||
<td><%= item.stock_count %></td>
|
||||
<td><%= item.stock_balance %></td>
|
||||
<td><%= item.different %></td>
|
||||
<td><%= item.remark %></td>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<%
|
||||
count = 0
|
||||
@check.stock_check_items.each do |item|
|
||||
count += 1
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(item.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<%= Product.find_by_item_code(item.item_code).name rescue "-" %>
|
||||
<% else %>
|
||||
<%= menu_item.menu_item.name rescue "-" %>
|
||||
- <%= menu_item.item_instance_name rescue "-" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= item.stock_count %></td>
|
||||
<td><%= item.stock_balance %></td>
|
||||
<td><%= item.different %></td>
|
||||
<td><%= item.remark %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> Save to Journal </button>
|
||||
<button id="print" type="button" class="btn btn-block btn-primary"> Print </button>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
||||
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> Save to Journal</button>
|
||||
<button id="print" type="button" class="btn btn-block btn-primary"> Print</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#save_to_journal').on('click', function(){
|
||||
check_id = $('#stock_check_id').val();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<%= inventory_save_to_journal_path %>',
|
||||
data: 'data='+ check_id,
|
||||
success: function(){
|
||||
alert('success')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('#print').on('click',function(){
|
||||
check_id = $('#stock_check_id').val();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<%= inventory_print_stock_check_path %>',
|
||||
data: 'stock_check_id='+ check_id
|
||||
})
|
||||
})
|
||||
$('#save_to_journal').on('click', function () {
|
||||
check_id = $('#stock_check_id').val();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<%= inventory_save_to_journal_path %>',
|
||||
data: 'data=' + check_id,
|
||||
success: function () {
|
||||
alert('Successfully saved to journal.');
|
||||
window.location.href = '/inventory';
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('#print').on('click', function () {
|
||||
check_id = $('#stock_check_id').val();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<%= inventory_print_stock_check_path %>',
|
||||
data: 'stock_check_id=' + check_id
|
||||
})
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/inventory';
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
38
app/views/layouts/_header_inventory.html.erb
Normal file
38
app/views/layouts/_header_inventory.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="container-fluid" style="min-height:30px; padding-left:0px !important; padding-right:0px !important; background:#54A5AF; margin-bottom:5px">
|
||||
<div style="padding-top:5px;padding-bottom:5px;margin-left:15px; margin-right:15px;">
|
||||
<div style="float:left;margin-top:3px;text-align:left;color:#ffffff">
|
||||
<strong>Inventory - <span id="clockbox"></span></strong>
|
||||
</div>
|
||||
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">
|
||||
<% if current_login_employee %>
|
||||
<%= current_login_employee.name %> | <%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
tday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
|
||||
tmonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
|
||||
function GetClock(){
|
||||
var d=new Date();
|
||||
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getFullYear();
|
||||
var nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds(),ap;
|
||||
|
||||
if(nhour==0){ap=" AM";nhour=12;}
|
||||
else if(nhour<12){ap=" AM";}
|
||||
else if(nhour==12){ap=" PM";}
|
||||
else if(nhour>12){ap=" PM";nhour-=12;}
|
||||
|
||||
if(nmin<=9) nmin="0"+nmin;
|
||||
if(nsec<=9) nsec="0"+nsec;
|
||||
|
||||
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
|
||||
}
|
||||
|
||||
window.onload=function(){
|
||||
GetClock();
|
||||
setInterval(GetClock,1000);
|
||||
}
|
||||
</script>
|
||||
<div id="clockbox"></div>
|
||||
@@ -9,14 +9,14 @@
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'inventory_definitions', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header_orgiami' %>
|
||||
<%= render 'layouts/header_inventory' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<% if !flash["errors"]%>
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block">Charges</button>
|
||||
<button type="button" id="commissions" class="btn btn-primary btn-block">Commissions</button>
|
||||
<button type="button" id="in_juties" class="btn btn-primary btn-block">In Juties</button>
|
||||
<button type="button" id="in_duties" class="btn btn-primary btn-block">In Duties</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||
@@ -579,9 +579,9 @@
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners";
|
||||
});
|
||||
|
||||
$('#in_juties').on('click', function () {
|
||||
$('#in_duties').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
window.location.href = '/origami/assign_in_juty/'+ dining_id;
|
||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
||||
});
|
||||
|
||||
$('#void').on('click', function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for([:origami, @in_juty]) do |f| %>
|
||||
<%= simple_form_for([:origami, @in_duty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
|
||||
<%= simple_form_for @in_duty, :url => origami_index_in_duty_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 " %>
|
||||
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! in_duty, :id, :created_at, :updated_at
|
||||
json.url in_duty_url(in_duty, format: :json)
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Create In Juty</h3>
|
||||
<h3>Create In Duty</h3>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@in_juty]) do |f| %>
|
||||
<%= simple_form_for([:origami,@in_duty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
@@ -22,10 +22,10 @@
|
||||
<div class="form-actions">
|
||||
<div class='row'>
|
||||
<div class="col-md-2">
|
||||
<%= link_to 'Back', origami_index_in_juty_path(@table.id), class: 'btn btn-success' %>
|
||||
<%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn btn-success' %>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<button type="button" class="btn btn-primary btn-block" id='in_juty'>Create In Juty</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='in_duty'>Create In Duty</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,18 +45,18 @@ $(function() {
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
|
||||
$('#in_juty').on('click', function () {
|
||||
var ajax_url = "/origami/assign_in_juty";
|
||||
var commissioner_ids = $('#in_juty_commissioner_ids').val();
|
||||
var in_time = $('#in_juty_in_time').val();
|
||||
var out_time = $('#in_juty_out_time').val();
|
||||
$('#in_duty').on('click', function () {
|
||||
var ajax_url = "/origami/assign_in_duty";
|
||||
var commissioner_ids = $('#in_duty_commissioner_ids').val();
|
||||
var in_time = $('#in_duty_in_time').val();
|
||||
var out_time = $('#in_duty_out_time').val();
|
||||
var dining_id = '<%= @table.id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&commissioner_ids=" + commissioner_ids +'&in_time=' + in_time + "&out_time=" + out_time,
|
||||
success: function (result) {
|
||||
window.location.href = '/origami/assign_in_juty/'+ dining_id;
|
||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
||||
}
|
||||
});
|
||||
})
|
||||
@@ -2,9 +2,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_juty: @in_juty %>
|
||||
<%= render 'form', in_duty: @in_duty %>
|
||||
</div>
|
||||
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Update In Duty</h3>
|
||||
</div>
|
||||
<%= render 'edit_in_duty', in_duty: @in_duty %>
|
||||
</div>
|
||||
@@ -14,27 +14,27 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @juties_in.each do |in_juty| %>
|
||||
<tr class="injuty_tr" data-ref="<%= in_juty.id %>">
|
||||
<% @duties_in.each do |in_duty| %>
|
||||
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<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 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= in_duty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_duty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
<%= paginate @duties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_duty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
$(document).on('click', ".induty_tr", function () {
|
||||
|
||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var in_duty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
var url = "/origami/assign_in_duty/table/" + table_id + "/in_duty/" + in_duty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -59,22 +59,22 @@
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#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);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
// $('#in_duty_id').val(data.in_duty.id);
|
||||
// $('#in_duty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_duty_in_time').val(data.in_duty.in_time);
|
||||
// $('#in_duty_out_time').val(data.in_duty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
// $("#new_in_duty").attr('class', 'simple_form edit_in_duty');
|
||||
// var id = "edit_in_duty_" + in_duty_id;
|
||||
// $("#new_in_duty").attr('id', id);
|
||||
//
|
||||
// $(".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());
|
||||
// $(".edit_in_duty").attr('id', id);
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
|
||||
// setInterval(function () {
|
||||
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @in_duties, partial: 'in_duties/in_duty', as: :in_duty
|
||||
@@ -18,24 +18,24 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @juties_in.each do |in_juty| %>
|
||||
<tr class="injuty_tr" data-ref="<%= in_juty.id %>">
|
||||
<% @duties_in.each do |in_duty| %>
|
||||
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<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 'Remove', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= in_duty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_duty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Remove', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
<%= paginate @duties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
@@ -45,13 +45,13 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
$(document).on('click', ".induty_tr", function () {
|
||||
|
||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var in_duty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
var url = "/origami/assign_in_duty/table/" + table_id + "/in_duty/" + in_duty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -61,22 +61,22 @@
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#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);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
// $('#in_duty_id').val(data.in_duty.id);
|
||||
// $('#in_duty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_duty_in_time').val(data.in_duty.in_time);
|
||||
// $('#in_duty_out_time').val(data.in_duty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
// $("#new_in_duty").attr('class', 'simple_form edit_in_duty');
|
||||
// var id = "edit_in_duty_" + in_duty_id;
|
||||
// $("#new_in_duty").attr('id', id);
|
||||
//
|
||||
// $(".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());
|
||||
// $(".edit_in_duty").attr('id', id);
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
|
||||
// setInterval(function () {
|
||||
@@ -91,14 +91,14 @@
|
||||
});
|
||||
|
||||
$('#reset').click(function () {
|
||||
var url = "<%= new_origami_in_juty_path %>";
|
||||
var url = "<%= new_origami_in_duty_path %>";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: { table_id: <%= @table.id %> },
|
||||
success: function (data) {
|
||||
$('.partial').empty().append(data);
|
||||
$('.injuty_tr > td > .checkbox_check').prop("checked", false);
|
||||
$('.induty_tr > td > .checkbox_check').prop("checked", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2,9 +2,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Duties</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
@@ -9,34 +9,34 @@
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">In Juty</h4>
|
||||
<h4 class="card-title">In Duty</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="width:20%">Dining Facility Name</td>
|
||||
<td><%= @in_juty.dining_facility.name%></td>
|
||||
<td><%= @in_duty.dining_facility.name%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commissioner Name</td>
|
||||
<td>
|
||||
<%= @in_juty.commissioner.name rescue '-' %>
|
||||
<%= @in_duty.commissioner.name rescue '-' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">In Time</td>
|
||||
<td><%= @in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= @in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Out Time</td>
|
||||
<td><%= @in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= @in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_in_juty_path(@in_juty), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_in_juty_path(@in_juty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
<%= link_to 'Back', origami_in_duties_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_in_duty_path(@in_duty), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_in_duty_path(@in_duty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "in_duties/in_duty", in_duty: @in_duty
|
||||
@@ -1,2 +0,0 @@
|
||||
json.extract! in_juty, :id, :created_at, :updated_at
|
||||
json.url in_juty_url(in_juty, format: :json)
|
||||
@@ -1,6 +0,0 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Update In Juty</h3>
|
||||
</div>
|
||||
<%= render 'edit_in_juty', in_juty: @in_juty %>
|
||||
</div>
|
||||
@@ -1 +0,0 @@
|
||||
json.array! @in_juties, partial: 'in_juties/in_juty', as: :in_juty
|
||||
@@ -1 +0,0 @@
|
||||
json.partial! "in_juties/in_juty", in_juty: @in_juty
|
||||
@@ -0,0 +1,89 @@
|
||||
<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-3">
|
||||
<label class="">Select Date Range</label>
|
||||
<% if @daterange %>
|
||||
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
||||
<% else %>
|
||||
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="">Definition Item</label>
|
||||
<select class="form-control" name="item_code" id="item_code">
|
||||
<option value="">Select Product</option>
|
||||
<% @inventory_definitions.each do |id| %>
|
||||
<option value="<%= id.item_code %>">
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(id.item_code) %>
|
||||
<% if menu_item.nil? %>
|
||||
<%= Product.find_by_item_code(id.item_code).name rescue "-" %>
|
||||
<% else %>
|
||||
<%= menu_item.menu_item.name rescue '-' %> - <%= menu_item.item_instance_name rescue '-' %>
|
||||
<% end %>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#item_code').select2({
|
||||
placeholder: 'Select Product',
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$('#clear_filter').click(function () {
|
||||
$('#daterange').val('');
|
||||
$('#item_code').val('').text('');
|
||||
});
|
||||
|
||||
$('input[name="daterange"]').daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD'
|
||||
}
|
||||
},
|
||||
function (start, end, label) {
|
||||
$('input[name="daterange"]').val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
|
||||
});
|
||||
|
||||
$('input[name="daterange"]').on('apply.daterangepicker', function (ev, picker) {
|
||||
$('input[name="daterange"]').val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
|
||||
|
||||
from_date = picker.startDate.format('YYYY-MM-DD 00:00:00');
|
||||
to_date = picker.endDate.format('YYYY-MM-DD 23:59:59');
|
||||
});
|
||||
|
||||
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||
$('input[name="daterange"]').val('');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
79
app/views/reports/stock_check/index.html.erb
Normal file
79
app/views/reports/stock_check/index.html.erb
Normal file
@@ -0,0 +1,79 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Stock Check Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial => 'stock_check_report_filter',
|
||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
|
||||
<hr/>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-default">Export to
|
||||
Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<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>
|
||||
<tr>
|
||||
<th>Sale</th>
|
||||
<th>Sale Item</th>
|
||||
<th>Commissioner Name</th>
|
||||
<th>Product Name</th>
|
||||
<th>Qty</th>
|
||||
<th>Commission Price</th>
|
||||
<th>Commission Amount</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_qty = 0 %>
|
||||
<% total_price = 0 %>
|
||||
<% total_amount = 0 %>
|
||||
|
||||
<% @transaction.each do |result| %>
|
||||
<tr>
|
||||
<td><%= result.sale_id rescue '-' %></td>
|
||||
<td><%= result.sale_item_id rescue '-' %></td>
|
||||
<td><%= result.commissioner.name rescue '-' %></td>
|
||||
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
|
||||
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
||||
</tr>
|
||||
<% total_qty += result.qty.to_f %>
|
||||
<% total_price += result.price.to_f %>
|
||||
<% total_amount += result.amount.to_f %>
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="4"></td>
|
||||
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
52
app/views/reports/stock_check/index.xls.erb
Normal file
52
app/views/reports/stock_check/index.xls.erb
Normal file
@@ -0,0 +1,52 @@
|
||||
<div class="container margin-top-20">
|
||||
<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>
|
||||
<tr>
|
||||
<th>Commissioner Name</th>
|
||||
<th>Product Name</th>
|
||||
<th>Qty</th>
|
||||
<th>Commission Price</th>
|
||||
<th>Commission Amount</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_qty = 0 %>
|
||||
<% total_price = 0 %>
|
||||
<% total_amount = 0 %>
|
||||
|
||||
<% @transaction.each do |result| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result.commissioner.name rescue '-' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= result.commission.menu_item.name rescue '-' %>
|
||||
</td>
|
||||
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
|
||||
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
||||
</tr>
|
||||
<% total_qty += result.qty.to_f %>
|
||||
<% total_price += result.price.to_f %>
|
||||
<% total_amount += result.amount.to_f %>
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="2"></td>
|
||||
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,18 +39,19 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row checkboxes">
|
||||
<%= f.hidden_field :promo_day, :value => "", :class => "form-control col-md-1" %>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Tuesday" value="2" id="2"> Tue</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Wednesday" value="3" id="3"> Wed</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Thursday" value="4" id="4">Thu</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Friday" value="5" id="5">Fri</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6">Sat</div>
|
||||
<div class="col-md-2"><label class="control-label"><abbr title="required">*</abbr> Promotion Day</label></div>
|
||||
<%= f.hidden_field :promo_day, :class => "form-control" %>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Tuesday" value="2" id="2"> Tue</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Wednesday" value="3" id="3"> Wed</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Thursday" value="4" id="4"> Thu</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Friday" value="5" id="5"> Fri</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6"> Sat</label></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= f.input :promo_type,input_html: { class: "" },
|
||||
@@ -73,11 +74,12 @@
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value="" selected>Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
@@ -109,19 +111,23 @@
|
||||
<div class="row"></div >
|
||||
<%= f.fields_for :promotion_products do |pro| %>
|
||||
<div class="row">
|
||||
<%= pro.hidden_field :item_code,:class => "promo_product" %>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-2" style="text-align:left">
|
||||
<div class="col-md-2 menu_item_choose" style="text-align:left">
|
||||
<select class="form-control item_code_place1">
|
||||
<option value="">Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<option value="<%= a[1 ]%>"><%= a[0] %></option>
|
||||
<option value="<%= a[1 ]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<% sample = [] %>
|
||||
<div class="col-md-2" style="text-align:left"><%= pro.input :item_code, :class => 'promoproduct', collection: sample,input_html: { selected: 2 }, label: false %></div>
|
||||
<!-- <% sample = [] %> -->
|
||||
|
||||
<div class="col-md-2" style="text-align:left"><%= pro.input :item_code, :class => 'promoproduct', collection:[],input_html: { selected: 2 }, label: false %></div>
|
||||
|
||||
<div class="col-md-2"><%= pro.input :min_qty , label: false%></div>
|
||||
<div class="col-md-2"><%= pro.input :net_off , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :net_price , label: false %></div>
|
||||
@@ -156,14 +162,24 @@ $(document).ready(function(){
|
||||
$('#promotion_promo_start_hour').datetimepicker({
|
||||
datepicker:false,
|
||||
format:'H:m'
|
||||
});
|
||||
});
|
||||
$('#promotion_promo_end_hour').datetimepicker({
|
||||
datepicker:false,
|
||||
format:'H:m'
|
||||
});
|
||||
|
||||
$('#promotion_promo_start_hour').on('change', function(event) {
|
||||
$('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
||||
});
|
||||
|
||||
$('#promotion_promo_end_hour').on('change', function(event) {
|
||||
$('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
|
||||
});
|
||||
|
||||
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
||||
jQuery.each( dayy.split(","), function( i, d ) {
|
||||
$("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||
});
|
||||
|
||||
var form = document.getElementById("new_promotion");
|
||||
var inputs = $("input");
|
||||
@@ -197,7 +213,7 @@ $(".selectDay").click(function() {
|
||||
$("#promotion_original_product").select2();
|
||||
$(".item_code_place").select2();
|
||||
$(".item_code_place").on('change', function(event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -223,6 +239,29 @@ $(".selectDay").click(function() {
|
||||
callforpromoproduct();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
// for promotion products data showing
|
||||
var promopdt = $(".promo_product");
|
||||
jQuery.each( promopdt, function( i, ppdt ) {
|
||||
var ajax_url = "<%= settings_find_parent_item_path %>";
|
||||
var item_code = ppdt.value;
|
||||
var select_id = ppdt.id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_instance_code=' + item_code,
|
||||
success: function (result) {
|
||||
if(result.length > 0){
|
||||
$("select#"+select_id).empty();
|
||||
$("select#"+select_id).append("<option value='"+item_code+"'>"+result[0]+"</option>");
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+result[1]+"']").attr("selected","true")
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// promotion_promotion_products_attributes_0_item_code
|
||||
function callforpromoproduct(){
|
||||
$(".item_code_place1").select2();
|
||||
$(".item_code_place1").on('change', function(event) {
|
||||
@@ -234,16 +273,17 @@ $(".selectDay").click(function() {
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#"+id).empty();
|
||||
$("select#"+id).empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#"+id).append(itemlist);
|
||||
$("#"+id).select2();
|
||||
$("select#"+id).append(itemlist);
|
||||
$("select#"+id).select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -36,3 +36,7 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
|
||||
# --- Customer/ Customer - Crm ----
|
||||
Rails.application.config.assets.precompile += %w( addorder.css )
|
||||
Rails.application.config.assets.precompile += %w( addorder.js )
|
||||
|
||||
# --- Inventory Definition ----
|
||||
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
|
||||
|
||||
|
||||
@@ -88,14 +88,14 @@ Rails.application.routes.draw do
|
||||
post 'item_void_cancel' => "sale_edit#item_void_cancel"
|
||||
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
|
||||
post 'apply_void' => 'sale_edit#apply_void'
|
||||
# in_juties
|
||||
get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty'
|
||||
get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty'
|
||||
post 'assign_in_juty/:table_id' => 'in_juties#create_for_in_juty'
|
||||
# in_duties
|
||||
get '/table/:table_id/assign_in_duty' => 'in_duties#assign_in_duty', as: 'assign_in_duty'
|
||||
get 'assign_in_duty/:table_id' => 'in_duties#index_in_duty', as: 'index_in_duty'
|
||||
post 'assign_in_duty/:table_id' => 'in_duties#create_for_in_duty'
|
||||
|
||||
get 'assign_in_juty/table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
|
||||
patch 'edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
|
||||
delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty'
|
||||
get 'assign_in_duty/table/:table_id/in_duty/:id/edit' => 'in_duties#edit_in_duty' ,as: 'edit_in_duty'
|
||||
patch 'edit_in_duty/:id' => 'in_duties#update_for_in_duty', as: 'update_for_in_duty'
|
||||
delete 'table/:table_id/destroy_in_duty/:id' => 'in_duties#destroy_in_duty', as: 'destroy_in_duty'
|
||||
|
||||
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
||||
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
||||
@@ -184,7 +184,8 @@ Rails.application.routes.draw do
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
|
||||
resources :in_juties
|
||||
resources :addorders
|
||||
resources :in_duties
|
||||
|
||||
# product_commission
|
||||
get 'table/:table_id/sale/:sale_id/load_commissioners' => 'product_commissions#load_commissioners', as: 'load_commissioners'
|
||||
@@ -305,6 +306,7 @@ Rails.application.routes.draw do
|
||||
resources :promotion_products
|
||||
end
|
||||
get '/find_item_instance' => 'promotions#find_item_instance', as:'find_item_instance'
|
||||
get '/find_parent_item' => 'promotions#find_parent_item', as:'find_parent_item'
|
||||
|
||||
# commission
|
||||
resources :commissions
|
||||
@@ -335,6 +337,7 @@ Rails.application.routes.draw do
|
||||
resources :credit_payment, :only => [:index, :show]
|
||||
resources :void_sale, :only => [:index, :show]
|
||||
resources :commission, :only => [:index, :show]
|
||||
resources :stock_check, :only => [:index, :show]
|
||||
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class CreateInJuties < ActiveRecord::Migration[5.1]
|
||||
class CreateInDuties < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :in_juties do |t|
|
||||
create_table :in_duties do |t|
|
||||
t.integer :dinning_id
|
||||
t.string :booking_id
|
||||
t.string :sale_id
|
||||
t.json :commissioner_ids
|
||||
t.datetime :in_time
|
||||
t.datetime :out_time
|
||||
@@ -23,7 +23,7 @@ require 'rails_helper'
|
||||
# removed from Rails core in Rails 5, but can be added back in via the
|
||||
# `rails-controller-testing` gem.
|
||||
|
||||
RSpec.describe Origami::InJutiesController, type: :controller do
|
||||
RSpec.describe Origami::InDutiesController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# InJuty. As you add validations to InJuty, be sure to
|
||||
@@ -38,7 +38,7 @@ RSpec.describe Origami::InJutiesController, type: :controller do
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# Origami::InJutiesController. Be sure to keep this updated too.
|
||||
# Origami::InDutiesController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
@@ -1,5 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe InJuty, type: :model do
|
||||
RSpec.describe InDuty, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Reference in New Issue
Block a user