%{#
    Copyright (c) 2015 Chintalagiri Shashank
    Released under the MIT license
%#}
\documentclass[subject=centered, fromalign=right, foldmarks=false, fontsize=9pt, DIV=13]{scrlttr2}
\usepackage[utf8]{inputenc}
%\usepackage[top=0in, bottom=0.5in, right=1in, left=1in]{geometry}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tfrupee}
\pdfmapfile{=tfrupee.map}
\renewcommand{\ttdefault}{pcr}

\makeatletter
\@setplength{toaddrvpos}{3.5cm}
\@setplength{refvpos}{6cm}
\makeatother

\begin{document}
\setkomavar{signature}{For %{{stage.company%}}\\%{{stage.signatory%}}}
\setkomavar{location}{\sffamily\scriptsize \small \raggedleft \textbf{\tiny INTERNAL REFERENCE} \\ \texttt{%{{stage.sno%}}}}

\setkomavar{subject}{{Technical Writeup / End Use}\\\small\textit{For contents as listed in %{{stage.given_data.supplier_name%}} Invoice No. %{{stage.given_data.invoice_no%}},\\shipped via %{{stage.given_data.shipper%}} AWB %{{stage.given_data.shipper_awb_no%}}}}

\begin{letter}{The Deputy Commissioner of Customs\\
		New Courier Terminal, I.G.I Airport,\\
		New Delhi, India}
		
		
\opening{Dear Sir/Madam,}
% \pagestyle{fancy}
{
The contents of this package are electronic components, manufactured by various companies across the world. We have purchased them from a distributor, i.e., %{{stage.given_data.supplier_name%}}. The full list of %{{stage.linecount%}} line items is present in Invoice No. %{{stage.given_data.invoice_no%}}, a copy of which should be accompanying the shipment as well. The prices may readily be verified as needed from the %{{stage.given_data.supplier_name%}} website (%{{stage.given_data.supplier_website%}}). These components have been pre-paid for by SWIFT Wire Transfer. An overwhelming majority of these components (or suitable replacements thereof) are not manufactured in India at this time.
\vspace{0.5em}

These are to be used in our products, viz.:
\textbf{\small
\begin{itemize}
 \item nanoRev Air Scanning Tunnelling Microscopes
 \item Xplore Physical Quantities Measurement Systems
 \item QDA Series Data Acquisition Systems
\end{itemize}
}
 These products are high-end scientific instruments developed and marketed by us, i.e., %{{stage.company%}}. Our customers are typically Indian Universities, Colleges, and Research Institutions. The intruments are generally of use for research in the fields of materials and experimental condensed matter physics. 
 \vspace{0.5em}
 
 We have attempted to classify the individual line items as per the applicable tariff sections to the best of our knowledge. Any additional charges, such as frieght and insurance, if any, have been divided among the various lines in proportion with the invoice value of each line.
 \vspace{0.5em}
 \small
 \begin{center}
 \keepXColumns
 \renewcommand{\arraystretch}{1.2}
 \begin{tabularx}{1.0\textwidth}{|>{\centering\arraybackslash}p{0.05\textwidth} | >{\raggedright\arraybacklash}p{0.30\textwidth} | >{\raggedright\arraybackslash}X | >{\centering\arraybackslash}p{0.1\textwidth} | >{\raggedleft\arraybackslash}p{0.15\textwidth}|}
   \hline 
   \textbf{S.No.} & \textbf{Tariff Section} & \textbf{Line Numbers (Idx)} & \textbf{Qty} & \textbf{Value (USD)} \\\hline
  %{ for section in stage.sectable %}
  %{{loop.index%}} & {\tt %{{section.code%}}} {\small %{{section.name%}}} & {\tt %{for idx in section.idxs%} %{{idx%}}%{if not loop.last%}, %{endif%} %{endfor%} } & {\tt %{{section.qty%}} } & {\tt %{{section.value%}} }\\\hline
  %{ endfor %}
  %{ if stage.unclassified.qty > 0 %}
   & {Unclassified} & {\tt %{for idx in stage.unclassified.idxs%} %{{idx%}}%{if not loop.last%}, %{endif%} %{endfor%} } & {\tt %{{stage.unclassified.qty%}} } & {\tt %{{stage.unclassified.value%}} }\\\hline
   %{endif%}
  & \textbf{Total} & & {\tt\bf %{{stage.tqty%}} }& {\tt\bf %{{stage.tvalue%}}} \\\hline
 \end{tabularx}
 \end{center}
 
 }
\small 
\vspace{1em}
\closing{Sincerely,}
\end{letter}
\end{document}
