sia
gesperrt
Hi Leute,
Habe folgende dapper-invoice.cls:
[src=latex]% dapper-invoice.cls -- a billable-hours invoice featuring style over substance
\ProvidesClass{dapper-invoice}[2015/04/12]
\NeedsTeXFormat{LaTeX2e}
\LoadClass[11pt]{article}
% For page number calculations
\RequirePackage{ifthen}
% To handle key=value options in class definition
\RequirePackage{kvoptions}
\SetupKeyvalOptions{%
prefix=dapper@
}
% Default currency option is "dollar"
\DeclareStringOption[dollar]{currency}[dollar]
\ProcessKeyvalOptions*
\RequirePackage{eurosym}
\ifthenelse{\equal{\dapper@currency}{dollar}}{\newcommand{\currencysym}{\ \$}}{}
\ifthenelse{\equal{\dapper@currency}{euro}}{\newcommand{\currencysym}{\ \euro}}{}
\ifthenelse{\equal{\dapper@currency}{pound}}{\newcommand{\currencysym}{\ \textsterling}}{}
% Set the standard geometry
\RequirePackage[hmargin=2cm,vmargin=2cm]{geometry}
% For links and metadata
\RequirePackage[hidelinks]{hyperref}
% For "At*" hooks
\RequirePackage{etoolbox}
% For adjusting footer
\RequirePackage{fancyhdr}
% For tables
\RequirePackage{longtable}
% Caluclating due date
\RequirePackage{datenumber}
% graphics
\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fpu}
% For invoice math
\RequirePackage{fp}
% Customizing lists
\RequirePackage{enumitem}
% Formatting numbers
\RequirePackage{siunitx}
\sisetup{round-integer-to-decimal, group-separator={\ }}
\RequirePackage{fontspec}
\setmainfont {MuseoSans-300.otf}[
BoldFont = MuseoSans_500.otf ,
ItalicFont = MuseoSans-300Italic.otf ,
BoldItalicFont = MuseoSans_500_Italic.otf ]
\RequirePackage{fontawesome}
\RequirePackage{tabularx}
%%%%% Commands %%%%%
\newcommand*{\setmetadata}[4]{
\hypersetup{
bookmarksopen = false,
bookmarksdepth = 2,% to show sections and subsections
pdfauthor = {#1},
pdftitle = {#2 --- Invoice \##3 for #4},
pdfsubject = {Invoice \##3},
pdfkeywords = {invoice, #2, #4}
}
}
\newcommand*{\twocolumnlayout}[2]{
\begin{tabularx}{\textwidth}{l X r} #1 & & #2 \end{tabularx}
}
\newcommand*{\makeheader}[2]{
\begin{minipage}[t]{.5\linewidth} {\headerStyle #1} \end{minipage}
\hfill
\begin{tabular}[t]{@{} c @{}}
{\headerStyle RECHNUNG \##2} \\
{\color{subduedColor} \today}
\end{tabular}
}
\newcommand*{\duedate}[1]{%
\setdatetoday%
\addtocounter{datenumber}{#1}%
\setdatebynumber{\thedatenumber}%
\datedate%
}
\newcommand*{\infoSubStyle}{\small\slshape}
\newenvironment{infoSection}{\tabular[t]{r @{\hspace{1.5em}} l}}{\endtabular}
\newcommand{\infoBox}[2]{
{\titleStyle #1} & \begin{minipage}[t]{.25\textwidth} #2 \end{minipage} \\
\noalign{\addvspace{2ex}}
}
\newcommand{\infoSub}[2]{
\noalign{\vspace{-1.8ex}}
{\color{subduedColor} #1} & \begin{minipage}[t]{.25\textwidth} \infoSubStyle #2 \end{minipage} \\
\noalign{\addvspace{2ex}}
}
\newcommand{\emaillink}[1]{%
\href{mailto:#1}{#1}%
}
\newcommand*{\itemizationRowStyle}[0]{\small}
\newcommand*{\itemizationHeaderStyle}[0]{\normalsize\color{highlightColor}}
\newcounter{colskipcount}
\newenvironment{hours}{
\setcounter{colskipcount}{4}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{l @{\hspace{1.5em}} p{.35\textwidth} r r r}
\hline
\noalign{\smallskip}
{\itemizationHeaderStyle Datum} &
{\itemizationHeaderStyle Beschreibung} &
{\itemizationHeaderStyle Stunden} &
{\itemizationHeaderStyle €/h} &
{\itemizationHeaderStyle Gesamtpreis}
\\
\noalign{\smallskip}
\hline
\noalign{\bigskip}
\endhead
\noalign{\bigskip}
\hline
\endfoot
\endlastfoot
}{
\end{longtable}
}
\newenvironment{expenses}{
\setcounter{colskipcount}{4}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{l @{\hspace{1.5em}} p{.35\textwidth} r r r}
\hline
\noalign{\smallskip}
{\itemizationHeaderStyle Datum} &
{\itemizationHeaderStyle Beschreibung} &
{\itemizationHeaderStyle Anzahl} &
{\itemizationHeaderStyle Preis} &
{\itemizationHeaderStyle Gesamtpreis}
\\
\noalign{\smallskip}
\hline
\noalign{\bigskip}
\endhead
\noalign{\bigskip}
\hline
\endfoot
\endlastfoot
}{
\end{longtable}
}
\gdef\InvoiceTotal{0}
\newcommand*{\calcamount}[2]{%
\FPmul\t{#1}{#2}%
\formatcurrency{\t}%
%
\FPadd\gt{\InvoiceTotal}{\t}%
\global\let\InvoiceTotal\gt%
}
\newcommand{\lineitem}[4]{
{\itemizationRowStyle #1} &
\begin{minipage}[t]{.6\textwidth}
\begin{itemize}[leftmargin=0pt, labelsep=1pt, itemsep=0pt] \itemizationRowStyle #4 \end{itemize}
\end{minipage} &
{\itemizationRowStyle #2} &
{\itemizationRowStyle #3 \currencysym} &
{\itemizationRowStyle \calcamount{#2}{#3} \currencysym}
\\
\noalign{\medskip}
}
\newcommand{\beginsummary}{
\noalign{\bigskip}
\hline
\noalign{\medskip}
}
\newcommand*{\summaryline}[2]{
\multicolumn{\thecolskipcount}{r}{\itemizationHeaderStyle #1} & #2 \\
}
\newcommand*{\formatcurrency}[1]{%
\num[group-separator={\ }, group-minimum-digits=3, round-mode=places, round-precision=2]{#1}%
}
%%%%% Styles %%%%%
\RequirePackage{xcolor}
\definecolor{highlightColor}{rgb}{0.15,0.55,0.35}% green
\definecolor{subduedColor}{rgb}{0.35,0.35,0.35}% dark grey
\def\headerStyle{\Huge}
\def\titleStyle{\color{highlightColor}}
% Add page numbers
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}}
% page numbers in footer if more than 1 page
% Copied from moderncv
\AtEndPreamble{%
\AtBeginDocument{%
\@ifundefined{r@lastpage}{}{%
\ifthenelse{\pageref{lastpage}>1}{%
\newlength{\pagenumberwidth}%
\settowidth{\pagenumberwidth}{\thepage/\pageref{lastpage}}%
\fancypagestyle{plain}{%
\fancyfoot[r]{\parbox{\pagenumberwidth}{\thepage/\pageref{lastpage}}}%
}%
\pagestyle{plain}%
}{}%
}%
\AtEndDocument{\label{lastpage}}%
}%
}
\pagestyle{plain}
% Disable paragraph indent
\setlength{\parindent}{0pt}
[/src]
und folgende example.tex:
[src=latex]%\documentclass[a4paper]{dapper-invoice}
%\documentclass[a4paper,currency=dollar]{dapper-invoice}
\documentclass[a4paper,currency=euro]{dapper-invoice}
%\documentclass[a4paper,currency=pound]{dapper-invoice}
\newcommand{\invoiceNo}{17}
\newcommand{\duein}{15}% days
\newcommand{\paid}{20}% EUR
\newcommand{\me}{Your~Name}
\newcommand{\clientName}{Sample~Client}
\setmetadata{\me}{\me}{\invoiceNo}{\clientName}
\begin{document}
\makeheader{\me}{\invoiceNo}
\twocolumnlayout{
\noalign{\addvspace{4em}}
\clientName \\
123 Street Address \\
City, State 55555
}{
\begin{infoSection}
\infoBox{}{
{\huge\formatcurrency{\paid}\large\raisebox{.55\height}\currencysym} \\
{\small\color{subduedColor} due \duedate{\duein}}
}
\infoBox{Zu zahlen an}{
\me \\
1234 Sycamore Ave \\
Blacksburg, VA 24060
}
\infoSub{\faMobilePhone}{\small\slshape +1~(555)~555-5555}
\infoSub{\tiny\faEnvelope}{\small\slshape \emaillink{you@example.com}}
\end{infoSection}
}
\addvspace{1ex}
\begin{hours}
\lineitem{2015-04-11}{21.0}{50}{
\item Discussed requirements with client}
\lineitem{2015/4/11}{1.2}{50}{
\item Wrote Invoice in LaTeX}
\lineitem{2015/4/11}{0.5}{50}{
\item Packaged Invoice in .cls file}
\end{hours}
\FPsub\topay{\InvoiceTotal}{\paid}
\begin{expenses}
\lineitem{2015-04-11}{1}{490}{
\item Computer}
\beginsummary
\summaryline{Gesamt}{\formatcurrency{\InvoiceTotal}\currencysym}
\summaryline{Bezahlt}{\formatcurrency{\paid} \currencysym}
\summaryline{Zu zahlen}{\topay \currencysym}
\end{expenses}
\end{document}[/src]
Jetzt würde ich gerne die Berechnung der Variable \topay nach den Ausgaben machen und natürlich die Summe im Header entsprechend anpassen.
Außerdem wäre es toll, wenn die ganzen Tabellen aneinander ausgerichtet wären und im Header der Rechnungsschriftzug nicht aus dem Dokument läuft.
Bin leider mittlerweile etwas verrannt und habe nur noch ein Brett vor dem Kopf, Hilfe wäre toll
Anhang anzeigen MuseoSans.7z
EDIT: Toll wäre es auch, wenn ich die example.tex etwas verschönern könnte – wie könnte ich das einrichten, dass es ungefähr so aussieht?
[src=latex]\documentclass[a4paper,currency=euro]{dapper-invoice}
\invoiceNo{123}
\invoiceDue{15}
\clientCompany{Musterfirma\\ Musterabteilung}
\clientName{Hr. Mustermann}
\clientAddress{Musterstr. 44}{66616 Musterstadt}
\begin{document}
\makeheader{\me}{\invoiceNo}
\begin{project}
\projectName{Büro}
\service{2017-01-04}{2}{50}{Computer eingerichtet}
\service{2017-02-04}{3}{50}{Server eingerichtet}
\product{1}{499}{Computer}
\expense{2017-02-04}{10}{1.5}{Mettbrötchen}
\end{project}
\begin{project}
\projectName{Laden}
\service{2017-01-14}{2}{50}{Kasse eingerichtet}
\product{1}{499}{Kasse}
\end{project}
\paid{20}
\discount{99}
\summary
\end{document}[/src]
Habe folgende dapper-invoice.cls:
[src=latex]% dapper-invoice.cls -- a billable-hours invoice featuring style over substance
\ProvidesClass{dapper-invoice}[2015/04/12]
\NeedsTeXFormat{LaTeX2e}
\LoadClass[11pt]{article}
% For page number calculations
\RequirePackage{ifthen}
% To handle key=value options in class definition
\RequirePackage{kvoptions}
\SetupKeyvalOptions{%
prefix=dapper@
}
% Default currency option is "dollar"
\DeclareStringOption[dollar]{currency}[dollar]
\ProcessKeyvalOptions*
\RequirePackage{eurosym}
\ifthenelse{\equal{\dapper@currency}{dollar}}{\newcommand{\currencysym}{\ \$}}{}
\ifthenelse{\equal{\dapper@currency}{euro}}{\newcommand{\currencysym}{\ \euro}}{}
\ifthenelse{\equal{\dapper@currency}{pound}}{\newcommand{\currencysym}{\ \textsterling}}{}
% Set the standard geometry
\RequirePackage[hmargin=2cm,vmargin=2cm]{geometry}
% For links and metadata
\RequirePackage[hidelinks]{hyperref}
% For "At*" hooks
\RequirePackage{etoolbox}
% For adjusting footer
\RequirePackage{fancyhdr}
% For tables
\RequirePackage{longtable}
% Caluclating due date
\RequirePackage{datenumber}
% graphics
\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fpu}
% For invoice math
\RequirePackage{fp}
% Customizing lists
\RequirePackage{enumitem}
% Formatting numbers
\RequirePackage{siunitx}
\sisetup{round-integer-to-decimal, group-separator={\ }}
\RequirePackage{fontspec}
\setmainfont {MuseoSans-300.otf}[
BoldFont = MuseoSans_500.otf ,
ItalicFont = MuseoSans-300Italic.otf ,
BoldItalicFont = MuseoSans_500_Italic.otf ]
\RequirePackage{fontawesome}
\RequirePackage{tabularx}
%%%%% Commands %%%%%
\newcommand*{\setmetadata}[4]{
\hypersetup{
bookmarksopen = false,
bookmarksdepth = 2,% to show sections and subsections
pdfauthor = {#1},
pdftitle = {#2 --- Invoice \##3 for #4},
pdfsubject = {Invoice \##3},
pdfkeywords = {invoice, #2, #4}
}
}
\newcommand*{\twocolumnlayout}[2]{
\begin{tabularx}{\textwidth}{l X r} #1 & & #2 \end{tabularx}
}
\newcommand*{\makeheader}[2]{
\begin{minipage}[t]{.5\linewidth} {\headerStyle #1} \end{minipage}
\hfill
\begin{tabular}[t]{@{} c @{}}
{\headerStyle RECHNUNG \##2} \\
{\color{subduedColor} \today}
\end{tabular}
}
\newcommand*{\duedate}[1]{%
\setdatetoday%
\addtocounter{datenumber}{#1}%
\setdatebynumber{\thedatenumber}%
\datedate%
}
\newcommand*{\infoSubStyle}{\small\slshape}
\newenvironment{infoSection}{\tabular[t]{r @{\hspace{1.5em}} l}}{\endtabular}
\newcommand{\infoBox}[2]{
{\titleStyle #1} & \begin{minipage}[t]{.25\textwidth} #2 \end{minipage} \\
\noalign{\addvspace{2ex}}
}
\newcommand{\infoSub}[2]{
\noalign{\vspace{-1.8ex}}
{\color{subduedColor} #1} & \begin{minipage}[t]{.25\textwidth} \infoSubStyle #2 \end{minipage} \\
\noalign{\addvspace{2ex}}
}
\newcommand{\emaillink}[1]{%
\href{mailto:#1}{#1}%
}
\newcommand*{\itemizationRowStyle}[0]{\small}
\newcommand*{\itemizationHeaderStyle}[0]{\normalsize\color{highlightColor}}
\newcounter{colskipcount}
\newenvironment{hours}{
\setcounter{colskipcount}{4}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{l @{\hspace{1.5em}} p{.35\textwidth} r r r}
\hline
\noalign{\smallskip}
{\itemizationHeaderStyle Datum} &
{\itemizationHeaderStyle Beschreibung} &
{\itemizationHeaderStyle Stunden} &
{\itemizationHeaderStyle €/h} &
{\itemizationHeaderStyle Gesamtpreis}
\\
\noalign{\smallskip}
\hline
\noalign{\bigskip}
\endhead
\noalign{\bigskip}
\hline
\endfoot
\endlastfoot
}{
\end{longtable}
}
\newenvironment{expenses}{
\setcounter{colskipcount}{4}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{l @{\hspace{1.5em}} p{.35\textwidth} r r r}
\hline
\noalign{\smallskip}
{\itemizationHeaderStyle Datum} &
{\itemizationHeaderStyle Beschreibung} &
{\itemizationHeaderStyle Anzahl} &
{\itemizationHeaderStyle Preis} &
{\itemizationHeaderStyle Gesamtpreis}
\\
\noalign{\smallskip}
\hline
\noalign{\bigskip}
\endhead
\noalign{\bigskip}
\hline
\endfoot
\endlastfoot
}{
\end{longtable}
}
\gdef\InvoiceTotal{0}
\newcommand*{\calcamount}[2]{%
\FPmul\t{#1}{#2}%
\formatcurrency{\t}%
%
\FPadd\gt{\InvoiceTotal}{\t}%
\global\let\InvoiceTotal\gt%
}
\newcommand{\lineitem}[4]{
{\itemizationRowStyle #1} &
\begin{minipage}[t]{.6\textwidth}
\begin{itemize}[leftmargin=0pt, labelsep=1pt, itemsep=0pt] \itemizationRowStyle #4 \end{itemize}
\end{minipage} &
{\itemizationRowStyle #2} &
{\itemizationRowStyle #3 \currencysym} &
{\itemizationRowStyle \calcamount{#2}{#3} \currencysym}
\\
\noalign{\medskip}
}
\newcommand{\beginsummary}{
\noalign{\bigskip}
\hline
\noalign{\medskip}
}
\newcommand*{\summaryline}[2]{
\multicolumn{\thecolskipcount}{r}{\itemizationHeaderStyle #1} & #2 \\
}
\newcommand*{\formatcurrency}[1]{%
\num[group-separator={\ }, group-minimum-digits=3, round-mode=places, round-precision=2]{#1}%
}
%%%%% Styles %%%%%
\RequirePackage{xcolor}
\definecolor{highlightColor}{rgb}{0.15,0.55,0.35}% green
\definecolor{subduedColor}{rgb}{0.35,0.35,0.35}% dark grey
\def\headerStyle{\Huge}
\def\titleStyle{\color{highlightColor}}
% Add page numbers
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}}
% page numbers in footer if more than 1 page
% Copied from moderncv
\AtEndPreamble{%
\AtBeginDocument{%
\@ifundefined{r@lastpage}{}{%
\ifthenelse{\pageref{lastpage}>1}{%
\newlength{\pagenumberwidth}%
\settowidth{\pagenumberwidth}{\thepage/\pageref{lastpage}}%
\fancypagestyle{plain}{%
\fancyfoot[r]{\parbox{\pagenumberwidth}{\thepage/\pageref{lastpage}}}%
}%
\pagestyle{plain}%
}{}%
}%
\AtEndDocument{\label{lastpage}}%
}%
}
\pagestyle{plain}
% Disable paragraph indent
\setlength{\parindent}{0pt}
[/src]
und folgende example.tex:
[src=latex]%\documentclass[a4paper]{dapper-invoice}
%\documentclass[a4paper,currency=dollar]{dapper-invoice}
\documentclass[a4paper,currency=euro]{dapper-invoice}
%\documentclass[a4paper,currency=pound]{dapper-invoice}
\newcommand{\invoiceNo}{17}
\newcommand{\duein}{15}% days
\newcommand{\paid}{20}% EUR
\newcommand{\me}{Your~Name}
\newcommand{\clientName}{Sample~Client}
\setmetadata{\me}{\me}{\invoiceNo}{\clientName}
\begin{document}
\makeheader{\me}{\invoiceNo}
\twocolumnlayout{
\noalign{\addvspace{4em}}
\clientName \\
123 Street Address \\
City, State 55555
}{
\begin{infoSection}
\infoBox{}{
{\huge\formatcurrency{\paid}\large\raisebox{.55\height}\currencysym} \\
{\small\color{subduedColor} due \duedate{\duein}}
}
\infoBox{Zu zahlen an}{
\me \\
1234 Sycamore Ave \\
Blacksburg, VA 24060
}
\infoSub{\faMobilePhone}{\small\slshape +1~(555)~555-5555}
\infoSub{\tiny\faEnvelope}{\small\slshape \emaillink{you@example.com}}
\end{infoSection}
}
\addvspace{1ex}
\begin{hours}
\lineitem{2015-04-11}{21.0}{50}{
\item Discussed requirements with client}
\lineitem{2015/4/11}{1.2}{50}{
\item Wrote Invoice in LaTeX}
\lineitem{2015/4/11}{0.5}{50}{
\item Packaged Invoice in .cls file}
\end{hours}
\FPsub\topay{\InvoiceTotal}{\paid}
\begin{expenses}
\lineitem{2015-04-11}{1}{490}{
\item Computer}
\beginsummary
\summaryline{Gesamt}{\formatcurrency{\InvoiceTotal}\currencysym}
\summaryline{Bezahlt}{\formatcurrency{\paid} \currencysym}
\summaryline{Zu zahlen}{\topay \currencysym}
\end{expenses}
\end{document}[/src]
Jetzt würde ich gerne die Berechnung der Variable \topay nach den Ausgaben machen und natürlich die Summe im Header entsprechend anpassen.
Außerdem wäre es toll, wenn die ganzen Tabellen aneinander ausgerichtet wären und im Header der Rechnungsschriftzug nicht aus dem Dokument läuft.
Bin leider mittlerweile etwas verrannt und habe nur noch ein Brett vor dem Kopf, Hilfe wäre toll
Anhang anzeigen MuseoSans.7z
EDIT: Toll wäre es auch, wenn ich die example.tex etwas verschönern könnte – wie könnte ich das einrichten, dass es ungefähr so aussieht?
[src=latex]\documentclass[a4paper,currency=euro]{dapper-invoice}
\invoiceNo{123}
\invoiceDue{15}
\clientCompany{Musterfirma\\ Musterabteilung}
\clientName{Hr. Mustermann}
\clientAddress{Musterstr. 44}{66616 Musterstadt}
\begin{document}
\makeheader{\me}{\invoiceNo}
\begin{project}
\projectName{Büro}
\service{2017-01-04}{2}{50}{Computer eingerichtet}
\service{2017-02-04}{3}{50}{Server eingerichtet}
\product{1}{499}{Computer}
\expense{2017-02-04}{10}{1.5}{Mettbrötchen}
\end{project}
\begin{project}
\projectName{Laden}
\service{2017-01-14}{2}{50}{Kasse eingerichtet}
\product{1}{499}{Kasse}
\end{project}
\paid{20}
\discount{99}
\summary
\end{document}[/src]
Zuletzt bearbeitet: