Proper if statement












2















I have real trouble getting an if statement to work properly....
here is a link to a zip file with all code needed: https://www.dropbox.com/s/ojsj33oe9ac4g09/latex-rechnung.zip?dl=0



My code:



documentclass[a4paper]{scrlttr2}    
usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
usepackage{graphicx}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{color}
usepackage[hidelinks]{hyperref}
usepackage{lipsum}
usepackage{xifthen}

usepackage[german]{invoice}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
makeatletter
defUnitDay{Preis/Tag}% <========================================

newcommand{FeeDay@Title}{% <==========================================
\
noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
hline%
}%

newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
%
% #1 Contents
% #2 Fee per Day
% #3 Unit Count
%
ifcaseFlag % 0: Invoice not started yet
error@message{MissingOpening}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 1: Start invoice
%
error@message{MissingProject}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 2: Start project, print title
%
FeeDay@Title%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 3: Print remuneration item
%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 4: Print subtotal remuneration
%
warning@message{FeeSTExists}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 5: Expense item
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 6: Print subtotal expenses
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 7: Print subtotal project
%
error@message{ProjectCompletedNoFee}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 8: Print total, close invoice
%
error@message{InvoiceCompletedNoFee}%
%
%
else error@message{InternalError}%
fi%
}%
makeatother


renewcommand{familydefault}{sfdefault}

