edit invoice
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0'
|
|||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
# gem 'pg'
|
gem 'pg'
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
|
|||||||
@@ -128,6 +128,11 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-attr-edit{
|
||||||
|
width: 10%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.display-none{
|
.display-none{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -186,4 +191,4 @@ tr.discount-item-row:hover {
|
|||||||
|
|
||||||
.jconfirm-box-container{
|
.jconfirm-box-container{
|
||||||
margin-left:-40px !important
|
margin-left:-40px !important
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||||
|
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
@@ -53,7 +53,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
response["data"].each do |res|
|
response["data"].each do |res|
|
||||||
if res["accountable_type"] == "RebateAccount"
|
if res["accountable_type"] == "RebateAccount"
|
||||||
@balance = res["balance"]
|
@balance = res["balance"]
|
||||||
@accountable_type = res["accountable_type"]
|
# @accountable_type = res["accountable_type"]
|
||||||
|
@accountable_type = "Rebate Balance"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
8
app/controllers/origami/sale_edit_controller.rb
Normal file
8
app/controllers/origami/sale_edit_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Origami::SaleEditController < BaseOrigamiController
|
||||||
|
|
||||||
|
def edit
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
@table_id = params[:table_id]
|
||||||
|
@saleobj = Sale.find(sale_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -20,8 +20,6 @@ class DiningFacility < ApplicationRecord
|
|||||||
|
|
||||||
def get_booking
|
def get_booking
|
||||||
booking = self.get_current_booking
|
booking = self.get_current_booking
|
||||||
puts "is bookig?"
|
|
||||||
puts booking
|
|
||||||
if booking
|
if booking
|
||||||
if booking.dining_facility_id.to_i == self.id
|
if booking.dining_facility_id.to_i == self.id
|
||||||
if booking.booking_status == 'assign'
|
if booking.booking_status == 'assign'
|
||||||
|
|||||||
@@ -260,17 +260,19 @@
|
|||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
<% if @dining.bookings.length >= 1 %>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
|
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||||
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
|
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
|
||||||
<% else %>
|
<% else %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" >Edit</button>
|
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||||
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</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="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
@@ -382,4 +384,10 @@ $('#add_invoice').on('click',function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#edit').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
120
app/views/origami/sale_edit/edit.html.erb
Normal file
120
app/views/origami/sale_edit/edit.html.erb
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<div class="row">
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title row">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p> Receipt No: <span id="receipt_no">
|
||||||
|
<%= @saleobj.receipt_no rescue '' %>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p>Customer : <span id="customer_name"></span></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="card-text">
|
||||||
|
<table class="table table-striped" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th style="item-attr-edit">QTY</td>
|
||||||
|
<th class="item-attr-edit">Price</td>
|
||||||
|
<th class='item-attr'> Action </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
count = 0
|
||||||
|
sub_total = 0
|
||||||
|
@saleobj.sale_items.each do |sale_item|
|
||||||
|
count += 1
|
||||||
|
sub_total = sub_total + sale_item.price
|
||||||
|
%>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||||
|
<%
|
||||||
|
# Can't check for discount
|
||||||
|
unless sale_item.price == 0
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
|
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" /></td>
|
||||||
|
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" /></td>
|
||||||
|
<td class='item-attr'><button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm update'>Update</button>
|
||||||
|
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-sm void'>Void</button></td></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @saleobj.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @saleobj.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @saleobj.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<!-- Waiter Buttons -->
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
// Bill Request
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".update").on('click',function() {
|
||||||
|
var sale_item_id = $(this).attr('data-id');
|
||||||
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
data: 'order_id='+ order_id,
|
||||||
|
success:function(result){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.void').on('click',function(){
|
||||||
|
var sale_item_id = $(this).attr('data-id');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
var table_id = '<%= @table_id %>'
|
||||||
|
window.location.href = '/origami/table/'+ table_id;
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -76,7 +76,7 @@ Rails.application.routes.draw do
|
|||||||
resources :customers #add customer type
|
resources :customers #add customer type
|
||||||
end
|
end
|
||||||
post 'moving' => "movetable#moving"
|
post 'moving' => "movetable#moving"
|
||||||
|
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit"
|
||||||
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
||||||
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
||||||
get 'sale/:sale_id' => 'sales#show'
|
get 'sale/:sale_id' => 'sales#show'
|
||||||
|
|||||||
Reference in New Issue
Block a user