summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2020-05-27 13:39:47 -0700
committerIvan Kohler <ivan@freeside.biz>2020-05-27 13:39:47 -0700
commitfc263806f5e475559a0c4cfdb70a5f1cefe0ffa3 (patch)
treec0887bc08d9836175fd4a915d3b20bb7ce458bb6
parentae09d41481da0937765821af91537b8e728169e4 (diff)
deposit slips
-rw-r--r--FS/FS/Conf.pm28
-rw-r--r--FS/FS/Mason.pm2
-rw-r--r--FS/FS/Misc/DepositSlip.pm376
-rw-r--r--FS/MANIFEST1
-rw-r--r--Makefile1
-rw-r--r--debian/control2
-rwxr-xr-xdebian/rules1
-rw-r--r--etc/GnuMICR.otfbin0 -> 4424 bytes
-rw-r--r--httemplate/docs/credits.html8
-rw-r--r--httemplate/docs/license.html10
-rw-r--r--httemplate/search/elements/grouped-search.html2
-rw-r--r--httemplate/search/elements/grouped-search/deposit_slip8
-rw-r--r--httemplate/search/elements/grouped-search/html6
-rw-r--r--httemplate/search/elements/search-deposit_slip.html17
-rw-r--r--httemplate/search/elements/search.html9
15 files changed, 460 insertions, 11 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 3ac22ca..cbccffb 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -6065,6 +6065,34 @@ and customer address. Include units.',
'type' => 'checkbox',
},
+ {
+ 'key' => 'deposit_slip-bank_name',
+ 'section' => 'payments', #XXX payment_deposit_slips
+ 'description' => 'Bank name to print on check deposit slips',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'deposit_slip-bank_address',
+ 'section' => 'payments', #XXX payment_deposit_slips
+ 'description' => 'Bank address to print on check deposit slips',
+ 'type' => 'textarea',
+ },
+
+ {
+ 'key' => 'deposit_slip-bank_routingnumber',
+ 'section' => 'payments', #XXX payment_deposit_slips
+ 'description' => '9 digit bank routing number to print on check deposit slips',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'deposit_slip-bank_accountnumber',
+ 'section' => 'payments', #XXX payment_deposit_slips
+ 'description' => 'Bank account number to print on check deposit slips',
+ 'type' => 'text',
+ },
+
# for internal use only; test databases should declare this option and
# everyone else should pretend it doesn't exist
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 5b8242b..8dd72ac 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -387,7 +387,6 @@ if ( -e $addl_handler_use_file ) {
use FS::export_batch_item;
use FS::part_pkg_fcc_option;
use FS::state;
- use FS::state;
use FS::queue_stat;
use FS::deploy_zone;
use FS::deploy_zone_block;
@@ -424,6 +423,7 @@ if ( -e $addl_handler_use_file ) {
use FS::saved_search;
use FS::sector_coverage;
use FS::svc_group;
+ use FS::Misc::DepositSlip qw( deposit_slip_pdf );
# Sammath Naur
if ( $FS::Mason::addl_handler_use ) {
diff --git a/FS/FS/Misc/DepositSlip.pm b/FS/FS/Misc/DepositSlip.pm
new file mode 100644
index 0000000..b687691
--- /dev/null
+++ b/FS/FS/Misc/DepositSlip.pm
@@ -0,0 +1,376 @@
+package FS::Misc::DepositSlip;
+use base 'Exporter';
+
+use strict;
+use warnings;
+use vars qw( @EXPORT_OK );
+
+#use Date::Format;
+use IPC::Run qw( run timeout ); # for _xelatex
+use Text::Template;
+
+@EXPORT_OK = qw( deposit_slip_pdf );
+
+=item deposit_slip_pdf
+
+=cut
+
+sub deposit_slip_pdf {
+ my %arg = @_;
+ my $conf = $arg{'conf'};
+ my @cust_pay = @{ $arg{'cust_pay'} };
+
+ if ( scalar(@cust_pay) > 25 ) {
+ return 'ERROR: Maxiumum of 25 items per deposit slip at this time';
+ }
+
+ my $text_template = new Text::Template(
+ TYPE => 'STRING',
+ SOURCE => slip_template(),
+ DELIMITERS => [ '[@--', '--@]' ],
+ );
+
+ $text_template->compile() or die $Text::Template::ERROR;
+
+ my $dir = $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc;
+ chdir($dir);
+
+ #my $date = time2str( $self->conf->config('date_format_long') || '%b %o, %Y',
+ # time #XXX future deposit date
+ # );
+
+ my $total = 0;
+ foreach my $cust_pay (@cust_pay) {
+ $total += $cust_pay->paid;
+ }
+ $total = sprintf('%.2f', $total + 0.00000001); #so FP math errors round out
+ my ($total_dollars, $total_cents) = split(/\./, $total);
+
+ my $gtotal = sprintf('%11.2f', $total);
+ $gtotal =~ s/\.//;
+ my @gtotal = split('', $gtotal);
+
+ #XXX agent virt for company name, address
+ my %fill_in = (
+ 'company_name' => _latex_escape($conf->config('company_name')),
+ 'company_address' => join('\\\\', map _latex_escape($_),
+ $conf->config('company_address') ),
+
+ 'bank_name' => _latex_escape($conf->config('deposit_slip-bank_name')),
+ 'bank_address' => join('\\\\', map _latex_escape($_),
+ $conf->config('deposit_slip-bank_address') ),
+
+ 'bank_routingnumber' => _latex_escape(
+ $conf->config('deposit_slip-bank_routingnumber')),
+ 'bank_accountnumber' => _latex_escape(
+ $conf->config('deposit_slip-bank_accountnumber')),
+
+ #already defaulting to today
+ #'depositdate' => _latex_escape($date),
+
+ 'currency_dollars' => '',
+ 'currency_cents' => '',
+ 'coin_dollars' => '',
+ 'coin_cents' => '',
+ 'checks_dollars' => '',
+ 'checks_cents' => '',
+
+ 'reverse_dollars' => '',
+ 'reverse_cents' => '',
+ 'total_dollars' => $total_dollars,
+ 'total_cents' => $total_cents,
+
+ 'cust_pay' => \@cust_pay,
+
+ 'totalitems' => scalar(@cust_pay),
+
+ 'grandtotalboxone' => $gtotal[0],
+ 'grandtotalboxtwo' => $gtotal[1],
+ 'grandtotalboxthree' => $gtotal[2],
+ 'grandtotalboxfour' => $gtotal[3],
+ 'grandtotalboxfive' => $gtotal[4],
+ 'grandtotalboxsix' => $gtotal[5],
+ 'grandtotalboxseven' => $gtotal[6],
+ 'grandtotalboxeight' => $gtotal[7],
+ 'grandtotalboxnine' => $gtotal[8],
+ 'grandtotalboxten' => $gtotal[9],
+ );
+
+ #XXX better unique filename
+ my $file = "deposit$$";
+
+ open(DEPOSIT_TEX, ">$file.tex") or die $!;
+ print DEPOSIT_TEX $text_template->fill_in( HASH => \%fill_in );
+ close DEPOSIT_TEX or die $!;
+
+ _xelatex($file);
+
+ #XXX use File::Slurp
+ my $pdf = '';
+ open(PDF, "<$file.pdf") or die $!;
+
+ unlink("$file.log", "$file.aux", "$file.pdf", "$file.tex");
+
+ while (<PDF>) {
+ $pdf .= $_;
+ }
+ close PDF;
+
+ return $pdf;
+
+}
+
+#some false laziness w/_pslatex in Misc.pm
+sub _xelatex {
+ my $file = shift;
+
+ #my $sfile = shell_quote $file;
+
+ my @cmd = (
+ 'xelatex',
+ '-interaction=batchmode',
+ "$file.tex"
+ );
+
+ my $timeout = 30; #? should be more than enough
+
+ for ( 1, 2 ) {
+
+ local($SIG{CHLD}) = sub {};
+ run( \@cmd, '>'=>'/dev/null', '2>'=>'/dev/null', timeout($timeout) )
+ or warn "bad exit status from xelatex pass $_\n";
+
+ }
+
+ return if -e "$file.pdf" && -s "$file.pdf";
+ die "xelatex $file.tex failed, see $file.log for details?\n";
+
+}
+
+#false laxiness w/Template_Mixin.pm
+sub _latex_escape {
+ my $value = shift;
+ $value =~ s/([#\$%&~_\^{}])( )?/"\\$1". ( ( defined($2) && length($2) ) ? "\\$2" : '' )/ge;
+ $value =~ s/([<>])/\$$1\$/g;
+ $value;
+}
+
+sub slip_template { <<'__END__';
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Freeside Deposit Slip
+% LaTeX Template
+% Version 1.1 (May 9, 2020)
+%
+% This template was created by:
+% Vel (enquiries@latextypesetting.com)
+% LaTeXTypesetting.com
+%
+%!TEX program = xelatex
+% Note: this template must be compiled with XeLaTeX rather than PDFLaTeX
+% due to the custom fonts used. The line above should ensure this happens
+% automatically, but if it doesn't, your LaTeX editor should have a simple toggle
+% to switch to using XeLaTeX.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%----------------------------------------------------------------------------------------
+% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
+%----------------------------------------------------------------------------------------
+
+\documentclass{article}
+
+%----------------------------------------------------------------------------------------
+% REQUIRED PACKAGES AND MISC CONFIGURATIONS
+%----------------------------------------------------------------------------------------
+
+\setlength{\parindent}{0pt} % Stop paragraph indentation
+
+\usepackage{tikz} % Required for custom graphics
+\usetikzlibrary{calc} % Required for coordinate calculations within TikZ
+
+% Suppress hyphenation across the whole document
+\hyphenpenalty=10000
+\exhyphenpenalty=10000
+
+%----------------------------------------------------------------------------------------
+% MARGINS
+%----------------------------------------------------------------------------------------
+
+\usepackage[
+ paperwidth=8.5in,
+ paperheight=3.25in,
+ top=0cm, % Top margin
+ bottom=1cm, % Bottom margin
+ left=1cm, % Left margin
+ right=1cm, % Right margin
+ footskip=0.6cm, % Space from the bottom margin to the baseline of the footer
+ headsep=0.8cm, % Space from the top margin to the baseline of the header
+ headheight=0.5cm, % Height of the header
+ %showframe % Uncomment to show the frames around the margins for debugging purposes
+]{geometry}
+
+%----------------------------------------------------------------------------------------
+% FONTS
+%----------------------------------------------------------------------------------------
+
+\usepackage{fontspec} % Required for specifying custom fonts
+
+\defaultfontfeatures{Ligatures=TeX} % To support LaTeX ligatures (`` and --)
+\defaultfontfeatures{Path=/usr/local/etc/freeside/} % Specify the location of font files
+
+\newfontface\GNUMicr{GnuMICR.otf} % MICR font from file
+
+\usepackage[default]{sourcesanspro} % Use the Source Sans Pro font for the document body
+
+%----------------------------------------------------------------------------------------
+% HEADERS AND FOOTERS
+%----------------------------------------------------------------------------------------
+
+\usepackage{fancyhdr} % Required for customising headers and footers
+\pagestyle{fancy} % Enable custom headers and footers
+
+\renewcommand{\headrulewidth}{0pt} % Remove default top horizontal rule
+
+\fancyhf{} % Clear default headers/footers
+
+\fancyfoot[C]{{\Large\GNUMicr\MICR}} % Centre footer
+
+%----------------------------------------------------------------------------------------
+% TABLES
+%----------------------------------------------------------------------------------------
+
+\usepackage{booktabs} % Required for better horizontal rules in tables
+
+\usepackage{array} % Required for manipulating table columns
+
+\renewcommand{\arraystretch}{1.35} % Increase the space between table rows
+
+\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} % Define a new right-aligned paragraph column type
+\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} % Define a new left-aligned (no justification) paragraph column type
+\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % Define a new centred paragraph column type
+
+%----------------------------------------------------------------------------------------
+% CUSTOM COMMANDS
+%----------------------------------------------------------------------------------------
+
+\newcommand{\MICR}[1]{\renewcommand{\MICR}{#1}}
+\newcommand{\disclaimer}[1]{\renewcommand{\disclaimer}{#1}}
+\newcommand{\companyaddress}[1]{\renewcommand{\companyaddress}{#1}}
+\newcommand{\bankaddress}[1]{\renewcommand{\bankaddress}{#1}}
+\newcommand{\totalitems}[1]{\renewcommand{\totalitems}{#1}}
+\newcommand{\grandtotalboxone}[1]{\renewcommand{\grandtotalboxone}{#1}}
+\newcommand{\grandtotalboxtwo}[1]{\renewcommand{\grandtotalboxtwo}{#1}}
+\newcommand{\grandtotalboxthree}[1]{\renewcommand{\grandtotalboxthree}{#1}}
+\newcommand{\grandtotalboxfour}[1]{\renewcommand{\grandtotalboxfour}{#1}}
+\newcommand{\grandtotalboxfive}[1]{\renewcommand{\grandtotalboxfive}{#1}}
+\newcommand{\grandtotalboxsix}[1]{\renewcommand{\grandtotalboxsix}{#1}}
+\newcommand{\grandtotalboxseven}[1]{\renewcommand{\grandtotalboxseven}{#1}}
+\newcommand{\grandtotalboxeight}[1]{\renewcommand{\grandtotalboxeight}{#1}}
+\newcommand{\grandtotalboxnine}[1]{\renewcommand{\grandtotalboxnine}{#1}}
+\newcommand{\grandtotalboxten}[1]{\renewcommand{\grandtotalboxten}{#1}}
+\newcommand{\depositdate}[1]{\renewcommand{\depositdate}{#1}}
+
+%\newcommand{\command}[1]{\renewcommand{\command}{#1}}
+
+%----------------------------------------------------------------------------------------
+% DEPOSIT SLIP INFORMATION
+%----------------------------------------------------------------------------------------
+
+\MICR{A[@-- $bank_routingnumber --@]A [@-- $bank_accountnumber --@]C} % Displayed at the bottom of the slip
+
+\disclaimer{Checks and other items are received for deposit subject to the provisions of the Uniform Commercial Code and any applicable collection agreement. Deposits May Not Be Available For Immediate Withdrawal.}
+
+\companyaddress{\textbf{[@-- $company_name --@]}\\[@-- $company_address --@]}
+
+\bankaddress{\textbf{[@-- $bank_name --@]}\\ [@-- $bank_address --@]}
+
+\totalitems{[@-- $totalitems --@]}
+
+\grandtotalboxone{[@-- $grandtotalboxone --@]}
+\grandtotalboxtwo{[@-- $grandtotalboxtwo --@]}
+\grandtotalboxthree{[@-- $grandtotalboxthree --@]}
+\grandtotalboxfour{[@-- $grandtotalboxfour --@]}
+\grandtotalboxfive{[@-- $grandtotalboxfive --@]}
+\grandtotalboxsix{[@-- $grandtotalboxsix --@]}
+\grandtotalboxseven{[@-- $grandtotalboxseven --@]}
+\grandtotalboxeight{[@-- $grandtotalboxeight --@]}
+\grandtotalboxnine{[@-- $grandtotalboxnine --@]}
+\grandtotalboxten{[@-- $grandtotalboxten --@]}
+
+\depositdate{\today}
+
+%----------------------------------------------------------------------------------------
+
+\begin{document}
+
+%----------------------------------------------------------------------------------------
+% DEPOSIT SLIP
+%----------------------------------------------------------------------------------------
+
+\begin{tikzpicture}[remember picture, overlay]
+ \node [anchor=north, rotate=90, xshift=-0.5\paperheight, yshift=-0.4cm, inner sep=0pt] (title) at (current page.north west) {\textbf{DEPOSIT TICKET}}; % Deposit ticket title text
+
+ \node [anchor=north, rotate=90, yshift=-0.4cm, inner sep=0pt] (dateline) at (title.south) {DATE: \rule{0.58\paperheight}{1pt}}; % Date line
+ \node [anchor=south, rotate=90, yshift=-0.2cm, inner sep=0pt] (date) at (dateline.north) {\depositdate}; % Date
+
+ \node [anchor=north west, rotate=90, yshift=-0.25cm, text width=0.8\paperheight, inner sep=0pt] (disclaimer) at (dateline.south west) {\fontsize{6pt}{7pt}\selectfont \disclaimer\par}; % Disclaimer text
+
+ \node [anchor=north east, rotate=90, inner sep=0pt] (table) at (disclaimer.south east) {% Table
+ \begin{tabular}{| L{1.8cm} | L{1cm} | L{0.5cm}}
+ \cline{2-3}
+ \multicolumn{1}{R{1.8cm} |}{} & \scriptsize DOLLARS & \scriptsize CENTS \\\cline{2-3}
+ \multicolumn{1}{R{1.8cm} |}{\scriptsize CURRENCY} & [@-- $currency_dollars --@] & [@-- $currency_cents --@]\\\cline{2-3}
+ \multicolumn{1}{R{1.8cm} |}{\scriptsize COIN} & [@-- $coin_dollars --@] & [@-- $coin_cents --@]\\\cline{2-3}
+ \multicolumn{1}{| R{1.8cm} |}{\vspace{-1.2\baselineskip}\scriptsize CHECKS \newline \tiny (ENTER SEPARATELY)} & [@-- $checks_dollars --@] & [@-- $checks_cents --@]\\[-3pt]\cline{1-3}
+[@--
+ for (0 .. 24) {
+ if ( scalar(@cust_pay) ) {
+ my $cust_pay = shift @cust_pay;
+ my ($dollars, $cents) = split(/\./, $cust_pay->paid);
+ $OUT .= $cust_pay->payinfo. " & $dollars & $cents". '\\\\\\cline{1-3}'. "\n";
+ } else {
+ $OUT .= ' & & \\\\\\cline{1-3}'. "\n";
+ }
+ }
+--@]
+ \fontsize{6pt}{6pt}\selectfont TOTAL OF \newline REVERSE SIDE & [@-- $reverse_dollars --@] & [@-- $reverse_cents --@] \\\cline{1-3}
+ \fontsize{10pt}{10pt}\selectfont\textbf{TOTAL} \newline DEPOSIT & [@-- $total_dollars --@] & [@-- $total_cents --@] \\\cline{1-3}
+ \end{tabular}
+ }; % Table
+ \node [anchor=north east, rotate=90, yshift=-0.07cm, inner sep=0pt] (totalguidetext) at (table.south east) {\fontsize{6pt}{6pt}\selectfont PLEASE ENTER TOTAL HERE}; % Total guide text
+ \draw [->] ($(totalguidetext.west)-(0, 0.1cm)$) -- ($(totalguidetext.west)-(0cm, 2.7cm)$); % Total guide text arrow
+
+ \node [anchor=south west, xshift=0.3cm, text width=0.3\paperwidth, inner sep=0pt] (companyaddress) at (disclaimer.south west) {\Large\companyaddress\par}; % Company and address
+
+ \node [anchor=north west, text width=0.3\paperwidth, inner sep=0pt] (bankaddress) at (companyaddress.north east) {\footnotesize\bankaddress\par}; % Financial institution address
+
+ \node [anchor=south west, xshift=0.5cm, yshift=1.4cm, text width=0.75cm, inner sep=0pt] (totalitemstext) at (current page.south) {\fontsize{6pt}{6pt}\selectfont TOTAL ITEMS\par}; % Total items text
+ \node [rectangle, anchor=west, draw=black, line width=1pt, minimum width=1cm, minimum height=0.5cm, inner sep=0pt] (totalitemsbox) at (totalitemstext.east) {\totalitems}; % Total items box
+
+ \node [anchor=west, xshift=1cm, text width=0.4cm, inner sep=0pt] (dollarsign) at (totalitemsbox.east) {\Large\textbf{\$}}; % Dollar sign text
+ \node [rectangle, anchor=west, fill=black!7, minimum width=6.7cm, minimum height=1.25cm, inner sep=0pt] (totalbox) at (dollarsign.east) {}; % Grand total grey box
+ \node [rectangle, anchor=west, fill=white, xshift=0.3cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxone) at (totalbox.west) {\grandtotalboxone}; % White box 1
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxtwo) at (whiteboxone.east) {\grandtotalboxtwo}; % White box 2
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxthree) at (whiteboxtwo.east) {\grandtotalboxthree}; % White box 3
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxfour) at (whiteboxthree.east) {\grandtotalboxfour}; % White box 4
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxfive) at (whiteboxfour.east) {\grandtotalboxfive}; % White box 5
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxsix) at (whiteboxfive.east) {\grandtotalboxsix}; % White box 6
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxseven) at (whiteboxsix.east) {\grandtotalboxseven}; % White box 7
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxeight) at (whiteboxseven.east) {\grandtotalboxeight}; % White box 8
+ \node [anchor=west, xshift=-0.5pt, inner sep=0pt] (centsperiod) at (whiteboxeight.south east) {.}; % Cents period
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxnine) at (whiteboxeight.east) {\grandtotalboxnine}; % White box 9
+ \node [rectangle, anchor=west, fill=white, xshift=0.05cm, minimum width=0.55cm, minimum height=0.55cm, inner sep=0pt] (whiteboxten) at (whiteboxnine.east) {\grandtotalboxten}; % White box 10
+ \draw [fill=white, draw=white] ($(whiteboxtwo.south east)+(0.02cm, 0cm)$) -- ($(whiteboxtwo.south east)-(0.03cm, 0.1cm)$) -- ($(whiteboxtwo.south east)+(0.07cm, -0.1cm)$) -- cycle; % Triangle 1
+ \draw [fill=white, draw=white] ($(whiteboxfive.south east)+(0.02cm, 0cm)$) -- ($(whiteboxfive.south east)-(0.03cm, 0.1cm)$) -- ($(whiteboxfive.south east)+(0.07cm, -0.1cm)$) -- cycle; % Triangle 2
+\end{tikzpicture}
+
+%----------------------------------------------------------------------------------------
+
+\end{document}
+
+__END__
+
+}
+
+1;
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 17100cd..1e26a3c 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -879,3 +879,4 @@ FS/access_user_session_log.pm
t/access_user_session_log.t
FS/svc_group.pm
FS/h_svc_group.pm
+FS/Misc/DepositSlip.pm
diff --git a/Makefile b/Makefile
index 802632e..7055c29 100644
--- a/Makefile
+++ b/Makefile
@@ -264,6 +264,7 @@ install-texmf:
install -D -o freeside -m 444 etc/*.sty \
/usr/local/share/texmf/tex/latex/
texhash /usr/local/share/texmf
+ install -D -o root -m 444 etc/GnuMICR.otf /usr/local/etc/freeside
install-init:
#[ -e ${INIT_FILE} ] || install -o root -g ${INSTALLGROUP} -m 711 init.d/freeside-init ${INIT_FILE}
diff --git a/debian/control b/debian/control
index 5b8c021..28ff880 100644
--- a/debian/control
+++ b/debian/control
@@ -64,7 +64,7 @@ Depends: aspell-en,gnupg,ghostscript,gsfonts,gzip,
mime-support,
ntp,ntpdate,perl,perl-base,perl-modules,postgresql,postgresql-client,psutils,
rsync,openssh-client,texlive,texlive-latex-recommended,texlive-latex-extra,
- texinfo,ttf-bitstream-vera,
+ texinfo,ttf-bitstream-vera,texlive-xetex,texlive-fonts-extra,
fonts-dustin,libdatetime-perl,libdatetime-format-strptime-perl,
libfile-slurp-perl,libspreadsheet-parseexcel-perl,libauthen-passphrase-perl,
libnet-domain-tld-perl,libbusiness-us-usps-webtools-perl,libxml-simple-perl,
diff --git a/debian/rules b/debian/rules
index 153f177..e32910f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -171,6 +171,7 @@ install-stamp: build-stamp
# Install tex
install -d ${TEXMF_PATH}
install -o freeside -m 444 etc/*.sty ${TEXMF_PATH}
+ install -o root -m 444 etc/GnuMICR.otf /usr/local/etc/freeside
# Create Apache configurations
install -d $(APACHE_CONF)
diff --git a/etc/GnuMICR.otf b/etc/GnuMICR.otf
new file mode 100644
index 0000000..8fd1823
--- /dev/null
+++ b/etc/GnuMICR.otf
Binary files differ
diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html
index 4bcb266..d71d563 100644
--- a/httemplate/docs/credits.html
+++ b/httemplate/docs/credits.html
@@ -29,9 +29,6 @@
<BR>
<H3>Core Team</H3>
-Christopher Burger<BR>
-Mitch Jackson<BR>
-Jim Lucas<BR>
Ivan Kohler<BR>
<BR>
@@ -64,6 +61,7 @@ Stephen Bechard<BR>
Eric Bosrup<BR>
Dickie Bradford<BR>
Alex Brelsfoard<BR>
+Christopher Burger<BR>
Dave Burgess<BR>
Joe Camadine<BR>
Chris Cappuccio<BR>
@@ -76,6 +74,7 @@ Dave Denney<BR>
Serge Dolgov<BR>
Scott Edwards<BR>
Kenny Elliott<BR>
+Velimir Gayevskiy<BR>
Joshua Goodman<BR>
Donald Greer<BR>
Joel Griffiths<BR>
@@ -85,12 +84,14 @@ Troy Hammonds<BR>
Sean Hanson<BR>
Dale Hege<BR>
Kelly Hickel<BR>
+Mitch Jackson<BR>
Mark James<BR>
Gary Jones<BR>
Fernando M. Kiernan<BR>
Frederico Caldeira Knabben<BR>
Greg Kuhnert<BR>
Steven Levithan<BR>
+Jim Lucas<BR>
Randall Lucas<BR>
Foteos Macrides<BR>
Roger Mangraviti<BR>
@@ -100,6 +101,7 @@ David Peters<BR>
Matt Peterson<BR>
Luke Pfeifer<BR>
Alan Phipps<BR>
+Eric Sandeen<BR>
Ricardo Signes<BR>
Steve Simitzis<BR>
Stanislav Sinyagin<BR>
diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html
index 1b9d10a..2676920 100644
--- a/httemplate/docs/license.html
+++ b/httemplate/docs/license.html
@@ -6,7 +6,7 @@
<P>
-Copyright &copy; 2005-2017 Freeside Internet Services, Inc.<BR>
+Copyright &copy; 2005-2020 Freeside Internet Services, Inc.<BR>
Copyright &copy; 2000-2005 Ivan Kohler<BR>
Copyright &copy; 1999 Silicon Interactive Software Design<BR>
All rights reserved<BR>
@@ -152,6 +152,9 @@ licensed under the terms of MIT License.
Contains the leaflet JavaScript library <a href="http://leafletjs.com/">Leaflet JS</a> by Vladimir Agafonkin,
licensed under the terms of MIT License.
+<P>
+Contains a deposit slip template by Vel from <a href="http://latextypesetting.com">LaTeX Typesetting</a>.
+
<!-- artwork -->
<P>
@@ -170,7 +173,6 @@ http://www.iconarchive.com/show/oxygen-icons-by-oxygen-icons.org/Actions-documen
licensed under GNU Lesser General Public License
</P>
-
<P>
Contains icons from
<A HREF="https://www.iconfinder.com/colebemis" TARGET="_blank">iconfinder.com</A>
@@ -178,5 +180,9 @@ by Cole Bemis, licensed under the terms of the Creative Commons Attribution
3.0 License.
</p>
+<P>
+Contains the <a href="http://sandeen.net/GnuMICR/">GnuMICR font</a>
+by Eric Sandeen, licensed under the terms of the GNU GPL.
+
</BODY>
</HTML>
diff --git a/httemplate/search/elements/grouped-search.html b/httemplate/search/elements/grouped-search.html
index 56fc88d..80a9319 100644
--- a/httemplate/search/elements/grouped-search.html
+++ b/httemplate/search/elements/grouped-search.html
@@ -42,7 +42,7 @@
</%doc>
<%init>
my $type = 'html';
-if ($cgi->param('type') =~ /^(html|html-print|xls)$/) {
+if ($cgi->param('type') =~ /^(html|html-print|xls|deposit_slip)$/) {
$type = $1;
}
</%init>
diff --git a/httemplate/search/elements/grouped-search/deposit_slip b/httemplate/search/elements/grouped-search/deposit_slip
new file mode 100644
index 0000000..6e69662
--- /dev/null
+++ b/httemplate/search/elements/grouped-search/deposit_slip
@@ -0,0 +1,8 @@
+<& /search/elements/search-deposit_slip.html, rows=>\@rows, &>\
+<%init>
+my %opt = @_;
+my $group_info = $m->comp('core', %opt);
+#just the first group
+my $query = $group_info->{queries}[0];
+my @rows = $query->qsearch;
+</%init>
diff --git a/httemplate/search/elements/grouped-search/html b/httemplate/search/elements/grouped-search/html
index ae80865..24cf50e 100644
--- a/httemplate/search/elements/grouped-search/html
+++ b/httemplate/search/elements/grouped-search/html
@@ -114,9 +114,13 @@ my $money = $conf->config('money_char') || '$';
%# download links
<P><% emt('Download results:') %>
% $cgi->param('type', 'xls');
-<A HREF="<% $cgi->self_url %>"><% emt('Spreadsheet') %></A>&nbsp;|&nbsp;
+<A HREF="<% $cgi->self_url %>"><% emt('Spreadsheet') %></A> |
% $cgi->param('type', 'html-print');
<A HREF="<% $cgi->self_url %>"><% emt('webpage') %></A>
+% if ( ref($query) && $query->{table} eq 'cust_pay' ) {
+% $cgi->param('type', 'deposit_slip');
+ | <A HREF="<% $cgi->self_url %>"><% emt('deposit slip') %></A>
+% }
% $cgi->delete('type');
</P>
% }
diff --git a/httemplate/search/elements/search-deposit_slip.html b/httemplate/search/elements/search-deposit_slip.html
new file mode 100644
index 0000000..c7a6cbb
--- /dev/null
+++ b/httemplate/search/elements/search-deposit_slip.html
@@ -0,0 +1,17 @@
+<% $deposit_pdf %>\
+<%init>
+
+my %args = @_;
+my $rows = $args{'rows'};
+
+my $deposit_pdf = deposit_slip_pdf(
+ conf => FS::Conf->new,
+ cust_pay => $rows,
+);
+
+http_header('Content-Type' => 'application/pdf');
+http_header('Content-Disposition' => "filename=deposit.pdf" );
+http_header('Content-Length' => length($deposit_pdf) );
+http_header('Cache-control' => 'max-age=60' );
+
+</%init>
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index 730a51a..60548e2 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -198,6 +198,10 @@ Example:
%
<% include('search-xml.html', rows=>$rows, opt=>\%opt ) %>
%
+% } elsif ( $type eq 'deposit_slip' ) {
+%
+<% include('search-deposit_slip.html', rows=>$rows, opt=>\%opt ) %>
+%
% } else {
%
<% include('search-html.html',
@@ -224,8 +228,9 @@ my $curuser = $FS::CurrentUser::CurrentUser;
$m->comp('/elements/handle_uri_query');
-my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|xml|select|html(-print)?)$/
- ? $1 : 'html' ;
+my $type = $cgi->param('_type')
+ =~ /^(csv|\w*\.xls|xml|select|html(-print)?|deposit_slip)$/
+ ? $1 : 'html' ;
if ( !$curuser->access_right('Download report data') ) {
$opt{'disable_download'} = 1;