require("../config.php");
require("$basepath/includes/subs.php");
/**********************************
display_bill.php
Display Customer Bill
**********************************/
require("$basepath/cust/auth_cust.php");
do_header('C',"Consumer Bill Listing");
$fn = $_REQUEST['f'];
$off = $_REQUEST['o'];
if (!$fd = @fopen("$fn", 'r')) {
if (!$fd = @fopen("$fn.sent", 'r')) {
if (!$fd = @fopen("$fn.mrg", 'r')) {
do_error("Cannot open Billing File ($fn)");
}
}
}
$offs = 0;
while($offs < $off) {
$buffer = trim(fgets($fd,4096));
$offs++;
}
$buffer = trim(fgets($fd,4096));
if($buffer != '') {
list($stmt,$date,$billtype,$inserts,$m1cnt,$lcnt,$m2cnt,$cid,$bal,$due) = explode(",", $buffer);
$fnd = strpos($stmt,"-");
if($fnd === false) { do_error("Invalid File Format in $fn at offset $offs
$buffer"); }
if($cid != $cust_id) { do_error("Invalid Statement # $stmt for Cust ID [$cust_id]"); }
$buffer = trim(fgets($fd,4096));
list($pname,$paddr1,$paddr2,$pcity,$pstate,$pzip) = explode(",", $buffer);
$buffer = trim(fgets($fd,4096));
list($cname,$caddr1,$caddr2,$ccity,$cstate,$czip) = explode(",", $buffer);
$buffer = trim(fgets($fd,4096));
list($rname,$raddr1,$raddr2,$rcity,$rstate,$rzip) = explode(",", $buffer);
$title = "Statement Number: $stmt Date: $date";
if($billtype == 9) {
$title = "REPRINT $title REPRINT";
}
print "
| $title | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Payable To: $pname $paddr1 "; if(!empty($paddr2)) { print "$paddr2 "; } print "$pcity, $pstate $pzip | ";
print "
| ||||||||||||||||||||
| Addressee: $cname $caddr1 "; if(!empty($caddr2)) { print "$caddr2 "; } print "$ccity, $cstate $czip | ";
print "Remit To: $rname $raddr1 "; if(!empty($raddr2)) { print "$raddr2 "; } print "$rcity, $rstate $rzip | ||||||||||||||||||||
$msg1 | |||||||||||||||||||||
";
print "
| |||||||||||||||||||||
$msg2 | |||||||||||||||||||||