- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / PaymentAllocations.php
blob577c9a3d1c5a9de9940caffe7b6a448643c810c6
1 <?php
3 /* $Revision: 1.3 $ */
5 /*
6 This page is called from SupplierInquiry.php when the 'view payments' button is selected
7 */
10 $PageSecurity = 5;
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');
22 exit;
25 if (!isset($_GET['InvID'])){
26 prnMsg( _('Invoice Number is not Set, can not display result'),'warn');
27 include('includes/footer.inc');
28 exit;
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,
40 supptrans.trandate,
41 supptrans.alloc
42 FROM supptrans
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,
54 supptrans.trandate,
55 supptrans.alloc
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');
66 exit;
69 echo '<CENTER><TABLE CELLPADDING=2 COLSPAN=7 WIDTH=100% BORDER=0>';
70 $TableHeader = "<TR>
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>';
76 echo $TableHeader;
78 $j=1;
79 $k=0; //row colour counter
80 while ($myrow = DB_fetch_array($Result)) {
81 if ($k == 1){
82 echo '<TR BGCOLOR="#CCCCCC">';
83 $k = 0;
84 } else {
85 echo '<TR BGCOLOR="#EEEEEE">';
86 $k++;
89 printf('<TD>%s</TD>
90 <TD>%s</TD>
91 <TD>%s</TD>
92 <TD>%s</TD>
93 </TR>',
94 $myrow['supplierno'],
95 $myrow['suppreference'],
96 ConvertSQLDate($myrow['trandate']),
97 $myrow['alloc'] );
99 $j++;
100 If ($j == 18){
101 $j=1;
102 echo $TableHeader;
106 echo '</TABLE></CENTER>';
108 include('includes/footer.inc');