$select="select n_count ,sum(Dr)-sum(Cr) as total from account , chartaccount , dateaccount, itemaccount where account.g_count =chartaccount.g_count and account.numcount =itemaccount.numcount and itemaccount.nolist=dateaccount.nolist and chartaccount.g_count='1' group by n_count ; ";
$query= mysql_query($select);
$select="SELECT n_count, sum( dr ) - sum( cr ) FROM account, chartaccount, dateaccount, itemaccount WHERE account.g_count = chartaccount.g_count AND account.numcount = itemaccount.numcount AND itemaccount.nolist = dateaccount.nolistAND chartaccount.g_count = '1' AND dateaccount.date_in BETWEEN '$date_in'' AND '$date_out ' GROUP BY n_count; ";
$select="SELECT n_count, sum( dr ) - sum( cr ) FROM account, chartaccount, dateaccount, itemaccount WHERE account.g_count = chartaccount.g_count AND account.numcount = itemaccount.numcount AND itemaccount.nolist = dateaccount.nolistAND chartaccount.g_count = '1' AND dateaccount.date_in BETWEEN '$date_in'' AND '$date_out ' GROUP BY n_count; ";
$select=" SELECT sum( dr ) FROM account, chartaccount, dateaccount, itemaccount WHERE account.g_count = chartaccount.g_count AND account.numcount = itemaccount.numcount AND itemaccount.nolist = dateaccount.nolist AND account.g_count IN ( SELECT account.g_count FROM account, chartaccount WHERE chartaccount.g_count = account.g_count AND account.g_count = '1' ) ; ";
$result= mysql_query($select);
$sql= mysql_fetch_array($result);
$select=" SELECT sum( cr ) FROM account, chartaccount, dateaccount, itemaccount WHERE account.g_count = chartaccount.g_count AND account.numcount = itemaccount.numcount AND itemaccount.nolist = dateaccount.nolist AND account.g_count IN ( SELECT account.g_count FROM account, chartaccount WHERE chartaccount.g_count = account.g_count AND account.g_count = '1' ) ; ";
$result= mysql_query($select);
$sql1= mysql_fetch_array($result);