0

UrlaubsTermine deren Überschneidungen auswerten

Ein alter Ansatz der neu überarbeitet gehört..

Ich habe eine alte Urlaubsplanung die aktualisiert werden müsste und aktuell alle Mitarbeiter zusammenzählt die bei einem Termin eines Mirtarbeiters zuasammengezählt werden und eventuell vorwarnen wenn es zuviele sind .

Diese Rechnung stimmt zwar sagt aber nichts darüber aus das dieser Zustand an einem gewissen Tag erreicht wird wie im Bild am 12.1 und 13.1.

nun kommt der Moment für die Nussknacker unter euch denn ich komme da nicht weiter..

 

das ist der Code den ich aktuell verwende

let my := this;
let myStart := start('Von - Bis');
let myEnd := endof('Von - Bis');
let mycnt := cnt(select Urlaub where Nr != my.Nr and (start('Von - Bis') >= myStart and start('Von - Bis') <= myEnd or endof('Von - Bis') >= myStart and endof('Von - Bis') <= myEnd or start('Von - Bis') <= myStart and endof('Von - Bis') >= myEnd));
if Urlaub2018.ID <= 4 and mycnt <= 2 then
styled("Führungscharge OK" + " " + mycnt, "green", "black", "ok")
else
if Urlaub2018.ID <= 4 and mycnt >= 2 then
styled("Führungscharge Achtung" + " " + mycnt, "yellow", "black", "warn")
else
if Urlaub2018.ID > 4 and mycnt <= 3 then
styled("Charge  OK" + " " + mycnt, "green", "black", "ok")
else
if Urlaub2018.ID > 4 and mycnt >= 3 then
styled("Charge Achtung" + " " + mycnt, "yellow", "black", "warn")
end
end
end
end

und so sieht das Formular aus

2 Antworten

null
    • Martin_K
    • vor 5 Jahren
    • Gemeldet - anzeigen

    hmm irgenwo ist da der Wurm drinnen..

    let my := this;
    let myn := days('Von (Inclusive)', 'Bis (Inclusive)');
    let myStart := 'Von (Inclusive)';
    let myEnd := 'Bis (Inclusive)';
    myEnd := date(myEnd) - myn;
    let myERG := 0;
    let mycnt := 0;
    for i in range(0, myn - 1) do
    mycnt := 0;
    let mycnt := cnt(select Urlaub where Nr != my.Nr 
    and date(myStart) + i >= date('Von (Inclusive)') 
    and date(myStart) + i <= date('Bis (Inclusive)') 
    and date(myEnd) - myn + i <= date('Bis (Inclusive)')
    and date(myEnd) - myn + i >= date('Von (Inclusive)'));
    if mycnt > myERG then myERG := mycnt end
    end;
    mycnt := myERG;
    if Urlaub2018.ID <= 4 and mycnt <= 2 then
    styled("Führungscharge OK" + " " + mycnt, "green", "black", "ok")
    else
    if Urlaub2018.ID <= 4 and mycnt >= 2 then
    styled("Führungscharge Achtung" + " " + mycnt, "yellow", "black", "warn")
    else
    if Urlaub2018.ID > 4 and mycnt <= 3 then
    styled("Charge  OK" + " " + mycnt, "green", "black", "ok")
    else
    if Urlaub2018.ID > 4 and mycnt >= 3 then
    styled("Charge Achtung" + " " + mycnt, "yellow", "black", "warn")
    end
    end
    end
    end

    mal rechnet es richtig mal falsch 

    • Martin_K
    • vor 5 Jahren
    • Gemeldet - anzeigen

    so das Problem wurde gefunden und gelöst..

    let my := this;
    let myn := days('Von (Inclusive)', 'Bis (Inclusive)');
    let myStart := 'Von (Inclusive)';
    let myEnd := 'Bis (Inclusive)';
    let myERG := 0;
    let mycnt := 0;
    for i in range(0, myn) do
    let mycnt := cnt(select Urlaub where Nr != my.Nr and date(myStart) + i >= date('Von (Inclusive)') and date(myEnd) - myn + i <= date('Bis (Inclusive)'));
    if mycnt > myERG then myERG := mycnt end;
    mycnt := 0
    end;
    mycnt := myERG;
    if Urlaub.WacheID <= 4 and mycnt <= 2 then
    styled("Führungscharge OK" + " " + mycnt, "green", "black", "ok")
    else
    if Urlaub.WacheID <= 4 and mycnt >= 2 then
    styled("Führungscharge Achtung" + " " + mycnt, "yellow", "black", "warn")
    else
    if Urlaub.WacheID > 4 and mycnt <= 3 then
    styled("Charge  OK" + " " + mycnt, "green", "black", "ok")
    else
    if Urlaub.WacheID > 4 and mycnt >= 3 then
    styled("Charge Achtung" + " " + mycnt, "yellow", "black", "warn")
    end
    end
    end
    end

Content aside

  • vor 5 JahrenZuletzt aktiv
  • 2Antworten
  • 1164Ansichten