route conflit fix

This commit is contained in:
Zin Lin Phyo
2017-06-26 18:02:08 +06:30
110 changed files with 2477 additions and 441 deletions

View File

@@ -11,24 +11,20 @@
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Salutation :</label><br>
<label>
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
</label>
<label>
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
</label>
<label>
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
</label>
<label>
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
</label>
<label>Mr</label>
<%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%>
<label>Miss</label>
<%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%>
<label>Mrs</label>
<%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%>
<label>Mdm</label>
<%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -37,18 +33,16 @@
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Gender :</label><br>
<label>
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
</label>
<label>
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
</label>
<label>Male</label>
<%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%>
<label>Female</label>
<%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%>
</div>
<div class="form-group">
@@ -62,7 +56,7 @@
<% str="[\"#{msg['company']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -72,7 +66,7 @@
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%>
</div>
@@ -83,7 +77,7 @@
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%>
</div>

View File

@@ -152,7 +152,6 @@ $(document).on('click',".customer_tr",function(){
$("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+customer_id;
alert(id)
$("#new_customer").attr('id', id);
$(".edit_customer").attr('id', id);

View File

@@ -55,12 +55,16 @@
<div class="table-responsive">
<table class="table table-striped">
<thead>
<% puts "'''''''''''''''''''"
puts @response
if @response["status"] == true %>
<tr>
<th colspan="5">Membership Transactions</th>
<% if @response["status"] == true %>
<th>Current Balance : <%= @response["data"][0]["balance"]%></th>
<% end %>
</tr>
<% end %>
<tr>
<th>Date</th>
<th>Redeem</th>
@@ -99,28 +103,22 @@
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
<th>Created at </th>
<th>Order ID </th>
<th>Type</th>
<th>Order status</th>
<th>Order date</th>
<th>Items Count</th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<% @orders.each do |order| %>
<tr>
<td><%= order_item.order_id %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
<td><%= order.order_id %></td>
<td><%= order.order_type %></td>
<td><%= order.status %></td>
<td><%= order.date.strftime("%d-%m-%Y") %> </td>
<td><%= order.item_count %> </td>
</tr>
<% end %>
</tbody>
@@ -135,62 +133,33 @@
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
<th>Sale Id </th>
<th>Receipt no </th>
<th>Grand total</th>
<th>Tax amount</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt Date</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
<% @sales.each do |sale| %>
<tr>
<td><%= sale.sale_id %></td>
<td><%= sale.receipt_no %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="customer" role="tabpanel">
<h3>Sale Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -23,7 +23,6 @@
</div>
<% end %>
<%= yield %>
</div>
</body>
</html>

View File

@@ -38,8 +38,8 @@
<li class="navbar-nav mr-auto dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Reports</a>
<ul class="dropdown-menu">
<li><%= link_to "Daily Sale Report", reports_daily_sale_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales Item Report", reports_sale_item_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Daily Sale Report", reports_daily_sales_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales Item Report", reports_sale_items_path, :tabindex =>"-1" %></li>
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
</ul>
</li>
@@ -49,10 +49,13 @@
<% if current_login_employee %>
<div class="right">
<ul class="navbar-nav mr-auto">
<%if current_login_employee.role !="waiter" %>
<li style="color: #959595"><%= current_login_employee.name %> </li>
<li style="padding-right:10px;padding-left:10px"> | </li>
<li ><%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
</li>
<%end%>
</ul>
</div>
<% end %>

View File

@@ -18,7 +18,16 @@
<%= render 'layouts/header' %>
<div class="container-fluid">
<% flash.each do |type, message| %>
<div class="alert fade-in">
<%
if type== "warning"
alert = "alert-warning"
elsif type== "notice"
alert = "alert-success"
else
alert = "alert-danger"
end
%>
<div class="alert <%=alert%> fade-in">
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
<%= message %>
</div>

View File

@@ -0,0 +1,27 @@
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">Update Quantity</div>
<div class="card-body">
<div class="col-md-12">
<h3><%= @order_item[0].item_name + " - [" + @order_item[0].qty.to_s + "]" %></h3>
<div class="form-group">
<label class="col-md-1">Quantity: </label>
<input type="text" name="qty_weight" class="text-right" value="<%= @order_item[0].qty %>" />
</div>
<div class="form-group">
<label class="col-md-1">Remark: </label>
<textarea rows="2" cols="22" name="remarks"></textarea>
</div>
<div class="form-group">
<a href="<%= oqs_root_path %>" class="btn btn-primary">
<i class="fa fa-arrow-left"></i> Back
</a>
<button id="qty-update" class="btn btn-info" data-id="<%= @order_item[0].order_items_id %>">Update</button>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -29,7 +29,7 @@
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
<div class="tab-content" style="max-height:670px; overflow:auto">
<!--- Panel 0 - Completed -->
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
@@ -39,9 +39,11 @@
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone">
<%= qid.zone %>
</span> -
<span class="order-zone-type"><%= qid.type %> - </span>
<span class="order-zone"><%= qid.zone %></span>
<small class="pull-right"><%= qid.order_id %></small>
</h4>
<h4>
<span class="order-item">
<%= qid.item_name %>
</span> [x
@@ -55,7 +57,7 @@
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.strftime("%Y %m %d") %>
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
@@ -89,15 +91,13 @@
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone">
<%= qid.zone %>
</span> -
<span class="order-item">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<span class="order-zone-type"><%= qid.type %> - </span>
<span class="order-zone"><%= qid.zone %></span>
<small class="pull-right"><%= qid.order_id %></small>
</h4>
<h4>
<span class="order-item"><%= qid.item_name %></span> [x
<span class="order-qty"><%= qid.qty %></span> ]
</h4>
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
@@ -105,7 +105,7 @@
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.strftime("%Y %m %d") %>
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
@@ -116,8 +116,9 @@
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
<div class="card-footer">
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
<div class="card-footer">
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
</div>
</div>
<%
@@ -163,7 +164,7 @@
</tbody>
</table>
</div>
<div class="card-text" style="min-height:400px; max-height:400px; overflow:auto">
<div class="card-text" style="min-height:360px; max-height:360px; overflow:auto">
<table class="table" id="oqs-order-details-table">
<thead>
<tr>

View File

@@ -0,0 +1 @@
json.status true

View File

@@ -1 +1,166 @@
hello Credit
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-3">
<div class="row">
<div class="col-md-6">
<h2>CREDIT PAYMENT</h2>
</div>
</div>
<div class="card" style="margin-top:10px;padding-top:20px;">
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_credit %>" data-member-value="">
</div>
<hr>
</div>
<% if @creditcount != 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Recent Credit Amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@creditcount %>" data-member-value="">
</div>
<hr>
</div>
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Recent Credit Amount</label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
</div>
<hr>
</div>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
</div>
<hr>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
<div class="row">
<div class="col-lg-6 col-md-1 col-sm-1">
<div class="row bottom">
<div class=" cashier_number " data-value="1" data-type="num">1</div>
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="4" data-type="num">4</div>
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="7" data-type="num">7</div>
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="0" data-type="num">0</div>
<div class=" cashier_number left" data-value="." data-type="num">.</div>
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<div class="row bottom">
<div class=" cashier_number green" data-type="nett" >Nett</div>
<div class=" cashier_number red left" data-type="del">Del</div>
<div class=" cashier_number orange left" data-type="clr">Clr</div>
</div>
</div>
<div class="col-lg-6 col-md-1 col-sm-1">
<div class="row bottom">
<div class="cashier_number long" data-value="1000" data-type="add">1000</div>
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
</div>
<div class="row bottom">
<div class="cashier_number long" data-value="5000" data-type="add">5000</div>
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
</div>
<div class="row bottom">
<div class="pay purple" id="credit_pay">Pay</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
</div>
</div>
<script>
$(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_credit %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
if(event.handled !== true) {
var original_value;
original_value = $('#amount').text();
var input_value = $(this).attr("data-value");
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
if (original_value == "0.0"){
$('#amount').text(input_value);
}else{
$('#amount').append(input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#amount').html(amount);
break;
case 'clr':
$('#amount').html("0.0");
break;
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
event.handled = true;
} else {
return false;
}
});
$('#credit_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value"))){
$.ajax({type: "POST",
url: "<%= origami_payment_credit_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
alert("Payment success")
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
});
}else{
alert("Paid Amount is over!");
}
})
</script>

View File

@@ -88,18 +88,14 @@
</div>
<div class="form-group">
<label>Salutation :</label><br>
<label>
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
</label>
<label>
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
</label>
<label>
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
</label>
<label>
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
</label>
<label>Mr</label>
<%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%>
<label>Miss</label>
<%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%>
<label>Mrs</label>
<%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%>
<label>Mdm</label>
<%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -115,12 +111,10 @@
<div class="form-group">
<label>Gender :</label><br>
<label>
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
</label>
<label>
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
</label>
<label>Male</label>
<%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%>
<label>Female</label>
<%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%>
</div>
<div class="form-group">
@@ -161,10 +155,10 @@
<%= f.input :address, :class => "form-control col-md-6 address" %>
</div>
<div class="form-group">
<!-- <div class="form-group">
<label>Sr.No</label>
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
</div>
</div> -->
<div class="form-group">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
@@ -327,16 +321,4 @@
})
</script>
class CreateDiningQueues < ActiveRecord::Migration[5.1]
def change
create_table :dining_queues do |t|
t.string :name
t.string :contact_no
t.string :queue_no
t.string :status
t.references :dining_facility, foreign_key: true
t.timestamps
end
end
end

View File

@@ -199,31 +199,26 @@ $(document).ready(function(){
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#discount-amount').val(input_value);
// update_balance();
$('#discount-amount').val(input_value);
}
else{
$('#discount-amount').val(original_value + '' + input_value);
// update_balance();
$('#discount-amount').val(original_value + '' + input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value);
$('#discount-amount').val(amount);
// update_balance();
$('#discount-amount').val(amount);
break;
case 'del' :
var discount_text=$('#discount-amount').val();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
// update_balance();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
break;
case 'clr':
$('#discount-amount').val("0.0");
// update_balance();
$('#discount-amount').val("0.0");
break;
}
event.handled = true;
@@ -254,19 +249,24 @@ $(document).ready(function(){
// Select for account types
$(".accounts-type").on('click', function(e){
var account_id = $(this).attr('id').substr(8);
if($(this).hasClass('selected-account') == true){
$(this).removeClass('selected-account');
$(".item-row").each(function(i){
if($(this).children().find("#item-account-type").text() == account_id){
$(this).removeClass("selected-item");
}
});
}
else {
$(this).addClass('selected-account');
}
var account_id = $(this).attr('id').substr(8);
$(".item-row").each(function(i){
if($(this).children().find("#item-account-type").text() == account_id){
$(this).addClass("selected-item");
}
});
$(".item-row").each(function(i){
if($(this).children().find("#item-account-type").text() == account_id){
$(this).addClass("selected-item");
}
});
}
});
// Calculate Net Discount for Payment
@@ -332,13 +332,7 @@ $(document).ready(function(){
var sale_id = $('#sale-id').text();
var discount_items = JSON.stringify(get_discount_item_rows());
var overall_discount = $("#order-discount").text();
var sub_total = $('#order-sub-total').text();
// var sale_item_id = $('.selected-item').attr('id').substr(0,16);
// var sub_total = $('#order-sub-total').text();
// var grand_total = $('#order-grand-total').text();
// var discount_type = $('#discount-type').val();
// var discount_value = $('#discount-amount').val();
// var discount_amount = discount_value;
var sub_total = $('#order-sub-total').text();
var ajax_url = "/origami/" + sale_id + "/discount";
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
@@ -354,30 +348,12 @@ $(document).ready(function(){
}
else {
window.location.href = "/origami/room/" + result.table_id
}
// window.history.back();
}
}
});
});
});
/* For Receipt - Update Balance */
function update_balance(){
var discount_amount = $('#discount-amount').val();
var sub_total = $('#order-sub-total').text();
var tax = $('#order-Tax').text();
// For Percentage Discount
// if(discount_type == 1){
// discount_amount=(sub_total*discount_amount)/100;
// }
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
$('#order-discount').text(discount_amount);
$('#order-grand-total').text(total);
}
/* Remove Selection */
function selection_remove(){
$(".item-row").removeClass("selected-item");

View File

@@ -38,12 +38,21 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -121,7 +130,7 @@ $(function() {
var timer;
function start() {
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 30000); //10000
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 10000); //10000
};
function stop() {

View File

@@ -38,16 +38,22 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -108,9 +114,9 @@
<div class="card" >
<div class="card-header">
<% if @status_order == 'order' && @status_sale != 'sale' %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong></div>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
<% end %>
</div>
<div class="card-block">
@@ -126,13 +132,14 @@
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<%end%>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -174,7 +181,7 @@
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + order_item.price
sub_total = sub_total + (order_item.price * order_item.qty)
unless order_item.price == 0 %>
<tr>
@@ -241,18 +248,18 @@
%>
</table>
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<%
end
@sale_array.each do |sale|
<% end %>
<br><br>
Pending Payment
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<br><br>
Pending Payment
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-sm btn-primary '>Show Detail </button></td>
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
</tr>
</table>
<%
@@ -292,12 +299,17 @@
<% end %>
<!-- Cashier Buttons -->
<button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
<% end %>
</div>
</div>
<script>
$(document).ready(function(){
$('.invoicedetails').on('click',function(){
var dining_id = "<%= @dining.id %>";
var sale_id = this.id;
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
})
$(".tables").on('click', function(){
var customer_id=$(".customer-id").text();
@@ -348,6 +360,13 @@ $(document).ready(function(){
});
$('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
});
// Discount for Payment
$('#discount').click(function() {
var sale = $('#sale_id').val();
@@ -473,4 +492,5 @@ $('#edit').on('click',function(){
})
</script>

View File

@@ -189,7 +189,7 @@
<% if @sale_status != 'completed' %>
<button type="button" class="btn btn-primary btn-block" id='move'>MOVE</button>
<% end %>
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
</div>
</div>
<script>

View File

@@ -105,7 +105,7 @@
<div class="row payment credit-color" id="credit_payment" >
<div class="col-md-8">Credit</div>
<div class="col-md-4" id="credit">0.0</div>
<div class="col-md-4" id="credit"><%= @credit %></div>
</div>
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
<div class="row payment other-payment-color" id="card_payment" >
@@ -241,8 +241,10 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
<button type="button" class="btn btn-primary btn-block"> FOC </button>
<button type="button" class="btn btn-primary btn-block"> Void </button>
</div>
</div>

View File

@@ -5,7 +5,7 @@
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem upto </label>
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem up to </label>
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
@@ -21,7 +21,7 @@
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4"> Rebat Balance </label>
<label class="col-lg-4 col-md-4 col-sm-4"> Rebate Balance </label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
@@ -98,6 +98,12 @@
</div>
<script type="text/javascript">
$(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#redeemamt').attr("value",parseFloat("<%= @redeem_prices %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
@@ -131,7 +137,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#used_amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#redeemamt').val();
var remain_amount = $('#valid_amount').val();
$('#used_amount').text(remain_amount);
break;

View File

@@ -0,0 +1,82 @@
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-6">
<% @sale_array.each do |sale| %>
<div class="card tables" data-id="<%= sale.id %>">
<div class="card-block">
<%= sale.receipt_no %>
</div>
</div>
<% end %>
</div>
<!-- Column Two -->
<div class="col-lg-7 col-md-5 col-sm-5">
<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">
<%= @sale.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"><%= @sale.created_at.utc.getlocal.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-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"></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Discount:</strong></td>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.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"><%= @sale.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">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/<%= @room.id %>/table_invoice/' + dining_id;
})
});
$('#pay').on('click',function() {
// var sale_id = $('#sale_id').val();
// window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
$('#back').on('click',function(){
window.location.href = '/origami/table/<%= @room.id %>';
})
</script>

View File

@@ -0,0 +1,147 @@
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-6">
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
<% @sale_array.each do |sale| %>
<div class="card tables" data-id="<%= sale.id %>">
<% if sale.id == @sale.id %>
<div class="card-bl ock" style="background-color:#6080f0;">
<%= sale.receipt_no %>
</div>
<% else %>
<div class="card-block">
<%= sale.receipt_no %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="col-lg-7 col-md-5 col-sm-5">
<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">
<%= @sale.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"><%= @sale.created_at.utc.getlocal.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">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
</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 class="item-attr">QTY</td>
<th class="item-attr">Price</td>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@sale.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].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'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + order_item.price
unless order_item.price == 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
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">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.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"><%= @sale.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">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/<%= @room.id %>/table_invoice/' + dining_id;
})
});
$('#pay').on('click',function() {
window.location.href = '/origami/sale/<%= @sale.id %>/payment';
});
$('#back').on('click',function(){
window.location.href = '/origami/table/<%= @room.id %>';
})
</script>

View File

@@ -38,16 +38,21 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% if table.get_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block">
@@ -108,9 +113,9 @@
<div class="card" >
<div class="card-header">
<% if @status == 'order' %>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong></div>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% end %>
</div>
@@ -129,8 +134,10 @@
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<p>Customer : <%= @customer.name %></p>
<%end%>
</div>
</div>
@@ -148,7 +155,7 @@
sub_total = 0
if @status == "sale"
@obj.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
<% unless sale_item.price == 0 %>
@@ -165,7 +172,7 @@
if @status == 'order'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
sub_total = sub_total + (order_item.price * order_item.qty)
unless order_item.price == 0 %>
<tr>
@@ -250,7 +257,7 @@
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
</div>
</div>
<script>
@@ -258,28 +265,28 @@ $(document).ready(function(){
$(".tables").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;
})
$(".sales").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/sale/' + sale_id;
})
$(".rooms").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/room/' + dining_id;
})
$(".orders").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var order_id = $(this).attr("data-id");
window.location.href = '/origami/order/' + order_id;
})

