use precision for rounding adj in receipt report. bug fixes for discount.
This commit is contained in:
@@ -44,24 +44,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="order-detail-slimscroll" data-height="160">
|
<div id="order-detail-slimscroll" data-height="160">
|
||||||
<div class="card-text dining">
|
<div class="card-text dining">
|
||||||
<span id="discount_itemsErr" style="color:red;"></span>
|
<span id="discount_itemsErr" style="color:red;"></span>
|
||||||
<table class="table table-default" id="order-items-table">
|
<table class="table table-default" id="order-items-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="item-name">Items</th>
|
<th class="item-name">Items</th>
|
||||||
<th class="item-attr">QTY</th>
|
<th class="item-attr">QTY</th>
|
||||||
<th class="item-attr">Price</th>
|
<th class="item-attr">Price</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% @sale_data.sale_items.each do |sale_item| %>
|
<% @sale_data.sale_items.each do |sale_item| %>
|
||||||
<%
|
<% sub_total += sale_item.qty * sale_item.unit_price %>
|
||||||
sub_total += sale_item.qty*sale_item.unit_price
|
<% if sale_item.price > 0 && sale_item.status.blank? %>
|
||||||
if sale_item.price != 0 && sale_item.status != "void" && sale_item.status != "foc"
|
<tr class="item-row item" id=<%= sale_item.sale_item_id %> >
|
||||||
%>
|
|
||||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||||
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
|
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
|
||||||
@@ -74,14 +72,26 @@
|
|||||||
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<% elsif sale_item.price < 0 && sale_item.status == "Discount" %>
|
||||||
end
|
<tr class="item-row discount" id=<%= sale_item.sale_item_id %> >
|
||||||
end
|
<td style="width:60%; text-align:left">
|
||||||
%>
|
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||||
</tbody>
|
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
|
||||||
</table>
|
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||||
</div>
|
</td>
|
||||||
</div>
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-qty"><%=sale_item.qty.abs%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -132,7 +142,7 @@
|
|||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
<input type="text" id="discount-amount" name="discount-amount" value="0" class="form-control" />
|
||||||
<span id="discount-amountErr" style="color:red;"></span>
|
<span id="discount-amountErr" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@@ -270,6 +280,9 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
|
var totalAmount = <%= sub_total %>;
|
||||||
|
var totalDiscount = <%= @sale_data.total_discount %>
|
||||||
|
var precision = <%= precision %>;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||||
/* check webview loaded*/
|
/* check webview loaded*/
|
||||||
@@ -326,28 +339,12 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Select Sale Item
|
// Select Sale Item
|
||||||
$('.item-row').on('click',function(){
|
$('#order-items-table').on('click', '.item-row', function(){
|
||||||
if($(this).hasClass('selected-item') == true){
|
if($(this).hasClass('selected-item') == true){
|
||||||
$(this).removeClass('selected-item');
|
$(this).removeClass('selected-item');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
|
$(this).addClass('selected-item');
|
||||||
|
|
||||||
$(this).addClass('selected-item');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Select discount-item
|
|
||||||
$('#order-items-table tbody').on('click', '.discount-item-row',function(){
|
|
||||||
if($(this).hasClass('selected-item') == true){
|
|
||||||
$(this).removeClass('selected-item');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
|
|
||||||
|
|
||||||
$(this).addClass('selected-item');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -401,7 +398,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
if(sale_items.length == 0 && account_types.length == 0){
|
if(sale_items.length == 0 && account_types.length == 0){
|
||||||
calculate_overall_discount(0, discount_value);
|
calculate_overall_discount(0, discount_value);
|
||||||
}
|
}
|
||||||
else {
|
else if(sale_items.length > 0){
|
||||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,16 +421,25 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
var discount_value = $('#discount-amount').val();
|
var discount_value = $('#discount-amount').val();
|
||||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||||
|
|
||||||
// Selected Items
|
if(discount_value!=""){
|
||||||
var sale_items = get_selected_sale_items();
|
if(discount_value > 0){
|
||||||
// Selected Account
|
$("#discount-amountErr").val("");
|
||||||
var account_types = get_selected_account_types();
|
|
||||||
|
|
||||||
if(sale_items.length == 0 && account_types.length == 0){
|
// Selected Items
|
||||||
calculate_overall_discount(1, discount_value);
|
var sale_items = get_selected_sale_items();
|
||||||
}
|
// Selected Account
|
||||||
else {
|
var account_types = get_selected_account_types();
|
||||||
calculate_item_discount(1, discount_value, sale_items, account_types);
|
|
||||||
|
if(sale_items.length == 0 && account_types.length == 0){
|
||||||
|
calculate_overall_discount(1, discount_value);
|
||||||
|
} else if(sale_items.length > 0){
|
||||||
|
calculate_item_discount(1, discount_value, sale_items, account_types);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("#discount-amountErr").html("Discount must be greater than 0!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("#discount-amountErr").html("can't be blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove Selection
|
// Remove Selection
|
||||||
@@ -444,14 +450,17 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$("#remove-item").on('click', function(e){
|
$("#remove-item").on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||||
var total = 0;
|
// var total = 0;
|
||||||
|
|
||||||
$('.discount-item-row.selected-item').each(function(i){
|
$('.item-row.new-discount').each(function(i){
|
||||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||||
total = total + Math.abs(amount);
|
totalAmount += Math.abs(amount)
|
||||||
|
// total = total + Math.abs(amount);
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
$("#order-sub-total").text(origin_sub_total + total);
|
|
||||||
|
$("#order-sub-total").text(totalAmount);
|
||||||
|
$("#order-discount").text(totalDiscount.toFixed(<%= precision.to_i %>));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pay Discount for Payment
|
// Pay Discount for Payment
|
||||||
@@ -462,7 +471,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
}
|
}
|
||||||
$("#loading_wrapper").show();
|
$("#loading_wrapper").show();
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
var discount_items = JSON.stringify(get_discount_item_rows());
|
var discount_items = JSON.stringify(get_new_discount_item_rows());
|
||||||
var overall_discount = $("#order-discount").text();
|
var overall_discount = $("#order-discount").text();
|
||||||
var sub_total = $('#order-sub-total').text();
|
var sub_total = $('#order-sub-total').text();
|
||||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||||
@@ -500,13 +509,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
var discount_items = [];
|
var discount_items = [];
|
||||||
|
|
||||||
// Selected Items
|
var sale_items = get_selected_discount_items();
|
||||||
var sale_items = get_selected_sale_items();
|
|
||||||
if(sale_items.length == 0){
|
|
||||||
//swal("Information!", "You have no selected item!");
|
|
||||||
swal ( "Oops" , "You have no selected item!" , "error" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(var i=0;i < sale_items.length;i++){
|
for(var i=0;i < sale_items.length;i++){
|
||||||
if(sale_items[i].price < 0){
|
if(sale_items[i].price < 0){
|
||||||
@@ -625,14 +628,13 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
/* Remove Selection */
|
/* Remove Selection */
|
||||||
function selection_remove(){
|
function selection_remove(){
|
||||||
$(".item-row").removeClass("selected-item");
|
$(".item-row").removeClass("selected-item");
|
||||||
$(".discount_item_row").removeClass("selected-item");
|
|
||||||
$(".accounts-type").removeClass("selected-account");
|
$(".accounts-type").removeClass("selected-account");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get Item rows but not discount*/
|
/* Get Item rows but not discount*/
|
||||||
function get_item_rows(){
|
function get_item_rows(){
|
||||||
var sale_items = [];
|
var sale_items = [];
|
||||||
$('.item-row').not('.discount-item-row').each(function(i){
|
$('.item-row.item').not('.discount').each(function(i){
|
||||||
var sale_item = {};
|
var sale_item = {};
|
||||||
sale_item.id = $(this).attr('id').substr(0,16);
|
sale_item.id = $(this).attr('id').substr(0,16);
|
||||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||||
@@ -644,9 +646,9 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get discount Item rows */
|
/* Get discount Item rows */
|
||||||
function get_discount_item_rows(){
|
function get_new_discount_item_rows(){
|
||||||
var sale_items = [];
|
var sale_items = [];
|
||||||
$('.discount-item-row').each(function(i){
|
$('.item-row.new-discount').each(function(i){
|
||||||
var sale_item = {};
|
var sale_item = {};
|
||||||
sale_item.id = $(this).attr('id');
|
sale_item.id = $(this).attr('id');
|
||||||
sale_item.name = $(this).find('#item-name-price').text();
|
sale_item.name = $(this).find('#item-name-price').text();
|
||||||
@@ -658,23 +660,23 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get discount Item rows */
|
/* Get discount Item rows */
|
||||||
// function get_selected_discount_items(){
|
function get_selected_discount_items(){
|
||||||
// var sale_items = [];
|
var sale_items = [];
|
||||||
// $('.discount-item-row').hasClass('.selected-item').each(function(i){
|
$('.item-row.discount.selected-item').each(function(i){
|
||||||
// var sale_item = {};
|
var sale_item = {};
|
||||||
// sale_item.id = $(this).attr('id');
|
sale_item.id = $(this).attr('id');
|
||||||
// sale_item.name = $(this).find('#item-name-price').text();
|
sale_item.name = $(this).find('#item-name-price').text();
|
||||||
// sale_item.account_id = $(this).find('#item_account_type').text();
|
sale_item.account_id = $(this).find('#item_account_type').text();
|
||||||
// sale_item.price = $(this).find('#item-total-price').text();
|
sale_item.price = $(this).find('#item-total-price').text();
|
||||||
// sale_items.push(sale_item);
|
sale_items.push(sale_item);
|
||||||
// });
|
});
|
||||||
// return sale_items;
|
return sale_items;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/* Get Selected Sale Item's ID and Price */
|
/* Get Selected Sale Item's ID and Price */
|
||||||
function get_selected_sale_items(){
|
function get_selected_sale_items(){
|
||||||
var sale_items = [];
|
var sale_items = [];
|
||||||
$('.item-row.selected-item').each(function(i){
|
$('.item-row.item.selected-item').each(function(i){
|
||||||
var sale_item = {};
|
var sale_item = {};
|
||||||
sale_item.id = $(this).attr('id').substr(0,16);
|
sale_item.id = $(this).attr('id').substr(0,16);
|
||||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||||
@@ -700,7 +702,7 @@ function get_selected_account_types(){
|
|||||||
|
|
||||||
/* Calculate Overall Discount*/
|
/* Calculate Overall Discount*/
|
||||||
function calculate_overall_discount(type, amount){
|
function calculate_overall_discount(type, amount){
|
||||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
var origin_sub_total = parseFloat($("#order-sub-total").text()) + parseFloat($("#order-discount").text());
|
||||||
var dis_amount = 0;
|
var dis_amount = 0;
|
||||||
var sub_total = 0;
|
var sub_total = 0;
|
||||||
var total_discount = 0;
|
var total_discount = 0;
|
||||||
@@ -722,10 +724,12 @@ function calculate_overall_discount(type, amount){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
total_discount = Math.round(origin_sub_total * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
total_discount = Math.round(totalAmount * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub_total = parseFloat(totalAmount) - parseFloat(total_discount)
|
||||||
|
|
||||||
$("#order-discount").text(parseFloat(total_discount).toFixed(<%= precision.to_i %>));
|
$("#order-discount").text(parseFloat(total_discount).toFixed(<%= precision.to_i %>));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +740,7 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
|||||||
var sub_total = 0;
|
var sub_total = 0;
|
||||||
var total_discount = 0;
|
var total_discount = 0;
|
||||||
var arrItemName = "";
|
var arrItemName = "";
|
||||||
var precision = <%= precision %>;
|
|
||||||
$("#discount_itemsErr").html("");
|
$("#discount_itemsErr").html("");
|
||||||
$("#discount-amountErr").html("");
|
$("#discount-amountErr").html("");
|
||||||
// For Net Pay
|
// For Net Pay
|
||||||
@@ -756,20 +760,19 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
if(parseFloat(amount) > parseFloat(sale_items[i].price)){
|
if(parseFloat(amount) > parseFloat(sale_items[i].price)){
|
||||||
arrItemName += ", " + sale_items[i].name;
|
arrItemName += ", " + sale_items[i].name;
|
||||||
|
}else{
|
||||||
|
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||||
|
total_discount = parseFloat(total_discount) + parseFloat(amount);
|
||||||
|
|
||||||
|
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
||||||
|
$("#order-items-table tbody").append(discount_item_row);
|
||||||
}else{
|
}else{
|
||||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
total_discount = parseFloat(total_discount) - parseFloat(amount);
|
||||||
total_discount = parseFloat(total_discount) + parseFloat(amount);
|
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||||
|
|
||||||
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
|
||||||
$("#order-items-table tbody").append(discount_item_row);
|
|
||||||
}else{
|
|
||||||
total_discount = parseFloat(total_discount) - parseFloat(amount);
|
|
||||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -807,6 +810,8 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
sub_total = parseFloat(origin_sub_total) - parseFloat(total_discount);
|
sub_total = parseFloat(origin_sub_total) - parseFloat(total_discount);
|
||||||
|
totalAmount = sub_total
|
||||||
|
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Percentage Pay
|
// For Percentage Pay
|
||||||
@@ -849,6 +854,8 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
sub_total = parseFloat(origin_sub_total) + parseFloat(total_discount);
|
sub_total = parseFloat(origin_sub_total) + parseFloat(total_discount);
|
||||||
|
totalAmount = sub_total
|
||||||
|
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No Needs For Auto Selected
|
// No Needs For Auto Selected
|
||||||
@@ -875,7 +882,6 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
|
||||||
}else{
|
}else{
|
||||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||||
}
|
}
|
||||||
@@ -887,7 +893,7 @@ function item_row_template(type, item, discount_amount, amount){
|
|||||||
if(type == 1){
|
if(type == 1){
|
||||||
dis_str = dis_str + "(" + amount + "%)"
|
dis_str = dis_str + "(" + amount + "%)"
|
||||||
}
|
}
|
||||||
var discount_item_row = "<tr class='discount-item-row' id='" + item.id + "'>" +
|
var discount_item_row = "<tr class='item-row new-discount' id='" + item.id + "'>" +
|
||||||
"<td style='width: 60%; text-align: left;'>" +
|
"<td style='width: 60%; text-align: left;'>" +
|
||||||
"<span id='item_account_type' class='hidden'>" +
|
"<span id='item_account_type' class='hidden'>" +
|
||||||
item.account_id +
|
item.account_id +
|
||||||
|
|||||||
@@ -124,8 +124,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
<td><%= result.cashier_name rescue '-' %></td>
|
<td><%= result.cashier_name rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
<td><%= number_with_precision(result.total_amount, precision: precision.to_i, delimiter: delimiter) %></td>
|
||||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue '0' %>
|
<td><%= number_with_precision(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '0' %>
|
||||||
</td>
|
</td>
|
||||||
<% if !result.sale_taxes.empty? %>
|
<% if !result.sale_taxes.empty? %>
|
||||||
<% num = 1 %>
|
<% num = 1 %>
|
||||||
@@ -154,6 +154,7 @@
|
|||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|
||||||
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) %></td>
|
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) %></td>
|
||||||
<% if @lookup.value.to_i == 1 %>
|
<% if @lookup.value.to_i == 1 %>
|
||||||
@@ -173,12 +174,12 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<tr style="border-top:4px double #666;">
|
<tr style="border-top:4px double #666;">
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(total_sum, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<!-- <% if !@sale_taxes.empty?
|
<!-- <% if !@sale_taxes.empty?
|
||||||
@sale_taxes.each do |tax| %>
|
@sale_taxes.each do |tax| %>
|
||||||
<td>
|
<td>
|
||||||
<b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b>
|
<b><%= number_with_precision(tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
@@ -192,35 +193,35 @@
|
|||||||
if ttax_flag && ttax_count > 0 %>
|
if ttax_flag && ttax_count > 0 %>
|
||||||
<% while num <= ttax_count %>
|
<% while num <= ttax_count %>
|
||||||
<td>
|
<td>
|
||||||
<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
<%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %>
|
||||||
</td>
|
</td>
|
||||||
<% num += 1
|
<% num += 1
|
||||||
end %>
|
end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td>
|
<td>
|
||||||
<%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %>
|
<%= number_with_precision(tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %>
|
||||||
</td>
|
</td>
|
||||||
<%end%>
|
<%end%>
|
||||||
<% num = 1
|
<% num = 1
|
||||||
if ttax_flag==false && ttax_count > 0 %>
|
if ttax_flag==false && ttax_count > 0 %>
|
||||||
<% while num <= ttax_count %>
|
<% while num <= ttax_count %>
|
||||||
<td>
|
<td>
|
||||||
<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
<%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %>
|
||||||
</td>
|
</td>
|
||||||
<% num += 1
|
<% num += 1
|
||||||
end %>
|
end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% @tax_profiles.each do |tax| %>
|
<% @tax_profiles.each do |tax| %>
|
||||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
|
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
|
||||||
|
|
||||||
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
|
<td><b><%= number_with_precision(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user