From: <tu...@us...> - 2018-02-17 18:45:56
|
Revision: 7972 http://sourceforge.net/p/web-erp/reponame/7972 Author: turbopt Date: 2018-02-17 18:45:53 +0000 (Sat, 17 Feb 2018) Log Message: ----------- CustomerAllocations.php: Minor code shuffle to fix view page source message "Start tag 'div' seen in 'table'" reported in Firefox. Modified Paths: -------------- trunk/CustomerAllocations.php trunk/doc/Change.log Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2018-02-17 18:22:39 UTC (rev 7971) +++ trunk/CustomerAllocations.php 2018-02-17 18:45:53 UTC (rev 7972) @@ -544,71 +544,75 @@ $result = DB_query($SQL); $NoOfUnallocatedTrans = DB_num_rows($result); - $CurrentTransaction = 1; - $CurrentDebtor = ''; - echo '<table class="selection">'; - echo $TableHeader; - while ($myrow = DB_fetch_array($result)) { + if ($NoOfUnallocatedTrans == 0) { + prnMsg(_('There are no allocations to be done'),'info'); + } + else { + $CurrentTransaction = 1; + $CurrentDebtor = ''; + echo '<table class="selection">'; + echo $TableHeader; - $AllocateLink = '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?AllocTrans=' . $myrow['id'] . '">' . _('Allocate') . '</a>'; + while ($myrow = DB_fetch_array($result)) { - if ( $CurrentDebtor != $myrow['debtorno'] ) { - if ( $CurrentTransaction > 1 ) { - echo '<tr class="striped_row"> - <td colspan="7" class="number"><b>' . locale_number_format($Balance,$CurrDecimalPlaces) . '</b></td> - <td><b>' . $CurrCode . '</b></td> - <td><b>' . _('Balance') . '</b></td> - </tr>'; + $AllocateLink = '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?AllocTrans=' . $myrow['id'] . '">' . _('Allocate') . '</a>'; + + if ( $CurrentDebtor != $myrow['debtorno'] ) { + if ( $CurrentTransaction > 1 ) { + echo '<tr class="striped_row"> + <td colspan="7" class="number"><b>' . locale_number_format($Balance,$CurrDecimalPlaces) . '</b></td> + <td><b>' . $CurrCode . '</b></td> + <td><b>' . _('Balance') . '</b></td> + </tr>'; + } + + $Balance = 0; + $CurrentDebtor = $myrow['debtorno']; + + $BalSQL= "SELECT SUM(ovamount+ovgst+ovfreight+ovdiscount-alloc) as total + FROM debtortrans + WHERE (type=12 OR type=11) + AND debtorno='" . $myrow['debtorno'] . "' + AND ovamount<0"; + $BalResult = DB_query($BalSQL); + $BalRow = DB_fetch_array($BalResult); + $Balance = $BalRow['total']; } + $CurrentTransaction++; + $CurrCode = $myrow['currcode']; + $CurrDecimalPlaces = $myrow['currdecimalplaces']; + if (isset($Balance) AND abs($Balance) < -0.01 ) { + $AllocateLink = ' '; + } - $Balance = 0; - $CurrentDebtor = $myrow['debtorno']; + echo '<tr class="striped_row"> + <td>' . _($myrow['typename']) . '</td> + <td>' . $myrow['name'] . '</td> + <td>' . $myrow['debtorno'] . '</td> + <td>' . $myrow['transno'] . '</td> + <td>' . ConvertSQLDate($myrow['trandate']) . '</td> + <td class="number">' . locale_number_format($myrow['total'],$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($myrow['total']-$myrow['alloc'],$CurrDecimalPlaces) . '</td> + <td>' . $CurrCode . '</td> + <td>' . $AllocateLink . '</td> + </tr>'; - $BalSQL= "SELECT SUM(ovamount+ovgst+ovfreight+ovdiscount-alloc) as total - FROM debtortrans - WHERE (type=12 OR type=11) - AND debtorno='" . $myrow['debtorno'] . "' - AND ovamount<0"; - $BalResult = DB_query($BalSQL); - $BalRow = DB_fetch_array($BalResult); - $Balance = $BalRow['total']; + } //end loop around unallocated receipts and credit notes + + if (!isset($Balance)) { + $Balance=0; } - $CurrentTransaction++; - $CurrCode = $myrow['currcode']; - $CurrDecimalPlaces = $myrow['currdecimalplaces']; - if (isset($Balance) AND abs($Balance) < -0.01 ) { - $AllocateLink = ' '; - } echo '<tr class="striped_row"> - <td>' . _($myrow['typename']) . '</td> - <td>' . $myrow['name'] . '</td> - <td>' . $myrow['debtorno'] . '</td> - <td>' . $myrow['transno'] . '</td> - <td>' . ConvertSQLDate($myrow['trandate']) . '</td> - <td class="number">' . locale_number_format($myrow['total'],$CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($myrow['total']-$myrow['alloc'],$CurrDecimalPlaces) . '</td> - <td>' . $CurrCode . '</td> - <td>' . $AllocateLink . '</td> - </tr>'; - - } //end loop around unallocated receipts and credit notes - - if (!isset($Balance)) { - $Balance=0; - } - if ($NoOfUnallocatedTrans == 0) { - prnMsg(_('There are no allocations to be done'),'info'); - } else { - echo '<tr class="striped_row"> <td colspan="7" class="number"><b>' . locale_number_format($Balance,$CurrDecimalPlaces) . '</b></td> <td><b>' . $CurrCode . '</b></td> <td><b>' . _('Balance') . '</b></td> - </tr>'; + </tr> + </table>'; } - echo '</table> - <br />'; + + echo '<br />'; } include('includes/footer.php'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-17 18:22:39 UTC (rev 7971) +++ trunk/doc/Change.log 2018-02-17 18:45:53 UTC (rev 7972) @@ -1,5 +1,6 @@ webERP Change Log +17/2/18 PaulT: CustomerAllocations.php: Minor code shuffle to fix view page source message "Start tag 'div' seen in 'table'" reported in Firefox. 17/2/18 PaulT: Customers.php, ShopParameters.php: Fix view page source message "No space between attributes" reported in Firefox. 17/2/18 PaulT: Labels.php: Remove extra closing </td></tr> tag pair. 17/2/18 PaulT: FixedAssetLocations.php: Move closing condition brace to cover entire table output to avoid a stray closing table tag output if the condition is not met. Also, replace some style attributes with equivalent CSS. |