% include meta data
include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
newcommand{invoiceDate}{today} % Datum der rechnungsstellung
newcommand{invoiceReference}{2019_02_04_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
newcommand{invoiceSalutation}{} % die Anrede
newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
newcommand{invoiceEnclosures}{} % encl{} einfügen
newcommand{invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################


% ##################Job DATA ####################
def performaceStart {14.01.2019}
def performaceEnd {01.02.2019}
% ##################Job DATA ####################


% ################## Customer DATA ##################
newcommand{customerCompany}{Firma ABC} %ggf. Firma
newcommand{customerName}{Mustermann} % Name
newcommand{customerStreet}{Straße 123} % Straße
newcommand{customerZIP}{12345} % Postleitzahl
newcommand{customerCity}{Musterstadt} % Ort
newcommand{customerNumber}{1000} % Kundennummer <==================
% ################## Customer DATA ##################

setkomavar{fromname}{senderName}
setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
setkomavar{place}{senderCity}
setkomavar{date}{invoiceDate}
setkomavar{fromphone}{senderTelephone}
setkomavar{frommobilephone}{senderMobilephone}
setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
setkomavar{subject}{Rechnung}

def invoicenr{Rechnungsnummer: }% <========================================
def customernr{Kundennummer: }%
def performanceDuration{Leistungszeitraum: }

setkomavar{location}{vspace*{-1.99cm}
\[baselineskip] \[baselineskip]
flushrightsmall invoicenr invoiceReference\[5pt]
customernr\
customerNumber\[5pt]
performanceDuration\

newcommand{downow}{
if performanceEnd == {}
performaceStart{} -- performaceEnd
else
performanceStart
}
% performaceStart{} -- performaceEnd
}


setkomavar{firsthead}{hfill
parbox[t][headheight][t]{7.3cm}
{%
footnotesize
raggedright
flushright
color[gray]{.3}%
}%
}


begin{document}
begin{letter}{customerCompany \ customerName \
customerStreet \ customerZIP customerCity}vspace*{-3.5cm}


opening{invoiceSalutation}
invoiceText
begin{invoice}{Euro}{0}

ProjectTitle{Tagesleistungen} %
FeeDay{Freelancing} {300} {1}

%ProjectTitle{Projekttitel} %
%Fee{Überstunden} {37.5} {4}



% Auslagen
%EBC{Softwarenutzung} {150.00}
%EBCi{Hotel, 12 Nächte} {2400.00}
%STExpenses

% Rabatt
Discount{Rabatt} {0} %
end{invoice}
ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
ps Kleinunternehmerregelung:\
Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
enthalten.

closing{invoiceClosing}
invoiceEnclosures
vspace*{3.9cm}
footnotesize ps textbf{Bankverbindung:}hspace{6mm}accountBankName, accountIBAN, accountBIC
footnotesize ps textbf{Steuernummer:}hspace{8mm}taxID



end{letter}
end{document}


I would like to have an if statement that checks if performaceEnd is undefined or empty. If it is empty, under performanceDuration it shall only say performanceStart, if performanceEnd is defined it shall say performanceStart{} -- performanceEnd



Ho do I do that?










share|improve this question




















  • 4





    I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

    – Ulrike Fischer
    Feb 4 at 16:32











  • @Ulrike Fischer How am I supposed to upload any needed files?

    – Lala_Ghost
    Feb 4 at 17:49











  • @Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

    – Kurt
    Feb 8 at 3:39
















2















I have real trouble getting an if statement to work properly....
here is a link to a zip file with all code needed: https://www.dropbox.com/s/ojsj33oe9ac4g09/latex-rechnung.zip?dl=0



My code:



documentclass[a4paper]{scrlttr2}    
usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
usepackage{graphicx}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{color}
usepackage[hidelinks]{hyperref}
usepackage{lipsum}
usepackage{xifthen}

usepackage[german]{invoice}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
makeatletter
defUnitDay{Preis/Tag}% <========================================

newcommand{FeeDay@Title}{% <==========================================
\
noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
hline%
}%

newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
%
% #1 Contents
% #2 Fee per Day
% #3 Unit Count
%
ifcaseFlag % 0: Invoice not started yet
error@message{MissingOpening}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 1: Start invoice
%
error@message{MissingProject}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 2: Start project, print title
%
FeeDay@Title%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 3: Print remuneration item
%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 4: Print subtotal remuneration
%
warning@message{FeeSTExists}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 5: Expense item
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 6: Print subtotal expenses
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 7: Print subtotal project
%
error@message{ProjectCompletedNoFee}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 8: Print total, close invoice
%
error@message{InvoiceCompletedNoFee}%
%
%
else error@message{InternalError}%
fi%
}%
makeatother


renewcommand{familydefault}{sfdefault}

% include meta data
include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
newcommand{invoiceDate}{today} % Datum der rechnungsstellung
newcommand{invoiceReference}{2019_02_04_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
newcommand{invoiceSalutation}{} % die Anrede
newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
newcommand{invoiceEnclosures}{} % encl{} einfügen
newcommand{invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################


% ##################Job DATA ####################
def performaceStart {14.01.2019}
def performaceEnd {01.02.2019}
% ##################Job DATA ####################


% ################## Customer DATA ##################
newcommand{customerCompany}{Firma ABC} %ggf. Firma
newcommand{customerName}{Mustermann} % Name
newcommand{customerStreet}{Straße 123} % Straße
newcommand{customerZIP}{12345} % Postleitzahl
newcommand{customerCity}{Musterstadt} % Ort
newcommand{customerNumber}{1000} % Kundennummer <==================
% ################## Customer DATA ##################

setkomavar{fromname}{senderName}
setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
setkomavar{place}{senderCity}
setkomavar{date}{invoiceDate}
setkomavar{fromphone}{senderTelephone}
setkomavar{frommobilephone}{senderMobilephone}
setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
setkomavar{subject}{Rechnung}

def invoicenr{Rechnungsnummer: }% <========================================
def customernr{Kundennummer: }%
def performanceDuration{Leistungszeitraum: }

setkomavar{location}{vspace*{-1.99cm}
\[baselineskip] \[baselineskip]
flushrightsmall invoicenr invoiceReference\[5pt]
customernr\
customerNumber\[5pt]
performanceDuration\

newcommand{downow}{
if performanceEnd == {}
performaceStart{} -- performaceEnd
else
performanceStart
}
% performaceStart{} -- performaceEnd
}


setkomavar{firsthead}{hfill
parbox[t][headheight][t]{7.3cm}
{%
footnotesize
raggedright
flushright
color[gray]{.3}%
}%
}


begin{document}
begin{letter}{customerCompany \ customerName \
customerStreet \ customerZIP customerCity}vspace*{-3.5cm}


opening{invoiceSalutation}
invoiceText
begin{invoice}{Euro}{0}

ProjectTitle{Tagesleistungen} %
FeeDay{Freelancing} {300} {1}

%ProjectTitle{Projekttitel} %
%Fee{Überstunden} {37.5} {4}



% Auslagen
%EBC{Softwarenutzung} {150.00}
%EBCi{Hotel, 12 Nächte} {2400.00}
%STExpenses

% Rabatt
Discount{Rabatt} {0} %
end{invoice}
ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
ps Kleinunternehmerregelung:\
Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
enthalten.

closing{invoiceClosing}
invoiceEnclosures
vspace*{3.9cm}
footnotesize ps textbf{Bankverbindung:}hspace{6mm}accountBankName, accountIBAN, accountBIC
footnotesize ps textbf{Steuernummer:}hspace{8mm}taxID



end{letter}
end{document}


I would like to have an if statement that checks if performaceEnd is undefined or empty. If it is empty, under performanceDuration it shall only say performanceStart, if performanceEnd is defined it shall say performanceStart{} -- performanceEnd



Ho do I do that?










share|improve this question




















  • 4





    I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

    – Ulrike Fischer
    Feb 4 at 16:32











  • @Ulrike Fischer How am I supposed to upload any needed files?

    – Lala_Ghost
    Feb 4 at 17:49











  • @Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

    – Kurt
    Feb 8 at 3:39














2












2








2








I have real trouble getting an if statement to work properly....
here is a link to a zip file with all code needed: https://www.dropbox.com/s/ojsj33oe9ac4g09/latex-rechnung.zip?dl=0



My code:



documentclass[a4paper]{scrlttr2}    
usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
usepackage{graphicx}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{color}
usepackage[hidelinks]{hyperref}
usepackage{lipsum}
usepackage{xifthen}

usepackage[german]{invoice}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
makeatletter
defUnitDay{Preis/Tag}% <========================================

newcommand{FeeDay@Title}{% <==========================================
\
noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
hline%
}%

newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
%
% #1 Contents
% #2 Fee per Day
% #3 Unit Count
%
ifcaseFlag % 0: Invoice not started yet
error@message{MissingOpening}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 1: Start invoice
%
error@message{MissingProject}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 2: Start project, print title
%
FeeDay@Title%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 3: Print remuneration item
%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 4: Print subtotal remuneration
%
warning@message{FeeSTExists}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 5: Expense item
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 6: Print subtotal expenses
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 7: Print subtotal project
%
error@message{ProjectCompletedNoFee}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 8: Print total, close invoice
%
error@message{InvoiceCompletedNoFee}%
%
%
else error@message{InternalError}%
fi%
}%
makeatother


renewcommand{familydefault}{sfdefault}

% include meta data
include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
newcommand{invoiceDate}{today} % Datum der rechnungsstellung
newcommand{invoiceReference}{2019_02_04_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
newcommand{invoiceSalutation}{} % die Anrede
newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
newcommand{invoiceEnclosures}{} % encl{} einfügen
newcommand{invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################


% ##################Job DATA ####################
def performaceStart {14.01.2019}
def performaceEnd {01.02.2019}
% ##################Job DATA ####################


% ################## Customer DATA ##################
newcommand{customerCompany}{Firma ABC} %ggf. Firma
newcommand{customerName}{Mustermann} % Name
newcommand{customerStreet}{Straße 123} % Straße
newcommand{customerZIP}{12345} % Postleitzahl
newcommand{customerCity}{Musterstadt} % Ort
newcommand{customerNumber}{1000} % Kundennummer <==================
% ################## Customer DATA ##################

setkomavar{fromname}{senderName}
setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
setkomavar{place}{senderCity}
setkomavar{date}{invoiceDate}
setkomavar{fromphone}{senderTelephone}
setkomavar{frommobilephone}{senderMobilephone}
setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
setkomavar{subject}{Rechnung}

def invoicenr{Rechnungsnummer: }% <========================================
def customernr{Kundennummer: }%
def performanceDuration{Leistungszeitraum: }

setkomavar{location}{vspace*{-1.99cm}
\[baselineskip] \[baselineskip]
flushrightsmall invoicenr invoiceReference\[5pt]
customernr\
customerNumber\[5pt]
performanceDuration\

newcommand{downow}{
if performanceEnd == {}
performaceStart{} -- performaceEnd
else
performanceStart
}
% performaceStart{} -- performaceEnd
}


setkomavar{firsthead}{hfill
parbox[t][headheight][t]{7.3cm}
{%
footnotesize
raggedright
flushright
color[gray]{.3}%
}%
}


begin{document}
begin{letter}{customerCompany \ customerName \
customerStreet \ customerZIP customerCity}vspace*{-3.5cm}


opening{invoiceSalutation}
invoiceText
begin{invoice}{Euro}{0}

ProjectTitle{Tagesleistungen} %
FeeDay{Freelancing} {300} {1}

%ProjectTitle{Projekttitel} %
%Fee{Überstunden} {37.5} {4}



% Auslagen
%EBC{Softwarenutzung} {150.00}
%EBCi{Hotel, 12 Nächte} {2400.00}
%STExpenses

% Rabatt
Discount{Rabatt} {0} %
end{invoice}
ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
ps Kleinunternehmerregelung:\
Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
enthalten.

closing{invoiceClosing}
invoiceEnclosures
vspace*{3.9cm}
footnotesize ps textbf{Bankverbindung:}hspace{6mm}accountBankName, accountIBAN, accountBIC
footnotesize ps textbf{Steuernummer:}hspace{8mm}taxID



end{letter}
end{document}


I would like to have an if statement that checks if performaceEnd is undefined or empty. If it is empty, under performanceDuration it shall only say performanceStart, if performanceEnd is defined it shall say performanceStart{} -- performanceEnd



Ho do I do that?










share|improve this question
















I have real trouble getting an if statement to work properly....
here is a link to a zip file with all code needed: https://www.dropbox.com/s/ojsj33oe9ac4g09/latex-rechnung.zip?dl=0



My code:



documentclass[a4paper]{scrlttr2}    
usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
usepackage{graphicx}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{color}
usepackage[hidelinks]{hyperref}
usepackage{lipsum}
usepackage{xifthen}

usepackage[german]{invoice}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
makeatletter
defUnitDay{Preis/Tag}% <========================================

newcommand{FeeDay@Title}{% <==========================================
\
noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
hline%
}%

newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
%
% #1 Contents
% #2 Fee per Day
% #3 Unit Count
%
ifcaseFlag % 0: Invoice not started yet
error@message{MissingOpening}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 1: Start invoice
%
error@message{MissingProject}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 2: Start project, print title
%
FeeDay@Title%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 3: Print remuneration item
%
Fee@Line{#1}{#2}{#3}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 4: Print subtotal remuneration
%
warning@message{FeeSTExists}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 5: Expense item
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 6: Print subtotal expenses
%
error@message{FeeBeforeExpense}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 7: Print subtotal project
%
error@message{ProjectCompletedNoFee}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or % 8: Print total, close invoice
%
error@message{InvoiceCompletedNoFee}%
%
%
else error@message{InternalError}%
fi%
}%
makeatother


renewcommand{familydefault}{sfdefault}

% include meta data
include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
newcommand{invoiceDate}{today} % Datum der rechnungsstellung
newcommand{invoiceReference}{2019_02_04_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
newcommand{invoiceSalutation}{} % die Anrede
newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
newcommand{invoiceEnclosures}{} % encl{} einfügen
newcommand{invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################


% ##################Job DATA ####################
def performaceStart {14.01.2019}
def performaceEnd {01.02.2019}
% ##################Job DATA ####################


% ################## Customer DATA ##################
newcommand{customerCompany}{Firma ABC} %ggf. Firma
newcommand{customerName}{Mustermann} % Name
newcommand{customerStreet}{Straße 123} % Straße
newcommand{customerZIP}{12345} % Postleitzahl
newcommand{customerCity}{Musterstadt} % Ort
newcommand{customerNumber}{1000} % Kundennummer <==================
% ################## Customer DATA ##################

setkomavar{fromname}{senderName}
setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
setkomavar{place}{senderCity}
setkomavar{date}{invoiceDate}
setkomavar{fromphone}{senderTelephone}
setkomavar{frommobilephone}{senderMobilephone}
setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
setkomavar{subject}{Rechnung}

def invoicenr{Rechnungsnummer: }% <========================================
def customernr{Kundennummer: }%
def performanceDuration{Leistungszeitraum: }

setkomavar{location}{vspace*{-1.99cm}
\[baselineskip] \[baselineskip]
flushrightsmall invoicenr invoiceReference\[5pt]
customernr\
customerNumber\[5pt]
performanceDuration\

newcommand{downow}{
if performanceEnd == {}
performaceStart{} -- performaceEnd
else
performanceStart
}
% performaceStart{} -- performaceEnd
}


setkomavar{firsthead}{hfill
parbox[t][headheight][t]{7.3cm}
{%
footnotesize
raggedright
flushright
color[gray]{.3}%
}%
}


begin{document}
begin{letter}{customerCompany \ customerName \
customerStreet \ customerZIP customerCity}vspace*{-3.5cm}


opening{invoiceSalutation}
invoiceText
begin{invoice}{Euro}{0}

ProjectTitle{Tagesleistungen} %
FeeDay{Freelancing} {300} {1}

%ProjectTitle{Projekttitel} %
%Fee{Überstunden} {37.5} {4}



% Auslagen
%EBC{Softwarenutzung} {150.00}
%EBCi{Hotel, 12 Nächte} {2400.00}
%STExpenses

% Rabatt
Discount{Rabatt} {0} %
end{invoice}
ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
ps Kleinunternehmerregelung:\
Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
enthalten.

closing{invoiceClosing}
invoiceEnclosures
vspace*{3.9cm}
footnotesize ps textbf{Bankverbindung:}hspace{6mm}accountBankName, accountIBAN, accountBIC
footnotesize ps textbf{Steuernummer:}hspace{8mm}taxID



end{letter}
end{document}


I would like to have an if statement that checks if performaceEnd is undefined or empty. If it is empty, under performanceDuration it shall only say performanceStart, if performanceEnd is defined it shall say performanceStart{} -- performanceEnd



Ho do I do that?







ifthenelse condition






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 4 at 17:39









Kurt

39.9k850164




39.9k850164










asked Feb 4 at 16:24









Lala_GhostLala_Ghost

764




764








  • 4





    I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

    – Ulrike Fischer
    Feb 4 at 16:32











  • @Ulrike Fischer How am I supposed to upload any needed files?

    – Lala_Ghost
    Feb 4 at 17:49











  • @Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

    – Kurt
    Feb 8 at 3:39














  • 4





    I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

    – Ulrike Fischer
    Feb 4 at 16:32











  • @Ulrike Fischer How am I supposed to upload any needed files?

    – Lala_Ghost
    Feb 4 at 17:49











  • @Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

    – Kurt
    Feb 8 at 3:39








4




4





I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

– Ulrike Fischer
Feb 4 at 16:32





I won't download a zip from an external file. Also your question will get meaningless if the link no longer work. Write your question so that every needed info is here.

– Ulrike Fischer
Feb 4 at 16:32













@Ulrike Fischer How am I supposed to upload any needed files?

– Lala_Ghost
Feb 4 at 17:49





@Ulrike Fischer How am I supposed to upload any needed files?

– Lala_Ghost
Feb 4 at 17:49













@Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

– Kurt
Feb 8 at 3:39





@Lala_Ghost In this you have a problem with adding some text (or not) to command location, comming from KOMA-Script class scrlttr2. You can simply reduce the code to a normal letter (deleting all stuff needed for your invoice calculation) using location and ask then how to be able to add some text depending on the definition or value of two variables. Then you need not the files from your zip file.

– Kurt
Feb 8 at 3:39










2 Answers
2






active

oldest

votes


















4














The correct way to write your test is



ifxperformanceEndundefined
performanceStart
elseifxperformanceEndempty
performanceStart
else
performanceStart{} -- performanceEnd
fifi


You can also declare a boolean ifperformanceEnd by



newififperformanceEnd


anywhere in the preamble and check performanceEnd with



performanceEndfalse
ifxperformanceEndundefinedelse
ifxperformanceEndemptyelse
performanceEndtrue
fifi


then you can write



ifperformanceEnd
performanceStart{} -- performanceEnd
else
performanceStart
fi


or even



performanceStartifperformanceEnd{} -- performanceEndfi





share|improve this answer

































    3














    Okay, here we go: as already pointed out by @eric-domenjoud you can use ifx to build the variations of text you need. BTW think about adding an "seit " to make clear that the performance time is not over.



    I corrected in the following code the wrong written variables performaceStart and performaceEnd to the correct one performanceStart and performanceEnd in the complete following code.



    As we did in your last question we once again have to change the code for command location like:



    setkomavar{location}{%
    \[baselineskip] \[baselineskip]
    flushrightsmall invoicenr invoiceReference\[5pt]
    customernr\
    customerNumber\[5pt]
    performanceDuration\
    ifxperformanceEndundefined % <=======================================
    performanceStart
    elseifxperformanceEndempty
    performanceStart
    else
    performanceStart{} -- performanceEnd
    fifi % <==============================================================
    }


    Then we get with the following code (you need to use all files in the question linked zip file to be able to compile it!)



     documentclass[a4paper]{scrlttr2}

    usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
    usepackage{graphicx}
    usepackage{lmodern}
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage[ngerman]{babel}
    usepackage{color}
    usepackage[hidelinks]{hyperref}
    %usepackage {ifthen}

    usepackage[german]{invoice}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    makeatletter
    defUnitDay{Preis/Tag}% <========================================

    newcommand{FeeDay@Title}{% <==========================================
    \
    noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
    hline%
    }%

    newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
    %
    % #1 Contents
    % #2 Fee per Day
    % #3 Unit Count
    %
    ifcaseFlag % 0: Invoice not started yet
    error@message{MissingOpening}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 1: Start invoice
    %
    error@message{MissingProject}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 2: Start project, print title
    %
    FeeDay@Title%
    Fee@Line{#1}{#2}{#3}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 3: Print remuneration item
    %
    Fee@Line{#1}{#2}{#3}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 4: Print subtotal remuneration
    %
    warning@message{FeeSTExists}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 5: Expense item
    %
    error@message{FeeBeforeExpense}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 6: Print subtotal expenses
    %
    error@message{FeeBeforeExpense}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 7: Print subtotal project
    %
    error@message{ProjectCompletedNoFee}%
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    or % 8: Print total, close invoice
    %
    error@message{InvoiceCompletedNoFee}%
    %
    %
    else error@message{InternalError}%
    fi%
    }%
    makeatother


    renewcommand{familydefault}{sfdefault}

    % include meta data
    include{_data} % <============== delete in this file the following data!
    % ################## invoice DATA ##################
    newcommand{invoiceDate}{today} % Datum der rechnungsstellung
    newcommand{invoiceReference}{2019_01_01_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
    newcommand{invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
    newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
    newcommand{invoiceEnclosures}{} % encl{} einfügen
    newcommand{invoiceClosing}{Mit freundlichen Grüßen}
    % ################## invoice DATA ##################


    % ##################Job DATA ####################
    def performanceStart {01.01.2019}
    %def performanceEnd {02.01.2019}
    % ##################Job DATA ####################


    % ################## Customer DATA ##################
    newcommand{customerCompany}{Firma ABC} %ggf. Firma
    newcommand{customerName}{Max Mustermann} % Name
    newcommand{customerStreet}{Musterstraße 10} % Straße
    newcommand{customerZIP}{12345} % Postleitzahl
    newcommand{customerCity}{Musterort} % Ort
    newcommand{customerNumber}{1000} % Kundennummer <==================
    % ################## Customer DATA ##################

    setkomavar{fromname}{senderName}
    setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
    setkomavar{place}{senderCity}
    setkomavar{date}{invoiceDate}
    setkomavar{fromphone}{senderTelephone}
    setkomavar{frommobilephone}{senderMobilephone}
    setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
    setkomavar{subject}{Rechnung}

    def invoicenr{Rechnungsnummer: }% <========================================
    def customernr{Kundennummer: }%
    def performanceDuration{Leistungszeitraum: }

    setkomavar{location}{%
    \[baselineskip] \[baselineskip]
    flushrightsmall invoicenr invoiceReference\[5pt]
    customernr\
    customerNumber\[5pt]
    performanceDuration\
    ifxperformanceEndundefined % <=======================================
    performanceStart
    elseifxperformanceEndempty
    performanceStart
    else
    performanceStart{} -- performanceEnd
    fifi % <==============================================================
    }


    setkomavar{firsthead}{hfill
    parbox[t][headheight][t]{7.3cm}{%
    footnotesize
    raggedright
    flushright
    color[gray]{.3}%
    begin{tabular}{rl}
    Anschrift & usekomavar{fromname}\
    & senderStreet\
    & senderZIP senderCity \
    \
    %Telefon Telefon: ` senderTelephone \
    Mobil & usekomavar{frommobilephone} \
    E-Mail & usekomavar{fromemail} \
    %Webseite & {normalfontttfamily senderWeb } \
    \
    Steuernummer & taxID \
    \
    Institut & accountBankName \
    IBAN & accountIBAN \
    BIC & accountBIC
    end{tabular}
    }%
    }


    begin{document}
    begin{letter}{customerCompany \ customerName \
    customerStreet \ customerZIP customerCity}


    opening{invoiceSalutation}
    invoiceText
    begin{invoice}{Euro}{0}

    ProjectTitle{Tagesleistungen} %
    FeeDay{Freelance Arbeit} {10} {1}

    ProjectTitle{Projekttitel} %
    Fee{Überstunden} {20} {1}



    % Auslagen
    %EBC{Hotel, 12 Nächte} {2400.00} % EBCi{Hotel, 12 Nächte} {2400.00}
    %STExpenses

    % Rabatt
    Discount{Rabatt} {0} %
    end{invoice}
    ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
    ps Kleinunternehmerregelung:\
    Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
    enthalten.

    closing{invoiceClosing}
    invoiceEnclosures



    end{letter}
    end{document}


    the following result (see that I commented definition of performanceEnd):



    resulting pdf



    If you want to add "seit " as remarked at the beginning of this answer you can use



    setkomavar{location}{%
    \[baselineskip] \[baselineskip]
    flushrightsmall invoicenr invoiceReference\[5pt]
    customernr\
    customerNumber\[5pt]
    performanceDuration\
    ifxperformanceEndundefined % <=======================================
    seit performanceStart
    elseifxperformanceEndempty
    seit performanceStart
    else
    performanceStart{} -- performanceEnd
    fifi % <==============================================================
    }


    with the result:



    enter image description here






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473330%2fproper-if-statement%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4














      The correct way to write your test is



      ifxperformanceEndundefined
      performanceStart
      elseifxperformanceEndempty
      performanceStart
      else
      performanceStart{} -- performanceEnd
      fifi


      You can also declare a boolean ifperformanceEnd by



      newififperformanceEnd


      anywhere in the preamble and check performanceEnd with



      performanceEndfalse
      ifxperformanceEndundefinedelse
      ifxperformanceEndemptyelse
      performanceEndtrue
      fifi


      then you can write



      ifperformanceEnd
      performanceStart{} -- performanceEnd
      else
      performanceStart
      fi


      or even



      performanceStartifperformanceEnd{} -- performanceEndfi





      share|improve this answer






























        4














        The correct way to write your test is



        ifxperformanceEndundefined
        performanceStart
        elseifxperformanceEndempty
        performanceStart
        else
        performanceStart{} -- performanceEnd
        fifi


        You can also declare a boolean ifperformanceEnd by



        newififperformanceEnd


        anywhere in the preamble and check performanceEnd with



        performanceEndfalse
        ifxperformanceEndundefinedelse
        ifxperformanceEndemptyelse
        performanceEndtrue
        fifi


        then you can write



        ifperformanceEnd
        performanceStart{} -- performanceEnd
        else
        performanceStart
        fi


        or even



        performanceStartifperformanceEnd{} -- performanceEndfi





        share|improve this answer




























          4












          4








          4







          The correct way to write your test is



          ifxperformanceEndundefined
          performanceStart
          elseifxperformanceEndempty
          performanceStart
          else
          performanceStart{} -- performanceEnd
          fifi


          You can also declare a boolean ifperformanceEnd by



          newififperformanceEnd


          anywhere in the preamble and check performanceEnd with



          performanceEndfalse
          ifxperformanceEndundefinedelse
          ifxperformanceEndemptyelse
          performanceEndtrue
          fifi


          then you can write



          ifperformanceEnd
          performanceStart{} -- performanceEnd
          else
          performanceStart
          fi


          or even



          performanceStartifperformanceEnd{} -- performanceEndfi





          share|improve this answer















          The correct way to write your test is



          ifxperformanceEndundefined
          performanceStart
          elseifxperformanceEndempty
          performanceStart
          else
          performanceStart{} -- performanceEnd
          fifi


          You can also declare a boolean ifperformanceEnd by



          newififperformanceEnd


          anywhere in the preamble and check performanceEnd with



          performanceEndfalse
          ifxperformanceEndundefinedelse
          ifxperformanceEndemptyelse
          performanceEndtrue
          fifi


          then you can write



          ifperformanceEnd
          performanceStart{} -- performanceEnd
          else
          performanceStart
          fi


          or even



          performanceStartifperformanceEnd{} -- performanceEndfi






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 4 at 17:39

























          answered Feb 4 at 16:49









          Eric DomenjoudEric Domenjoud

          95339




          95339























              3














              Okay, here we go: as already pointed out by @eric-domenjoud you can use ifx to build the variations of text you need. BTW think about adding an "seit " to make clear that the performance time is not over.



              I corrected in the following code the wrong written variables performaceStart and performaceEnd to the correct one performanceStart and performanceEnd in the complete following code.



              As we did in your last question we once again have to change the code for command location like:



              setkomavar{location}{%
              \[baselineskip] \[baselineskip]
              flushrightsmall invoicenr invoiceReference\[5pt]
              customernr\
              customerNumber\[5pt]
              performanceDuration\
              ifxperformanceEndundefined % <=======================================
              performanceStart
              elseifxperformanceEndempty
              performanceStart
              else
              performanceStart{} -- performanceEnd
              fifi % <==============================================================
              }


              Then we get with the following code (you need to use all files in the question linked zip file to be able to compile it!)



               documentclass[a4paper]{scrlttr2}

              usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
              usepackage{graphicx}
              usepackage{lmodern}
              usepackage[utf8]{inputenc}
              usepackage[T1]{fontenc}
              usepackage[ngerman]{babel}
              usepackage{color}
              usepackage[hidelinks]{hyperref}
              %usepackage {ifthen}

              usepackage[german]{invoice}

              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              makeatletter
              defUnitDay{Preis/Tag}% <========================================

              newcommand{FeeDay@Title}{% <==========================================
              \
              noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
              hline%
              }%

              newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
              %
              % #1 Contents
              % #2 Fee per Day
              % #3 Unit Count
              %
              ifcaseFlag % 0: Invoice not started yet
              error@message{MissingOpening}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 1: Start invoice
              %
              error@message{MissingProject}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 2: Start project, print title
              %
              FeeDay@Title%
              Fee@Line{#1}{#2}{#3}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 3: Print remuneration item
              %
              Fee@Line{#1}{#2}{#3}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 4: Print subtotal remuneration
              %
              warning@message{FeeSTExists}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 5: Expense item
              %
              error@message{FeeBeforeExpense}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 6: Print subtotal expenses
              %
              error@message{FeeBeforeExpense}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 7: Print subtotal project
              %
              error@message{ProjectCompletedNoFee}%
              %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              or % 8: Print total, close invoice
              %
              error@message{InvoiceCompletedNoFee}%
              %
              %
              else error@message{InternalError}%
              fi%
              }%
              makeatother


              renewcommand{familydefault}{sfdefault}

              % include meta data
              include{_data} % <============== delete in this file the following data!
              % ################## invoice DATA ##################
              newcommand{invoiceDate}{today} % Datum der rechnungsstellung
              newcommand{invoiceReference}{2019_01_01_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
              newcommand{invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
              newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
              newcommand{invoiceEnclosures}{} % encl{} einfügen
              newcommand{invoiceClosing}{Mit freundlichen Grüßen}
              % ################## invoice DATA ##################


              % ##################Job DATA ####################
              def performanceStart {01.01.2019}
              %def performanceEnd {02.01.2019}
              % ##################Job DATA ####################


              % ################## Customer DATA ##################
              newcommand{customerCompany}{Firma ABC} %ggf. Firma
              newcommand{customerName}{Max Mustermann} % Name
              newcommand{customerStreet}{Musterstraße 10} % Straße
              newcommand{customerZIP}{12345} % Postleitzahl
              newcommand{customerCity}{Musterort} % Ort
              newcommand{customerNumber}{1000} % Kundennummer <==================
              % ################## Customer DATA ##################

              setkomavar{fromname}{senderName}
              setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
              setkomavar{place}{senderCity}
              setkomavar{date}{invoiceDate}
              setkomavar{fromphone}{senderTelephone}
              setkomavar{frommobilephone}{senderMobilephone}
              setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
              setkomavar{subject}{Rechnung}

              def invoicenr{Rechnungsnummer: }% <========================================
              def customernr{Kundennummer: }%
              def performanceDuration{Leistungszeitraum: }

              setkomavar{location}{%
              \[baselineskip] \[baselineskip]
              flushrightsmall invoicenr invoiceReference\[5pt]
              customernr\
              customerNumber\[5pt]
              performanceDuration\
              ifxperformanceEndundefined % <=======================================
              performanceStart
              elseifxperformanceEndempty
              performanceStart
              else
              performanceStart{} -- performanceEnd
              fifi % <==============================================================
              }


              setkomavar{firsthead}{hfill
              parbox[t][headheight][t]{7.3cm}{%
              footnotesize
              raggedright
              flushright
              color[gray]{.3}%
              begin{tabular}{rl}
              Anschrift & usekomavar{fromname}\
              & senderStreet\
              & senderZIP senderCity \
              \
              %Telefon Telefon: ` senderTelephone \
              Mobil & usekomavar{frommobilephone} \
              E-Mail & usekomavar{fromemail} \
              %Webseite & {normalfontttfamily senderWeb } \
              \
              Steuernummer & taxID \
              \
              Institut & accountBankName \
              IBAN & accountIBAN \
              BIC & accountBIC
              end{tabular}
              }%
              }


              begin{document}
              begin{letter}{customerCompany \ customerName \
              customerStreet \ customerZIP customerCity}


              opening{invoiceSalutation}
              invoiceText
              begin{invoice}{Euro}{0}

              ProjectTitle{Tagesleistungen} %
              FeeDay{Freelance Arbeit} {10} {1}

              ProjectTitle{Projekttitel} %
              Fee{Überstunden} {20} {1}



              % Auslagen
              %EBC{Hotel, 12 Nächte} {2400.00} % EBCi{Hotel, 12 Nächte} {2400.00}
              %STExpenses

              % Rabatt
              Discount{Rabatt} {0} %
              end{invoice}
              ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
              ps Kleinunternehmerregelung:\
              Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
              enthalten.

              closing{invoiceClosing}
              invoiceEnclosures



              end{letter}
              end{document}


              the following result (see that I commented definition of performanceEnd):



              resulting pdf



              If you want to add "seit " as remarked at the beginning of this answer you can use



              setkomavar{location}{%
              \[baselineskip] \[baselineskip]
              flushrightsmall invoicenr invoiceReference\[5pt]
              customernr\
              customerNumber\[5pt]
              performanceDuration\
              ifxperformanceEndundefined % <=======================================
              seit performanceStart
              elseifxperformanceEndempty
              seit performanceStart
              else
              performanceStart{} -- performanceEnd
              fifi % <==============================================================
              }


              with the result:



              enter image description here






              share|improve this answer




























                3














                Okay, here we go: as already pointed out by @eric-domenjoud you can use ifx to build the variations of text you need. BTW think about adding an "seit " to make clear that the performance time is not over.



                I corrected in the following code the wrong written variables performaceStart and performaceEnd to the correct one performanceStart and performanceEnd in the complete following code.



                As we did in your last question we once again have to change the code for command location like:



                setkomavar{location}{%
                \[baselineskip] \[baselineskip]
                flushrightsmall invoicenr invoiceReference\[5pt]
                customernr\
                customerNumber\[5pt]
                performanceDuration\
                ifxperformanceEndundefined % <=======================================
                performanceStart
                elseifxperformanceEndempty
                performanceStart
                else
                performanceStart{} -- performanceEnd
                fifi % <==============================================================
                }


                Then we get with the following code (you need to use all files in the question linked zip file to be able to compile it!)



                 documentclass[a4paper]{scrlttr2}

                usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
                usepackage{graphicx}
                usepackage{lmodern}
                usepackage[utf8]{inputenc}
                usepackage[T1]{fontenc}
                usepackage[ngerman]{babel}
                usepackage{color}
                usepackage[hidelinks]{hyperref}
                %usepackage {ifthen}

                usepackage[german]{invoice}

                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                makeatletter
                defUnitDay{Preis/Tag}% <========================================

                newcommand{FeeDay@Title}{% <==========================================
                \
                noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
                hline%
                }%

                newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
                %
                % #1 Contents
                % #2 Fee per Day
                % #3 Unit Count
                %
                ifcaseFlag % 0: Invoice not started yet
                error@message{MissingOpening}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 1: Start invoice
                %
                error@message{MissingProject}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 2: Start project, print title
                %
                FeeDay@Title%
                Fee@Line{#1}{#2}{#3}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 3: Print remuneration item
                %
                Fee@Line{#1}{#2}{#3}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 4: Print subtotal remuneration
                %
                warning@message{FeeSTExists}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 5: Expense item
                %
                error@message{FeeBeforeExpense}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 6: Print subtotal expenses
                %
                error@message{FeeBeforeExpense}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 7: Print subtotal project
                %
                error@message{ProjectCompletedNoFee}%
                %
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                or % 8: Print total, close invoice
                %
                error@message{InvoiceCompletedNoFee}%
                %
                %
                else error@message{InternalError}%
                fi%
                }%
                makeatother


                renewcommand{familydefault}{sfdefault}

                % include meta data
                include{_data} % <============== delete in this file the following data!
                % ################## invoice DATA ##################
                newcommand{invoiceDate}{today} % Datum der rechnungsstellung
                newcommand{invoiceReference}{2019_01_01_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
                newcommand{invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
                newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
                newcommand{invoiceEnclosures}{} % encl{} einfügen
                newcommand{invoiceClosing}{Mit freundlichen Grüßen}
                % ################## invoice DATA ##################


                % ##################Job DATA ####################
                def performanceStart {01.01.2019}
                %def performanceEnd {02.01.2019}
                % ##################Job DATA ####################


                % ################## Customer DATA ##################
                newcommand{customerCompany}{Firma ABC} %ggf. Firma
                newcommand{customerName}{Max Mustermann} % Name
                newcommand{customerStreet}{Musterstraße 10} % Straße
                newcommand{customerZIP}{12345} % Postleitzahl
                newcommand{customerCity}{Musterort} % Ort
                newcommand{customerNumber}{1000} % Kundennummer <==================
                % ################## Customer DATA ##################

                setkomavar{fromname}{senderName}
                setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
                setkomavar{place}{senderCity}
                setkomavar{date}{invoiceDate}
                setkomavar{fromphone}{senderTelephone}
                setkomavar{frommobilephone}{senderMobilephone}
                setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
                setkomavar{subject}{Rechnung}

                def invoicenr{Rechnungsnummer: }% <========================================
                def customernr{Kundennummer: }%
                def performanceDuration{Leistungszeitraum: }

                setkomavar{location}{%
                \[baselineskip] \[baselineskip]
                flushrightsmall invoicenr invoiceReference\[5pt]
                customernr\
                customerNumber\[5pt]
                performanceDuration\
                ifxperformanceEndundefined % <=======================================
                performanceStart
                elseifxperformanceEndempty
                performanceStart
                else
                performanceStart{} -- performanceEnd
                fifi % <==============================================================
                }


                setkomavar{firsthead}{hfill
                parbox[t][headheight][t]{7.3cm}{%
                footnotesize
                raggedright
                flushright
                color[gray]{.3}%
                begin{tabular}{rl}
                Anschrift & usekomavar{fromname}\
                & senderStreet\
                & senderZIP senderCity \
                \
                %Telefon Telefon: ` senderTelephone \
                Mobil & usekomavar{frommobilephone} \
                E-Mail & usekomavar{fromemail} \
                %Webseite & {normalfontttfamily senderWeb } \
                \
                Steuernummer & taxID \
                \
                Institut & accountBankName \
                IBAN & accountIBAN \
                BIC & accountBIC
                end{tabular}
                }%
                }


                begin{document}
                begin{letter}{customerCompany \ customerName \
                customerStreet \ customerZIP customerCity}


                opening{invoiceSalutation}
                invoiceText
                begin{invoice}{Euro}{0}

                ProjectTitle{Tagesleistungen} %
                FeeDay{Freelance Arbeit} {10} {1}

                ProjectTitle{Projekttitel} %
                Fee{Überstunden} {20} {1}



                % Auslagen
                %EBC{Hotel, 12 Nächte} {2400.00} % EBCi{Hotel, 12 Nächte} {2400.00}
                %STExpenses

                % Rabatt
                Discount{Rabatt} {0} %
                end{invoice}
                ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
                ps Kleinunternehmerregelung:\
                Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
                enthalten.

                closing{invoiceClosing}
                invoiceEnclosures



                end{letter}
                end{document}


                the following result (see that I commented definition of performanceEnd):



                resulting pdf



                If you want to add "seit " as remarked at the beginning of this answer you can use



                setkomavar{location}{%
                \[baselineskip] \[baselineskip]
                flushrightsmall invoicenr invoiceReference\[5pt]
                customernr\
                customerNumber\[5pt]
                performanceDuration\
                ifxperformanceEndundefined % <=======================================
                seit performanceStart
                elseifxperformanceEndempty
                seit performanceStart
                else
                performanceStart{} -- performanceEnd
                fifi % <==============================================================
                }


                with the result:



                enter image description here






                share|improve this answer


























                  3












                  3








                  3







                  Okay, here we go: as already pointed out by @eric-domenjoud you can use ifx to build the variations of text you need. BTW think about adding an "seit " to make clear that the performance time is not over.



                  I corrected in the following code the wrong written variables performaceStart and performaceEnd to the correct one performanceStart and performanceEnd in the complete following code.



                  As we did in your last question we once again have to change the code for command location like:



                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  performanceStart
                  elseifxperformanceEndempty
                  performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  Then we get with the following code (you need to use all files in the question linked zip file to be able to compile it!)



                   documentclass[a4paper]{scrlttr2}

                  usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
                  usepackage{graphicx}
                  usepackage{lmodern}
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage[ngerman]{babel}
                  usepackage{color}
                  usepackage[hidelinks]{hyperref}
                  %usepackage {ifthen}

                  usepackage[german]{invoice}

                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  makeatletter
                  defUnitDay{Preis/Tag}% <========================================

                  newcommand{FeeDay@Title}{% <==========================================
                  \
                  noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
                  hline%
                  }%

                  newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
                  %
                  % #1 Contents
                  % #2 Fee per Day
                  % #3 Unit Count
                  %
                  ifcaseFlag % 0: Invoice not started yet
                  error@message{MissingOpening}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 1: Start invoice
                  %
                  error@message{MissingProject}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 2: Start project, print title
                  %
                  FeeDay@Title%
                  Fee@Line{#1}{#2}{#3}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 3: Print remuneration item
                  %
                  Fee@Line{#1}{#2}{#3}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 4: Print subtotal remuneration
                  %
                  warning@message{FeeSTExists}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 5: Expense item
                  %
                  error@message{FeeBeforeExpense}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 6: Print subtotal expenses
                  %
                  error@message{FeeBeforeExpense}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 7: Print subtotal project
                  %
                  error@message{ProjectCompletedNoFee}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 8: Print total, close invoice
                  %
                  error@message{InvoiceCompletedNoFee}%
                  %
                  %
                  else error@message{InternalError}%
                  fi%
                  }%
                  makeatother


                  renewcommand{familydefault}{sfdefault}

                  % include meta data
                  include{_data} % <============== delete in this file the following data!
                  % ################## invoice DATA ##################
                  newcommand{invoiceDate}{today} % Datum der rechnungsstellung
                  newcommand{invoiceReference}{2019_01_01_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
                  newcommand{invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
                  newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
                  newcommand{invoiceEnclosures}{} % encl{} einfügen
                  newcommand{invoiceClosing}{Mit freundlichen Grüßen}
                  % ################## invoice DATA ##################


                  % ##################Job DATA ####################
                  def performanceStart {01.01.2019}
                  %def performanceEnd {02.01.2019}
                  % ##################Job DATA ####################


                  % ################## Customer DATA ##################
                  newcommand{customerCompany}{Firma ABC} %ggf. Firma
                  newcommand{customerName}{Max Mustermann} % Name
                  newcommand{customerStreet}{Musterstraße 10} % Straße
                  newcommand{customerZIP}{12345} % Postleitzahl
                  newcommand{customerCity}{Musterort} % Ort
                  newcommand{customerNumber}{1000} % Kundennummer <==================
                  % ################## Customer DATA ##################

                  setkomavar{fromname}{senderName}
                  setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
                  setkomavar{place}{senderCity}
                  setkomavar{date}{invoiceDate}
                  setkomavar{fromphone}{senderTelephone}
                  setkomavar{frommobilephone}{senderMobilephone}
                  setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
                  setkomavar{subject}{Rechnung}

                  def invoicenr{Rechnungsnummer: }% <========================================
                  def customernr{Kundennummer: }%
                  def performanceDuration{Leistungszeitraum: }

                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  performanceStart
                  elseifxperformanceEndempty
                  performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  setkomavar{firsthead}{hfill
                  parbox[t][headheight][t]{7.3cm}{%
                  footnotesize
                  raggedright
                  flushright
                  color[gray]{.3}%
                  begin{tabular}{rl}
                  Anschrift & usekomavar{fromname}\
                  & senderStreet\
                  & senderZIP senderCity \
                  \
                  %Telefon Telefon: ` senderTelephone \
                  Mobil & usekomavar{frommobilephone} \
                  E-Mail & usekomavar{fromemail} \
                  %Webseite & {normalfontttfamily senderWeb } \
                  \
                  Steuernummer & taxID \
                  \
                  Institut & accountBankName \
                  IBAN & accountIBAN \
                  BIC & accountBIC
                  end{tabular}
                  }%
                  }


                  begin{document}
                  begin{letter}{customerCompany \ customerName \
                  customerStreet \ customerZIP customerCity}


                  opening{invoiceSalutation}
                  invoiceText
                  begin{invoice}{Euro}{0}

                  ProjectTitle{Tagesleistungen} %
                  FeeDay{Freelance Arbeit} {10} {1}

                  ProjectTitle{Projekttitel} %
                  Fee{Überstunden} {20} {1}



                  % Auslagen
                  %EBC{Hotel, 12 Nächte} {2400.00} % EBCi{Hotel, 12 Nächte} {2400.00}
                  %STExpenses

                  % Rabatt
                  Discount{Rabatt} {0} %
                  end{invoice}
                  ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
                  ps Kleinunternehmerregelung:\
                  Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
                  enthalten.

                  closing{invoiceClosing}
                  invoiceEnclosures



                  end{letter}
                  end{document}


                  the following result (see that I commented definition of performanceEnd):



                  resulting pdf



                  If you want to add "seit " as remarked at the beginning of this answer you can use



                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  seit performanceStart
                  elseifxperformanceEndempty
                  seit performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  with the result:



                  enter image description here






                  share|improve this answer













                  Okay, here we go: as already pointed out by @eric-domenjoud you can use ifx to build the variations of text you need. BTW think about adding an "seit " to make clear that the performance time is not over.



                  I corrected in the following code the wrong written variables performaceStart and performaceEnd to the correct one performanceStart and performanceEnd in the complete following code.



                  As we did in your last question we once again have to change the code for command location like:



                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  performanceStart
                  elseifxperformanceEndempty
                  performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  Then we get with the following code (you need to use all files in the question linked zip file to be able to compile it!)



                   documentclass[a4paper]{scrlttr2}

                  usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
                  usepackage{graphicx}
                  usepackage{lmodern}
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage[ngerman]{babel}
                  usepackage{color}
                  usepackage[hidelinks]{hyperref}
                  %usepackage {ifthen}

                  usepackage[german]{invoice}

                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  makeatletter
                  defUnitDay{Preis/Tag}% <========================================

                  newcommand{FeeDay@Title}{% <==========================================
                  \
                  noindenttextbf{Activity}&&UnitDay&Count&Amount (BC)\
                  hline%
                  }%

                  newcommand{FeeDay}[3]{% Yields state 3, Print Fee Item <==============
                  %
                  % #1 Contents
                  % #2 Fee per Day
                  % #3 Unit Count
                  %
                  ifcaseFlag % 0: Invoice not started yet
                  error@message{MissingOpening}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 1: Start invoice
                  %
                  error@message{MissingProject}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 2: Start project, print title
                  %
                  FeeDay@Title%
                  Fee@Line{#1}{#2}{#3}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 3: Print remuneration item
                  %
                  Fee@Line{#1}{#2}{#3}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 4: Print subtotal remuneration
                  %
                  warning@message{FeeSTExists}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 5: Expense item
                  %
                  error@message{FeeBeforeExpense}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 6: Print subtotal expenses
                  %
                  error@message{FeeBeforeExpense}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 7: Print subtotal project
                  %
                  error@message{ProjectCompletedNoFee}%
                  %
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  or % 8: Print total, close invoice
                  %
                  error@message{InvoiceCompletedNoFee}%
                  %
                  %
                  else error@message{InternalError}%
                  fi%
                  }%
                  makeatother


                  renewcommand{familydefault}{sfdefault}

                  % include meta data
                  include{_data} % <============== delete in this file the following data!
                  % ################## invoice DATA ##################
                  newcommand{invoiceDate}{today} % Datum der rechnungsstellung
                  newcommand{invoiceReference}{2019_01_01_1} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
                  newcommand{invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
                  newcommand{invoiceText}{Folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
                  newcommand{invoiceEnclosures}{} % encl{} einfügen
                  newcommand{invoiceClosing}{Mit freundlichen Grüßen}
                  % ################## invoice DATA ##################


                  % ##################Job DATA ####################
                  def performanceStart {01.01.2019}
                  %def performanceEnd {02.01.2019}
                  % ##################Job DATA ####################


                  % ################## Customer DATA ##################
                  newcommand{customerCompany}{Firma ABC} %ggf. Firma
                  newcommand{customerName}{Max Mustermann} % Name
                  newcommand{customerStreet}{Musterstraße 10} % Straße
                  newcommand{customerZIP}{12345} % Postleitzahl
                  newcommand{customerCity}{Musterort} % Ort
                  newcommand{customerNumber}{1000} % Kundennummer <==================
                  % ################## Customer DATA ##################

                  setkomavar{fromname}{senderName}
                  setkomavar{fromaddress}{senderStreet \ senderZIP senderCity}
                  setkomavar{place}{senderCity}
                  setkomavar{date}{invoiceDate}
                  setkomavar{fromphone}{senderTelephone}
                  setkomavar{frommobilephone}{senderMobilephone}
                  setkomavar{fromemail}{href{mailto:senderEmail}{nolinkurl{senderEmail}}}
                  setkomavar{subject}{Rechnung}

                  def invoicenr{Rechnungsnummer: }% <========================================
                  def customernr{Kundennummer: }%
                  def performanceDuration{Leistungszeitraum: }

                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  performanceStart
                  elseifxperformanceEndempty
                  performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  setkomavar{firsthead}{hfill
                  parbox[t][headheight][t]{7.3cm}{%
                  footnotesize
                  raggedright
                  flushright
                  color[gray]{.3}%
                  begin{tabular}{rl}
                  Anschrift & usekomavar{fromname}\
                  & senderStreet\
                  & senderZIP senderCity \
                  \
                  %Telefon Telefon: ` senderTelephone \
                  Mobil & usekomavar{frommobilephone} \
                  E-Mail & usekomavar{fromemail} \
                  %Webseite & {normalfontttfamily senderWeb } \
                  \
                  Steuernummer & taxID \
                  \
                  Institut & accountBankName \
                  IBAN & accountIBAN \
                  BIC & accountBIC
                  end{tabular}
                  }%
                  }


                  begin{document}
                  begin{letter}{customerCompany \ customerName \
                  customerStreet \ customerZIP customerCity}


                  opening{invoiceSalutation}
                  invoiceText
                  begin{invoice}{Euro}{0}

                  ProjectTitle{Tagesleistungen} %
                  FeeDay{Freelance Arbeit} {10} {1}

                  ProjectTitle{Projekttitel} %
                  Fee{Überstunden} {20} {1}



                  % Auslagen
                  %EBC{Hotel, 12 Nächte} {2400.00} % EBCi{Hotel, 12 Nächte} {2400.00}
                  %STExpenses

                  % Rabatt
                  Discount{Rabatt} {0} %
                  end{invoice}
                  ps Bitte zahlen Sie den Gesamtbetrag unter Angabe der Rechnungsnummer auf das aufgeführte Konto.
                  ps Kleinunternehmerregelung:\
                  Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer
                  enthalten.

                  closing{invoiceClosing}
                  invoiceEnclosures



                  end{letter}
                  end{document}


                  the following result (see that I commented definition of performanceEnd):



                  resulting pdf



                  If you want to add "seit " as remarked at the beginning of this answer you can use



                  setkomavar{location}{%
                  \[baselineskip] \[baselineskip]
                  flushrightsmall invoicenr invoiceReference\[5pt]
                  customernr\
                  customerNumber\[5pt]
                  performanceDuration\
                  ifxperformanceEndundefined % <=======================================
                  seit performanceStart
                  elseifxperformanceEndempty
                  seit performanceStart
                  else
                  performanceStart{} -- performanceEnd
                  fifi % <==============================================================
                  }


                  with the result:



                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 4 at 17:37









                  KurtKurt

                  39.9k850164




                  39.9k850164






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473330%2fproper-if-statement%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Human spaceflight

                      Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                      File:DeusFollowingSea.jpg