Fix display of discount when reset button for invoice is clicked. #270

This commit is contained in:
Korina Cordero 2020-02-18 02:29:22 +00:00
parent e48e86340a
commit 688ccd8a91

View file

@ -1371,10 +1371,9 @@ $(function() {
// reset the invoice table
$("#btn-reset-invoice").click(function() {
$("#invoice-discount").prop('selectedIndex', 0);
$("#invoice-discount").val(0);
$('.sc-select').closest('.row').remove();
invoiceItems = [];
sc_array = [];
generateInvoice();
});
@ -1389,8 +1388,14 @@ $(function() {
var stype = $("#service_type").val();
var cvid = $("#customer-vehicle").val();
$.each(sc_array, function(index){
console.log('generateInvoice ' + this.id);
sc_array = [];
// get the service charges
$('.sc-select').each(function() {
var id = $(this).children('option:selected').val();
sc_array.push({
id: id,
});
});
// generate invoice values
@ -1677,9 +1682,6 @@ $(function() {
$('#sc-section').append(html);
// clear the sc_array
sc_array.length = 0;
// trigger change in select
$('#sc-section').find('.sc-select').last().change();
return false;
@ -1691,16 +1693,6 @@ $(function() {
$(this).closest('.row').remove();
sc_array.length = 0;
// get the service charges
$('.sc-select').each(function() {
var id = $(this).children('option:selected').val();
sc_array.push({
id: id,
});
});
generateInvoice();
return false;
@ -1710,17 +1702,6 @@ $(function() {
var amount = $(this).children('option:selected').data('amount');
$(this).closest('.row').find('.sc-amount').val(amount);
// clear the sc_array
sc_array.length = 0;
// get the service charges
$('.sc-select').each(function() {
var id = $(this).children('option:selected').val();
sc_array.push({
id: id,
});
});
generateInvoice();
});