1<?php
2
3include('includes/session.php');
4$Title=_('Check Period Sales Ledger Control Account');
5include('includes/header.php');
6
7echo '<table>';
8
9$Header = '<tr>
10			<th>' . _('Date') . '</th>
11			<th>' . _('Type') . '</th>
12			<th>' . _('Number') . '</th>
13			<th>' . _('Period') . '</th>
14			<th>' . _('Difference') . '</th>
15		</tr>';
16
17echo $Header;
18
19$sql = "SELECT gltrans.type,
20			gltrans.trandate,
21			systypes.typename,
22			gltrans.typeno,
23			periodno,
24			SUM(amount) AS nettot
25		FROM gltrans
26			INNER JOIN chartmaster ON
27			gltrans.account=chartmaster.accountcode
28			INNER JOIN systypes ON gltrans.type = systypes.typeid
29		GROUP BY gltrans.type,
30			systypes.typename,
31			typeno,
32			periodno
33		HAVING ABS(SUM(amount))>= " . 1/pow(10,$_SESSION['CompanyRecord']['decimalplaces']) . "
34		ORDER BY gltrans.counterindex";
35
36$OutOfWackResult = DB_query($sql);
37
38
39$RowCounter =0;
40
41while ($OutOfWackRow = DB_fetch_array($OutOfWackResult)){
42
43	if ($RowCounter==18){
44		$RowCounter=0;
45		echo $Header;
46	} else {
47		$RowCounter++;
48	}
49	echo '<tr>
50	<td>' . ConvertSQLDate($OutOfWackRow['trandate']) . '</td>
51	<td><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=' . $OutOfWackRow['type'] . '&TransNo=' . $OutOfWackRow['typeno'] . '">' . $OutOfWackRow['typename'] . '</a></td>
52	<td class="number">' . $OutOfWackRow['typeno'] . '</td>
53	<td class="number">' . $OutOfWackRow['periodno'] . '</td>
54	<td class="number">' . locale_number_format($OutOfWackRow['nettot'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
55	</tr>';
56
57}
58echo '</table>';
59
60include('includes/footer.php');
61?>