All pastes #899306 Raw Edit

Unnamed

public text v1 · immutable
#899306 ·published 2008-02-11 01:02 UTC
rendered paste body
%% snippet from modified library

\newcommand{\RichiHLine}[4]{%
%\def\timediff#1:#2-#3:#4 {%
  \setcounter{bh}{#1}
  \setcounter{bm}{#2}
  \setcounter{eh}{#3}
  \setcounter{em}{#4}
  \ifthenelse{\(\value{eh}>\value{bh}\or\value{eh}=\value{bh}\)
              \and\(\value{em}>\value{bm}\or\value{em}=\value{bm}\)}
    {\setcounter{dh}{\value{eh}-\value{bh}}
     \setcounter{dm}{\value{em}-\value{bm}}}
    {\ifthenelse{\(\value{eh}>\value{bh}\or\value{eh}=\value{bh}\)
                 \and\value{em}<\value{bm}}
      {\setcounter{dh}{\value{eh}-\value{bh}-1}
       \setcounter{dm}{60+\value{em}-\value{bm}}}
      {\ifthenelse{\value{eh}<\value{bh}
        \and\(\value{em}>\value{bm}\or\value{em}=\value{bm}\)}
       {\setcounter{dh}{24+\value{eh}-\value{bh}}
        \setcounter{dm}{\value{em}-\value{bm}}}
       {\ifthenelse{\value{eh}<\value{bh}\and\value{em}<\value{bm}}
       {\setcounter{dh}{23+\value{eh}-\value{bh}}
        \setcounter{dm}{60+\value{em}-\value{bm}}}}}{}}
    \setcounter{hrdec}{\value{dm}*5/3}
%    \gdef\RichiHValue{\value{dm}*5/3}
%    \ifthenelse{\value{dm}>5}{\thedh.\thehrdec}{\thedh.0\thehrdec}
    \ifthenelse{\value{dm}>5}{
        \gdef\RichiHValue{\thedh.\thehrdec}
    }{
        \gdef\RichiHValue{\thedh.0\thehrdec}
    }
}%
\newcommand{\Fee@Line}[6]{%
    %
    % #1 Contents
    % #2 Charged Fee per Unit
    % #3 Count
    %
    % Internal command, called by \Fee.
    %
    \gdef\Flag{3}%
    %
    #1          &   &#2 &#3 &
%
%   next is reversed to allow real arithmetic.
%   intermediate results are stored in integer format, so calculations are
%   incorrect in case #2 is a real.
%   fixed by exchanging the 1 and the 100
%

% i am not using the right value for setcounter, here. does not matter, as
% this is only for testing, only.
        \setcounter{One@Fee}{100 * \real{#2} * \real{#3} * 1}%
\RichiHLine{#3}{#4}{#5}{#6}

        \addtocounter{ST@Fee}{\theOne@Fee}%
        \addtocounter{Fee}{\theOne@Fee}%
        \addtocounter{Fee@ctr}{1}%      increase counter with 1
        \Print@Value{\RichiHValue}\\
%       \Print@Value{\theOne@Fee}\\%
}%

%=======================================
%=======================================

% test script

\documentclass[11pt,twoside,a4paper]{article}
\usepackage{a4wide,amsmath,amssymb}
\usepackage{invoice}

\usepackage{ifthen}
\usepackage{calc}

\newcounter{bh}
\newcounter{bm}
\newcounter{eh}
\newcounter{em}
\newcounter{dh}
\newcounter{dm}
\newcounter{hrdec}


\def\timediff#1:#2-#3:#4 {%
  \setcounter{bh}{#1}
  \setcounter{bm}{#2}
  \setcounter{eh}{#3}
  \setcounter{em}{#4}
  \ifthenelse{\(\value{eh}>\value{bh}\or\value{eh}=\value{bh}\)
              \and\(\value{em}>\value{bm}\or\value{em}=\value{bm}\)}
    {\setcounter{dh}{\value{eh}-\value{bh}}
     \setcounter{dm}{\value{em}-\value{bm}}}
    {\ifthenelse{\(\value{eh}>\value{bh}\or\value{eh}=\value{bh}\)
                 \and\value{em}<\value{bm}}
      {\setcounter{dh}{\value{eh}-\value{bh}-1}
       \setcounter{dm}{60+\value{em}-\value{bm}}}
      {\ifthenelse{\value{eh}<\value{bh}
        \and\(\value{em}>\value{bm}\or\value{em}=\value{bm}\)}
       {\setcounter{dh}{24+\value{eh}-\value{bh}}
        \setcounter{dm}{\value{em}-\value{bm}}}
       {\ifthenelse{\value{eh}<\value{bh}\and\value{em}<\value{bm}}
       {\setcounter{dh}{23+\value{eh}-\value{bh}}
        \setcounter{dm}{60+\value{em}-\value{bm}}}}}{}}
    \setcounter{hrdec}{\value{dm}*5/3}
    \ifthenelse{\value{dm}>5}{\thedh.\thehrdec}{\thedh.0\thehrdec}}


\begin{document}


\timediff10:15-16:00

\begin{invoice}{EUR}{0}
        \ProjectTitle{Rechnung }%
                %    Contents                    Rate/Unit Count
%\edef\foo{{ab.cd.de}{12.5}{\timediff10:15-16:00}} \expandafter\Fee\foo
%                \Fee{ab.cd.de}     {12.5}   {\timediff10:15-16:00}
%                \Fee{ab.cd.de}     {12.5}   {10}
                \Fee{ab.cd.de}     {12.5}   {10}{15}{11}{15}
        \ProjectTitle{Sales Restructuring}%
                %    Contents                    Rate/Unit Count
                \Fee{Sales Structure Analysis}   {2750.00} { 6}
                \Fee{Negotiation with Agents}    {2750.00} { 3}
\end{invoice}
\end{document}


%======================
%======================

% output

This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(./invoice_test.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size11.clo))
(/usr/share/texmf-texlive/tex/latex/ltxmisc/a4wide.sty
(/usr/share/texmf-texlive/tex/latex/ntgclass/a4.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/amsfonts/amssymb.sty
(/usr/share/texmf-texlive/tex/latex/amsfonts/amsfonts.sty))
(/usr/share/texmf-texlive/tex/latex/invoice/invoice.sty
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/tools/longtable.sty)
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty)
(/usr/share/texmf-texlive/tex/generic/realcalc/realcalc.tex
`Real arithmetic', Version 1.0, Jan. 1993(C) Frank Buchholz)
(/usr/share/texmf-texlive/tex/latex/invoice/invoice.def)) (./invoice_test.aux)


VAT is zero!

! Missing number, treated as zero.
<to be read again>
                   \gdef
l.56 ...\Fee{Negotiation with Agents}    {2750.00}
                                                   { 3}
?