add taxes in sale item

This commit is contained in:
Aung Myo
2017-12-04 15:57:23 +06:30
parent 79d7adf170
commit 0c0ba0858a
3 changed files with 34 additions and 12 deletions

View File

@@ -22,9 +22,6 @@ authorize_resource :class => false
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.order('order_by asc')
puts @sale_data.count
puts "sssssss"
puts @tax_profiles.to_json
@from = from
@to = to

View File

@@ -17,6 +17,8 @@ class Reports::SaleitemController < BaseReportController
end
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
puts @sale_taxes.to_json
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}

View File

@@ -60,7 +60,8 @@
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% @sale_data.each do |sale| %>
@@ -153,7 +154,7 @@
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= other_sub_total %></span></td>
<td ><span><%= other_sub_total %></span></td>
</tr>
<!-- End Other Charges -->
@@ -161,8 +162,8 @@
<td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td><%= t("views.right_panel.detail.net_amount") %></td>
<td><span><%= grand_total%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= grand_total%></span></td>
</tr>
<% end %>
@@ -173,8 +174,8 @@
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= total_item_dis %></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= total_item_dis %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
@@ -183,9 +184,31 @@
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= @discount_data %></span></td>
</tr>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= @discount_data %></span></td>
</tr>
<% @sale_taxes.each do |tax| %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= tax.tax_name %></td>
<td><%= tax.st_amount.round(2) %>
<%total_tax += tax.st_amount%>
</td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-top:2px solid grey;">Net Amount</td>
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
<td style="border-top:2px solid grey;"><%= grand_total + total_tax%></td>
</tr>
<!-- <tr>
<td colspan="5">&nbsp;</td>
<td>Grand Total</td>
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
</tr> -->
</tbody>
</table>
</div>