%------------------------------------------------------------------
% Author: Karsten Hilbert
% License: GPL v2 or later
%------------------------------------------------------------------

\listfiles

\documentclass[english]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{tabu}
%\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{afterpage}
\usepackage{fancyhdr}
\usepackage[a4paper]{geometry}
\usepackage{lastpage}
\usepackage{babel}
%\usepackage{ucs}
%\usepackage{lmodern}
%\usepackage{times}
%\usepackage{amsmath}


\geometry{verbose,lmargin=2.54cm}
\pagestyle{fancy}

\setlength{\headheight}{13.6pt}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\lhead[]{}
\rhead[]{}
\lfoot[\thepage\ / \pageref{LastPage}]{{\tiny \href{http://www.gnumed.org}{GNUmed} $<client_version::::>$: $<form_name_long::::60>$ v$<form_version::::20>$}}
\cfoot[]{}
\rfoot[{\tiny \href{http://www.gnumed.org}{GNUmed} $<client_version::::>$: $<form_name_long::::60>$ v$<form_version::::20>$}]{\thepage\ / \pageref{LastPage}}

\begin{document}

\afterpage{\lhead[Current Medication List of $<lastname::::>$, $<firstname::::>$ ($<date_of_birth::%Y %B %d::>$)]{Current Medication List of $<lastname::::>$, $<firstname::::>$ ($<date_of_birth::%Y %B %d::>$}}
\afterpage{\rhead[$<today::%Y %B %d::>$]{$<today::%Y %B %d::>$}}


\noindent \begin{center}
{\LARGE
	Current Medication List
} \par
{\large
	Printed: $<today::%Y %B %d::>$ \\
	Provider: $<current_provider::::>$}
} \par
\end{center}

\noindent
Patient: $<lastname::::>$, $<firstname::::>$ \\
Birthdate: $<date_of_birth::%Y %B %d::>$ \\
{\footnotesize
	$<adr_street::home::>$ $<adr_number::home::>$ \\
	$<adr_postcode::home::>$ $<adr_location::home::>$
}


\vspace*{\medskipamount}

%------------------------------------------------------------------
$<current_meds_table::latex::>$

$<current_meds_notes::latex::>$

%------------------------------------------------------------------
$<free_text::tex//Medication notes to the patient::9999>$
%------------------------------------------------------------------

% uncomment, if and as needed, the next lines to append text below the table
%{\footnotesize			% start smaller font
% <any line(s) of info you wish to always be printed immediately below the table>
%}						% end smaller font
%------------------------------------------------------------------

\vfill{}

%------------------------------------------------------------------
\noindent Allergies:

\noindent $<allergy_state::::>$

\noindent \begin{tabularx}{\textwidth}{|l|l|X|}
\hline 
Agent & Type & Reaction\tabularnewline
\hline
\hline
$<allergies::%(descriptor)s & %(l10n_type)s & {\footnotesize %(reaction)s} \tabularnewline \hline::>$
\end{tabularx}
%------------------------------------------------------------------

\medskip{}


\noindent \begin{flushright}
\texttt{\textsl{\footnotesize Practice Stamp / Physician Signature}}
\par\end{flushright}
\end{document}

%------------------------------------------------------------------
