% Design of QSL-card rear side (the information carrying side).
%
% This file was (many, many edits ago) based on work by Fabian Kurz, DJ1YFK.
%
% (c) Jon Krom PE1AQP/DK1AQP, 2018...2020, CC-BY-SA
% Last edit: 2020-06-28
%% ------------------------------------------------------------------
\documentclass[landscape]{article}
\pagestyle{empty}
\usepackage{ifthen}
\usepackage[normalem]{ulem}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{graphicx}

% Very small left margin, due to paperhandling in my printer
\usepackage[papersize={140mm,90mm}, margin=0mm, left=0mm, right=12mm, top=4mm, bottom=1mm]{geometry}

\renewcommand{\familydefault}{\sfdefault}
\setlength{\parindent}{0pt}

\newcommand{\mystrut}{\rule{0pt}{1.1ex}}
\newcommand\blankbox{\raisebox{0.1em}{\framebox[1em]{\mystrut}} }

\newcommand\textblue{\textcolor{blue}}
\newcommand\bluesout{\bgroup\markoverwith{\textblue{\rule[0.7ex]{2pt}{8pt}}}\ULon}
\newcommand\bluebox{\blankbox\hspace*{-2.6ex}\textbf{\textblue X}}

\newcommand\makeruler{{\makebox[30mm]{\hrulefill}}}

\newlength{\mpl} % Width of some minipages.
\setlength{\mpl}{50mm}

