I've attached a newer version of the instructions which give the line
numbers in rp.pl in which to insert the code. (The line numbers are for 
v1.8.5 - which I haven't upgraded to as of yet)
Also, I have reversed steps 2 & 3 because you should patch-in the
changes from last to first so that the line numbers do not change in the
earlier steps. Finally, the .tex file is named aging.tex.


Ted
Changes needed to print Outstanding Invoice Summaries.
v1.8.5)

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|&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 and prints the last customer:
**********************************************************************************
**                          PUT IN rp.pl sub aging (line 724) 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);

}


Reply via email to