From a236c763fb5bc43a45ffac08c941bf3a6fbdf78c Mon Sep 17 00:00:00 2001 From: Andre Cianfarani Date: Thu, 23 Feb 2006 10:07:10 +0000 Subject: [PATCH] modif pour assuj TVA --- htdocs/soc.php | 54 +++++++++++++++++++++++++++++++++++++--- htdocs/societe.class.php | 3 ++- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/htdocs/soc.php b/htdocs/soc.php index bcf2d6c2389..58774b2c27f 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -58,6 +58,12 @@ $soc = new Societe($db); /* * Actions */ +// assujétissement à la TVA +if ($_POST["action"] == 'setassujtva') +{ + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE idp='".$socid."'"; + $result = $db->query($sql); +} if ($_POST["action"] == 'add' || $_POST["action"] == 'update') { $soc->nom = $_POST["nom"]; @@ -86,6 +92,7 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') $soc->typent_id = $_POST["typent_id"]; $soc->client = $_POST["client"]; $soc->fournisseur = $_POST["fournisseur"]; + $soc->tva_assuj = $_POST["assujtva_value"]; if ($_POST["action"] == 'update') { @@ -188,6 +195,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') $soc->effectif_id=$_POST["effectif_id"]; $soc->tva_intra_code=$_POST["tva_intra_code"]; $soc->tva_intra_num=$_POST["tva_intra_num"]; + $soc->tva_assuj = $_POST["assujtva_value"]; } // On positionne pays_id, pays_code et libelle du pays choisi @@ -339,6 +347,16 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') print ''; print ' '.$langs->trans("VATIntraCheckableOnEUSite"); print ''; + // assuj TVA + if($conf->facture->enabled) + { + $html = new Form($db); + print ''.$langs->trans('VATIsUsed').''; + $html->select_assujetti_tva("1",'assujtva_value'); + print ''."\n"; + } + + print ''; print ''."\n"; @@ -389,6 +407,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') $soc->effectif_id=$_POST["effectif_id"]; $soc->tva_intra_code=$_POST["tva_intra_code"]; $soc->tva_intra_num=$_POST["tva_intra_num"]; + $soc->tva_assuj = $_POST["assujtva_value"]; // On positionne pays_id, pays_code et libelle du pays choisi if ($soc->pays_id) @@ -547,7 +566,13 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') print ''.$langs->trans("Staff").''; $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); print ''; - + // assuj TVA + if($conf->facture->enabled) + { + print ''.$langs->trans('VATIsUsed').''; + $form->select_assujetti_tva($soc->tva_assuj,'assujtva_value'); + print ''."\n"; + } print ''; print ''; @@ -818,7 +843,31 @@ else dolibarr_print_error($db); } print ''; - + // assuj TVA + if($conf->facture->enabled) + { + $html = new Form($db); + print ''; + print '
'; + print $langs->trans('VATIsUsed'); + print ''; + if ($user->rights->societe->creer && $_GET['action'] != 'editassujtva') + print 'id.'">'.img_edit($langs->trans('SetMode')).''; + else + print ' '; + print '
'; + print ''; + print ''; + if($_GET['action'] == 'editassujtva') + print $html->form_assujetti_tva($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->tva_assuj,'assujtva_value'); + else if($soc->tva_assuj == 1) + print 'oui'; + else + print 'non'; + print ''; + print ''; + + } print ''; print "\n"; @@ -860,4 +909,3 @@ $db->close(); llxFooter('$Date$ - $Revision$'); ?> - diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index f1392820f7c..5e31d03bcd4 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -269,7 +269,7 @@ class Societe { $this->capital=trim($this->capital); $this->effectif_id=trim($this->effectif_id); $this->forme_juridique_code=trim($this->forme_juridique_code); - + $this->tva_assuj=trim($this->tva_assuj); $result = $this->verify(); if ($result >= 0) @@ -326,6 +326,7 @@ class Societe { $sql .= ",client = " . $this->client; $sql .= ",fournisseur = " . $this->fournisseur; + $sql .= ",tva_assuj = " . $this->tva_assuj; if ($this->creation_bit || $this->codeclient_modifiable) {