我正在使用发票文档类。但是,我不具备向其中添加增值税所需的知识...有人能帮我吗?我想添加总成本的 25%,它应该显示如下:
因此,最终结果应如下所示。不要介意不同的货币和错误的数字。这是“应付余额”帖子的替代内容。
“付款”应显示不含增值税的价格乘以 1.25,但我不知道如何编程。
这是 .tex 文件
\documentclass{invoice} % Use the custom invoice class (invoice.cls)
\def \tab {\hspace*{3ex}} % Define \tab to create some horizontal white space
\begin{document}
%----------------------------------------------------------------------------------------
% HEADING SECTION
%----------------------------------------------------------------------------------------
\hfil{\Huge\bf Initech Inc.}\hfil % Company providing the invoice
\bigskip\break % Whitespace
\hrule % Horizontal line
123 Broadway \hfill (000) 111-1111 \\ % Your address and contact information
City, State 12345 \hfill [email protected]
\\ \\
{\bf Invoice To:} \\
\tab James Smith \\ % Invoice recipient
\tab Generic Corporation \\ % Recipient's company
{\bf Date:} \\
\tab \today \\ % Invoice date
%----------------------------------------------------------------------------------------
% TABLE OF EXPENSES
%----------------------------------------------------------------------------------------
\begin{invoiceTable}
\feetype{Consulting Services} % Fee category description
\hourrow{October 3, 2012}{8}{12} % Each separate billing day includes the date, the number of hours and the hourly rate
\hourrow{October 4, 2012}{6.5}{12}
\hourrow{October 5, 2012}{5.25}{12}
\hourrow{October 10, 2012}{9.75}{20}
\hourrow{October 11, 2012}{5}{12.51}
\feetype{Accounting Services} % Fee category description
\hourrow{October 10, 2012}{2}{80}
\hourrow{October 11, 2012}{1}{80}
\subtotal % Prints a subtotal, can be used multiple times
\feetype{Hosting Expenses} % Fee category description
\feerow{Web Hosting: October, 2012}{60} % A flat fee service, note there is no hourly rate for this
\end{invoiceTable}
\end{document}
这是 .cls 文件
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (c) 2011 Trey Hunner %
% %
% Permission is hereby granted, free of charge, to any person obtaining %
% a copy of this software and associated documentation files (the %
% "Software"), to deal in the Software without restriction, including %
% without limitation the rights to use, copy, modify, merge, publish, %
% distribute, sublicense, and/or sell copies of the Software, and to %
% permit persons to whom the Software is furnished to do so, subject to %
% the following conditions: %
% %
% The above copyright notice and this permission notice shall be %
% included in all copies or substantial portions of the Software. %
% %
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, %
% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF %
% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND %
% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE %
% LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION %
% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION %
% WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesClass{invoice}
\LoadClass[12pt]{article}
\usepackage[letterpaper,hmargin=0.79in,vmargin=0.79in]{geometry}
\usepackage[parfill]{parskip} % Do not indent paragraphs
\usepackage{fp} % Fixed-point arithmetic
\usepackage{calc} % Counters for totaling hours and cost
\usepackage{longtable}
\pagestyle{empty} % No page numbers
\linespread{1.5} % Line spacing
\setlength{\doublerulesep}{\arrayrulewidth} % Double rules look like one thick one
% Command for setting a default hourly rate
\newcommand{\feetype}[1]{
\textbf{#1}
\\
}
% Counters for totaling up hours and dollars
\newcounter{hours} \newcounter{subhours} \newcounter{cost} \newcounter{subcost}
\setcounter{hours}{0} \setcounter{subhours}{0} \setcounter{cost}{0} \setcounter{subcost}{0}
% Formats inputed number with 2 digits after the decimal place
\newcommand*{\formatNumber}[1]{\FPround{\cost}{#1}{2}\cost} %
% Returns the total of counter
\newcommand*{\total}[1]{\FPdiv{\t}{\arabic{#1}}{1000}\formatNumber{\t}}
% Create an invoice table
\newenvironment{invoiceTable}{
% Create a new row from title, unit quantity, unit rate, and unit name
\newcommand*{\unitrow}[4]{%
\addtocounter{cost}{1000 * \real{##2} * \real{##3}}%
\addtocounter{subcost}{1000 * \real{##2} * \real{##3}}%
##1 & \formatNumber{##2} ##4 & \$\formatNumber{##3} & \$\FPmul{\cost}{##2}{##3}\formatNumber{\cost}%
\\
}
% Create a new row from title and expense amount
\newcommand*{\feerow}[2]{%
\addtocounter{cost}{1000 * \real{##2}}%
\addtocounter{subcost}{1000 * \real{##2}}%
##1 & & \$\formatNumber{##2} & \$\FPmul{\cost}{##2}{1}\formatNumber{\cost}%
\\
}
\newcommand{\subtotalNoStar}{
{\bf Subtotal} & {\bf \total{subhours} hours} & & {\bf \$\total{subcost}}
\setcounter{subcost}{0}
\setcounter{subhours}{0}
\\*[1.5ex]
}
\newcommand{\subtotalStar}{
{\bf Subtotal} & & & {\bf \$\total{subcost}}
\setcounter{subcost}{0}
\\*[1.5ex]
}
\newcommand{\subtotal}{
\hline
\@ifstar
\subtotalStar%
\subtotalNoStar%
}
% Create a new row from date and hours worked (use stored fee type and hourly rate)
\newcommand*{\hourrow}[3]{%
\addtocounter{hours}{1000 * \real{##2}}%
\addtocounter{subhours}{1000 * \real{##2}}%
\unitrow{##1}{##2}{##3}{hours}%
}
\renewcommand{\tabcolsep}{0.8ex}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{@{\extracolsep{\fill}\hspace{\tabcolsep}} l r r r }
\hline
{\bf Description of Services} & \multicolumn{1}{c}{\bf Quantity} & \multicolumn{1}{c}{\bf Unit Price} & \multicolumn{1}{c}{\bf Amount} \\*
\hline\hline
\endhead
}{
\hline\hline\hline
{\bf Balance Due} & & & {\bf \$\total{cost}} \\
\end{longtable}
}
代码生成此pdf:http://www.latextemplates.com/templates/miscellaneous/3/invoice.pdf
答案1
我加了税。你看一下。 https://github.com/treyhunner/invoices/pull/3
问候!