4 /* $Revision: 1.10 $ */
7 This page can be called with...
9 1. A SuppTrans TransNo and Type
10 The page will then show potential allocations for the transaction called with,
11 this page can be called from the supplier enquiry to show the make up and to modify
15 The page will show all outstanding payments or credits yet to be allocated for the supplier selected
18 The page will show all outstanding supplier credit notes and payments yet to be
22 include('includes/DefineSuppAllocsClass.php');
26 include('includes/session.inc');
28 $title = _('Supplier Payment') . '/' . _('Credit Note Allocations');
30 include('includes/header.inc');
31 include('includes/SQL_CommonFunctions.inc');
33 if (isset($_POST['UpdateDatabase']) OR isset($_POST['RefreshAllocTotal'])) {
35 //initialise no input errors assumed initially before we test
39 if (!isset($_SESSION['Alloc'])){
40 prnMsg( _('Allocations can not be processed again') . '. ' . _('If you hit refresh on this page after having just processed an allocation') . ', ' . _('try to use the navigation links provided rather than the back button, to avoid this message in future'),'warn');
41 include('includes/footer.inc');
45 /*1st off run through and update the array with the amounts allocated
46 This works because the form has an input field called the value of
47 AllocnItm->ID for each record of the array - and PHP sets the value of
48 the form variable on a post*/
53 for ($AllocCounter=0; $AllocCounter < $_POST['TotalNumberOfAllocs']; $AllocCounter++
){
55 if (!is_numeric($_POST['Amt' . $AllocCounter])){
56 $_POST['Amt' . $AllocCounter] = 0;
58 if ($_POST['Amt' . $AllocCounter] < 0){
59 prnMsg(_('The entry for the amount to allocate was negative') . '. ' . _('A positive allocation amount is expected'),'error');
60 $_POST['Amt' . $AllocCounter] = 0;
63 if ($_POST['All' . $AllocCounter] == True){
64 $_POST['Amt' . $AllocCounter] = $_POST['YetToAlloc' . $AllocCounter];
68 /*Now check to see that the AllocAmt is no greater than the
69 amount left to be allocated against the transaction under review */
71 if ($_POST['Amt' . $AllocCounter] > $_POST['YetToAlloc' . $AllocCounter]){
72 $_POST['Amt' . $AllocCounter] = $_POST['YetToAlloc' . $AllocCounter];
77 $_SESSION['Alloc']->Allocs
[$_POST['AllocID' . $AllocCounter]]->AllocAmt
= $_POST['Amt' . $AllocCounter];
79 /*recalcuate the new difference on exchange
80 (a +positive amount is a gain -ve a loss)*/
82 $_SESSION['Alloc']->Allocs
[$_POST['AllocID' . $AllocCounter]]->DiffOnExch
= ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->TransExRate
) - ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->Allocs
[$_POST['AllocID' . $AllocCounter]]->ExRate
);
84 $TotalDiffOnExch = $TotalDiffOnExch +
$_SESSION['Alloc']->Allocs
[$_POST['AllocID' . $AllocCounter]]->DiffOnExch
;
85 $TotalAllocated = $TotalAllocated +
$_POST['Amt' . $AllocCounter];
87 } /*end of the loop to set the new allocation amounts,
88 recalc diff on exchange and add up total allocations */
90 if ($TotalAllocated +
$_SESSION['Alloc']->TransAmt
> 0.005){
92 prnMsg(_('These allocations cannot be processed because the amount allocated is more than the amount of the') .
93 ' ' . $_SESSION['Alloc']->TransTypeName
. ' ' . _('being allocated') . '<BR>' . _('Total allocated') . ' = ' . $TotalAllocated . ' ' . _('and the total amount of the Credit/payment was') . ' ' . -$_SESSION['Alloc']->TransAmt
,'error');
101 if (isset($_POST['UpdateDatabase'])){
103 if ($InputError == 0){ /* ie all the traps were passed */
105 /* actions to take having checked that the input is sensible
106 1st set up a transaction on this thread*/
110 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('The transaction BEGIN failed with error');
111 $DbgMsg = _('The SQL that was used but failed was');
113 $Result=DB_query($SQL, $db, $ErrMsg, $DbgMsg);
115 foreach ($_SESSION['Alloc']->Allocs
as $AllocnItem) {
117 if ($AllocnItem->OrigAlloc
>0 AND ($AllocnItem->OrigAlloc
!= $AllocnItem->AllocAmt
)){
119 /*Orignial allocation was not 0 and it has now changed
120 need to delete the old allocation record */
122 $SQL = 'DELETE FROM suppallocs WHERE id = ' . $AllocnItem->PrevAllocRecordID
;
124 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The existing allocation for') . ' ' . $AllocnItem->TransType
.' ' . $AllocnItem->TypeNo
. ' ' . _('could not be deleted because');
125 $DbgMsg = _('The following SQL to delete the allocation record was used');
127 $Result=DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
130 if ($AllocnItem->OrigAlloc
!= $AllocnItem->AllocAmt
){
132 /*Only when there has been a change to the allocated amount
133 do we need to insert a new allocation record and update
134 the transaction with the new alloc amount and diff on exch */
136 if ($AllocnItem->AllocAmt
> 0){
137 $SQL = "INSERT INTO suppallocs (datealloc, amt, transid_allocfrom, transid_allocto) VALUES ('" . FormatDateForSQL(date($_SESSION['DefaultDateFormat'])) . "',
138 " . $AllocnItem->AllocAmt
. ',
139 ' . $_SESSION['Alloc']->AllocTrans
. ',
140 ' . $AllocnItem->ID
. ')';
142 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The supplier allocation record for') . ' ' . $AllocnItem->TransType
. ' ' . $AllocnItem->TypeNo
. ' ' ._('could not be inserted because');
143 $DbgMsg = _('The following SQL to insert the allocation record was used');
145 $Result=DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
147 $NewAllocTotal = $AllocnItem->PrevAlloc +
$AllocnItem->AllocAmt
;
149 if (abs($NewAllocTotal-$AllocnItem->TransAmount
) < 0.01){
155 $SQL = 'UPDATE supptrans SET diffonexch=' . $AllocnItem->DiffOnExch
. ',
156 alloc = ' . $NewAllocTotal . ',
157 settled = ' . $Settled . '
158 WHERE id = ' . $AllocnItem->ID
;
160 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction record could not be modified for the allocation against it because');
162 $DbgMsg = _('The following SQL to update the debtor transaction record was used');
164 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
166 } /*end if the new allocation is different to what it was before */
168 } /*end of the loop through the array of allocations made */
170 /*Now update the payment or credit note with the amount allocated
171 and the new diff on exchange */
173 if (abs($TotalAllocated +
$_SESSION['Alloc']->TransAmt
) < 0.01){
179 $SQL = 'UPDATE supptrans SET alloc = ' . -$TotalAllocated . ',
180 diffonexch = ' . -$TotalDiffOnExch . ',
181 settled=' . $Settled . '
182 WHERE id = ' . $_SESSION['AllocTrans'];
184 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' .
185 _('The supplier payment or credit note transaction could not be modified for the new allocation and exchange difference because');
187 $DbgMsg = _('The following SQL to update the payment or credit note was used');
189 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
191 /*Almost there ... if there is a change in the total diff on exchange
192 and if the GLLink to debtors is active - need to post diff on exchange to GL */
194 $MovtInDiffOnExch = $_SESSION['Alloc']->PrevDiffOnExch +
$TotalDiffOnExch;
195 if ($MovtInDiffOnExch !=0 ){
197 if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1){
199 $PeriodNo = GetPeriod($_SESSION['Alloc']->TransDate
, $db);
201 $_SESSION['Alloc']->TransDate
= FormatDateForSQL($_SESSION['Alloc']->TransDate
);
203 $SQL = 'INSERT INTO gltrans (type,
210 VALUES (' . $_SESSION['Alloc']->TransType
. ',
211 ' . $_SESSION['Alloc']->TransNo
. ",
212 '" . $_SESSION['Alloc']->TransDate
. "',
214 ' . $_SESSION['CompanyRecord']['purchasesexchangediffact'] . ",
215 '". _('Exch diff') . "',
216 " . $MovtInDiffOnExch . ')';
218 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' .
219 _('The GL entry for the difference on exchange arising out of this allocation could not be inserted because');
220 $DbgMsg = _('The following SQL to insert the GLTrans record was used');
222 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
225 $SQL = 'INSERT INTO gltrans (type,
232 VALUES (' . $_SESSION['Alloc']->TransType
. ',
233 ' . $_SESSION['Alloc']->TransNo
. ",
234 '" . $_SESSION['Alloc']->TransDate
. "',
236 ' . $_SESSION['CompanyRecord']['creditorsact'] . ",
237 '" . _('Exch Diff') . "',
238 " . -$MovtInDiffOnExch . ')';
240 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ' : ' .
241 _('The GL entry for the difference on exchange arising out of this allocation could not be inserted because');
243 $DbgMsg = _('The following SQL to insert the GLTrans record was used');
245 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
251 /* OK Commit the transaction */
255 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' .
256 _('The updates and insertions arising from this allocation could not be committed to the database');
258 $DbgMsg = _('The COMMIT SQL failed');
260 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg);
262 /*finally delete the session variables holding all the previous data */
264 unset($_SESSION['AllocTrans']);
265 unset($_SESSION['Alloc']);
266 unset($_POST['AllocTrans']);
268 } /* end of processing required if there were no input errors trapped */
271 /*The main logic determines whether the page is called with a Supplier code
272 a specific transaction or with no parameters ie else
273 If with a supplier code show just that supplier's payments and credits for allocating
274 If with a specific payment or credit show the invoices and credits available
277 echo "<FORM ACTION='" . $_SERVER['PHP_SELF'] . "?" . SID
. "' METHOD=POST>";
279 if (isset($_POST['SupplierID'])){
280 $_GET['SupplierID'] = $_POST['SupplierID'];
281 echo "<INPUT TYPE='hidden' NAME='SupplierID' VALUE='" . $_POST["SupplierID"] . "'>";
284 If (isset($_GET['AllocTrans'])){
286 /*page called with a specific transaction ID for allocating
287 SupplierID may also be set but this is the logic to follow
288 the SupplierID logic is only for showing the payments and credits to allocate*/
292 - read in the transaction into a session class variable
293 - read in the invoices available for allocating to into a session array of allocs object
294 - Display the supplier name the transaction being allocated amount and trans no
295 - Display the invoices for allocating to with a form entry for each one
296 for the allocated amount to be entered */
299 $_SESSION['Alloc'] = new Allocation
;
301 /*The session varibale AllocTrans is set from the passed variable AllocTrans
304 $_SESSION['AllocTrans'] = $_GET['AllocTrans'];
305 $_POST['AllocTrans'] = $_GET['AllocTrans'];
308 $SQL= 'SELECT systypes.typename,
312 supptrans.supplierno,
315 (supptrans.ovamount+supptrans.ovgst) AS total,
316 supptrans.diffonexch,
321 WHERE supptrans.type = systypes.typeid
322 AND supptrans.supplierno = suppliers.supplierid
323 AND supptrans.id=' . $_SESSION['AllocTrans'];
325 $Result = DB_query($SQL, $db);
326 if (DB_num_rows($Result) != 1){
327 echo _('There was a problem retrieving the information relating the transaction selected') . '. ' . _('Allocations are unable to proceed');
329 echo '<BR>' . _('The SQL that was used to retreive the transaction information was') . " :<BR>$SQL";
334 $myrow = DB_fetch_array($Result);
336 $_SESSION['Alloc']->AllocTrans
= $_SESSION['AllocTrans'];
337 $_SESSION['Alloc']->SupplierID
= $myrow['supplierno'];
338 $_SESSION['Alloc']->SuppName
= $myrow['suppname'];;
339 $_SESSION['Alloc']->TransType
= $myrow['type'];
340 $_SESSION['Alloc']->TransTypeName
= $myrow['typename'];
341 $_SESSION['Alloc']->TransNo
= $myrow['transno'];
342 $_SESSION['Alloc']->TransExRate
= $myrow['rate'];
343 $_SESSION['Alloc']->TransAmt
= $myrow['total'];
344 $_SESSION['Alloc']->PrevDiffOnExch
= $myrow['diffonexch'];
345 $_SESSION['Alloc']->TransDate
= ConvertSQLDate($myrow['trandate']);
347 /* Now populate the array of possible (and previous actual) allocations for this supplier */
348 /*First get the transactions that have outstanding balances ie Total-Alloc >0 */
350 $SQL= "SELECT supptrans.id,
356 ovamount+ovgst AS total,
361 WHERE supptrans.type = systypes.typeid
362 AND supptrans.settled=0
363 AND abs(ovamount+ovgst-alloc)>0.009
364 AND supplierno='" . $_SESSION['Alloc']->SupplierID
. "'";
366 $ErrMsg = _('There was a problem retrieving the transactions available to allocate to');
368 $DbgMsg = _('The SQL that was used to retreive the transaction information was');
370 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg);
372 while ($myrow=DB_fetch_array($Result)){
373 $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'],
376 ConvertSQLDate($myrow['trandate']),
377 $myrow['suppreference'],
381 $myrow['diffonexch'],
382 $myrow['diffonexch'],
387 /* Now get trans that might have previously been allocated to by this trans
388 NB existing entries where still some of the trans outstanding entered from
389 above logic will be overwritten with the prev alloc detail below */
391 $SQL = 'SELECT supptrans.id,
397 ovamount+ovgst AS total,
399 supptrans.alloc-suppallocs.amt AS prevallocs,
401 suppallocs.id AS allocid
405 WHERE supptrans.type = systypes.typeid
406 AND supptrans.id=suppallocs.transid_allocto
407 AND suppallocs.transid_allocfrom=' . $_SESSION['AllocTrans'] .
408 " AND supplierno='" . $_SESSION['Alloc']->SupplierID
. "'";
410 $ErrMsg = _('There was a problem retrieving the previously allocated transactions for modification');
412 $DbgMsg = _('The SQL that was used to retreive the previously allocated transaction information was');
414 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg);
416 while ($myrow = DB_fetch_array($Result)){
418 $DiffOnExchThisOne = ($myrow['amt']/$myrow['rate']) - ($myrow['amt']/$_SESSION['Alloc']->TransExRate
);
420 $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], $myrow['typename'], $myrow['transno'],
421 ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'],
425 ($myrow['diffonexch'] - $DiffOnExchThisOne),
426 $myrow['prevallocs'],
431 if (isset($_POST['AllocTrans'])){
433 echo "<INPUT TYPE='hidden' NAME='AllocTrans' VALUE='" . $_POST["AllocTrans"] . "'>";
435 /*Show the transaction being allocated and the potential trans it could be allocated to
436 and those where there is already an existing allocation */
438 echo '<HR><CENTER><FONT COLOR=BLUE>' . _('Allocation of supplier') . ' ' .
439 $_SESSION['Alloc']->TransTypeName
. ' ' . _('number') . ' ' .
440 $_SESSION['Alloc']->TransNo
. ' ' . _('from') . ' ' .
441 $_SESSION['Alloc']->SupplierID
. ' - <B>' .
442 $_SESSION['Alloc']->SuppName
. '</B>, ' . _('dated') . ' ' .
443 $_SESSION['Alloc']->TransDate
;
445 if ($_SESSION['Alloc']->TransExRate
!= 1){
446 echo '<BR>' . _("Amount in supplier currency"). ' <B>' .
447 number_format(-$_SESSION['Alloc']->TransAmt
,2) . '</B><i> (' .
448 _('converted into local currency at an exchange rate of') . ' ' .
449 $_SESSION['Alloc']->TransExRate
. ')</i><P>';
453 echo '<BR>' . _('Transaction total') . ': <B>' . -$_SESSION['Alloc']->TransAmt
. '</B>';
458 /*Now display the potential and existing allocations put into the array above */
460 echo '<TABLE CELLPADDING=2 COLSPAN=7 BORDER=0>';
461 $TableHeader = "<TR><TD CLASS='tableheader'>" . _('Type') . "</TD>
462 <TD CLASS='tableheader'>" . _('Trans') . '<BR>' . _('Number') . "</TD>
463 <TD CLASS='tableheader'>" . _('Trans') .'<BR>' . _('Date') . "</TD>
464 <TD CLASS='tableheader'>" . _('Supp') . '<BR>' . _('Ref') . "</TD>
465 <TD CLASS='tableheader'>" . _('Total') . '<BR>' . _('Amount') . "</TD>
466 <TD CLASS='tableheader'>" . _('Yet to') . '<BR>' . _('Allocate') . "</TD>
467 <TD CLASS='tableheader'>" . _('This') . '<BR>' . _('Allocation') . '</TD></TR>';
473 foreach ($_SESSION['Alloc']->Allocs
as $AllocnItem) {
475 /*Alternate the background colour for each potential allocation line */
478 echo "<TR BGCOLOR='#CCCCCC'>";
481 echo "<TR BGCOLOR='#EEEEEE'>";
486 if ($RowCounter == 15){
488 /*Set up another row of headings to ensure always a heading on the screen of potential allocns*/
496 $YetToAlloc = ($AllocnItem->TransAmount
- $AllocnItem->PrevAlloc
);
498 echo "<TD>$AllocnItem->TransType</TD>
499 <TD>$AllocnItem->TypeNo</TD>
500 <TD>$AllocnItem->TransDate</TD>
501 <TD>$AllocnItem->SuppRef</TD>
502 <TD ALIGN=RIGHT>" . number_format($AllocnItem->TransAmount
,2) . '</TD>
503 <TD ALIGN=RIGHT>' . number_format($YetToAlloc,2) . "<INPUT TYPE=hidden NAME='YetToAlloc" .
504 $Counter . "' VALUE=" . $YetToAlloc . '></TD>';
506 echo "<TD ALIGN=RIGHT><INPUT TYPE='checkbox' NAME='All" . $Counter . "'";
508 if (ABS($AllocnItem->AllocAmt
-$YetToAlloc) < 0.01){
509 echo ' VALUE=' . True . '>';
513 echo "<INPUT TYPE=text NAME='Amt" . $Counter ."' MAXLENGTH=12 SIZE=13 VALUE=" .
514 $AllocnItem->AllocAmt
. "><INPUT TYPE=hidden NAME='AllocID" . $Counter .
515 "' VALUE=" . $AllocnItem->ID
. '></TD></TR>';
517 $TotalAllocated = $TotalAllocated +
$AllocnItem->AllocAmt
;
523 echo '<TR><TD COLSPAN=5 ALIGN=RIGHT><B><U>' . _('Total Allocated') . ':</U></B></TD>
524 <TD ALIGN=RIGHT><B><U>' . number_format($TotalAllocated,2) . '</U></B></TD></TR>';
526 echo '<TR><TD COLSPAN=5 ALIGN=RIGHT><B>' . _('Left to allocate') . '</B></TD><TD ALIGN=RIGHT><B>' .
527 number_format(-$_SESSION['Alloc']->TransAmt
- $TotalAllocated,2) . '</B></TD></TR></TABLE>';
529 echo "<INPUT TYPE=HIDDEN NAME='TotalNumberOfAllocs' VALUE=$Counter>";
531 echo "<INPUT TYPE=SUBMIT NAME='RefreshAllocTotal' VALUE='" . _('Recalculate Total To Allocate') . "'>";
532 echo "<INPUT TYPE=SUBMIT NAME=UpdateDatabase VALUE='" . _('Process Allocations') . "'>";
534 } elseif(isset($_GET['SupplierID'])){
536 /*page called with a supplier code so show the transactions to allocate
537 specific to the supplier selected */
539 echo "<INPUT TYPE=hidden NAME=SupplierID VALUE='" . $_GET['SupplierID'] . "'>";
541 /*Clear any previous allocation records */
543 unset($_SESSION['Alloc']);
549 suppliers.supplierid,
554 ovamount+ovgst AS total,
559 WHERE supptrans.type=systypes.typeid
560 AND supptrans.supplierno=suppliers.supplierid
561 AND suppliers.supplierid='" . $_GET['SupplierID'] ."'
562 AND (type=21 or type=22) AND settled=0 ORDER BY id";
564 $result = DB_query($sql, $db);
565 if (DB_num_rows($result) == 0){
566 prnMsg(_('There are no outstanding payments or credits yet to be allocated for this supplier'),'info');
567 include('includes/footer.inc');
570 echo '<CENTER><TABLE>';
572 $TableHeader = "<TR><TD CLASS='tableheader'>" . _('Trans Type') .
573 "</TD><TD CLASS='tableheader'>" . _('Supplier') .
574 "</TD><TD CLASS='tableheader'>" . _('Number') .
575 "</TD><TD CLASS='tableheader'>" . _('Date') .
576 "</TD><TD CLASS='tableheader'>" . _('Total') .
577 "</TD><TD CLASS='tableheader'>" . _('To Alloc') . "</TD></TR>\n";
581 /* set up table of TransType - Supplier - Trans No - Date - Total - Left to alloc */
584 $k = 0; //row colour counter
585 while ($myrow = DB_fetch_array($result)) {
587 echo "<TR BGCOLOR='#CCCCCC'>";
590 echo "<TR BGCOLOR='#EEEEEE'>";
598 <TD ALIGN=RIGHT>%0.2f</TD>
599 <TD ALIGN=RIGHT>%0.2f</TD>
600 <TD><A HREF='%sAllocTrans=%s'>" . _('Allocate') .'</TD>
605 ConvertSQLDate($myrow['trandate']),
607 $myrow['total']-$myrow['alloc'],
608 $_SERVER['PHP_SELF'] . "?" . SID
,
612 if ($RowCounter == 20){
619 } else { /* show all outstanding payments and credits to be allocated */
621 /*Clear any previous allocation records */
623 unset($_SESSION['Alloc']->Allocs
);
624 unset($_SESSION['Alloc']);
630 suppliers.supplierid,
635 ovamount+ovgst AS total,
640 WHERE supptrans.type=systypes.typeid
641 AND supptrans.supplierno=suppliers.supplierid
642 AND (type=21 or type=22)
643 AND settled=0 ORDER BY id';
645 $result = DB_query($sql, $db);
647 echo '<CENTER><TABLE>';
648 $TableHeader = "<TR><TD CLASS='tableheader'>" . _('Trans Type') . "</TD>
649 <TD CLASS='tableheader'>" . _('Supplier') . "</TD>
650 <TD CLASS='tableheader'>" . _('Number') . "</TD>
651 <TD CLASS='tableheader'>" . _('Date') . "</TD>
652 <TD CLASS='tableheader'>" . _('Total') . "</TD>
653 <TD CLASS='tableheader'>" . _('To Alloc') . "</TD></TR>\n";
657 /* set up table of Tran Type - Supplier - Trans No - Date - Total - Left to alloc */
659 $k = 0; //row colour counter
661 while ($myrow = DB_fetch_array($result)) {
663 echo "<TR BGCOLOR='#CCCCCC'>";
666 echo "<TR BGCOLOR='#EEEEEE'>";
674 <TD ALIGN=RIGHT>%0.2f</TD>
675 <TD ALIGN=RIGHT>%0.2f</TD>
676 <TD><A HREF='%sAllocTrans=%s'>" . _('Allocate') . '</TD>
681 ConvertSQLDate($myrow['trandate']),
683 $myrow['total']-$myrow['alloc'],
684 $_SERVER['PHP_SELF'] . "?" . SID
,
688 if ($RowCounter == 20){
693 } //END WHILE LIST LOOP
695 echo "</TABLE></CENTER>";
697 if (DB_num_rows($result) == 0) {
698 prnMsg(_('There are no allocations to be done'),'info');
701 } /* end of else if not a SupplierID or transaction called with the URL */
704 include('includes/footer.inc');