finanzen/public/js/billing.js
Markus 842d9050dc html5 datetime instead of jquery
anhang pdf rechnung
2025-05-16 21:21:09 +02:00

86 lines
2.3 KiB
JavaScript

$(function() {
$('.parent').change(function() {
var $subs = $(this).parent().parent().children( ".sub" ).children();
$subs.children().remove().end();
var $output = '';
$liste = subsdata[$(this).val()];
$sort = Object.entries($liste).sort((a,b) => (a[1]>b[1])?1:(b[1]>a[1])?-1:0);
$.each($sort, function(key, value) {
$output += '<option value="'+value[0]+'">' + value[1] + '</option>';
});
$subs.append($output);
});
$('#multi').change(function() {
if($(this).is(":checked")) {
$('.single').addClass('d-none');
$('.multi').removeClass('d-none');
return;
}
$('.single').removeClass('d-none');
$('.multi').addClass('d-none');
//'unchecked' event code
}).change();
$('.dt-amount, .dt-subamount').change(function() {
var temp = convertInput( $(this).val());
$(this).val( convertOutput(temp));
if ($('#multi').is(":checked")) {
recalcOpenAmount();
}
}).change();
});
function logData(event){
var data = document.getElementById("billfile");
console.log(data.value);
}
function addLine(){
$('#linecont > div').each(function () {
if ($(this).hasClass("d-none")){
$(this).removeClass("d-none");
return false;
}
});
}
function convertInput( number )
{
var zahl = number.replace( /\,/g, "." );
var czahl = eval( zahl );
return czahl;
}
function convertOutput( number )
{
if ( typeof number !== 'undefined' )
{
var string = number.toFixed( 2 );
return string.replace( /\,/g, "." );
}
else
return "";
}
function recalcOpenAmount(){
var summe = 0.0;
$('.dt-subamount').each(function () {
b = $(this).val();
b = convertInput(b);
if (typeof b !== 'undefined'){
b = $(this).hasClass("text-danger") ? b*(-1) : b;
summe = summe +b;
}
// summe = summe + convertInput($(this).val());
});
$('#openamount').val(Math.round( ($('#total_in').val() - $('#total_out').val() - summe) * 100 ) / 100);
}
// $('form').submit(function () {
// alert("disable elements");
// $( ".d-none" ).prop( "disabled", true );
// return true;
// });