26 require_once(
'class_tva_parameter.php');
27 $cn=Dossier::connect();
30 if ( isset ($_POST[
'save_misc'])) {
33 foreach ( array(
'CRTVA',
'ATVA',
'DTTVA') as $i){
35 if ( trim(${$i})==
'') $value=null;
36 if (
$cn->get_value(
"select count(*) from tva_belge.parameter_chld where pcode=$1",array($i))==0)
38 $cn->exec_sql(
"insert into tva_belge.parameter_chld(pcode,pcm_val) values($1,$2) ",
42 $cn->exec_sql(
"update tva_belge.parameter_chld set pcm_val=$1::account_type where pcode=$2",
47 unset($_POST[
'save_misc']);
50 if ( isset ($_POST[
'save_addparam'])){
53 if ( trim(
$tva_id)==
"")
throw new Exception(
"TVA n'existe pas");
54 if ( trim($paccount)==
"")
throw new Exception(
"Poste comptable vide");
55 if (
$cn->get_value(
"select count(tva_id) from tva_rate where tva_id=$1",array(
$tva_id))==0)
throw new Exception(
"TVA $tva_id n'existe pas");
56 $cn->exec_sql(
"insert into tva_belge.parameter_chld(pcode,tva_id,pcm_val) values ($1,$2,$3::account_type)",
57 array($pcode,
$tva_id,$paccount));
58 }
catch(Exception $e) {
59 alert(
"Ne peut sauver : ".$e->getMessage());
62 if ( isset ($_POST[
'pi_id'])){
63 $cn->exec_sql(
"delete from tva_belge.parameter_chld where pi_id=$1",array($_POST[
'pi_id']));
67 require_once NOALYSS_INCLUDE.
'/lib/class_itva_popup.php';
68 require_once NOALYSS_INCLUDE.
'/lib/class_iposte.php';
70 echo dossier::hidden();
71 echo HtmlInput::extension();
72 echo
$tvap->display();
if(isset($_POST['save_misc'])) if(isset($_POST['save_addparam'])) if(isset($_POST['pi_id'])) $tvap