diff --git a/include/tva.inc.php b/include/tva.inc.php index 4d399ab61..44ae0c693 100644 --- a/include/tva.inc.php +++ b/include/tva.inc.php @@ -15,10 +15,10 @@ * You should have received a copy of the GNU General Public License * along with PhpCompta; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + */ /* $Revision$ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/*! \file +/* ! \file * \brief included file for customizing with the vat (account,rate...) */ require_once('class_own.php'); @@ -27,101 +27,97 @@ require_once('class_ihidden.php'); require_once('class_itextarea.php'); echo '
'; // Confirm remove -if ( isset ($_POST['confirm_rm'])) +if (isset($_POST['confirm_rm'])) { - if ( $cn->count_sql('select * from tva_rate') > 1 ) - $cn->exec_sql('select tva_delete($1)',array($_POST['tva_id'])); + if ($cn->count_sql('select * from tva_rate') > 1) + $cn->exec_sql('select tva_delete($1)', array($_POST['tva_id'])); else - echo '

Vous ne pouvez pas effacer tous taux'. - ' Si votre société n\'utilise pas la TVA, changer dans le menu société

'; - + echo '

Vous ne pouvez pas effacer tous taux' . + ' Si votre société n\'utilise pas la TVA, changer dans le menu société

'; } //----------------------------------------------------- // Record Change -if ( isset ($_POST['confirm_mod']) - || isset ($_POST['confirm_add'])) +if (isset($_POST['confirm_mod']) + || isset($_POST['confirm_add'])) { extract($_POST); // remove space - $tva_poste=str_replace (" ","",$tva_poste); - $err=0; // Error code + $tva_poste = str_replace(" ", "", $tva_poste); + $err = 0; // Error code - if ( isNumber($tva_rate) == 0 ) + if (isNumber($tva_rate) == 0) { - $err=2; + $err = 2; } - if ( $err == 0 ) + if ($err == 0) { - if ( isset ($_POST['confirm_add']) ) - { - $sql="select tva_insert($1,$2,$3,$4)"; + if (isset($_POST['confirm_add'])) + { + $sql = "select tva_insert($1,$2,$3,$4)"; - $res=$cn->exec_sql( - $sql, - array($tva_label, - $tva_rate, - $tva_comment, - $tva_poste) - ); - $err=Database::fetch_result($res); - } - if ( isset ($_POST['confirm_mod']) ) - { - $Res=$cn->exec_sql( - "select tva_modify($tva_id,'$tva_label', + $res = $cn->exec_sql( + $sql, array($tva_label, + $tva_rate, + $tva_comment, + $tva_poste) + ); + $err = Database::fetch_result($res); + } + if (isset($_POST['confirm_mod'])) + { + $Res = $cn->exec_sql( + "select tva_modify($tva_id,'$tva_label', '$tva_rate','$tva_comment','$tva_poste')"); - $Res=$cn->exec_sql( - "select tva_modify($1,$2,$3,$4,$5)", - array($tva_id,$tva_label,$tva_rate,$tva_comment,$tva_poste) - ); - $err=Database::fetch_result($Res); - } - + $Res = $cn->exec_sql( + "select tva_modify($1,$2,$3,$4,$5)", array($tva_id, $tva_label, $tva_rate, $tva_comment, $tva_poste) + ); + $err = Database::fetch_result($Res); + } } - if ( $err != 0 ) + if ($err != 0) { - $err_code=array(1=>"Tva id n\'est pas un nombre", - 2=>"Taux tva invalide", - 3=>"Label ne peut être vide", - 4=>"Poste invalide", - 5=>"Tva id doit être unique"); - $str_err=$err_code[$err]; - echo ""; - ; + $err_code = array(1 => "Tva id n\'est pas un nombre", + 2 => "Taux tva invalide", + 3 => "Label ne peut être vide", + 4 => "Poste invalide", + 5 => "Tva id doit être unique"); + $str_err = $err_code[$err]; + echo ""; + ; } } // If company not use VAT -$own=new Own($cn); -if ( $own->MY_TVA_USE=='N' ) +$own = new Own($cn); +if ($own->MY_TVA_USE == 'N') { echo '

Vous n\'êtes pas assujetti à la TVA