View File

@@ -0,0 +1 @@
json.status true

View File

@@ -0,0 +1 @@
json.status true

View File

@@ -1,6 +1,6 @@
<div class="row">
<!-- Column Two -->
<div class="col-lg-11 col-md-11 col-sm-11">
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong></div>
@@ -13,7 +13,7 @@
</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>
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
@@ -23,7 +23,7 @@
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
<table class="table " id="order-items-table">
<thead>
<tr>
<th>#</th>
@@ -49,13 +49,23 @@
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
<% if sale_item.remark != 'void' %>
<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>
<% if sale_item.remark != 'void' || sale_item.qty.to_i > 0 %>
<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>
<% elsif sale_item.qty.to_i < 0 %>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td>
<td class='item-attr'>
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm cancel'>Cancel Void</button>
</td>
<% else %>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td>
<td></td>
<% end %>
</tr>
<%
@@ -70,18 +80,6 @@
<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>
@@ -91,9 +89,11 @@
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void' >Cancel All Void</button>
<button type="button" class="btn btn-primary btn-block" id='apply' >Apply</button>
</div>
</div>
<script>
@@ -125,10 +125,51 @@ $(document).ready(function(){
});
})
$('.cancel').on('click',function(){
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id,
success:function(result){
location.reload();
}
});
})
})
$('#back').on('click',function(){
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/'+ table_id;
})
$('#cancel_all_void').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
location.reload();
}
});
})
$('#apply').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
window.location.href = '/origami/table/'+ table_id ;
}
});
})
</script>

