0

Automatische Angebots- und Rechnungsnummer

Hallo,

ich habe eine Tabelle für meine Angebote bzw. Rechnungen. Diese sollen eine fortlaufende Nummer erhalten. Jeweils für die Angebote und die Rechnungen. Ich habe jetzt folgendes im Feld "Nach Änderungen folgednes Skipt ausführen" der Tabelle eingesetzt. Allerdings werden die Angebots- und Rechnungsnummer zusammen fortlaufend vergeben.

Beispiel:

Angebot 1: 2019-001

Angebot 2: 2019-002

Rechnung 1: 2019-003

Angebot 3: 2019-004

Was muss ich ändern, dass die fortlaufende Nummerierung nur auf den jeweiligen Bereich geändert wird?

if text(Dokumententyp) = "Angebot" then
if not Angebotsnummer then
let y := year(Datum);
let c := cnt(select Dokumente where year(Datum) = y);
Angebotsnummer := y + "-" + format(c, "000")
else
void
end
else
if text(Dokumententyp) = "Rechnung" then
if not Rechnungsnummer then
let y := year(Datum);
let c := cnt(select Dokumente where year(Datum) = y);
Rechnungsnummer := y + "-" + format(c, "000")
else
void
end
end
end

2 Antworten

null
    • Torsten_Stang.1
    • vor 5 Jahren
    • Gemeldet - anzeigen

    Hallo Timm,

    let c := cnt(select Dokumente where year(Datum) = y and text(Dokumententyp="Angebot");

    bzw.

    let c := cnt(select Dokumente where year(Datum) = y and text(Dokumententyp="Rechnung");

    also z.B.:

     

    let myDoc := Dokumententyp;
    let myYear := year(Datum);
    if text(myDoc) = "Angebot" then
       if not Angebotsnummer then
          let c := cnt(select Dokumente where year(Datum) = myYear and Dokumententyp = myDoc);
          Angebotsnummer := y + "-" + format(c, "000")
       else
          void
       end
    else
       if text(myDoc) = "Rechnung" then
          if not Rechnungsnummer then
             let c := cnt(select Dokumente where year(Datum) = myYear and Dokumententyp = myDoc);
             Rechnungsnummer := y + "-" + format(c, "000")
          else
             void
          end
       end
    end

     

    lg, Torsten

    • Timm
    • vor 5 Jahren
    • Gemeldet - anzeigen

    Top! Hat super funktioniert. Danke

Content aside

  • vor 5 JahrenZuletzt aktiv
  • 2Antworten
  • 1388Ansichten