6 This page is called from SupplierInquiry.php when the 'view payments' button is selected
12 include('includes/session.inc');
14 $title = _('Payment Allocations');
16 include('includes/header.inc');
17 include('includes/SQL_CommonFunctions.inc');
19 if (!isset($_GET['SuppID'])){
20 prnMsg( _('Supplier ID Number is not Set, can not display result'),'warn');
21 include('includes/footer.inc');
25 if (!isset($_GET['InvID'])){
26 prnMsg( _('Invoice Number is not Set, can not display result'),'warn');
27 include('includes/footer.inc');
30 $SuppID = $_GET['SuppID'];
31 $InvID = $_GET['InvID'];
33 echo "<BR><CENTER><FONT SIZE=4 COLOR=BLUE>Payment Allocation for Supplier: '$SuppID' and Invoice: '$InvID'</FONT>";
35 // $_SESSION['SuppID'] = new SupplierID;
36 // $_SESSION['InvID'] = new InvoiceID;
38 $SQL= "SELECT supptrans.supplierno,
39 supptrans.suppreference,
43 WHERE supptrans.id IN (SELECT suppallocs.transid_allocfrom
44 FROM supptrans, suppallocs
45 WHERE supptrans.supplierno = '$SuppID'
46 AND supptrans.suppreference = '$InvID'
47 AND supptrans.id = suppallocs.transid_allocto)";
50 Might be a way of doing this query without a subquery
52 $SQL= "SELECT supptrans.supplierno,
53 supptrans.suppreference,
56 FROM supptrans INNER JOIN suppallocs ON supptrans.id=suppallocs.transid_allocfrom
57 WHERE supptrans.supplierno = '$SuppID'
58 AND supptrans.suppreference = '$InvID'
61 $Result = DB_query($SQL, $db);
62 if (DB_num_rows($Result) == 0){
63 prnMsg(_('There may be a problem retrieving the information. No data is returned'),'warn');
64 echo '<BR><A HREF ="javascript:history.back()">' . _('Go back') . '</A>';
65 include('includes/foooter.inc');
69 echo '<CENTER><TABLE CELLPADDING=2 COLSPAN=7 WIDTH=100% BORDER=0>';
71 <TD CLASS='tableheader'>" . _('Supplier Number') . '<BR>' . _('Reference') . "</TD>
72 <TD CLASS='tableheader'>" . _('Payment') .'<BR>' . _('Reference') . "</TD>
73 <TD CLASS='tableheader'>" . _('Payment') . '<BR>' . _('Date') . "</TD>
74 <TD CLASS='tableheader'>" . _('Total Payment') . '<BR>' . _('Amount') . '</TD></TR>';
79 $k=0; //row colour counter
80 while ($myrow = DB_fetch_array($Result)) {
82 echo '<TR BGCOLOR="#CCCCCC">';
85 echo '<TR BGCOLOR="#EEEEEE">';
95 $myrow['suppreference'],
96 ConvertSQLDate($myrow['trandate']),
106 echo '</TABLE></CENTER>';
108 include('includes/footer.inc');