Is there a package to generate a receipt which has following information. Header with a company name , date , receipt number which should be automatically generated and text saying - Received Xx amount from Mr xyz as a payment for xyz.
Signature
Is there a package to generate a receipt which has following information. Header with a company name , date , receipt number which should be automatically generated and text saying - Received Xx amount from Mr xyz as a payment for xyz.
Signature
I made a sample receipt using datatool and tikz. For printing such receipt, you may need a database in which you store the data of your customers. I made it by creating a cvs file named database:
BillNumber,FirstName,Surname,Address,Date,Amount
11234,Name,Family,"No. 1, First St.", "2014,06,02",1000
21485,Name,Family,"No. 1, First St.", "2014,06,02",1000
35987,Name,Family,"No. 1, First St.", "2014,06,02",1000
45784,Name,Family,"No. 1, First St.", "2014,06,02",1000
56874,Name,Family,"No. 1, First St., City, Country.", "2014,06,02",1000
69851,Name,Family,"No. 1, First St.", "2014,06,02",1000
By running the code bellow, you will ask the latex to read the receipt or bill number you enter in front of the \def \query { } and all the data you need will be printed in the output pdf file.
I used the tikz package to create a sample logo too, you may change this part and add your own company's logo or even omit it from the file.

\documentclass{article}
\usepackage{datatool}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{latexsym}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[a6paper, margin=10mm, landscape]{geometry}
% ------------- | ---------- Please enter the bill number you want to print
\def \query {56874}
% ---------------------------------------------------------------------------------
\begin{document}
\thispagestyle{empty}
\pagecolor{yellow!25}
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1.0pt,rounded corners=10pt,]
($ (current page.north west) + (5mm,-5mm) $)
rectangle
($ (current page.south east) + (-5mm,5mm) $);
\end{tikzpicture}
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1.0pt,rounded corners=10pt,]
($ (current page.north west) + (15mm,-10mm) $)
rectangle
($ (current page.south east) + (-105mm,65mm) $);
\node at (-2.11,-1) {Logo};
\end{tikzpicture}
{\centering
{\bf \LARGE Your Store Name}\[2.5mm]
Address Line Here\
Phone: 555-555-555555\
Fax: 123-123-123456\[15mm]
{\bf \Large Cash Receipt}\hfill$\overline{\text{cashier's signature}}$\[10mm]
}
\DTLloaddb{database}{database.csv}
\DTLforeach*[\DTLiseq{\billnumber}{\query}]{database}{%
\billnumber=BillNumber,\firstname=FirstName,\surname=Surname,\address=Address,\billdate=Date,\amount=Amount}{%
\noindent {\bf Cash Receipt Number:} \billnumber \hfill {\bf Date:} \billdate \vfill
\noindent Cash Received from\hfill \firstname{ }\surname\hfill of \hfill $\amount \hfill payed in cash~$\blacksquare$~/~by check~$\square$\vfill
\noindent{\bf Customer's address:} \address\vfill
}
\end{document}
% ------------- | ---------- ? What is the purpose of this | ?
– Clément
Nov 03 '14 at 15:53
A partial answer, just to show how you can increment a counter (to be fair, this trick was found somewhere here, on TeX.sxe, but I can't find where anymore…).
\documentclass{article}
\newcounter{NumberOfRuns}
\makeatletter
\AtEndDocument{%
\immediate\write\@auxout{%
\string\setcounter{NumberOfRuns}{\number\value{NumberOfRuns}}}
}%
\AtBeginDocument{%
\refstepcounter{NumberOfRuns}
}%
\makeatletter
\begin{document}
This document was compiled \theNumberOfRuns~times so far!
\end{document}
This small code will store in the aux file the number of times your tex was compiled so far. You can edit it or remove it to affect the value of your NumberOfRuns counter.
I have a solution, which you can modify for your needs:
\documentclass[
11pt,
a4paper,
english
]{scrartcl}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newwrite\NoFile
\newread\NoFile
\newread\DataFile
\newcounter{NoReceipt}
\openin\NoFile=NoFile.txt%
\read\NoFile to \fileline
\setcounter{NoReceipt}{\fileline}
\closein\NoFile
\stepcounter{NoReceipt}
\immediate\openout\NoFile=NoFile.txt
\immediate\write\NoFile{\theNoReceipt}
\immediate\closeout\NoFile
\begin{document}
Company
\today
Receipt No. \theNoReceipt
\openin\DataFile=DataFile.txt%
Received
\read\DataFile to \fileline
\fileline
from
\read\DataFile to \fileline
\fileline
as payment for
\read\DataFile to \fileline
\fileline
\closein\DataFile
\end{document}
Furthermore, you need two files, NoFile.txt and DataFile.txt. NoFile.txt contains the current number, so you need to provide this file initially with just the content 0 and DataFile.txt contains the information in this format:
195\$
Mr. X
Drugs
lualatexmay be useful here, since it can open databases etc. But, indeed, you should speficy your needs more precisely in order to get a useful answer. – nplatis Oct 28 '14 at 14:10