'; exit(); } //----------------------------------------------------- // Display -$sql="select tva_id,tva_label,tva_rate,tva_comment,tva_poste from tva_rate order by tva_label"; -$Res=$cn->exec_sql($sql); +$sql = "select tva_id,tva_label,tva_rate,tva_comment,tva_poste from tva_rate order by tva_label"; +$Res = $cn->exec_sql($sql); ?> - - - - - - + + + + + + $row['tva_label'], - 'tva_rate'=>$row['tva_rate'], - 'tva_comment'=>$row['tva_comment'], - 'tva_poste'=>$row['tva_poste'] - ); + $index = $row['tva_id']; + $tva_array[$index] = array( + 'tva_label' => $row['tva_label'], + 'tva_rate' => $row['tva_rate'], + 'tva_comment' => $row['tva_comment'], + 'tva_poste' => $row['tva_poste'] + ); echo ""; echo ''; @@ -129,7 +125,7 @@ foreach ( $val as $row) echo ""; @@ -146,19 +142,19 @@ foreach ( $val as $row) echo ""; echo ""; @@ -168,143 +164,150 @@ foreach ( $val as $row) } ?>
LabelTauxCommentairePoste
LabelTauxCommentairePoste
"; - echo HtmlInput::hidden('tva_id',$row['tva_id']); + echo HtmlInput::hidden('tva_id', $row['tva_id']); echo h($row['tva_label']); echo ""; - echo HtmlInput::submit("rm" ,"Efface"); - echo HtmlInput::submit("mod","Modifie"); - $w=new IHidden(); - $w->name="tva_id"; - $w->value=$row['tva_id']; + echo HtmlInput::submit("rm", "Efface"); + echo HtmlInput::submit("mod", "Modifie"); + $w = new IHidden(); + $w->name = "tva_id"; + $w->value = $row['tva_id']; echo $w->input(); - $w=new IHidden(); - $w->name="p_action"; - $w->value="divers"; + $w = new IHidden(); + $w->name = "p_action"; + $w->value = "divers"; echo $w->input(); - $w=new IHidden(); - $w->name="sa"; - $w->value="tva"; + $w = new IHidden(); + $w->name = "sa"; + $w->value = "tva"; echo $w->input(); echo "
- + - - - - - + + + + + + + + + + + + + + + + + +
LabelTauxCommentairePoste
+ '; + echo ''; + echo HtmlInput::submit("confirm_rm", "Confirme"); + echo HtmlInput::submit("Cancel", "no"); + echo ""; + } + //----------------------------------------------------- + // add + if (isset($_REQUEST['add'])) + { + echo "
Ajout d'un taux de tva "; + echo '
'; + ?> + + + + + + + + + + + + + + + +
Label (ce que vous verrez dans les journaux) size = 20; + echo $w->input('tva_label', '') + ?>
Taux de tva size = 5; + echo $w->input('tva_rate', '') + ?>
Commentaire heigh = 5; + $w->width = 50; + echo $w->input('tva_comment', '') + ?>
Poste comptable utilisés format :debit,credit size = 20; + echo $w->input('tva_poste', '') + ?>
+ + - ?> - - - - - - - - - - - - - -
LabelTauxCommentairePoste
- '; - echo ''; - echo HtmlInput::submit("confirm_rm" ,"Confirme"); - echo HtmlInput::submit("Cancel" ,"no"); - echo "
"; + +
+ Ajout d'un taux de tva "; - echo '
'; +//----------------------------------------------------- +// mod +if (isset($_REQUEST['mod'])) +{ + echo "Tva à modifier"; + $index = $_POST['tva_id']; + echo "
Modification d'un taux de tva "; + echo ''; + echo ''; + ?> + + + + + - ?> -
Label (ce que vous verrez dans les journaux) size = 20; + echo $w->input('tva_label', $tva_array[$index]['tva_label']) + ?>
Taux de tva
- - - - - - - - - - - - - - -
Label (ce que vous verrez dans les journaux) size=20; - echo $w->input('tva_label','') ?>
Taux de tva size=5; - echo $w->input('tva_rate','') ?>
Commentaire heigh=5; - $w->width=50; - echo $w->input('tva_comment','') ?>
Poste comptable utilisés format :debit,credit size=20; - echo $w->input('tva_poste','') ?>
- - - - -
- Modification d'un taux de tva "; - echo '
'; - echo ''; - ?> - - - - - - - - - - - - - - - - - -
Label (ce que vous verrez dans les journaux) size=20; - echo $w->input('tva_label',$tva_array[$index]['tva_label']) ?>
Taux de tva size=5; - echo $w->input('tva_rate',$tva_array[$index]['tva_rate']) ?>
Commentaire heigh=5; - $w->width=50; - echo $w->input('tva_comment',$tva_array[$index]['tva_comment']) ?>
Poste comptable utilisés format :debit,credit size=20; - echo $w->input('tva_poste',$tva_array[$index]['tva_poste']) ?>
- - -
- - '; + size = 5; + echo $w->input('tva_rate', $tva_array[$index]['tva_rate']) + ?> + + + Commentaire + heigh = 5; + $w->width = 50; + echo $w->input('tva_comment', $tva_array[$index]['tva_comment']) + ?> + + + Poste comptable utilisés format :debit,credit + size = 20; + echo $w->input('tva_poste', $tva_array[$index]['tva_poste']) + ?> + + + + + + + '; ?>