From: <dai...@us...> - 2012-10-25 07:51:59
|
Revision: 5728 http://sourceforge.net/p/web-erp/reponame/5728 Author: daintree Date: 2012-10-25 07:51:57 +0000 (Thu, 25 Oct 2012) Log Message: ----------- fix rounding so cash received entered will not trigger error Modified Paths: -------------- trunk/CounterSales.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2012-10-24 09:15:22 UTC (rev 5727) +++ trunk/CounterSales.php 2012-10-25 07:51:57 UTC (rev 5728) @@ -522,7 +522,7 @@ $OrderLine->DiscountPercent = 0; } - if ($Quantity<0 or $Price <0 or $DiscountPercentage >100 or $DiscountPercentage <0){ + if ($Quantity<0 OR $Price < 0 OR $DiscountPercentage >100 OR $DiscountPercentage <0){ prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn'); } else if ($OrderLine->Quantity !=$Quantity OR $OrderLine->Price != $Price @@ -912,12 +912,21 @@ if (!isset($_POST['AmountPaid'])){ $_POST['AmountPaid'] =0; } - echo '<tr><td>' . _('Amount Paid') . ':</td><td><input type="text" class="number" name="AmountPaid" maxlength="12" size="12" value="' . $_POST['AmountPaid'] . '" /></td></tr>'; + echo '<tr> + <td>' . _('Amount Paid') . ':</td> + <td><input type="text" class="number" name="AmountPaid" maxlength="12" size="12" value="' . $_POST['AmountPaid'] . '" /></td> + </tr>'; echo '</table>'; //end the sub table in the second column of master table - echo '</th></tr></table>'; //end of column/row/master table - echo '<br /><div class="centre"><input type="submit" name="Recalculate" value="' . _('Re-Calculate') . '" /> - <input type="submit" name="ProcessSale" value="' . _('Process The Sale') . '" /></div><hr />'; + echo '</th> + </tr> + </table>'; //end of column/row/master table + echo '<br /> + <div class="centre"> + <input type="submit" name="Recalculate" value="' . _('Re-Calculate') . '" /> + <input type="submit" name="ProcessSale" value="' . _('Process The Sale') . '" /> + </div> + <hr />'; } # end of if lines @@ -933,7 +942,7 @@ prnMsg(_('There are no lines on this sale. Please enter lines to invoice first'),'error'); $InputError = true; } - if (abs(filter_number_format($_POST['AmountPaid']) -($_SESSION['Items'.$identifier]->total+filter_number_format($_POST['TaxTotal'])))>=0.01) { + if (abs(filter_number_format($_POST['AmountPaid']) -(round($_SESSION['Items'.$identifier]->total+filter_number_format($_POST['TaxTotal']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces)))>=0.01) { prnMsg(_('The amount entered as payment does not equal the amount of the invoice. Please ensure the customer has paid the correct amount and re-enter'),'error'); $InputError = true; } |