https://wiki.contextgarden.net/index.php?title=Invoice&feed=atom&action=history
Invoice - Revision history
2024-03-29T13:05:40Z
Revision history for this page on the wiki
MediaWiki 1.34.1
https://wiki.contextgarden.net/index.php?title=Invoice&diff=28940&oldid=prev
Garulfo at 16:55, 8 June 2020
2020-06-08T16:55:44Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 16:55, 8 June 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l300" >Line 300:</td>
<td colspan="2" class="diff-lineno">Line 300:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Sample documents]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Sample documents]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Category:<del class="diffchange diffchange-inline">Lua</del>]]</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Category:<ins class="diffchange diffchange-inline">Programming and Databases</ins>]]</div></td></tr>
</table>
Garulfo
https://wiki.contextgarden.net/index.php?title=Invoice&diff=28755&oldid=prev
Garulfo at 14:45, 8 June 2020
2020-06-08T14:45:53Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 14:45, 8 June 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l300" >Line 300:</td>
<td colspan="2" class="diff-lineno">Line 300:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Sample documents]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Sample documents]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Lua]]</ins></div></td></tr>
<!-- diff cache key wikidb16_33:diff::1.12:old-28753:rev-28755 -->
</table>
Garulfo
https://wiki.contextgarden.net/index.php?title=Invoice&diff=28753&oldid=prev
Garulfo at 14:44, 8 June 2020
2020-06-08T14:44:40Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 14:44, 8 June 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l298" >Line 298:</td>
<td colspan="2" class="diff-lineno">Line 298:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>\stopletter</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>\stopletter</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></texcode></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></texcode></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Sample documents]]</ins></div></td></tr>
</table>
Garulfo
https://wiki.contextgarden.net/index.php?title=Invoice&diff=22226&oldid=prev
Hraban: adaptions to current letter module
2014-01-13T07:33:49Z
<p>adaptions to current letter module</p>
<a href="https://wiki.contextgarden.net/index.php?title=Invoice&diff=22226&oldid=21324">Show changes</a>
Hraban
https://wiki.contextgarden.net/index.php?title=Invoice&diff=21324&oldid=prev
Hraban: add link to Letter
2012-12-07T19:32:50Z
<p>add link to Letter</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 19:32, 7 December 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>< [[Sample documents]]</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>< [[Sample documents<ins class="diffchange diffchange-inline">]] | [[Letter</ins>]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This is my invoice setup, it works with MkIV as of 2011-12.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This is my invoice setup, it works with MkIV as of 2011-12.</div></td></tr>
</table>
Hraban
https://wiki.contextgarden.net/index.php?title=Invoice&diff=13516&oldid=prev
Hraban: new
2011-12-14T22:46:30Z
<p>new</p>
<p><b>New page</b></p><div>< [[Sample documents]]<br />
<br />
This is my invoice setup, it works with MkIV as of 2011-12.<br />
<br />
It’s an application of Wolfgang’s letter module with a lot of tweaks that I could never think of on my own.<br />
<br />
The code isn’t pretty or modular or readily usable for you, but works for me and might get you over some hurds.<br />
<br />
As you see, I need my invoices in Euros or Swiss Francs. And I need to charge some work by time and some by fixed amounts. If you need number of pieces etc., it should be easy to adapt.<br />
<br />
Big thanks to Wolfgang and all the other helpful power users on NTG-ConTeXt!<br />
<br />
== Lua functions ==<br />
File <code>invoicefunctions.tex</code><br />
<texcode><br />
\startluacode<br />
userdata = userdata or {}<br />
<br />
userdata.invoice = { amount = 0, hours = 0, perhour = 50, currency1 = "€", currency2 = "SFr", exchangerate=1.22, items = {} }<br />
<br />
function userdata.RegisterTimeItem(text, hours)<br />
if tex.systemmodes.trialtypesetting then return end<br />
table.insert(userdata.invoice.items, {text=text, hours=hours, amount=0})<br />
userdata.invoice.hours = userdata.invoice.hours + hours<br />
userdata.invoice.amount = userdata.invoice.amount + hours * userdata.invoice.perhour<br />
end<br />
<br />
function userdata.RegisterAmountItem(text, amount)<br />
if tex.systemmodes.trialtypesetting then return end<br />
table.insert(userdata.invoice.items, {text=text, hours=0, amount=amount})<br />
userdata.invoice.amount = userdata.invoice.amount + amount<br />
end<br />
<br />
function userdata.RegisterTextItem(text)<br />
if tex.systemmodes.trialtypesetting then return end<br />
table.insert(userdata.invoice.items, {text=text, hours=0, amount=0})<br />
end<br />
<br />
function userdata.numberformat(amount)<br />
-- replace decimal point with comma (= German format)<br />
return string.gsub(string.format("\%.2f", amount), "%.", ",")<br />
end<br />
<br />
function userdata.InvoiceTimeLine(text, hours, printperhour)<br />
context.NC(text)<br />
context.NC(userdata.numberformat(hours) .. "\\,h")<br />
if printperhour then<br />
context.NC("à " .. userdata.numberformat(userdata.invoice.perhour) .. "\\," .. userdata.invoice.currency1 .. "/h")<br />
else<br />
context.NC()<br />
end<br />
context.NC(userdata.numberformat(hours * userdata.invoice.perhour) .. "\\," .. userdata.invoice.currency1)<br />
context.NC()<br />
context.NR()<br />
end<br />
<br />
function userdata.InvoiceAmountLine(text, amount)<br />
context.NC(text)<br />
context.NC()<br />
context.NC()<br />
context.NC(userdata.numberformat(amount) .. "\\," .. userdata.invoice.currency1)<br />
context.NC()<br />
context.NR()<br />
end<br />
<br />
function userdata.InvoiceTextLine(text)<br />
context.NC(text)<br />
context.NC()<br />
context.NC()<br />
context.NC()<br />
context.NC()<br />
context.NR()<br />
end<br />
<br />
function userdata.InvoiceSumLine(text, printperhour)<br />
context.HL()<br />
context.NC("\\bf " .. text)<br />
if userdata.invoice.hours > 0 then<br />
context.NC(userdata.numberformat(userdata.invoice.hours) .. "\\,h")<br />
else<br />
context.NC()<br />
end<br />
if printperhour then<br />
context.NC("à " .. userdata.numberformat(userdata.invoice.perhour) .. "\\," .. userdata.invoice.currency1 .. "/h")<br />
else<br />
context.NC()<br />
end<br />
context.NC("\\bf " .. userdata.numberformat(userdata.invoice.amount) .. "\\," .. userdata.invoice.currency1)<br />
context.NC()<br />
context.NR()<br />
if userdata.invoice.currency1 ~= userdata.invoice.currency2 then<br />
context.NC()<br />
context.NC()<br />
context.NC()<br />
context.NC("(" .. userdata.numberformat(userdata.invoice.amount * userdata.invoice.exchangerate) .. "\\," .. userdata.invoice.currency2 .. ")")<br />
context.NC()<br />
context.NR()<br />
end<br />
end<br />
<br />
function userdata.Invoice()<br />
local amountsum, hoursum = 0,0<br />
local printperhour<br />
printperhour = (userdata.invoice.amount ~= (userdata.invoice.hours * userdata.invoice.perhour))<br />
context.starttabulate({"|lw(8cm)|rg(,)w(2cm)|rg(,)w(2cm)|rg(,)w(3cm)|"})<br />
for no, item in ipairs(userdata.invoice.items) do<br />
if item.hours ~= 0 and item.amount == 0 then<br />
userdata.InvoiceTimeLine(item.text, item.hours, printperhour)<br />
hoursum = hoursum + item.hours<br />
amountsum = amountsum + item.hours * userdata.invoice.perhour<br />
elseif item.amount ~= 0 and item.hours == 0 then<br />
userdata.InvoiceAmountLine(item.text, item.amount)<br />
amountsum = amountsum + item.amount<br />
else<br />
userdata.InvoiceTextLine(item.text)<br />
end<br />
end<br />
printperhour = (hoursum > 0) and (amountsum == (hoursum * userdata.invoice.perhour))<br />
--userdata.invoice.hours = hoursum<br />
--userdata.invoice.amount = amountsum<br />
userdata.InvoiceSumLine("gesamt", printperhour)<br />
context.stoptabulate()<br />
end<br />
<br />
\stopluacode<br />
</texcode><br />
<br />
== Letter setup ==<br />
File <code>invoicesetup.tex</code><br />
<texcode><br />
\mainlanguage[de]<br />
\usemodule[letter]<br />
<br />
\setuplanguage [de] [date={year, –, mm, –, dd}] % ISO 8601 date<br />
<br />
\usemodule[simplefonts]<br />
\setmainfont[Gentium Basic][expansion=quality,protrusion=quality]<br />
\setsansfont[Delicious][scale=0.9]<br />
\setupbodyfont[rm,9.5pt]<br />
\setupinterlinespace[3.0ex] % default: 2.8ex<br />
<br />
\setuptabulate[distance=0pt]<br />
<br />
\def\MyCompany{{\it MyCompany}}<br />
\useexternalfigure[logo][logo-head]<br />
\useexternalfigure[schriftzug][logo-type]<br />
<br />
\setupletter[<br />
% Sender address in envelope window<br />
backaddress={\MyCompany\ · My Name · Samplestr.\,11 · CH-1234 Village}<br />
]<br />
<br />
% Use the sender address line, but not the default subject line<br />
\setupletterstyle[backaddress=yes,reference=no]<br />
<br />
% We put our logo in the head<br />
\setupletterstyle[head,nexthead][<br />
hoffset=128mm,<br />
voffset=0pt,<br />
alternative=fiee,<br />
]<br />
<br />
% Define logo for the first page<br />
\defineletterelement[head][fiee]{%<br />
\framed[background=logo,height=35mm,frame=off]{\vbox{<br />
\par\blank[15mm]\par<br />
\externalfigure[schriftzug]}}<br />
<br />
}<br />
<br />
% Other logo for subsequent (right) pages<br />
\defineletterelement[nexthead][fiee]{%<br />
\externalfigure[logo][height=2cm, width=6cm]}<br />
<br />
\setupletterstyle[nexthead][<br />
state=right,<br />
]<br />
<br />
% We don't really use this<br />
\copyletterelement[location][fiee][reference][d]<br />
<br />
\setupletterstyle[location][<br />
hoffset=128mm,<br />
voffset=3cm,<br />
alternative=fiee,<br />
list={name,street,city,phone,email,web,skype}<br />
]<br />
<br />
\setupletter[<br />
name={My Name},<br />
street={Samplestrasse 11},<br />
city={CH-1234 Village},<br />
phone={+41 11 23\,45\,67},<br />
mobile={+41 00 99\,88\,88\,88},<br />
email={me@mycompany.com},<br />
web={www.example.com},<br />
skype={example}<br />
]<br />
<br />
% center around the :<br />
\startsetups letter:location<br />
\tfx\it<br />
\starttabulate[|rw(39mm)|p|]<br />
\NC name \NC\lettervalue{name} \NC\NR<br />
\NC location \NC\lettervalue{street}\\\lettervalue{city}\NC\NR<br />
\NC phone \NC\lettervalue{phone}\\\lettervalue{mobile} \NC\NR<br />
\NC internet \NC\lettervalue{email}\\\lettervalue{web} \NC\NR<br />
\NC skype \NC\lettervalue{skype} \NC\NR<br />
\stoptabulate<br />
\stopsetups<br />
<br />
<br />
\setupletterstyle[address][alternative=fiee]<br />
% Our own recipient setup without too much space before the address<br />
\defineletterelement[address][fiee]{<br />
\setupinterlinespace<br />
\blank<br />
\lettervalue{toname}\\<br />
\lettervalue{toaddress}<br />
}<br />
<br />
% Subject and date on the same line, date below logo<br />
\startsetups letter:subject<br />
\bTABLE[frame=off]<br />
\bTR<br />
\bTD[width=\dimexpr169mm-\backspace\relax]\lettervalue{subject}\eTD<br />
\bTD{\tf\lettervalue{date}}\eTD % auto date<br />
%\bTD{\tf 2011-11-14}\eTD % manual date<br />
\eTR<br />
\eTABLE<br />
\stopsetups<br />
<br />
% account information at the foot, below the logo<br />
\defineletterelement[foot][fiee]{<br />
\tfx\it<br />
% \starttabulate[|rw(5em)a{{\tf~:}}|p|]<br />
\starttabulate[|rw(39mm)|p|]<br />
\NC account \NC \NC\NR<br />
\NC Swiss \NC 12-34567-89 \NC\NR<br />
\NC IBAN \NC CH12\,1234\,5678\,0000\,1234\,X \NC\NR<br />
\NC German \NC Kto. 111\,222\,333\\Fraudbank, BLZ 110\,110\,10 \NC\NR<br />
\NC IBAN \NC DE11\,1234\,0000\,1234\,9999\,12 \NC\NR<br />
\stoptabulate<br />
\crlf<br />
}<br />
<br />
\setupletterstyle[foot][<br />
preset=leftbottom,<br />
hoffset=130mm,<br />
voffset=3.4cm,<br />
alternative=fiee,<br />
]<br />
<br />
% switch off reference line<br />
\setupletterstyle[reference][alternative=none]<br />
<br />
% Move the text a bit up<br />
\setupletterstyle[firstpage][<br />
topspace=10cm<br />
]<br />
<br />
% Adjust text start on subsequent pages<br />
\setupletterstyle[secondpage][<br />
topspace=3cm,<br />
]<br />
<br />
% Move marks to the paper rim (won't print on most printers)<br />
\setupletterstyle[topmark,botmark,cutmark][<br />
hoffset=-2mm<br />
]<br />
</texcode><br />
<br />
== Invoice ==<br />
File <code>invoice.tex</code><br />
<texcode><br />
\input invoicesetup.tex<br />
\input invoicefunctions.tex<br />
<br />
\setupletter[<br />
% Recipient<br />
%toname={Pragma ADE\\Mr.\\,Hans Hagen},toaddress={Ridderstraat 27\\8061GH Hasselt NL},<br />
% here I keep commented all of my few customers<br />
]<br />
\starttext<br />
<br />
\startletter[subject={Invoice No.\,99/2011}]<br />
%\startletter[subject={Reminder on invoice No.\,1/2011}]<br />
<br />
Special services in December 2011:<br />
<br />
{<br />
\setuptabulate[distance=.25em]<br />
\startluacode<br />
userdata.invoice.perhour = 111<br />
--userdata.invoice.currency1 = "SFr"<br />
<br />
userdata.RegisterTextItem("Some project description")<br />
<br />
userdata.RegisterAmountItem("Data handling, flat-rate", 500)<br />
<br />
userdata.RegisterTimeItem("Design of issue 1 of Some magazine", 42.5)<br />
<br />
userdata.Invoice()<br />
\stopluacode<br />
}<br />
<br />
Due on 1.\,1.\2012. Earlier is nicer.<br />
<br />
\blank[2*big]<br />
<br />
\MyCompany\ bedankt sich für den Auftrag.<br />
\blank[2*big]<br />
Mit freundlichen Grüßen,<br />
<br />
\externalfigure[signature]<br />
<br />
My Name<br />
<br />
\stopletter<br />
<br />
\stoptext<br />
</texcode></div>
Hraban