Chris Beggy wrote:

 >>
 >>        1. I created a 'next_check_number' field in the 'defaults' 
table but haven't yet implemented it.
 >>
 >
 >So we can only print one check at a time?
 >
No. If you put the number of the first check in the 'next check number'
field , the routine will assign a check number to each vendor listed.
(e.g. next_check_number =1000. if you have three invoices of $10.00 each
for vendor A and two invoices of $5.00 each for vendor B the routine
will subtotal vendor A and write check number 1000 for $30.00 and
subtotal vendor B and write check number 1001 for $10.00)

When you process payments, these check numbers are written to the source
field of the data base.

If you want to only pay certain invoices, you can always enter the
invoice number or, alternatively, enter a date range if your business
pays based on payables aging.


I have now incorporated the update of next_check_number and the routines
are attached.

Ted

***this routine for ap.pl now includes AP->update_check_number 

 # get last check
        $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
        my @dollars = split /\./, $form->{amount};
        my $amt = new Lingua::EN::Numbers($dollars[0]);
        $form->{amount_text} = $amt->get_string()." and ";
        $form->{amount_cents} = $dollars[1]."/100";
        $form->parse_template(\%myconfig, $userspath);
        IR->vendor_details(\%myconfig, \%$form);
        AP->update_check_number(\%myconfig, \%$form);



***this goes in AP.pm


  sub update_check_number {
  my ($self, $myconfig, $form) = @_;

  # connect to database
  my $dbh = $form->dbconnect_noauto($myconfig);

  my $query = qq|UPDATE defaults
                SET next_check_number = $form->{save_check_number} + 1|;
  $dbh->do($query) || $form->dberror($query);

  # commit and redirect
  my $rc = $dbh->commit;
  $dbh->disconnect;

  $rc;

}

Reply via email to