View File

@@ -0,0 +1 @@
json.status true

View File

@@ -0,0 +1,82 @@
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-6">
<% @sale_array.each do |sale| %>
<div class="card tables" data-id="<%= sale.id %>">
<div class="card-block">
<%= sale.receipt_no %>
</div>
</div>
<% end %>
</div>
<!-- Column Two -->
<div class="col-lg-7 col-md-5 col-sm-5">
<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">
<%= @sale.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"><%= @sale.created_at.utc.getlocal.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-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"></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Discount:</strong></td>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.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"><%= @sale.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">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
})
});
$('#pay').on('click',function() {
// var sale_id = $('#sale_id').val();
// window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
$('#back').on('click',function(){
window.location.href = '/origami/table/<%= @table.id %>';
})
</script>

View File

@@ -0,0 +1,147 @@
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-6">
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
<% @sale_array.each do |sale| %>
<div class="card tables" data-id="<%= sale.id %>">
<% if sale.id == @sale.id %>
<div class="card-block" style="background-color:#6080f0;">
<%= sale.receipt_no %>
</div>
<% else %>
<div class="card-block">
<%= sale.receipt_no %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="col-lg-7 col-md-5 col-sm-5">
<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">
<%= @sale.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"><%= @sale.created_at.utc.getlocal.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">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
</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 class="item-attr">QTY</td>
<th class="item-attr">Price</td>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@sale.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].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'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + order_item.price
unless order_item.price == 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
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">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.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"><%= @sale.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">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
})
});
$('#pay').on('click',function() {
window.location.href = '/origami/sale/<%= @sale.id %>/payment';
});
$('#back').on('click',function(){
window.location.href = '/origami/table/<%= @table.id %>';
})
</script>

View File

@@ -7,14 +7,14 @@
<div class="container">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sale_index_path} %>
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
<hr />
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_daily_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
<a href="javascript:export_to('<%=reports_daily_sales_path%>.xls')" class = "btn btn-default">Export to Excel</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,151 @@
<div class="row">
<div class="col-md-12">
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="form-group col-md-2">
<label>Select Period</label>
<select name="period" id="sel_period" class="form-control">
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
<!-- <div class="form-group col-md-2">
<label>Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="0">All Sale Type</option>
<option value="1">Revenue Only</option>
<option value="2">Discount Only</option>
<option value="3">Void Only</option>
<option value="4">Taxes Only</option>
<option value="5">Other Amount Only</option>
</select>
</div> -->
<div class="form-group col-md-3">
<!-- <label class="">Select Shift Period</label> -->
<label class="">From</label>
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
</div>
<div class="form-group col-md-3">
<label class="">To</label>
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div>
<% end %>
<!-- <div class="row">
<% if defined? show_monthly %>
<div class="span3" style="margin-bottom:10px;">
<input type="hidden" id="report_type" name="report_type" value="0">
<div class="btn-group" data-toggle="buttons-radio">
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
</div>
</div>
<% end %>
</div> -->
<div class="row">
<div class="form-group">
<% if defined? promotions %>
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
<% end %>
<% if defined? menu_types %>
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
<% end %>
<% if defined? payments %>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
<% end %>
<% if defined? shift_name %>
<!-- Temporary no needs
<select name="shift_name" id="shift_name"></select>
-->
<% end %>
<% if defined? cashiers %>
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
<% end %>
<% if defined? singer %>
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
<% end %>
<% if defined? bsm %>
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
<% end %>
<% if defined? guest_role %>
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
<% end %>
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
<% end %>
<% if defined? products %>
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
<% end %>
<% if defined? items %>
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
<% end %>
</div>
</div>
<!-- <div class="row">
<div class="col-md-12">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div> -->
<% end %>
</div>
</div>
<!--
<div class = "row">
<div class = "span3">
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
</div>
<div class = "span3">
<select name="shift" id="shift">
<option value="">All Shift</option>
</select>
</div>
<div class = "span3">
</div>
</div>
-->
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
});
</script>

