From: <Ex...@us...> - 2012-03-20 14:23:15
|
Revision: 5111 http://web-erp.svn.sourceforge.net/web-erp/?rev=5111&view=rev Author: ExsonQu Date: 2012-03-20 14:23:04 +0000 (Tue, 20 Mar 2012) Log Message: ----------- 20/3/2012 Exson: Fixed bugs that users push Process Credit button in Credit_Invoice.php directly without update will lead to unbalance Journal entry. Reported by Russ Modified Paths: -------------- trunk/Credit_Invoice.php Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2012-03-20 12:39:40 UTC (rev 5110) +++ trunk/Credit_Invoice.php 2012-03-20 14:23:04 UTC (rev 5111) @@ -292,9 +292,28 @@ $k=0; //row colour counter $j=0; //row counter - +if(isset($_POST['AutoUpdate'])){//clear the $_SESSION value when users have not click update button and directly process the credit note + $_SESSION['CreditItems']->total = 0; + $_SESSION['CreditItems']->totalVolume = 0; + $_SESSION['CreditItems']->totalWeight = 0; +} foreach ($_SESSION['CreditItems']->LineItems as $LnItm) { $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); + if (isset($_POST['AutoUpdate'])){//If users push Process Credit button instead of Update button, use this variable to update related information + $_SESSION['CreditItems']->total +=$LineTotal; + $_SESSION['CreditItems']->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); + $_SESSION['CreditItems']->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); + } + + + + + + + + + + $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); if (!isset($_POST['ProcessCredit'])) { $_SESSION['CreditItems']->total += $LineTotal; $_SESSION['CreditItems']->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); @@ -1512,6 +1531,7 @@ echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex="' . $j . '" name="CreditText" cols="31" rows="5">' . $_POST['CreditText'] . '</textarea></td></tr>'; echo '</table><br /><div class="centre"><input tabindex="' . $j . '" type="submit" name="Update" value="' . _('Update') . '" /><br />'; $j++; + echo '<input type="hidden" name="AutoUpdate" value="" />'; echo '<input type="submit" tabindex="'.$j++.'" name="ProcessCredit" value="' . _('Process Credit') .'" /></div>'; } echo '</div>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |