Hi all,

In my business, it is prudent to send customers an Outstanding Invoice 
Summary at the beginning of each month. They can refer to this and 
reconcile thier payables and get an idea of the aging. This report has 
uncovered several errors in just the first few months.

For what it's worth, this kludge and the associated .tex file is attached.

Ted
Changes needed to print Outstanding Invoice Summaries.


Step 1: This puts a check box on the AR aging screen to enable printing of summaries
*********************************************************************************
**                          PUT IN rp.pl sub aging AFTER:                      **
**                                                                             **
**<tr>                                                                         **
**                                                                             **
**  <th align=right>|.$locale->text('To').qq|&nbsp;($myconfig{dateformat})</th>**
**  <td colspan=3><input name=todate size=11></td>                             **
**                                                                             **
**</tr>                                                                        **
*********************************************************************************
<tr>

    <th align=right>|.$locale->text('Print Reports').qq|&nbsp;</th>
    <td colspan=3><input name=print_report class=checkbox type=checkbox value=Y></td>

</tr>



Step 2: This captures all summary data for print and initiates
        print when the customer id changes
*********************************************************************************
**                          PUT IN rp.pl sub aging 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 3: This captures and prints the last customer:
**********************************************************************************
**                          PUT IN rp.pl sub aging 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 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);

}

\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}

Reply via email to