%% ------------------------------------------------------------------
\newcommand{\VFROM}{}
\newcommand{\FROM}[1]{\renewcommand{\VFROM}{#1}}
\newcommand{\NONDEFAULTQTH}[1]{\newcommand{\NONDEFQTH}{#1}}
\newcommand{\MYTRX}[1]{\newcommand{\VMYTRX}{#1}}


\newcommand{\VTOCALL}{}
\newcommand{\TOCALL}[1]{\renewcommand{\VTOCALL}{#1}}
\newcommand{\VTOOP}{}
\newcommand{\TOOP}[1]{\renewcommand{\VTOOP}{#1}}
\newcommand{\VWATT}{}
\newcommand{\WATT}[1]{\renewcommand{\VWATT}{#1}}
\newcommand{\VANTENNA}{}
\newcommand{\ANTENNA}[1]{\renewcommand{\VANTENNA}{#1}}

\newcommand{\VADATE}{}
\newcommand{\ADATE}[1]{\renewcommand{\VADATE}{#1}}
\newcommand{\VATIME}{}
\newcommand{\ATIME}[1]{\renewcommand{\VATIME}{#1}}
\newcommand{\VAQRG}{}
\newcommand{\AQRG}[1]{\renewcommand{\VAQRG}{#1}}
\newcommand{\VAMODE}{}
\newcommand{\AMODE}[1]{\renewcommand{\VAMODE}{#1}}
\newcommand{\VARST}{}
\newcommand{\ARST}[1]{\renewcommand{\VARST}{#1}}
\newcommand{\VQSLCOMMENT}{}
\newcommand{\QSLCOMMENT}[1]{\renewcommand{\VQSLCOMMENT}{#1}}

\newcommand{\VBDATE}{}
\newcommand{\BDATE}[1]{\renewcommand{\VBDATE}{#1}}
\newcommand{\VBTIME}{}
\newcommand{\BTIME}[1]{\renewcommand{\VBTIME}{#1}}
\newcommand{\VBQRG}{}
\newcommand{\BQRG}[1]{\renewcommand{\VBQRG}{#1}}
\newcommand{\VBMODE}{}
\newcommand{\BMODE}[1]{\renewcommand{\VBMODE}{#1}}
\newcommand{\VBRST}{}
\newcommand{\BRST}[1]{\renewcommand{\VBRST}{#1}}

%% ------------------------------------------------------------------
\input{data.tex}

\begin{document}
%% ------------------------------------------------------------------
% For "vspace{0pt}" see: https://latex.org/forum/viewtopic.php?t=1059
%
\begin{minipage}[t]{40mm}\vspace{0pt}%
  \ifthenelse%
      {\equal{\VFROM}{DK}}%
      {\bluesout{\Huge\textbf{PE\,1AQP}}}%
      {\Huge\textbf{PE\,1AQP}}
      
  \ifthenelse%
      {\equal{\VFROM}{PE}}%
      {\bluesout{\Huge\textbf{DK1AQP}}}%
      {\Huge\textbf{DK1AQP}}
                        
  \normalsize
  \smallskip
  
  Jon Krom
                        
  \small
  Somestreet 0 
                        
  00000 Sometown
                        
  http:{\scriptsize//}pe1aqp.krom.eu\\
  {\scriptsize (Q\textsc{sl} via bureau or direct, \textsc{pse}.)}%
\end{minipage}%
%
\begin{minipage}[t]{13mm}\vspace{0pt}%
  \centering
  \includegraphics[width=13mm]{veronAW.pdf}
  \footnotesize VERON\\Afd.\,A22
\end{minipage}%
\hfill%
\begin{minipage}[t]{13.3mm}\vspace{0pt}%
  \centering
  \includegraphics[width=13.3mm]{darc}
  \footnotesize DARC\\DOK G01
\end{minipage}
\hfill
\hfill
\begin{minipage}[t]{\mpl}\vspace{0pt}%
  \framebox[\mpl][l]{\parbox[l][12mm]{\mpl}%
    { \scriptsize QSO(s) WITH: \\
      \Large \textbf{\-  \hfill \textblue \VTOCALL \hfill  }
      \vfill
      \scriptsize
      OPERATOR: {\textblue \VTOOP}    
  }}
  \smallskip
  
  \framebox[\mpl][l]{\parbox[l][6ex]{\mpl}%
    {
      \scriptsize VIA:
  }}%
  \footnotesize%
  
\end{minipage}

%\newline
\vfill
\-\hfill I'm pleased to confirm the following QSO(s):
\topsep3pt
\begin{center}
  \begin{tabularx}{\textwidth}%
    %\begin{tabular}%
    {| c |X|X|X|X|X|X|X|}
    \hline
        {\bf\ YYYY-MM-DD}&{\bf\ UTC}&{\bf\ MHz}&{\bf\ Mode}&{\bf\ Report}&{\bf\ QSL}\\
        \hline
        \ifthenelse{\equal{\VADATE}{}}{}{\textblue \VADATE}
        &
        \ifthenelse{\equal{\VATIME}{}}{}{\textblue \VATIME}
        &
        \ifthenelse{\equal{\VAQRG}{}}{}{\textblue \VAQRG}
        &
        \ifthenelse{\equal{\VAMODE}{}}{}{\textblue \VAMODE}
        &
        \ifthenelse{\equal{\VARST}{}}{}{\textblue \VARST}
        & PSE/TNX \\
        \hline
        \ifthenelse{\equal{\VBDATE}{}}{}{\textblue \VBDATE}
        &
        \ifthenelse{\equal{\VBTIME}{}}{}{\textblue \VBTIME}
        &
        \ifthenelse{\equal{\VBQRG}{}}{}{\textblue \VBQRG}
        &
        \ifthenelse{\equal{\VBMODE}{}}{}{\textblue \VBMODE}
        &
        \ifthenelse{\equal{\VBRST}{}}{}{\textblue \VBRST}
        & PSE/TNX \\
        \hline
  \end{tabularx}
\end{center}

\textbf{TRX\ : }
\ifthenelse%
    {\isundefined{\VMYTRX}}%
    {\ifthenelse{\equal{}{\VFROM}}{\blankbox}{\bluebox}\ IC-7100\ \ }%
    {\ifthenelse%
      {\equal{}{\VMYTRX}}%
      {}%
      {\bluebox\ \VMYTRX\ \ }}
    \blankbox\makeruler
    \textbf{ Power:}
    \makebox[10mm]{\ifthenelse%
      {\equal{\VWATT}{}}{W}{\textblue \VWATT}}%
%
\newline
\textbf{ANT.: }\textblue{\small\VANTENNA}
%
\newline
\textbf{QTH\,: }
\ifthenelse%
    {\isundefined{\NONDEFQTH}\AND\NOT\equal{}{\VFROM}}%
    {\bluebox}%
    {\blankbox}%
    \ Aachen JO30AS{\footnotesize 54ag }
\ifthenelse%
    {\isundefined{\NONDEFQTH}}%
    {\blankbox\makeruler}%
    {\bluebox%
      \ifthenelse%
          {\equal{}{\NONDEFQTH}}%
          {\makeruler}%
          {\ \NONDEFQTH}}
\newline
\ifthenelse%
    {\equal{\VQSLCOMMENT}{}}%
    {}%
    {\textbf{NOTE:\,}\textblue \VQSLCOMMENT}
%
\-\hfill   73, \makebox[30mm]{\dotfill}\hfill
\vfill
%% ------------------------------------------------------------------
\end{document}
