improves the simplified payment
MAIN_JS_ON_PAYMENT must be set
This commit is contained in:
parent
01d623712f
commit
65fccb87d3
@ -12,7 +12,8 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +48,7 @@ $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invo
|
|||||||
// from text inputs : total amount
|
// from text inputs : total amount
|
||||||
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment)
|
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment)
|
||||||
: ''
|
: ''
|
||||||
)
|
)
|
||||||
: ''; // keep void if not a valid entry
|
: ''; // keep void if not a valid entry
|
||||||
// Checkamounts
|
// Checkamounts
|
||||||
foreach ($amounts as $key => $value)
|
foreach ($amounts as $key => $value)
|
||||||
@ -66,7 +67,7 @@ if($currentInvId) // Here to breakdown
|
|||||||
// Get the current amount (from form) and the corresponding remainToPay (from invoice)
|
// Get the current amount (from form) and the corresponding remainToPay (from invoice)
|
||||||
$currentAmount = $amounts['amount_'.$currentInvId];
|
$currentAmount = $amounts['amount_'.$currentInvId];
|
||||||
$currentRemain = $remains['remain_'.$currentInvId];
|
$currentRemain = $remains['remain_'.$currentInvId];
|
||||||
|
|
||||||
// If amountPayment isn't filled, breakdown invoice amount, else breakdown from amountPayment
|
// If amountPayment isn't filled, breakdown invoice amount, else breakdown from amountPayment
|
||||||
if($amountPayment == '')
|
if($amountPayment == '')
|
||||||
{
|
{
|
||||||
@ -77,17 +78,17 @@ if($currentInvId) // Here to breakdown
|
|||||||
$remainAmount = $currentRemain - $currentAmount; // To keep value between curRemain and curAmount
|
$remainAmount = $currentRemain - $currentAmount; // To keep value between curRemain and curAmount
|
||||||
$result += $remainAmount; // result must be deduced by
|
$result += $remainAmount; // result must be deduced by
|
||||||
$currentAmount += $remainAmount; // curAmount put to curRemain
|
$currentAmount += $remainAmount; // curAmount put to curRemain
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
$currentAmount = $currentRemain;
|
$currentAmount = $currentRemain;
|
||||||
$result += $currentRemain;
|
$result += $currentRemain;
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Reset the substraction for this amount
|
// Reset the substraction for this amount
|
||||||
$result += price2num($currentAmount);
|
$result += price2num($currentAmount);
|
||||||
$currentAmount = 0;
|
$currentAmount = 0;
|
||||||
|
|
||||||
if($result >= 0) // then we need to calculate the amount to breakdown
|
if($result >= 0) // then we need to calculate the amount to breakdown
|
||||||
{
|
{
|
||||||
$amountToBreakdown = ($result - $currentRemain >= 0 ?
|
$amountToBreakdown = ($result - $currentRemain >= 0 ?
|
||||||
|
|||||||
@ -16,14 +16,15 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/paiement.php
|
* \file htdocs/compta/paiement.php
|
||||||
* \ingroup compta
|
* \ingroup compta
|
||||||
* \brief Page to create a payment
|
* \brief Page to create a payment
|
||||||
* \version $Id: paiement.php,v 1.113 2011/08/03 00:46:23 eldy Exp $
|
* \version $Id: paiement.php,v 1.112 2011/07/27 08:00:45 cdelambert Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('../main.inc.php');
|
require('../main.inc.php');
|
||||||
@ -672,5 +673,5 @@ if (! GETPOST('action'))
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date: 2011/08/03 00:46:23 $ - $Revision: 1.113 $');
|
llxFooter('$Date: 2011/07/27 08:00:45 $ - $Revision: 1.112 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user