diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e5acabd4e19..33c795ed10b 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -33,7 +33,9 @@ $langs->load("banks"); $langs->load("bills"); $id=GETPOST("id",'int'); -$action=GETPOST('action'); +$action=GETPOST("action","alpha"); +$refund=GETPOST("refund","int"); +if (empty($refund)) $refund=0; // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; @@ -46,7 +48,6 @@ $tva = new Tva($db); $hookmanager->initHooks(array('taxvatcard','globalcard')); - /** * Actions */ @@ -69,7 +70,12 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $tva->num_payment=GETPOST("num_payment"); $tva->datev=$datev; $tva->datep=$datep; - $tva->amount=GETPOST("amount"); + + $amount = GETPOST("amount"); + if ($refund == 1) { + $amount= -$amount; + } + $tva->amount= $amount; $tva->label=GETPOST("label"); $tva->note=GETPOST("note"); @@ -182,12 +188,46 @@ if ($id) // Formulaire saisie tva if ($action == 'create') { - print "