Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to create invoices with the invoice package, however I'm running into a problem. In some cases I only have one project with multiple fees. This creates a rather... ugly looking document with the end of it being a Sub total of the fees, a sub total of the project (both exactly the same), a sum of the fees (again the same as before) and then the total. Is there any way to get rid of all these subtotals?

\documentclass[11pt]{letter}
 \usepackage{invoice}
 \address{123 derp }
 \signature{D}
 \date{10-10-2012}
 \begin{document}
  \begin{letter}{ }
   \opening{Invoice no. }
    \begin{invoice}{USD}{0}
     \ProjectTitle{}
       \Fee{herp} {50} {2}
       \Fee{derp}{50}{5}
       \hline
    \end{invoice}
   \end{letter}
 \end{document}

(also sorry for the stupid tags. I have no idea what to file this under other than invoice and I don't have the rep to create a tag for it)

share|improve this question
add comment

1 Answer

While I'm not familiar with any of the packages of that nature, I've had a quick look at the package documentation and code for invoice and I believe there is no 'in-built' mechanism to do this. However, I have come up with a quick hack (based on the current version of invoice.sty and liable to break) which simply omits printing of these subtotals (but still calculates them). I'm not quite sure if a solution with such a result is acceptable to you, or if you still wish to get subtotals when they actually provide some meaning? (The latter would be possible but more involved.)

So here's the hack (and I apologise because it is ugly), and I should also add the disclaimer that while I think it doesn't change the calculations, you should probably convince yourself of this too:

\documentclass[11pt]{letter}
 \usepackage{invoice}
\makeatletter
\renewcommand{\Print@ST@Fees}{%
    \gdef\Flag{4}%
    %\SubtotalFee & &   &   &%  print the subtotal of fees
    %   \Print@Value{\theST@Fee}\\%
}%
\renewcommand{\ST@Project}{%
    \gdef\Flag{7}%
    \\
    %\SubtotalProject & &   &   & 
            \addtocounter{ST@Project}{\theST@Fee}%
            \addtocounter{ST@Project}{\theST@VAT}%
            \addtocounter{ST@Project}{\theST@Expenses}%
    %       \Print@Value{\theST@Project}\\
}
\renewcommand{\Tot@l}{%
    \\\hline
    \ifnum\theFee>0 %\SumFees&  &   &   &%
                %\Print@Value{\theFee}\\ 
        \ifVATnonzero%
            \Total@VAT@Printout%
        \fi%
    \fi%
    \ifnum\theExpenses>0 \SumExpenses&  &   &   &%
                \Print@Value{\theExpenses}\\ 
    \fi%
    \ifnum\theDiscount<0 \Discount@Contents&    &   &   &%
                \Print@Value{\theDiscount}\\ 
    \fi%
    \hline\hline
    \textbf{\Total} &   &   &   &%
        \message{^^J\Currency: \BC}%
        \message{^^J\VAT: \VAT@rate}%
        \addtocounter{Total}{\theFee}%
        \message{^^J\SumFees: }\Message@Value{\theFee}%
        \addtocounter{Total}{\theVAT}%
        \message{^^J\SumVAT: }\Message@Value{\theVAT}%
        \addtocounter{Total}{\theExpenses}%
        \message{^^J\SumExpenses: }\Message@Value{\theExpenses}%
        \ifnum\theDiscount<0 %
        \addtocounter{Total}{\theDiscount}%
        \message{^^J\Discount@Contents: }\Message@Value{\theDiscount}%
        \fi %
        \textbf{\Print@Value{\theTotal}}%
        \message{^^J\Total: }%
            \Message@Value{\theTotal}\message{^^J^^J}\\%
    \end{longtable}
    %\end{center}% Removed 20050621 by suggestion from ...
    \gdef\Flag{8}%
}
\makeatother

 \address{123 derp }
 \signature{D}
 \date{10-10-2012}
 \begin{document}
  \begin{letter}{ }
   \opening{Invoice no. }
    \begin{invoice}{USD}{0}
     \ProjectTitle{}
       \Fee{herp} {50} {2}
       \Fee{derp}{50}{5}
       \hline
    \end{invoice}
   \end{letter}
 \end{document}

If you find this answer isn't satisfactory, see what answers others are able to provide and/or consider contacting the package maintainer.

share|improve this answer
    
Gonzalo's answer has a nice idea about toggling the subtotal generation on and off. This answer could be adapted in a similar way. However, I believe Gonzalo's answer currently is affecting the final total calculations, because the commands defined to do nothing there would normally do some calculations as well as show the subtotals! –  cyberSingularity Aug 10 '12 at 23:59
    
You're probably right; in any case, I didn't like my answer much (I didn't really worked through the code to see if my redefinitions changed something essential), so I will delete it. –  Gonzalo Medina Aug 11 '12 at 0:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.