diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 860209e4158..8965445f732 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -21,7 +21,8 @@ * */ -/** \file htdocs/compta/tva/fiche.php +/** + \file htdocs/compta/tva/fiche.php \brief Page des règlements de TVA \version $Revision$ */ @@ -29,55 +30,82 @@ require("./pre.inc.php"); require("../../tva.class.php"); +$langs->load("compta"); + $mesg = ''; + +/** + * Action ajout paiement tva + */ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $tva = new Tva($db); + $tva = new Tva($db); + + $db->begin(); + + $tva->label = $langs->trans("VATPayment"); + $tva->accountid=$_POST["accountid"]; + $tva->paymenttype=$_POST["paiementtype"]; + $tva->datev=mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); + $tva->datep=mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); + $tva->amount=$_POST["amount"]; - $tva->add_payement(mktime(12,0,0, - $_POST["datevmonth"], - $_POST["datevday"], - $_POST["datevyear"] - ), - mktime(12,0,0, - $_POST["datepmonth"], - $_POST["datepday"], - $_POST["datepyear"] - ), - $_POST["amount"] - ); - Header ( "Location: reglement.php"); + $ret=$tva->add_payement($user); + if ($ret > 0) + { + $db->commit(); + Header ("Location: reglement.php"); + } + else + { + $db->rollback(); + $message=$langs->trans("Error"); + $_GET["action"]="create"; + } } + + llxHeader(); -/* - * - * - */ $html = new Form($db); + +// Formulaire saisie tva if ($_GET["action"] == 'create') { - print "
'; + if ($message) print '| '.$langs->trans("DatePayment").' | '; + print $html->select_date("","datev"); + print ' |
| '.$langs->trans("DateValue").' | '; + print $html->select_date("","datep"); + print ' |
| '.$langs->trans("Type").' | '; + $html->select_types_paiements($charge->paiementtype, "paiementtype"); + print " | \n"; + + print '
| Compte à créditer : | '; + $html->select_comptes($charge->accountid, "accountid", 0, "courant=1"); // Affiche liste des comptes courant + print ' |
| '.$langs->trans("Amount").' | |
| '; + print ' |