Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -1 +1,3 @@
|
||||
json.array! @customers, :id, :name, :company, :contact_no, :email, :membership_id, :membership_type
|
||||
json.array! @customers, :id, :name, :company, :contact_no,:salution,
|
||||
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||
:membership_id, :created_at
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
json.extract! @customer, :id, :name, :company, :contact_no, :membership_type, :membership_id, :created_at
|
||||
json.extract! @customer, :id, :name, :company, :contact_no,:salution,
|
||||
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||
:membership_id, :created_at
|
||||
json.invoices do
|
||||
json.array! @customer.lastest_invoices ,:id, :receipt_no, :receipt_date, :sale_status, :payment_status
|
||||
end
|
||||
|
||||
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog" style="margin-left:-180px">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Modal Header</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Some text in the modal.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="form-group">
|
||||
<select class="selectpicker form-control col-md-12" name="membership_id">
|
||||
<option>Select Member Group</option>
|
||||
<% @member_group.each do |member| %>
|
||||
<option value="<%= member["id"] %>">
|
||||
<%= member["name"] %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
122
app/views/crm/customers/_new_form.html.erb
Normal file
122
app/views/crm/customers/_new_form.html.erb
Normal file
@@ -0,0 +1,122 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
@@ -11,8 +11,6 @@
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
@@ -26,14 +24,18 @@
|
||||
<td colspan="6">
|
||||
<%= form_tag crm_customers_path, :method => :get do %>
|
||||
<div class="input-append col-md-12 form-group pull-left">
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-md">Search</button>
|
||||
<!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> -->
|
||||
|
||||
<!-- <button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#myModal">Open Modal</button> -->
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Sr.no</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
@@ -42,12 +44,13 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
@@ -57,9 +60,7 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%else%>
|
||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
@@ -67,85 +68,33 @@
|
||||
<%= paginate @crm_customers %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'card_read_form' %>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<%= render 'new_form', crm_customer: @crm_customer %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['name'] %></span>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['email'] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_customers_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
@@ -171,8 +120,28 @@ $(function() {
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_salution').val(data.salution);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
if(data.salution == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
}else if(data.salution == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salution == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
// $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
|
||||
@@ -1,61 +1,74 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= crm_root_path %>">Home</a></li>
|
||||
<li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li>
|
||||
<li><%= @customer.customer_id%></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<!-- Column One -->
|
||||
<div class="tab-pane active" id="queue" role="tabpanel"">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Customer Profile</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @crm_customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><%= @crm_customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact no</th>
|
||||
<td><%= @crm_customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td><%= @crm_customer.company %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Of Birth</th>
|
||||
<td><%= @crm_customer.date_of_birth %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Membership Detail</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<th><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card No</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:created_at, :updated_at,
|
||||
:salution, :gender,:nrc_no,:address,:card_no
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
@@ -1,44 +1,112 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= crm_dining_queues_path %>">Queue</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<%= form_tag crm_assign_table_path, :method => :post do %>
|
||||
<input type="hidden" name="id" value="<%=@queue.id%>">
|
||||
<div class="form-group">
|
||||
<label>Queue No</label>
|
||||
<input type="text" name="queue" class="form-control" readonly="true" value="<%=@queue.queue_no%>">
|
||||
|
||||
</div>
|
||||
<div class="form-inputs">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Table</label>
|
||||
<select class="selectpicker form-control col-md-12" name="table_id" style="height: 40px" >
|
||||
<% @tables.each do |table| %>
|
||||
<option value="<%= table.id %>">
|
||||
<%= table.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-default">Assign Table</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<li>Assign Queue <%=@queue.queue_no%></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
<% @i =0 %>
|
||||
<% DiningFacility.all.each do |table| %>
|
||||
<div class="card assign_table <%= table.status=="available" ? "green" : "red"%>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= @queue.id %></p>
|
||||
<p class="hidden queue-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_dining_queues_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script> -->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).on('click',".assign_table",function(){
|
||||
|
||||
var queue_id = $(this).find(".queue-id").text();
|
||||
var table_id = $(this).attr('data-id');
|
||||
url = '<%= crm_assign_table_path %>';
|
||||
var status = $(this).find(".queue-status").text()
|
||||
|
||||
if (status == "available") {
|
||||
assign_table(queue_id,table_id,url);
|
||||
} else {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'You cannot assign this table',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
function assign_table(id,table_id,url) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
cancel: function () {
|
||||
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url ,
|
||||
data: {id:id,table_id:table_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
window.location.href = '<%=crm_dining_queues_path%>'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,39 +9,41 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" style="max-height:670px; overflow-y:scroll">
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" role="tabpanel">
|
||||
<div class="tab-pane" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @i =0 %>
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<span class="card-title">
|
||||
<%= @i += 1 %> . Queue No </span>
|
||||
<p style="font-size: 30px ;text-align: center;">
|
||||
<strong><%= queue.queue_no %></strong>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
@@ -53,7 +55,7 @@ $(function(){
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
$("#assign").attr("disabled","disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
@@ -0,0 +1,69 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
$(".select-queue").on("click", function(){
|
||||
$('.select-queue').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var status = $(this).find(".queue-status").text();
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
|
||||
});
|
||||
$('#assign').click(function() {
|
||||
var id = $(this).val();
|
||||
window.location.href = "dining_queues/"+id + "/assign"
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
<%= stylesheet_link_tag 'CRM', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'CRM', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> 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", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", reports_sale_item_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid" style="min-height:30px; padding-left:0px !important; padding-right:0px !important; background:#54A5AF; margin-bottom:5px">
|
||||
<div style="padding-top:5px;padding-bottom:5px;margin-left:15px; margin-right:15px;">
|
||||
<div style="float:left;margin-top:3px;text-align:left;color:#ffffff">
|
||||
<strong>Cashier Station 1 - <%= Time.now.strftime('%a, %d %b %Y %H:%M:%S %p') %></strong>
|
||||
<strong>Cashier Station 1 - <span id="clockbox"></span></strong>
|
||||
</div>
|
||||
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">
|
||||
<% if current_login_employee %>
|
||||
@@ -10,3 +10,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
tday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
|
||||
tmonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
|
||||
function GetClock(){
|
||||
var d=new Date();
|
||||
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getFullYear();
|
||||
var nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds(),ap;
|
||||
|
||||
if(nhour==0){ap=" AM";nhour=12;}
|
||||
else if(nhour<12){ap=" AM";}
|
||||
else if(nhour==12){ap=" PM";}
|
||||
else if(nhour>12){ap=" PM";nhour-=12;}
|
||||
|
||||
if(nmin<=9) nmin="0"+nmin;
|
||||
if(nsec<=9) nsec="0"+nsec;
|
||||
|
||||
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
|
||||
}
|
||||
|
||||
window.onload=function(){
|
||||
GetClock();
|
||||
setInterval(GetClock,1000);
|
||||
}
|
||||
</script>
|
||||
<div id="clockbox"></div>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Sr.no</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
@@ -37,12 +38,14 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
@@ -72,32 +75,86 @@
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['name'] %></span>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= 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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['email'] %></span>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
@@ -127,8 +184,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
@@ -170,6 +225,25 @@
|
||||
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
$('#customer_salution').val(data.salution);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
if (data.salution == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
} else if(data.salution == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salution == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Order Details -->
|
||||
<div class="card" >
|
||||
<!-- <div class="card-header">
|
||||
@@ -31,8 +30,9 @@
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||
<tr class="discount-item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
@@ -62,7 +62,7 @@
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@sale_data.total_discount rescue 0%>)</strong></td>
|
||||
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
@@ -75,104 +75,476 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<!-- Discount Amount -->
|
||||
<div class="card row">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Overall Discount</strong></div>
|
||||
<div><strong id="order-title">Discount Control</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
<select name="discount_type" id="discount-type" class="form-control">
|
||||
<option value=0 >Net</option>
|
||||
<option value=1 >Percentage</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<button id="pay-discount" class="btn btn-primary long">Discount</button>
|
||||
<div class="form-group">
|
||||
<%
|
||||
@accounts.each do |acc|
|
||||
%>
|
||||
<button id="account-<%= acc.id %>" class="accounts-type btn btn-default"><%= acc.title %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5" data-type="add">5%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="5" data-type="add">5%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10" data-type="add">10%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="10" data-type="add">10%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50" data-type="add">50%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="50" data-type="add">50%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number"></div>
|
||||
<div class="col-md-4 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-4 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<button id="net" class="btn btn-warning fluid action-btn">Net</button>
|
||||
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
|
||||
<button id="pay-discount" class="btn btn-danger fluid action-btn">Enter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
// update_balance();
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
// update_balance();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
// update_balance();
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
// update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
// update_balance();
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Select Sale Item
|
||||
$('.item-row').on('click',function(){
|
||||
if($(this).hasClass('selected-item') == true){
|
||||
$(this).removeClass('selected-item');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-item');
|
||||
}
|
||||
});
|
||||
|
||||
// Select for account types
|
||||
$(".accounts-type").on('click', function(e){
|
||||
if($(this).hasClass('selected-account') == true){
|
||||
$(this).removeClass('selected-account');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-account');
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Net Discount for Payment
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(0, discount_value);
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Percentage Discount for Payment
|
||||
$("#percentage").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(1, discount_value);
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(1, discount_value, sale_items, account_types);
|
||||
}
|
||||
});
|
||||
|
||||
// Pay Discount
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
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 ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
alert("Successfully Discount!");
|
||||
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);
|
||||
}
|
||||
|
||||
/* Get Item rows but not discount*/
|
||||
function get_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.item-row').not('.discount-item-row').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get discount Item rows */
|
||||
function get_discount_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.discount-item-row').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id');
|
||||
sale_item.name = $(this).find('#item-name-price').text();
|
||||
sale_item.account_id = $(this).find('#item_account_type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
|
||||
/* Get Selected Sale Item's ID and Price */
|
||||
function get_selected_sale_items(){
|
||||
var sale_items = [];
|
||||
$('.selected-item').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get Selected Accounts ID and Price */
|
||||
function get_selected_account_types(){
|
||||
var account_types = [];
|
||||
|
||||
$('.selected-account').each(function(i){
|
||||
var account= {};
|
||||
account.id = $(this).attr('id').substr(8);
|
||||
account.name = $(this).text();
|
||||
account_types.push(account);
|
||||
});
|
||||
return account_types;
|
||||
}
|
||||
|
||||
/* Calculate Overall Discount*/
|
||||
function calculate_overall_discount(type, amount){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
total_discount = amount;
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
}
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
|
||||
$("#order-discount").text(total_discount);
|
||||
}
|
||||
|
||||
/* Calculate Items Discount*/
|
||||
function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total - total_discount;
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check account types exists
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
console.log(account_types);
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
}
|
||||
|
||||
function item_row_template(type, item, discount_amount, amount){
|
||||
var dis_str = "-discount";
|
||||
if(type == 1){
|
||||
dis_str = dis_str + "(" + amount + "%)"
|
||||
}
|
||||
var discount_item_row = "<tr class='item-row discount-item-row' id='" + item.id + "'>" +
|
||||
"<td style='width: 60%; text-align: left;'>" +
|
||||
"<span id='item_account_type' class='hidden'>" +
|
||||
item.account_id +
|
||||
"</span>" +
|
||||
"<span id='item-name-price'>" +
|
||||
item.name + dis_str +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-qty'>1</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-total-price'>" +
|
||||
discount_amount +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"</tr>";
|
||||
return discount_item_row;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block"> Refresh </button>
|
||||
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
@@ -117,4 +117,70 @@ $(document).ready(function(){
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
$(function() {
|
||||
var timer;
|
||||
|
||||
function start() {
|
||||
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 30000); //10000
|
||||
};
|
||||
|
||||
function stop() {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
|
||||
if(localStorage.getItem("refreshflag") != null){
|
||||
if (localStorage.getItem("refreshflag") == 0) {
|
||||
$('#refreshbutton').html("Refresh off");
|
||||
$('#refreshbutton').css("background-color","red");
|
||||
stop();
|
||||
}
|
||||
else{
|
||||
$('#refreshbutton').html("Refresh on");
|
||||
$('#refreshbutton').css("background-color","green");
|
||||
start();
|
||||
}
|
||||
}
|
||||
else{
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
}
|
||||
var url = location.href;
|
||||
if (location.href.slice(-1) == "/"){
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
var arr = url.split("/");
|
||||
|
||||
if(arr[arr.length-1] != "origami"){
|
||||
stop();
|
||||
}
|
||||
$('#refreshbutton').bind("click", function(){
|
||||
if(localStorage.getItem("refreshflag") == "0"){
|
||||
localStorage.setItem("refreshflag", 1);
|
||||
$(this).html("Refresh on");
|
||||
$(this).css("background-color","green");
|
||||
// $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
|
||||
start();
|
||||
}
|
||||
else{
|
||||
stop();
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
$(this).html("Refresh off");
|
||||
$(this).css("background-color","red");
|
||||
}
|
||||
});
|
||||
function refreshing(){
|
||||
if(localStorage.getItem("refreshflag") == "0"){
|
||||
localStorage.setItem("refreshflag", 1);
|
||||
$(this).html("Refresh on");
|
||||
$(this).css("background-color","green");
|
||||
// $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
|
||||
start();
|
||||
}
|
||||
else{
|
||||
stop();
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
$(this).html("Refresh off");
|
||||
$(this).css("background-color","red");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -142,7 +142,10 @@
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
@@ -150,7 +153,7 @@
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -161,7 +164,7 @@
|
||||
count += 1
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
unless order_item.price == 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
@@ -185,7 +188,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_order.total_discount rescue 0%>)</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<% if @status_sale == "sale" %>
|
||||
<tr>
|
||||
@@ -284,20 +287,58 @@ $(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
|
||||
// bind customer to order or sale
|
||||
$("#customer").on('click', function(){
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale!="") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale!="") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
|
||||
if(sale_id!=""){
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
|
||||
@@ -134,6 +134,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
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);
|
||||
|
||||
@@ -133,6 +133,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
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);
|
||||
|
||||
@@ -133,6 +133,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
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);
|
||||
|
||||
@@ -113,14 +113,14 @@
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="row payment other-payment-color" id="card_payment" style="line-height:30px;height: 30px;margin-bottom: 0px;" >
|
||||
<div class="col-md-12">Other Payments</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- mpu -->
|
||||
<% if @other != 0.0 %>
|
||||
<div class="row payment other-payment-color" >
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
@@ -134,7 +134,7 @@
|
||||
<% end %>
|
||||
<!-- paypar -->
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Paypar</div>
|
||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||
@@ -148,7 +148,7 @@
|
||||
<% end %>
|
||||
<!-- Visa -->
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Visa</div>
|
||||
<div class="col-md-4" id="visacount"><%= @visacount %></div>
|
||||
@@ -162,7 +162,7 @@
|
||||
<% end %>
|
||||
<!-- JCB -->
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= @jcbcount %></div>
|
||||
@@ -176,7 +176,7 @@
|
||||
<% end %>
|
||||
<!-- Master -->
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Master</div>
|
||||
<div class="col-md-4" id="mastercount"><%= @mastercount %></div>
|
||||
|
||||
@@ -129,6 +129,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
alert($('#valid_amount').text())
|
||||
$('#used_amount').text($('#valid_amount').text());
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<!-- 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="re-print" class="btn btn-primary btn-block">VOID</button>
|
||||
<button type="button" id="void" class="btn btn-primary btn-block">VOID</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -206,4 +206,10 @@ $('#pay').on('click',function() {
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -133,6 +133,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
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);
|
||||
|
||||
@@ -145,68 +145,7 @@ $(function(){
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
$("#branch").val(<%=params[:branch]%>);
|
||||
$("#waiter").val("<%=params[:waiter]%>");
|
||||
$("#cashier").val(<%=params[:cashier]%>);
|
||||
$("#product").val(<%=params[:product]%>);
|
||||
$("#singer").val(<%=params[:singer]%>);
|
||||
$("#item").val('<%=params[:item]%>');
|
||||
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||
|
||||
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -32,16 +32,16 @@
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr.no</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily Discount)</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>
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr.no</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily Discount)</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>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,7 +30,9 @@
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<th style='text-align:center;'>CT</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -48,7 +50,10 @@
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<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>
|
||||
@@ -28,7 +29,7 @@
|
||||
<option value="4">Taxes Only</option>
|
||||
<option value="5">Other Amount Only</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
@@ -143,69 +144,13 @@ $(function(){
|
||||
$('#frm_report').submit();
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
function export_to(path)
|
||||
{
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
$("#branch").val(<%=params[:branch]%>);
|
||||
$("#waiter").val("<%=params[:waiter]%>");
|
||||
$("#cashier").val(<%=params[:cashier]%>);
|
||||
$("#product").val(<%=params[:product]%>);
|
||||
$("#singer").val(<%=params[:singer]%>);
|
||||
$("#item").val('<%=params[:item]%>');
|
||||
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||
|
||||
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
141
app/views/reports/sale_item/index.html.erb
Normal file
141
app/views/reports/sale_item/index.html.erb
Normal 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_item_index_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>
|
||||
</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>
|
||||
116
app/views/reports/sale_item/index.xls.erb
Normal file
116
app/views/reports/sale_item/index.xls.erb
Normal 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;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily 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"> </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"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<td><%= @sale.receipt_no %></td>
|
||||
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= @sale.sale_status %> </td>
|
||||
<td> <%= @sale.requested_at %> </td>
|
||||
<td> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<th>Sale item name</th>
|
||||
@@ -175,63 +175,63 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
|
||||
<div class="table-responsive">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Customer Profile</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><%= @customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact no</th>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td><%= @customer.company %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Of Birth</th>
|
||||
<td><%= @customer.date_of_birth %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Membership Detail</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<th><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card No</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user