View File

@@ -0,0 +1,190 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Daily Sale Report</li>
</ul>
</div>
<div class="container">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
<hr />
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_daily_sales_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-bordered">
<thead>
<% if params[:from]%>
<tr>
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
</tr>
<% end %>
<tr>
<th style='text-align:center;'>Sr.no</th>
<th style='text-align:center;'>Date</th>
<th style='text-align:center;'>Void Amount</th>
<th style='text-align:center;'>Mpu Sales</th>
<th style='text-align:center;'>Master Sales</th>
<th style='text-align:center;'>Visa Sales</th>
<th style='text-align:center;'>Jcb Sales</th>
<th style='text-align:center;'>Paypar Sales</th>
<th style='text-align:center;'>Cash Sales</th>
<th style='text-align:center;'>Credit Sales</th>
<th style='text-align:center;'>FOC Sales</th>
<th style='text-align:center;'>(Discount)</th>
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
<th style='text-align:center;'>Rounding Adj.</th>
<th style='text-align:center;'>Grand Total</th>
</tr>
</thead>
<% unless @sale_data.empty? %>
<tbody>
<% void = 0 %>
<% mpu = 0 %>
<% master = 0 %>
<% visa = 0 %>
<% jcb = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% total = 0 %>
<% grand_total = 0 %>
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% rounding_adj += sale[:rounding_adj].to_f %>
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
</tr>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="3" style='text-align:center;'>Total</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
</tr>
<% total_tax = 0 %>
<% unless @tax.empty? %>
<% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
<% net = total - total_tax %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'>Net Amount</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
<script>
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
if(parseInt(search) == 0){
search_by_period();
}
else{
search_by_date();
}
}else{
search_by_period();
}
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
}
$('#from').change(function(){
search_by_date();
});
$('#to').change(function(){
search_by_date();
});
function search_by_date(){
var from = $('#from').val();
var to = $('#to').val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
// console.log(check_arr.length)
if(check_arr.length == 1){
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
});
</script>

