Fix display of discount when reset button for invoice is clicked. #270
This commit is contained in:
parent
e48e86340a
commit
688ccd8a91
1 changed files with 45 additions and 64 deletions
|
|
@ -1371,10 +1371,9 @@ $(function() {
|
||||||
|
|
||||||
// reset the invoice table
|
// reset the invoice table
|
||||||
$("#btn-reset-invoice").click(function() {
|
$("#btn-reset-invoice").click(function() {
|
||||||
$("#invoice-discount").prop('selectedIndex', 0);
|
$("#invoice-discount").val(0);
|
||||||
$('.sc-select').closest('.row').remove();
|
$('.sc-select').closest('.row').remove();
|
||||||
invoiceItems = [];
|
invoiceItems = [];
|
||||||
sc_array = [];
|
|
||||||
generateInvoice();
|
generateInvoice();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1389,8 +1388,14 @@ $(function() {
|
||||||
var stype = $("#service_type").val();
|
var stype = $("#service_type").val();
|
||||||
var cvid = $("#customer-vehicle").val();
|
var cvid = $("#customer-vehicle").val();
|
||||||
|
|
||||||
$.each(sc_array, function(index){
|
sc_array = [];
|
||||||
console.log('generateInvoice ' + this.id);
|
|
||||||
|
// get the service charges
|
||||||
|
$('.sc-select').each(function() {
|
||||||
|
var id = $(this).children('option:selected').val();
|
||||||
|
sc_array.push({
|
||||||
|
id: id,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// generate invoice values
|
// generate invoice values
|
||||||
|
|
@ -1677,9 +1682,6 @@ $(function() {
|
||||||
|
|
||||||
$('#sc-section').append(html);
|
$('#sc-section').append(html);
|
||||||
|
|
||||||
// clear the sc_array
|
|
||||||
sc_array.length = 0;
|
|
||||||
|
|
||||||
// trigger change in select
|
// trigger change in select
|
||||||
$('#sc-section').find('.sc-select').last().change();
|
$('#sc-section').find('.sc-select').last().change();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1691,16 +1693,6 @@ $(function() {
|
||||||
|
|
||||||
$(this).closest('.row').remove();
|
$(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();
|
generateInvoice();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1710,17 +1702,6 @@ $(function() {
|
||||||
var amount = $(this).children('option:selected').data('amount');
|
var amount = $(this).children('option:selected').data('amount');
|
||||||
$(this).closest('.row').find('.sc-amount').val(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();
|
generateInvoice();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue