promotion add in report

This commit is contained in:
Aung Myo
2018-06-21 14:39:34 +06:30
parent e45e17968f
commit ad4bf1451b
5 changed files with 69 additions and 10 deletions

View File

@@ -28,6 +28,7 @@
<option value="discount">Discount Only</option>
<option value="void">Void Only</option>
<option value="foc">Foc Only</option>
<option value="promotion">Promotion Only</option>
<option value="other">Other Amount Only</option>
</select>
</div>

View File

@@ -79,7 +79,7 @@
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc"
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
@@ -88,6 +88,9 @@
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.remark =="promotion"
total_qty += sale.total_item
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
@@ -140,12 +143,16 @@
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") && sale.status_type != "promotion"
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if sale.remark == "promotion"
sub_qty += sale.total_item
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>

View File

@@ -48,10 +48,11 @@
%>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
@@ -67,7 +68,7 @@
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc"
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
@@ -76,6 +77,9 @@
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.remark =="promotion"
total_qty += sale.total_item
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
@@ -128,12 +132,16 @@
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") && sale.status_type != "promotion"
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if sale.remark == "promotion"
sub_qty += sale.total_item
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
@@ -150,8 +158,47 @@
<% end %>
<!-- end sub total -->
<% end %>
<!--Product Sale -->
<% if @product.present?%>
<tr>
<td><b>Product</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
<tr>
<td>&nbsp;</td>
<td>Product</td>
<td><%= product.product_code rescue '-' %></td>
<td><%= product.product_name rescue '-' %></td>
<td><%= product.total_item rescue '-' %></td>
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% product_sub_total += product.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total Product Qty </b> </td>
<td><b><%= p_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Product Sale -->
<!--Other Charges -->
<% if @type == "other"%>
<% if @type == "other" || @other_charges.present?%>
<tr>
<td><b>Other Charges</b></td>
@@ -205,7 +252,7 @@
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>