\documentclass[tikz]{standalone}% Does not support leap years.

%% Load needed packages
\usepackage{lmodern}
\usepackage{tikz}
    \usetikzlibrary{positioning}
\usepackage{ifthen}
\usepackage{xifthen}% provides \isempty test

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tikzset{year/.style={minimum height = 2em}}
\tikzset{dayname/.style={node font=\large}}
\tikzset{daynumber/.style={node font=\large\bfseries}}
\tikzset{dayspecialname/.style={node font=\small\bfseries,anchor=west, align=left, text width=5.5cm }}
\tikzset{dayspecial/.style={color=blue!50!green}}
\tikzset{month/.style={node font=\large}}
\tikzset{kw/.style={node font=\large}}

\newcommand{\monday}[0]{Montag}
\newcommand{\tuesday}[0]{Dienstag}
\newcommand{\wednesday}[0]{Mittwoch}
\newcommand{\thursday}[0]{Donnerstag}
\newcommand{\friday}[0]{Freitag}
\newcommand{\saturday}[0]{Samstag}
\newcommand{\sunday}[0]{Sonntag}


\newcommand{\daylines}[5]{
    \foreach \i in {#1, #2, ..., #3}{%
        \draw [black!30!white, thin] (#4,\i) -- (#5,\i);
    }

}

\newcommand{\taskbox}[5]{
    \foreach \i in {#1, #2, ..., #3}{%
        \draw [black!30!white, thin,dotted] (#4,\i) -- (#5,\i);
    }

    \draw [gray, thin,dotted] (#5,   #1) -- (#5,#3);
    \foreach \i in {0, 0.3, ..., 1}{%

        \draw [black!30!white, thin,dotted] (#4+\i,   #1) -- (#4+\i,#3);
    }

}

\newcommand{\printweek}[7]{
                           % KW
                           %monday date of month
                           %monday special text
                           %tuesday date of month
                           %tuesday special text
                           %Wednesday date of month
                           %Wednesday special text

    \begin{tikzpicture}[inner sep=3 pt,
                        xscale = 3,
                        yscale=-1.5,% CAUTION: axis direction reversed!
    ]

    \node at (0,0) [year]  {\year};    %prints year number
    \node at (0.5,0) [month] {\month}; %prints month name
    \node at (1.25,0) [kw] {#1}; %prints month name


    \ifthenelse{\isempty{#3}} {
        \node at (0,  0.3) [daynumber] {#2};
        \node at (0.5,0.3) [dayname] {\monday};
    } {
        \node at (0,  0.3) [dayspecial,daynumber] {#2};
        \node at (0,  0.7) [dayspecial,dayspecialname] {#3};
        \node at (0.5,0.3) [dayspecial,dayname] {\monday};
    }
    \daylines{1}{1.5}{6.5}{0}{1.9}

    \ifthenelse{\isempty{#5}} {
        \node at (2,  0.3) [daynumber] {#4};
        \node at (2.5,0.3) [dayname] {\tuesday};
    } {
        \node at (2,  0.3) [dayspecial,daynumber] {#4};
        \node at (2,  0.7) [dayspecial,dayspecialname] {#5};
        \node at (2.5,0.3) [dayspecial,dayname] {\tuesday};
    }
    \daylines{1}{1.5}{6.5}{2}{3.9}

    \ifthenelse{\isempty{#7}} {
        \node at (4,  0.3) [daynumber] {#6};
        \node at (4.5,0.3) [dayname] {\wednesday};
    } {
        \node at (4,  0.3) [dayspecial,daynumber] {#6};
        \node at (4,  0.7) [dayspecial,dayspecialname] {#7};
        \node at (4.5,0.3) [dayspecial,dayname] {\wednesday};
    }
    \daylines{1}{1.5}{6.5}{4}{5.9}

    \taskbox{7}{7.4}{15}{0}{5.9}


    \node at (6,  15.25) [daynumber] {};

    \end{tikzpicture}%
}


\newcommand{\printweekend}[9]{
                                % KW
                                %thursday date of month
                                %thursday special text
                                %Friday date of month
                                %Friday special text
                                %Saturday date of month
                                %Saturday special text
                                %Sunday date of month
                                %Sunday special text
                                %

    \begin{tikzpicture}[inner sep=3 pt,
    xscale = 3,
    yscale=-1.5,% CAUTION: axis direction reversed!
    ]

    \node at (5.0,0) [year]  {\year};    %prints year number
    \node at (5.5,0) [month] {\month}; %prints month name
    \node at (4.5,0) [month] {#1}; %prints month name

    \ifthenelse{\isempty{#3}} {
        \node at (0,  0.3) [daynumber] {#2};
        \node at (0.5,0.3) [dayname] {\thursday};
    } {
        \node at (0,  0.3) [dayspecial,daynumber] {#2};
        \node at (0,  0.7) [dayspecial,dayspecialname] {#3};
        \node at (0.5,0.3) [dayspecial,dayname] {\thursday};
    }
    \daylines{1}{1.5}{6.5}{0}{1.9}


    \ifthenelse{\isempty{#5}} {
        \node at (2,  0.3) [daynumber] {#4};
        \node at (2.5,0.3) [dayname] {\friday};
    } {%
        \node at (2,  0.3) [dayspecial,daynumber] {#4};
        \node at (2,  0.7) [dayspecial,dayspecialname] {#5};
        \node at (2.5,0.3) [dayspecial,dayname] {\friday};
    }%
    \daylines{1}{1.5}{6.5}{2}{3.9}

    \ifthenelse{\isempty{#7}} {
        \node at (4,  0.3) [daynumber,color=orange] {#6};
        \node at (4.5,0.3) [dayname,color=orange] {\saturday};
    } {%
        \node at (4,  0.3) [dayspecial,daynumber] {#6};
        \node at (4,  0.7) [dayspecial,dayspecialname] {#7};
        \node at (4.5,0.3) [dayspecial,dayname] {\saturday};
    }%
    \daylines{1}{1.5}{6.5}{4}{5.9}

    \ifthenelse{\isempty{#9}} {
        \node at (4,  6.8) [daynumber,color=red] {#8};
        \node at (4.5,6.8) [dayname,color=red] {\sunday};
    } {%
        \node at (4,  6.8) [dayspecial,daynumber] {#8};
        \node at (4,  7.2) [dayspecial,dayspecialname] {#9};
        \node at (4.5,6.8) [dayspecial,dayname] {\sunday};
    }%
    \daylines{7.5}{8}{15}{4}{5.9}

    \taskbox{7}{7.4}{15}{0}{3.9}


    \node at (6,  15.25) [daynumber] {};
    \end{tikzpicture}%
}

