refs #451 Bill Item
This commit is contained in:
parent
ebf79a315c
commit
bbd704635c
@ -161,11 +161,13 @@
|
|||||||
var item_row = '{{ $item_row }}';
|
var item_row = '{{ $item_row }}';
|
||||||
|
|
||||||
$(document).on('click', '#button-add-item', function (e) {
|
$(document).on('click', '#button-add-item', function (e) {
|
||||||
|
var currency_code = $('#currency_code').val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ url("expenses/bills/addItem") }}',
|
url: '{{ url("expenses/bills/addItem") }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
data: {item_row: item_row, currency_code : $('#currency_code').val()},
|
data: {item_row: item_row, currency_code : currency_code},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json['success']) {
|
if (json['success']) {
|
||||||
$('#items tbody #addItem').before(json['html']);
|
$('#items tbody #addItem').before(json['html']);
|
||||||
@ -285,6 +287,7 @@
|
|||||||
$('#item-tax-' + item_id).val(data.tax_id);
|
$('#item-tax-' + item_id).val(data.tax_id);
|
||||||
|
|
||||||
// This event Select2 Stylesheet
|
// This event Select2 Stylesheet
|
||||||
|
$('#item-price-' + item_id).trigger('focusout');
|
||||||
$('#item-tax-' + item_id).trigger('change');
|
$('#item-tax-' + item_id).trigger('change');
|
||||||
|
|
||||||
$('#item-total-' + item_id).html(data.total);
|
$('#item-total-' + item_id).html(data.total);
|
||||||
@ -412,6 +415,28 @@
|
|||||||
$('#discount-total').html(data.discount_total);
|
$('#discount-total').html(data.discount_total);
|
||||||
$('#tax-total').html(data.tax_total);
|
$('#tax-total').html(data.tax_total);
|
||||||
$('#grand-total').html(data.grand_total);
|
$('#grand-total').html(data.grand_total);
|
||||||
|
|
||||||
|
$('.input-price').each(function(){
|
||||||
|
input_price_id = $(this).attr('id');
|
||||||
|
input_currency_id = input_price_id.replace('price', 'currency');
|
||||||
|
|
||||||
|
$('#' + input_currency_id).val(data.currency_code);
|
||||||
|
|
||||||
|
amount = $(this).maskMoney('unmasked')[0];
|
||||||
|
|
||||||
|
$(this).maskMoney({
|
||||||
|
thousands : data.thousands_separator,
|
||||||
|
decimal : data.decimal_mark,
|
||||||
|
precision : data.precision,
|
||||||
|
allowZero : true,
|
||||||
|
prefix : (data.symbol_first) ? data.symbol : '',
|
||||||
|
suffix : (data.symbol_first) ? '' : data.symbol
|
||||||
|
});
|
||||||
|
|
||||||
|
$(this).val(amount);
|
||||||
|
|
||||||
|
$(this).trigger('focusout');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -142,11 +142,13 @@
|
|||||||
var item_row = '{{ $item_row }}';
|
var item_row = '{{ $item_row }}';
|
||||||
|
|
||||||
$(document).on('click', '#button-add-item', function (e) {
|
$(document).on('click', '#button-add-item', function (e) {
|
||||||
|
var currency_code = $('#currency_code').val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ url("expenses/bills/addItem") }}',
|
url: '{{ url("expenses/bills/addItem") }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
data: {item_row: item_row},
|
data: {item_row: item_row, currency_code : currency_code},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json['success']) {
|
if (json['success']) {
|
||||||
$('#items tbody #addItem').before(json['html']);
|
$('#items tbody #addItem').before(json['html']);
|
||||||
@ -293,6 +295,7 @@
|
|||||||
$('#item-tax-' + item_id).val(data.tax_id);
|
$('#item-tax-' + item_id).val(data.tax_id);
|
||||||
|
|
||||||
// This event Select2 Stylesheet
|
// This event Select2 Stylesheet
|
||||||
|
$('#item-price-' + item_id).trigger('focusout');
|
||||||
$('#item-tax-' + item_id).trigger('change');
|
$('#item-tax-' + item_id).trigger('change');
|
||||||
|
|
||||||
$('#item-total-' + item_id).html(data.total);
|
$('#item-total-' + item_id).html(data.total);
|
||||||
@ -406,7 +409,7 @@
|
|||||||
url: '{{ url("common/items/totalItem") }}',
|
url: '{{ url("common/items/totalItem") }}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'),
|
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'], #items input[type=\'number\'], #items input[type=\'hidden\'], #items textarea, #items select'),
|
||||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -420,6 +423,28 @@
|
|||||||
$('#discount-total').html(data.discount_total);
|
$('#discount-total').html(data.discount_total);
|
||||||
$('#tax-total').html(data.tax_total);
|
$('#tax-total').html(data.tax_total);
|
||||||
$('#grand-total').html(data.grand_total);
|
$('#grand-total').html(data.grand_total);
|
||||||
|
|
||||||
|
$('.input-price').each(function(){
|
||||||
|
input_price_id = $(this).attr('id');
|
||||||
|
input_currency_id = input_price_id.replace('price', 'currency');
|
||||||
|
|
||||||
|
$('#' + input_currency_id).val(data.currency_code);
|
||||||
|
|
||||||
|
amount = $(this).maskMoney('unmasked')[0];
|
||||||
|
|
||||||
|
$(this).maskMoney({
|
||||||
|
thousands : data.thousands_separator,
|
||||||
|
decimal : data.decimal_mark,
|
||||||
|
precision : data.precision,
|
||||||
|
allowZero : true,
|
||||||
|
prefix : (data.symbol_first) ? data.symbol : '',
|
||||||
|
suffix : (data.symbol_first) ? '' : data.symbol
|
||||||
|
});
|
||||||
|
|
||||||
|
$(this).val(amount);
|
||||||
|
|
||||||
|
$(this).trigger('focusout');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -373,11 +373,6 @@
|
|||||||
$('#currency_rate').val(data.currency_rate);
|
$('#currency_rate').val(data.currency_rate);
|
||||||
|
|
||||||
$('.input-price').each(function(){
|
$('.input-price').each(function(){
|
||||||
input_price_id = $(this).attr('id');
|
|
||||||
input_currency_id = input_price_id.replace('price', 'currency');
|
|
||||||
|
|
||||||
$('#' + input_currency_id).val(data.currency_code);
|
|
||||||
|
|
||||||
amount = $(this).maskMoney('unmasked')[0];
|
amount = $(this).maskMoney('unmasked')[0];
|
||||||
|
|
||||||
$(this).maskMoney({
|
$(this).maskMoney({
|
||||||
@ -408,13 +403,6 @@
|
|||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'),
|
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'),
|
||||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||||
before: function () {
|
|
||||||
$('.input-price').each(function(){
|
|
||||||
amount = $(this).maskMoney('unmasked')[0];
|
|
||||||
|
|
||||||
$(this).val(amount);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
$.each( data.items, function( key, value ) {
|
$.each( data.items, function( key, value ) {
|
||||||
@ -429,6 +417,11 @@
|
|||||||
$('#grand-total').html(data.grand_total);
|
$('#grand-total').html(data.grand_total);
|
||||||
|
|
||||||
$('.input-price').each(function(){
|
$('.input-price').each(function(){
|
||||||
|
input_price_id = $(this).attr('id');
|
||||||
|
input_currency_id = input_price_id.replace('price', 'currency');
|
||||||
|
|
||||||
|
$('#' + input_currency_id).val(data.currency_code);
|
||||||
|
|
||||||
amount = $(this).maskMoney('unmasked')[0];
|
amount = $(this).maskMoney('unmasked')[0];
|
||||||
|
|
||||||
$(this).maskMoney({
|
$(this).maskMoney({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user