1

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

Vaibhav
  • 6,625
  • 15
  • 49
  • 76
  • 4
    In case there isn't, if you provided more info about how you want to input that information, yes, it would be possible to write it. By the way, “receipt number which should be automatically generated” how can you know on a compilation which number to start? You must provide the starting point. – Manuel Oct 20 '14 at 19:53
  • May be using data tool – Vaibhav Oct 21 '14 at 01:39
  • This is an example - http://www.wordstemplates.org/category/receipt-templates/ – Vaibhav Oct 21 '14 at 02:40
  • 3
    As it stands I don't think this question is going to get answered. It's not clear which parts are an issue, and with no example code we've no real idea what you have already done. – Joseph Wright Oct 28 '14 at 11:42
  • Perhaps one of these invoice packages could be adapted. You could, I guess, base the invoice number on the date and time although only if the sole criterion is uniqueness rather than, say, being part of an integer sequence. – cfr Oct 28 '14 at 12:51
  • I have used LaTeX for this purpose, but I do not have the documents on-hand. I'll post an answer tonight. There is a package you can use. – Sean Allred Oct 28 '14 at 14:07
  • 1
    lualatex may 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
  • For invoices I use a spreadsheet which I export to csv. Then I let TeX read this file and typeset the individual lines on a paper. How do you input the values (rcpt.no., value, customer, description)? – Marcel Korpel Oct 28 '14 at 17:30
  • 1
    Found this http://www.ctan.org/tex-archive/macros/latex/contrib/invoice and this http://www.latextemplates.com/template/invoice and a previous question http://tex.stackexchange.com/questions/1308/nice-looking-invoices – alfC Oct 29 '14 at 03:32

3 Answers3

8

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.

enter image description here

\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}

enthu
  • 3,795
  • This is off-topic : why % ------------- | ---------- ? What is the purpose of this | ? – Clément Nov 03 '14 at 15:53
  • 2
    @Clément its just a marker to point to the invoice number which needs to be changed, directly below on the next line. Personally, I don't see why you would want to do receipts with latex when there are about a million accounting packages built for this purpose (amongst other things)... – Nicholas Hamilton Nov 03 '14 at 19:28
  • @Clément I think nicholas's comment perfectly answers your question. – enthu Nov 03 '14 at 20:02
2

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.

Clément
  • 5,591
1

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
bene
  • 2,090