Difficulty Re-printing Invoices

Ivan Kohler ivan at sisd.com
Mon Jan 4 13:06:35 PST 1999


You should be getting something in your web server's error log?  If you
could post that it would help myself and others.

I've attached htdocs/misc/print-invoice.cgi from the development tree
which should help you out.

I'll roll up a 1.1.7 and 1.2.0 beta soon.

-- 
Ivan Kohler <ivan at sisd.com> - finger for PGP key - <moc.dsis at navi> relhoK navI
Open-source billing and administration for ISPs - http://www.sisd.com/freeside
20 4,16 * * * saytime # please don't be surprised if you find me dreaming too

On Mon, Jan 04, 1999 at 10:51:03AM -0700, El hombre del espacio wrote:
> 
> Okay: here's a new one:
> 
> I have installed freeside ver 1.1.6 on a FreeBSD 2.2.7 machine. 
> 
> I can print the first invoice on an account (when you have just added new
> services) with no problems, but reprinting invoices has proven to be frustrating.
> 
> 
> By selecting an invoice in the Payment History section on any Customer View page
> and telling Freeside to 'reprint this invoice', I end up with a mostly blank
> page with the word 'Invoice' at the top of the page. Additionally, Freeside still
> says that the given invoice has been 'printed 0 times'.
> 
> I'm fairly certain that this is not a lpr command string issue, as I can print
> the first invoice. If anyone else has encountered this issue and has found a
> workaround, I would be grateful for a little enlightenment.
> 
> 
> spaceman at dimensional.com
> ______________________________________________________________
> Protect your privacy and use PGP! -It's freeware!
> My pgp key and info is available by 
> fingering spaceman at dimensional.com
> or by visiting http://www.dim.com/~spaceman/pgp.html
> If you want to use PGP but need help doing so, email me!
> ______________________________________________________________
> 



-------------- next part --------------
#!/usr/bin/perl -Tw
#
# $Id: print-invoice.cgi,v 1.3 1998/12/23 03:04:24 ivan Exp $
#
# just a kludge for now, since this duplicates in a way it shouldn't stuff from
# Bill.pm (like $lpr) ivan at sisd.com 98-jun-16
#
# $Log: print-invoice.cgi,v $
# Revision 1.3  1998/12/23 03:04:24  ivan
# $cgi->keywords instead of $cgi->query_string
#
# Revision 1.2  1998/12/17 09:12:47  ivan
# s/CGI::(Request|Base)/CGI.pm/;
#

use strict;
use vars qw($conf);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::CGI qw(popurl);
use FS::Record qw(qsearchs);
use FS::cust_bill;

my($cgi) = new CGI;
&cgisuidsetup($cgi);

$conf = new FS::Conf;
my $lpr = $conf->config('lpr');

#untaint invnum
my($query) = $cgi->keywords;
$query =~ /^(\d*)$/;
my($invnum)=$1;
my($cust_bill)=qsearchs('cust_bill',{'invnum'=>$invnum});
die "Can't find invoice!\n" unless $cust_bill;

        open(LPR,"|$lpr") or die "Can't open $lpr: $!";
        print LPR $cust_bill->print_text; #( date )
        close LPR
          or die $! ? "Error closing $lpr: $!"
                       : "Exit status $? from $lpr";

my($custnum)=$cust_bill->getfield('custnum');

print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history");



More information about the freeside-users mailing list