View File

@@ -0,0 +1,116 @@
<div class="card row">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<% if params[:from]%>
<tr>
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
</tr>
<% end %>
<tr>
<th style='text-align:center;'>Sr.no</th>
<th style='text-align:center;'>Date</th>
<th style='text-align:center;'>Void Amount</th>
<th style='text-align:center;'>Mpu Sales</th>
<th style='text-align:center;'>Master Sales</th>
<th style='text-align:center;'>Visa Sales</th>
<th style='text-align:center;'>Jcb Sales</th>
<th style='text-align:center;'>Paypar Sales</th>
<th style='text-align:center;'>Cash Sales</th>
<th style='text-align:center;'>Credit Sales</th>
<th style='text-align:center;'>FOC Sales</th>
<th style='text-align:center;'>(Discount)</th>
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
<th style='text-align:center;'>Rounding Adj.</th>
<th style='text-align:center;'>Grand Total</th>
</tr>
</thead>
<% unless @sale_data.empty? %>
<tbody>
<% void = 0 %>
<% mpu = 0 %>
<% master = 0 %>
<% visa = 0 %>
<% jcb = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% total = 0 %>
<% grand_total = 0 %>
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% rounding_adj += sale[:rounding_adj].to_f %>
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
</tr>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="3" style='text-align:center;'>Total</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
</tr>
<% total_tax = 0 %>
<% unless @tax.empty? %>
<% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
<% net = total - total_tax %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'>Net Amount</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>

View File

