<?
session_start();
 include("../test.php");
 include ("../opendb.php");

$chkres=mysqli_query($db,"select distinct partic from journal2  where brcode='$brcode' and  partic not in(select led from ledger where brcode='$brcode')")or die(mysqli_error());
if(mysqli_num_rows($chkres)>0)
{
 print "<font color=red> Following ledgers could not be found</font> <br>";
 $i=1;
 while($chrow=mysqli_fetch_array($chkres))
 {
   print $i++.". $chrow[0] <br>";
 }
 print "<a href='../ledge.php'>Create Ledger now </a>";

}
$sql="select led,count(led),brcode from ledger group by led,brcode having count(led)>1";
$re=mysqli_query($db,$sql) or die(mysqli_error());
 print "<font color=red> Duplicate ledgers found</font> <br>";
if(mysqli_num_rows($re)>0)
{
print "<table><th>Ledger <th>Count<th>Branch";
while($row=mysqli_fetch_array($re))
{
 print "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td></tr>";
}
print "</table>";
}
?>
