<?php

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

if($_GET[type]=='cashbank'){
$items = mysqli_query($con,"SELECT ledger FROM ledgerreg  ");
$items1 = mysqli_query($con,"SELECT refno FROM getvchno where vchtype='PAYMENT' ");
$items1_row = mysqli_fetch_assoc($items1);
}
else if($_GET[type]=='puracc')
$items = mysqli_query($con,"SELECT ledger FROM ledgerreg where ledtype='PURCHASE ACCOUNT'  ");
else if($_GET[type]=='credacc')
$items = mysqli_query($con,"SELECT ledger FROM ledgerreg where ledtype='SALES ACCOUNT' ");

else if($_GET[type]=='pettycash')
$items = mysqli_query($con,"SELECT ledger FROM ledgerreg where ledtype in('CASHBANK','SUNDRY CREDITORS') ");

else if($_GET[mode]=='pettyagst')
$items = mysqli_query($con,"SELECT ledger FROM ledgerreg where ledtype like '%expense%' ");

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

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


?>