@@ -7,14 +7,14 @@
<div class="container">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_item_index_path} %>
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %>
<hr />
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_sale_item_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
<a href="javascript:export_to('<%=reports_sale_items_path%>.xls')" class = "btn btn-default">Export to Excel</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,156 @@
<div class="row">
<div class="col-md-12">
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="form-group col-md-2">
<label>Select Period</label>
<select name="period" id="sel_period" class="form-control">
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<input type="hidden" name="report_type" value="sale_item" id="sel_sale_type">
<!-- <div class="form-group col-md-2">
<label>Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="0">All Sale Type</option>
<option value="1">Revenue Only</option>
<option value="2">Discount Only</option>
<option value="3">Void Only</option>
<option value="4">Taxes Only</option>
<option value="5">Other Amount Only</option>
</select>
</div> -->
<div class="form-group col-md-3">
<!-- <label class="">Select Shift Period</label> -->
<label class="">From</label>
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
</div>
<div class="form-group col-md-3">
<label class="">To</label>
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div>
<% end %>
<!-- <div class="row">
<% if defined? show_monthly %>
<div class="span3" style="margin-bottom:10px;">
<input type="hidden" id="report_type" name="report_type" value="0">
<div class="btn-group" data-toggle="buttons-radio">
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
</div>
</div>
<% end %>
</div> -->
<div class="row">
<div class="form-group">
<% if defined? promotions %>
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
<% end %>
<% if defined? menu_types %>
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
<% end %>
<% if defined? payments %>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
<% end %>
<% if defined? shift_name %>
<!-- Temporary no needs
<select name="shift_name" id="shift_name"></select>
-->
<% end %>
<% if defined? cashiers %>
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
<% end %>
<% if defined? singer %>
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
<% end %>
<% if defined? bsm %>
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
<% end %>
<% if defined? guest_role %>
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
<% end %>
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
<% end %>
<% if defined? products %>
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
<% end %>
<% if defined? items %>
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
<% end %>
</div>
</div>
<!-- <div class="row">
<div class="col-md-12">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div> -->
<% end %>
</div>
</div>
<!--
<div class = "row">
<div class = "span3">
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
</div>
<div class = "span3">
<select name="shift" id="shift">
<option value="">All Shift</option>
</select>
</div>
<div class = "span3">
</div>
</div>
-->
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
function export_to(path)
{
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
}
});
</script>

View File

@@ -0,0 +1,141 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Daily Sale Report</li>
</ul>
</div>
<div class="container">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %>
<hr />
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_sale_items_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>Date</th>
<th id="date"></th>
</tr>
<tr>
<th>Menu Category</th>
<th>Code</th>
<th>Product</th>
<th>Total Item</th>
<th>Unit Price</th>
<th>Revenue</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
var cate = [];
var y;
var count = 0;
var sub_total = 0;
var sub_total_arr = [];
<% @sale_data.each do |result| %>
count = count + 1;
if(count == 1)
$('#date').append('<%= result.date_name rescue '-'%>');
y = $.inArray(<%= result.menu_category_id %>, cate);
if(y == -1){
//add sub total row
sub_total_arr.push(sub_total);
var total_row = '<tr><td colspan="4"></td>'+
'<td > Sub Total</td> ' +
'<td><span class="underline">'+ sub_total +'</span></td>'+
'</tr>';
if(count != 1){
$('.table').append(total_row);
sub_total = 0;
}
cate.push(<%= result.menu_category_id %>);
var th = '<tr><td colspan="6"><%= result.menu_category_name rescue '-'%></td></tr>';
var tr = '<tr>'+
'<td></td>'+
'<td><%= result.code rescue '-'%></td>' +
'<td><%= result.product_name rescue '-'%></td>' +
'<td><%= result.total_item.to_i rescue '-'%></td>' +
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%>'+
'</td>'+
'</tr>';
$('.table').append(th);
$('.table').append(tr);
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
}
else{
var tr = '<tr>'+
'<td></td>'+
'<td><%= result.code rescue '-'%></td>' +
'<td><%= result.product_name rescue '-'%></td>' +
'<td><%= result.total_item.to_i rescue '-'%></td>' +
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%></td></tr>';
$('.table').append(tr);
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
}
<% end %>
last_line_subtotal(sub_total);
sub_total_arr.push(parseInt(sub_total));
grand_total(sub_total_arr);
})
function last_line_subtotal(sub_total){
var total_row = '<tr><td colspan="4"></td>'+
'<td > Sub Total</td> ' +
'<td><span class="underline">'+ sub_total +'</span></td>'+
'</tr>';
$('.table').append(total_row);
}
function grand_total(sub_total_arr){
var total = 0;
for(var i=0; i< sub_total_arr.length; i++){
//total_1 = (total_1) + (sub_total_arr[i]);
total = parseInt(total) + parseInt(sub_total_arr[i]);
}
var row = '<tr><td colspan="4"></td>'+
'<td > Grand Total</td> ' +
'<td><span class="double_underline">'+ total +'</span></td>'+
'</tr>';
$('.table').append(row);
}
</script>

View File

