Kontrolle: Rechnungsdialog übernimmt das Zahlungsziel der gewählten AB
Bei Anzahlung, Schlussrechnung und Aufwand wird 'Zahlungsziel in Tagen' mit auftrag.zahlungszielTage vorbelegt (sonst 14); eine Eingabe des Nutzers bleibt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7b3e834f8
commit
dec7bea7d2
5 files changed
+63
-3
No files matched your search
@@ -2,6 +2,7 @@
|
||||
// Aufgaben: Projektwahl, waehlbare Rechnungsarten, gültige Auftragsbestätigungen (AB), Vorgaben für Anzahlung und Standardart,
|
||||
// Arbeitsblätter (Auswahl, Summen, Umwandlung aus Appwrite-Dokumenten) und die Ticketliste für „Weiteres Ticket hinzunehmen“.
|
||||
import { euro, dateDe, ymdBerlin } from './financeFormat'
|
||||
import { INVOICE_LIMITS } from './financeView'
|
||||
import { worksheetMinutes } from './support'
|
||||
import { germanDateToIso } from './ticketForm'
|
||||
import { ticketsText } from './projektkontoView'
|
||||
@@ -145,6 +146,19 @@ export function standardAuftrag(art, auftraege, rechnungen = []) {
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* Vorbelegung „Zahlungsziel in Tagen“: bei Anzahlung und Schlussrechnung das Ziel der gewählten AB, bei Aufwand das der
|
||||
* jüngsten gültigen Aufwands-AB (`auftraege`), sonst 14. Nur ganze Zahlen von 0 bis 60 zählen. -> Text
|
||||
*/
|
||||
export function zahlungszielVorschlag({ art, ab = null, auftraege = [] } = {}) {
|
||||
const standard = String(INVOICE_LIMITS.defaultDays)
|
||||
let quelle = null
|
||||
if (art === 'anzahlung' || art === 'schluss') quelle = ab
|
||||
else if (art === 'aufwand') quelle = aufwandAuftrag(auftraege)
|
||||
const tage = quelle?.zahlungszielTage
|
||||
return Number.isSafeInteger(tage) && tage >= 0 && tage <= INVOICE_LIMITS.maxDays ? String(tage) : standard
|
||||
}
|
||||
|
||||
/** Vorgabe der Anzahlung: Prozent aus dem Zahlungsplan, sonst 50. */
|
||||
export function anzahlungStandard(auftrag) {
|
||||
const plan = auftrag?.zahlungsplan
|
||||
|
||||
Reference in new issue
Block a user