<?php
session_start();
$q = strtolower($_GET["q"]);
//if (!$q) return;
include 'db_connect.php';
include 'db_table_select.php';

$cmp=$_SESSION[SESS_CMPC];
$fny=$_SESSION[SESS_FNY];
//$items = mysqli_query($con,"Select billno, pedtotal from billreg where billto = '$_GET[comcode]' and cmp = 'IS' and fny = '12-13' and billno not in (select billno from vchdetails)");
$items = mysqli_query($con,"Select billno,(total-paid) as pedtotal from  $billreg where billto = '$_GET[comcode]' and cmp = '$_SESSION[SESS_CMPC]' and fny = '$_SESSION[SESS_FNY]' and (total-paid)<>0");

//while($row = mysqli_fetch_array($items))
 // {
 // echo $row['value'];
 
//  }

while($row = mysqli_fetch_array($items)) {
	//if (strpos(strtolower($row['billno']), $q) !== false) {
		echo "$row[billno]|$row[pedtotal]\n";
//}
}
mysqli_close($con);


?>