@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="span12">
<% unless @sale_data.blank? %>
<table class="table table-striped" id="items_table" border="0">
<thead>
<% if !params[:from].blank?%>
<tr>
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
</tr>
<% end %>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>&nbsp;</th>
<th>Menu Category</th>
<th>Code</th>
<th>Product</th>
<th>Total Item</th>
<th>Unit Price</th>
<th>Revenue</th>
</tr>
</thead>
<tbody>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% sub_total = 0.0 %>
<% count = 0%>
<% total_price = 0.0 %>
<% cate_count = 0 %>
<% acc_count = 0%>
<% grand_total = 0%>
<% total_discount = 0.0 %>
<% @sale_data.order("total_item desc").each do |sale| %>
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
<td colspan="4">&nbsp;</td>
<td>Total Price By <%= sale.account_name %></td>
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= total %></b>
<% end %>
<% end %>
</td>
</tr>
<% acc_arr.push(sale.account_id) %>
<% end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.code rescue '-' %></td>
<% if @item_table == 'sale' %>
<% if sale.item_remark == 'FOC' %>
<td><%= '[PROMO] '.to_s + sale.product_name.to_s rescue '-' %></td>
<% elsif sale.item_remark == 'FOC ITEM' %>
<td><%= '[DIS:QTY] '.to_s + sale.product_name.to_s rescue '-' %></td>
<% elsif sale.item_remark == 'DISCOUNT' %>
<td><%= '[DIS:TP] '.to_s + sale.product_name.to_s rescue '-' %></td>
<% else %>
<td><%= sale.product_name.to_s rescue '-' %></td>
<% end %>
<% if sale.item_remark == 'DISCOUNT' %>
<td> - </td>
<td> - </td>
<td><%= sale.total_price.abs rescue '-' %></td>
<% total_price += sale.total_price %>
<% else %>
<td><%= sale.total_item.abs rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total.abs rescue '-' %></td>
<% end %>
<% else %>
<td><%= sale.product_name.to_s rescue '-' %></td>
<td><%= sale.total_item.abs rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total.abs rescue '-' %></td>
<% end %>
</tr>
<!-- sub total -->
<% @menu_cate_count.each do |key,value| %>
<% if sale.menu_category_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% if count == value %>
<tr>
<td colspan="5">&nbsp;</td>
<td>Sub Total</td>
<td ><span class="underline"><%= sub_total + total_price %></span></td>
</tr>
<% sub_total = 0.0%>
<% total_discount = total_discount + total_price %>
<% total_price = 0.0%>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<!-- end sub total -->
<% grand_total += sale.grand_total%>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td>Grand Total</td>
<td><span class="double_underline"><%= grand_total + total_discount %></span></td>
</tr>
</tbody>
</table>
<% end %>
</div>
</body>
</html>

View File

@@ -16,9 +16,9 @@
<tr>
<th>Title</th>
<th>Account Type</th>
<th>Can get Discount</th>
<!-- <th>Can get Discount</th> -->
<th>Can get Points</th>
<th>Can get Bonus</th>
<!-- <th>Can get Bonus</th> -->
<th>Can rebate</th>
<th style="">Action</th>
@@ -30,9 +30,9 @@
<tr>
<td><%= account.title %></td>
<td><%= account.account_type %></td>
<td><%= account.discount %></td>
<!-- <td><%= account.discount %></td> -->
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<!-- <td><%= account.bonus %></td> -->
<td><%= account.rebate %></td>
<td>
<%= link_to 'Edit', edit_settings_account_path(account) %> |

View File

@@ -1,4 +1,4 @@
<!-- -->
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
@@ -17,9 +17,9 @@
<tr>
<th>Title</th>
<th>Account type</th>
<th>Can get Discount</th>
<!-- <th>Can get Discount</th> -->
<th>Can get Points</th>
<th>Can get Bonus</th>
<!-- <th>Can get Bonus</th> -->
<th>Can rebate</th>
<th>Action</th>
</tr>
@@ -29,9 +29,9 @@
<tr>
<td><%= @settings_account.title %></td>
<td><%= @settings_account.account_type %></td>
<td><%= @settings_account.discount %></td>
<!-- <td><%= @settings_account.discount %></td> -->
<td><%= @settings_account.point %></td>
<td><%= @settings_account.bonus %></td>
<!-- <td><%= @settings_account.bonus %></td> -->
<td><%= @settings_account.rebate %></td>
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>

View File

@@ -18,9 +18,9 @@
<td><%= settings_lookup.lookup_type %></td>
<td><%= settings_lookup.name %></td>
<td><%= settings_lookup.value %></td>
<td><%= link_to 'Show', settings_lookup %></td>
<td><%= link_to 'Show', settings_lookup_path(settings_lookup) %></td>
<td><%= link_to 'Edit', edit_settings_lookup_path(settings_lookup) %></td>
<td><%= link_to 'Destroy', settings_lookup, method: :delete, data: { confirm: 'Are you sure?' } %></td>
<td><%= link_to 'Destroy', settings_lookup_path(settings_lookup), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>