sale items pdf

This commit is contained in:
Zoey
2019-05-30 13:28:24 +06:30
parent 46dd96d0bb
commit b45c639631
4 changed files with 65 additions and 27 deletions

View File

@@ -15,7 +15,7 @@
<hr />
<div class="text-right">
<%= link_to "Print", reports_print_sale_items_path(:type => params[:sale_type], :period => params[:period], :account => params[:account_type], :from => @from, :to => @to, :shift_name => params[:shift_name], :shift_from => @shift_from, :shift_to => @shift_to, :menu_cate_count => @menu_cate_count, :sale_items => @sale_data.to_json), :method => 'post', class:"btn btn-info wave-effects" %>
<button class="btn btn-info wave-effects" onclick="print_sale_items()">Print</button>
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
</div>
@@ -66,6 +66,7 @@
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% row_count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
@@ -78,6 +79,7 @@
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% row_count += 1 %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
@@ -285,6 +287,7 @@
<%end%>
</tbody>
</table>
</div>
</div>
</div>
@@ -293,10 +296,7 @@
<script>
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
@@ -309,7 +309,7 @@
}
}else{
search_by_period();
}
}
$('#sel_period').change(function(){
search_by_period();
@@ -407,4 +407,29 @@
}
});
function print_sale_items(){
var period = $('#sel_period').val();
var type = $('#sel_sale_type').val();
var account = $('#account_type').val();
var from = $('#from').val();
var to = $('#to').val();
var shift = $('#shift_name').val();
// var flag = false;
// alert($('#row_count').val())
// if (flag == true) {
$.ajax({
type: "POST",
url: "<%= reports_print_sale_items_path %>",
data: "period="+period+"&period_type="+type+"&account_type="+account+"&from="+from+"&to="+to+"&shift_name="+shift,
success: function(data){
if (data != null){
location.reload();
}
$("#loader").hide();
}
});
// }
}
</script>