check product sale report
This commit is contained in:
@@ -83,13 +83,13 @@
|
||||
<span class="order-qty">
|
||||
<%= qid.qty %>
|
||||
</span> ]
|
||||
<% if !qid.set_menu_items.nil?
|
||||
qid.set_menu_items.each do |item_instance|%>
|
||||
<br><span class="font-12">
|
||||
<% if !qid.set_menu_items.nil? %>
|
||||
<% qid.set_menu_items.each do |item_instance|%>
|
||||
<br><span class="font-12">
|
||||
<%= item_instance %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||
$('#cash').text(parseFloat(amt).toFixed(1));
|
||||
$('#cash').text(parseFloat(amt).toFixed(2));
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,127 +1,121 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_product_sale_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
<div class="div_product_sale">
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_product_sale_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="p-l-20 p-t-20 p-b-20">
|
||||
<div class="col-md-6">
|
||||
<label class="font-16" for="order_by">Order by Qty</label>
|
||||
<select name="order_by" id="order_by" class="form-control" style="width:10%">
|
||||
<option value="asc">ASC</option>
|
||||
<option value="desc">DESC</option>
|
||||
</select>
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="p-l-20 p-t-20 p-b-20">
|
||||
<div class="col-md-6">
|
||||
<label class="font-16" for="order_by">Order by Qty</label>
|
||||
<select name="order_by" id="order_by" class="form-control" style="width:10%">
|
||||
<option value="asc">ASC</option>
|
||||
<option value="desc">DESC</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><%= t("views.right_panel.header.menu_category") %></th>
|
||||
<th><%= t("views.right_panel.detail.code") %></th>
|
||||
<th><%= t("views.right_panel.detail.product") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<div class="table-responsive">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><%= t("views.right_panel.header.menu_category") %></th>
|
||||
<th><%= t("views.right_panel.detail.code") %></th>
|
||||
<th><%= t("views.right_panel.detail.product") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbd_data">
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% total_qty = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% total_qty = 0 %>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
total_qty += sale.total_item
|
||||
grand_total += sale.grand_total
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
grand_total += sale.grand_total
|
||||
end %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
total_qty += sale.total_item
|
||||
grand_total += sale.grand_total
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
grand_total += sale.grand_total
|
||||
end %>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td><strong>Total</strong></td>
|
||||
<td><strong><%= total_qty %></strong></td>
|
||||
<td></td>
|
||||
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td><strong>Total</strong></td>
|
||||
<td><strong><%= total_qty %></strong></td>
|
||||
<td></td>
|
||||
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var order_status = '';
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if(order_status == ''){
|
||||
$('#order_by').val('desc');
|
||||
}else{
|
||||
$('#order_by').val(''+order_status+'');
|
||||
}
|
||||
$('#order_by').val('<%= @order_by %>');
|
||||
});
|
||||
|
||||
$('#order_by').on('change', function(){
|
||||
var order_by = $("#order_by").val();
|
||||
order_status = order_by;
|
||||
$('.div_product_sale').html("");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
data: {'order_by' : order_by},
|
||||
datatype: 'JSON',
|
||||
url: '?',
|
||||
url: '?order_by='+order_by,
|
||||
success: function(data) {
|
||||
// window.location.reload();
|
||||
$('.div_product_sale').html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user