rechnungsanhang handlign

charts bugfix only empty database
This commit is contained in:
Markus
2026-06-08 15:58:11 +02:00
parent aedd66202a
commit 6457f38f01
7 changed files with 117 additions and 96 deletions

View File

@@ -1,81 +1,97 @@
$(function() {
$('.parent').change(function() {
var $subs = $(this).parent().parent().children( ".sub" ).children();
$(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>';
$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")) {
$('#multi').change(function () {
if ($(this).is(":checked")) {
$('.single').addClass('d-none');
$('.multi').removeClass('d-none');
return;
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));
}).change();
$('.dt-amount, .dt-subamount').change(function () {
var temp = convertInput($(this).val());
$(this).val(convertOutput(temp));
if ($('#multi').is(":checked")) {
recalcOpenAmount();
}
}).change();
}).change();
});
function logData(event){
function logData(event) {
var data = document.getElementById("billfile");
console.log(data.value);
}
function addLine(){
function addLine() {
$('#linecont > div').each(function () {
if ($(this).hasClass("d-none")){
if ($(this).hasClass("d-none")) {
$(this).removeClass("d-none");
return false;
}
});
}
function convertInput( number )
{
var zahl = number.replace( /\,/g, "." );
var czahl = eval( zahl );
function removeBillFile(e) {
e.classList.add("d-none");
document.getElementById("billfile").classList.remove("d-none");
const billFile = document.getElementById("billfileRef");
const form = document.getElementById('newbill');
var DOB = document.createElement("input");
DOB.setAttribute("name", "removeBillFile");
DOB.setAttribute("value", billFile.innerText);
DOB.setAttribute("type", "hidden");
form.appendChild(DOB);
billFile.innerText = "REMOVED FILE: "+billFile.innerText;
billFile.classList.add("text-decoration-line-through");
billFile.classList.add("text-danger");
billFile.removeAttribute("href");
}
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, "." );
function convertOutput(number) {
if (typeof number !== 'undefined') {
var string = number.toFixed(2);
return string.replace(/\,/g, ".");
}
else
return "";
}
function recalcOpenAmount(){
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;
if (typeof b !== 'undefined') {
b = $(this).hasClass("text-danger") ? b * (-1) : b;
summe = summe + b;
}
// summe = summe + convertInput($(this).val());
// summe = summe + convertInput($(this).val());
});
$('#openamount').val(Math.round( ($('#total_in').val() - $('#total_out').val() - summe) * 100 ) / 100);
$('#openamount').val(Math.round(($('#total_in').val() - $('#total_out').val() - summe) * 100) / 100);
}
// $('form').submit(function () {