David Everly wrote:
>On the web example: http://abacus.sql-ledger.org/sql-ledger/login.pl > >If I go to AR | Reports | AR Aging, I get something that is a little >what I'm looking for. > >However, what I want to do is print all customers in one batch, one >sheet of paper (or more) per customer, stuff into envelopes, and mail. > I have a routine written which I refer to as an "Outstanding Invoice Summary". Essentially, this is an add-on to the Accounts Receivable Aging report. If you check the 'Print Reports' box prior to clicking 'Generate AR Aging', a report is generated for each customer in the same format as the aging screen. The instructions and the tex file are attached. -- Attached file included as plaintext by Ecartis -- -- File: aging.tex \documentclass[twoside]{scrartcl} \usepackage[frame]{xy} \usepackage{tabularx} \setlength{\voffset}{0.5cm} \setlength{\hoffset}{-2.0cm} \setlength{\topmargin}{0cm} \setlength{\headheight}{0.5cm} \setlength{\headsep}{1cm} \setlength{\topskip}{0pt} \setlength{\oddsidemargin}{1.0cm} \setlength{\evensidemargin}{1.0cm} \setlength{\textwidth}{19.2cm} \setlength{\textheight}{24.5cm} \setlength{\footskip}{1cm} \setlength{\parindent}{0pt} \renewcommand{\baselinestretch}{1} \begin{document} \newlength{\descrwidth}\setlength{\descrwidth}{10cm} \newsavebox{\hdr} \sbox{\hdr}{ \fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont \parbox{\textwidth}{ \parbox[b]{12cm}{ <%company%> <%address%>}\hfill \begin{tabular}[b]{rrr@{}} Telephone & <%tel%>\\ Facsimile & <%fax%> \end{tabular} \rule[1.5ex]{\textwidth}{0.5pt} } } \fontfamily{cmss}\fontshape{n}\selectfont \markboth{<%company%>\hfill <%ordnumber%>}{\usebox{\hdr}} \pagestyle{myheadings} %\thispagestyle{empty} use this with letterhead paper <%pagebreak 90 27 48%> \end{tabular*} \rule{\textwidth}{2pt} \hfill \begin{tabularx}{7cm}{Xr@{}} \textbf{Subtotal} & \textbf{<%sumcarriedforward%>} \\ \end{tabularx} \newpage \markright{<%company%>\hfill <%ordnumber%>} \vspace*{-12pt} \begin{tabular*}{\textwidth}{@{}lp{\descrwidth}@{\extracolsep\fill}rlrrr@{}} \textbf{Number} & \textbf{Description} & \textbf{Qty} & \textbf{Unit} & \textbf{Price} & \textbf{Disc} & \textbf{Amount} \\ & carried forward from <%lastpage%> & & & & & <%sumcarriedforward%> \\ <%end pagebreak%> \fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont \vspace*{2cm} <%name%> <%addr1%> <%addr2%>, <%addr3%> <%addr4%> \vspace{3.5cm} \textbf{OUTSTANDING INVOICE SUMMARY} \hfill \begin{tabular}[t]{l@{\hspace{0.3cm}}l} \textbf{Date} & <%checkdate%> \\ \end{tabular} \vspace{1cm} \begin{tabular*}{\textwidth}{lcccrrrr} \textbf{PO Number} & \textbf{Invoice Number} & \textbf{Invoice Date} & \textbf{Due Date} & \textbf{0-30} & \textbf{31-60} & \textbf{61-90} & \textbf{90+}\\ <%foreach ainvnumber%> <%aponumber%> & <%ainvnumber%> & <%ainvdate%> & <%aduedate%> & <%ac0%> & <%ac30%> & <%ac60%> & <%ac90%> \\ <%end ainvnumber%> \textbf{Subtotal} & & & & <%c0subtotal%> & <%c30subtotal%> & <%c60subtotal%> & <%c90subtotal%> \end{tabular*} \rule{\textwidth}{1pt} \parbox{\textwidth}{ \vspace{0.2cm} \hfill \vspace{0.3cm} \hfill All prices in \textbf{US} funds. \vspace{12pt} <%if notes%> <%notes%> <%end if%> } \renewcommand{\thefootnote}{\fnsymbol{footnote}} \footnotetext[1]{\tiny A 10\% order cancellation fee will be applied for any special order products or products that have been customized, enhanced or upgraded at customers request. Items which are non-returnable are indicated above. } \end{document} -- Attached file included as plaintext by Ecartis -- -- File: Outstanding Invoice Summary Procedure Changes needed to print Outstanding Invoice Summaries. v1.8.7) Step 1: This puts a check box on the AR aging screen to enable printing of summaries ********************************************************************************* ** PUT IN rp.pl sub aging (line 359) AFTER: ** ** ** **<tr> ** ** ** ** <th align=right>|.$locale->text('To').qq| ($myconfig{dateformat})</th>** ** <td colspan=3><input name=todate size=11></td> ** ** ** **</tr> ** ********************************************************************************* <tr> <th align=right>|.$locale->text('Print Reports').qq| </th> <td colspan=3><input name=print_report class=checkbox type=checkbox value=Y></td> </tr> Step 2: This captures and prints the last customer: ********************************************************************************** ** PUT IN rp.pl sub aging (line 836) AFTER: ** ** ** ** $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|; ** ** ** ** ** ** $i++; $i %= 2; ** ** print qq|<tr class=listrow$i>|; ** ** ** ** map { print "$column_data{$_}\n" } @column_index; ** ** ** ** print qq| ** **</tr>|; ** ** ** ** $ctid = $ref->{id}; ** ** } ** ********************************************************************************** if ($form->{print_report}) { # get last report $form->{c0subtotal} = $form->format_amount(\%myconfig, $c0subtotal, 2); $form->{c30subtotal} = $form->format_amount(\%myconfig, $c30subtotal, 2); $form->{c60subtotal} = $form->format_amount(\%myconfig, $c60subtotal, 2); $form->{c90subtotal} = $form->format_amount(\%myconfig, $c90subtotal, 2); &print_aging; $msg = 'Invoice Aging Summaries printed'; } Step 3: This captures all summary data for print and initiates print when the customer id changes ********************************************************************************* ** PUT IN rp.pl sub aging (line 757) AFTER: ** ** ** ** foreach $ref (@{ $form->{AG} }) { ** ** ** ********************************************************************************* $form->{c0subtotal} = $form->format_amount(\%myconfig, $c0subtotal, 2); $form->{c30subtotal} = $form->format_amount(\%myconfig, $c30subtotal, 2); $form->{c60subtotal} = $form->format_amount(\%myconfig, $c60subtotal, 2); $form->{c90subtotal} = $form->format_amount(\%myconfig, $c90subtotal, 2); if ($form->{print_report}) { if ($subtotal && $ctid != $ref->{id}) { # print aging report &print_aging; @{ $form->{ainvnumber} } = (); @{ $form->{aponumber} } = (); @{ $form->{ainvdate} } = (); @{ $form->{aduedate} } = (); @{ $form->{ac0} } = (); @{ $form->{ac30} } = (); @{ $form->{ac60} } = (); @{ $form->{ac90} } = (); $form->{c0subtotal} = ""; $form->{c30subtotal} = ""; $form->{c60subtotal} = ""; $form->{c90subtotal} = ""; } push(@{ $form->{ainvnumber} }, $ref->{invnumber}); push(@{ $form->{aponumber} }, $ref->{ponumber}); push(@{ $form->{ainvdate} }, $ref->{transdate}); push(@{ $form->{aduedate} }, $ref->{duedate}); push(@{ $form->{ac0} }, $form->format_amount(\%myconfig, $ref->{c0}, 2)); push(@{ $form->{ac30} },$form->format_amount(\%myconfig, $ref->{c30}, 2)); push(@{ $form->{ac60} },$form->format_amount(\%myconfig, $ref->{c60}, 2)); push(@{ $form->{ac90} },$form->format_amount(\%myconfig, $ref->{c90}, 2)); } Step 4: This is the sub that preps and initiates printing: ******************************************************************************** ** PUT AT THE END OF rp.pl ** ******************************************************************************** sub print_aging { # get customer $form->{customer_id} = $ctid; IS->customer_details(\%myconfig, \%$form); $form->{company}=$myconfig{company}; $form->{address}=$myconfig{address}; $form->{tel}=$myconfig{tel}; $form->{fax}=$myconfig{fax}; $form->{type}="aging"; $form->{templates} = "$myconfig{templates}"; $form->{IN} = "$form->{type}.tex"; $form->{contenttype} = ""; $form->{format}="postscript"; $form->{media}="printer"; $form->{printer} = "lpr" unless $form->{printer}; $form->{OUT} = "|$form->{printer}"; $form->{checkdate} = $form->check_date; $form->parse_template(\%myconfig, $userspath); }

