phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r5665 - in phpcompta/trunk: . html html/admin/sql/patch


From: phpcompta-dev
Subject: [Phpcompta-dev] r5665 - in phpcompta/trunk: . html html/admin/sql/patch include include/template
Date: Thu, 9 Jan 2014 20:06:30 +0100 (CET)

Author: danydb
Date: 2014-01-09 20:06:29 +0100 (Thu, 09 Jan 2014)
New Revision: 5665

Added:
   phpcompta/trunk/html/admin/sql/patch/upgrade112.sql
Modified:
   phpcompta/trunk/
   phpcompta/trunk/html/style-color.css
   phpcompta/trunk/html/style-epad.css
   phpcompta/trunk/html/style-light.css
   phpcompta/trunk/html/style.css
   phpcompta/trunk/html/test.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_operation.php
   phpcompta/trunk/include/class_anc_balance_double.php
   phpcompta/trunk/include/class_anc_balance_simple.php
   phpcompta/trunk/include/class_anc_grandlivre.php
   phpcompta/trunk/include/class_anc_listing.php
   phpcompta/trunk/include/class_anc_operation.php
   phpcompta/trunk/include/class_anc_table.php
   phpcompta/trunk/include/class_document.php
   phpcompta/trunk/include/constant.php
   phpcompta/trunk/include/template/anc_balance_group.php
   phpcompta/trunk/include/template/ledger_detail_ach.php
Log:
Merged revisions 5645-5664 via svnmerge from 
svn+ssh://address@hidden/svn/phpcompta/tags/rel671

........
  r5645 | danydb | 2014-01-07 17:54:56 +0100 (mar., 07 janv. 2014) | 2 lines
  
  Rewrite and have one row by ND
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
........
  r5646 | danydb | 2014-01-07 18:01:31 +0100 (mar., 07 janv. 2014) | 2 lines
  
  Rewrite and have one row by ND : add documentation 2 new private function : 
compute_no_deductible & insert_no_deductible
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
........
  r5647 | danydb | 2014-01-07 18:16:00 +0100 (mar., 07 janv. 2014) | 2 lines
  
  Add label for ND row
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
........
  r5648 | danydb | 2014-01-07 18:44:04 +0100 (mar., 07 janv. 2014) | 2 lines
  
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
  Move function find_label
........
  r5649 | danydb | 2014-01-07 21:22:48 +0100 (mar., 07 janv. 2014) | 1 line
  
  show TVA ND
........
  r5650 | danydb | 2014-01-08 21:48:44 +0100 (mer., 08 janv. 2014) | 3 lines
  
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
  TVA ND is now in the Analytic accountancy
  The Analytic Accountancy can work with negative amount
........
  r5651 | danydb | 2014-01-08 21:51:40 +0100 (mer., 08 janv. 2014) | 5 lines
  
  Task #960 - TVA ND & comptabilit?\195?\169 analytique
  TVA ND is now in the Analytic accountancy
  The Analytic Accountancy can work with negative amount
  
  Fix problem with update script
........
  r5652 | danydb | 2014-01-08 22:08:51 +0100 (mer., 08 janv. 2014) | 1 line
  
  Update SQL script
........
  r5653 | danydb | 2014-01-08 22:09:17 +0100 (mer., 08 janv. 2014) | 1 line
  
  Task #971 : Cosmetic 
........
  r5654 | danydb | 2014-01-08 22:09:51 +0100 (mer., 08 janv. 2014) | 1 line
  
  Task #960 : show negative
........
  r5655 | danydb | 2014-01-09 13:08:05 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCODS
........
  r5656 | danydb | 2014-01-09 13:10:24 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCHOP
........
  r5657 | danydb | 2014-01-09 13:17:46 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCGL
........
  r5658 | danydb | 2014-01-09 13:19:05 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCBS
........
  r5659 | danydb | 2014-01-09 13:24:46 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCTAB
........
  r5660 | danydb | 2014-01-09 13:27:09 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANCGR
........
  r5661 | danydb | 2014-01-09 13:29:06 +0100 (jeu., 09 janv. 2014) | 1 line
  
  Bug : race condition
........
  r5662 | danydb | 2014-01-09 13:30:08 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Task #961 - Compta analytique
  ANC
........
  r5663 | danydb | 2014-01-09 16:40:48 +0100 (jeu., 09 janv. 2014) | 2 lines
  
  Update unit test
........
  r5664 | danydb | 2014-01-09 16:41:07 +0100 (jeu., 09 janv. 2014) | 1 line
  
  Bug CSS
........



Property changes on: phpcompta/trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /phpcompta/tags/rel671:1-5643
   + /phpcompta/tags/rel671:1-5664

Copied: phpcompta/trunk/html/admin/sql/patch/upgrade112.sql (from rev 5664, 
phpcompta/tags/rel671/html/admin/sql/patch/upgrade112.sql)
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade112.sql                         
(rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade112.sql 2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -0,0 +1,15 @@
+begin;
+
+ALTER TABLE operation_analytique ADD COLUMN oa_jrnx_id_source bigint;
+COMMENT ON COLUMN operation_analytique.oa_jrnx_id_source IS 'jrnx.j_id source 
of this amount, this amount is computed from an amount giving a ND VAT.Normally 
NULL  is there is no ND VAT.';
+
+ALTER TABLE operation_analytique ADD COLUMN oa_signed character(1);
+ALTER TABLE operation_analytique ALTER COLUMN oa_signed SET DEFAULT 
'Y'::bpchar;
+update operation_analytique set oa_signed='Y';
+ALTER TABLE operation_analytique ALTER COLUMN oa_signed SET NOT NULL;
+
+COMMENT ON COLUMN operation_analytique.oa_signed IS 'Sign of the amount';
+
+update version set val=113;
+
+commit;
\ No newline at end of file

Modified: phpcompta/trunk/html/style-color.css
===================================================================
--- phpcompta/trunk/html/style-color.css        2014-01-09 15:41:07 UTC (rev 
5664)
+++ phpcompta/trunk/html/style-color.css        2014-01-09 19:06:29 UTC (rev 
5665)
@@ -201,7 +201,7 @@
 
 div.recherche_form{
     width:700px;
-    font-size:0.75em;;
+    font-size:0.75em;
     font-family:arial,verdana,sans-serif,helvetica;
     border-style:outset;
     border-width:1px;
@@ -212,7 +212,6 @@
     float:left;
     padding-top:7px;
     padding-left:8px;
-    font-size:0.75em;;
     font-family:arial,verdana,sans-serif,helvetica;
     width:75%;
 
@@ -1051,9 +1050,7 @@
     text-align:center;
 }
 div#div_jrnsearch_op{
-
     border:1px solid black;
-    display:none;
     width:50em;
     background-color:#EDF3FF;
     position:absolute;

Modified: phpcompta/trunk/html/style-epad.css
===================================================================
--- phpcompta/trunk/html/style-epad.css 2014-01-09 15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/html/style-epad.css 2014-01-09 19:06:29 UTC (rev 5665)
@@ -201,7 +201,6 @@
     float:left;
     padding-top:7px;
     padding-left:8px;
-    font-size:0.75em;;
     font-family:arial,verdana,sans-serif,helvetica;
     width:75%;
 
@@ -955,10 +954,8 @@
 
 }
 div#div_jrn{
-    position:absolute;
     border:1px solid black;
     top:15%;left:100;
-    visibility:hidden;
     z-index:2;
     width:50em;
     background-color:#EDF3FF;

Modified: phpcompta/trunk/html/style-light.css
===================================================================
--- phpcompta/trunk/html/style-light.css        2014-01-09 15:41:07 UTC (rev 
5664)
+++ phpcompta/trunk/html/style-light.css        2014-01-09 19:06:29 UTC (rev 
5665)
@@ -197,11 +197,9 @@
 
 }
 div.redcontent{
-
     float:left;
     padding-top:7px;
     padding-left:8px;
-    font-size:0.75em;;
     font-family:arial,verdana,sans-serif,helvetica;
     width:75%;
 

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2014-01-09 15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/html/style.css      2014-01-09 19:06:29 UTC (rev 5665)
@@ -201,7 +201,6 @@
     float:left;
     padding-top:7px;
     padding-left:8px;
-    font-size:0.75em;;
     font-family:arial,verdana,sans-serif,helvetica;
     width:75%;
 

Modified: phpcompta/trunk/html/test.php
===================================================================
--- phpcompta/trunk/html/test.php       2014-01-09 15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/html/test.php       2014-01-09 19:06:29 UTC (rev 5665)
@@ -40,6 +40,12 @@
 
 }
 html_page_start();
+function start_test($p_array)
+{
+    echo '<h1>'.$p_array['desc'].'</h1>';
+        require $p_array['file'];
+        call_user_func($p_array['function']);
+}
 // Test the connection
 echo __FILE__.":".__LINE__;
 print_r($_REQUEST);
@@ -52,10 +58,17 @@
 $cn=new Database($_GET['gDossier']);
 
 $a_route[]=array('desc'=>'test sur les menus par 
défauts','file'=>'class_default_menu.php','function'=>'Default_Menu::test_me');
-
-for ($i=0;$i< count($a_route);$i++)
+$a_route[]=array('desc'=>'test sur 
Acc_Operations','file'=>'class_acc_operation.php','function'=>'Acc_Operation::test_me');
+$a_route[]=array('desc'=>'test sur 
INVOICING','file'=>'../include/ext/invoicing/include/class_acc_ledger_sold_generate.php','function'=>'Acc_Ledger_Sold_Generate::test_me');
+$called=HtmlInput::default_value_get("called", -1);
+if ($called == -1 )
 {
-    echo '<h1>'.$a_route[$i]['desc'].'</h1>';
-    require $a_route[$i]['file'];
-    call_user_func($a_route[$i]['function']);
+    for ($i=0;$i< count($a_route);$i++)
+    {
+        start_test($a_route[$i]);
+    }
+}
+ else
+{
+    start_test($a_route[$called]);
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2014-01-09 15:41:07 UTC 
(rev 5664)
+++ phpcompta/trunk/include/class_acc_ledger.php        2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -3717,6 +3717,16 @@
             return $array;
                        
         }
+        /**
+         * Retrieve the label of an accounting
+         * @param $p_value tmp_pcmn.pcm_val
+         * @return string
+         */
+        protected function find_label($p_value)
+        {
+            $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where 
pcm_val=$1',array($p_value));
+            return $lib;
+        }
 
 }
 ?>
\ No newline at end of file

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2014-01-09 
15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2014-01-09 
19:06:29 UTC (rev 5665)
@@ -259,8 +259,185 @@
             throw new Exception(_('Il n\'y a aucune marchandise'),12);
 
     }
+    /**
+     * Compute the ND amount thanks the attribute of the concerned card. The 
object 
+     * $p_nd_amount will changed
+     * 
+     * @param Acc_Compute $p_nd_amount object with ND amount
+     * @param Fiche $p_fiche Concerned Card (purchase items)
+     * @param type $p_tva_bot 0 TVA on one side, 1 TVA on both side
+     */
+    private function compute_no_deductible(Acc_Compute $p_nd_amount, Fiche 
$p_fiche, $p_tva_both)
+    {
 
+        if (!$p_fiche->empty_attribute(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE))
+        {
+            $p_nd_amount->amount_nd_rate = 
$p_fiche->strAttribut(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE);
+            $p_nd_amount->compute_nd();
+        }
 
+        if (!$p_fiche->empty_attribute(ATTR_DEF_DEP_PRIV))
+        {
+            $p_nd_amount->amount_perso_rate = 
$p_fiche->strAttribut(ATTR_DEF_DEP_PRIV);
+            $p_nd_amount->compute_perso();
+        }
+
+        if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) && 
$tva_both == 0)
+        {
+            $p_nd_amount->nd_vat_rate = 
$p_fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE);
+            $p_nd_amount->compute_nd_vat();
+        }
+        if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP) && 
$p_tva_both == 0)
+        {
+            $p_nd_amount->nd_ded_vat_rate = 
$p_fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP);
+            $p_nd_amount->compute_ndded_vat();
+        }
+    }
+
+    /**
+     * Insert into JRNX the No Deductible amount and into Analytic Accountancy 
for the ND VAT
+     * @param Acc_Compute $p_nd_amount content ND amount
+     * @param Fiche $p_fiche Card of the Service
+     * @param type $p_tva_both  0 if TVA is normal or 1 if on both side
+     * @param type $p_tot_debit total debit
+     * @param $p_acc_operation Acc_Operation for inserting into jrnx
+     * @param $p_group group for AC
+     * @param $idx row number
+     * 
+     * @see Acc_Ledger_Purchase::insert
+     */
+    private function insert_no_deductible(Acc_Compute $p_nd_amount, Fiche 
$p_fiche, $p_tva_both,&$p_tot_debit,Acc_Operation 
$p_acc_operation,$p_group,$idx)
+    {
+        global $g_parameter;
+        if ($p_acc_operation->jrnx_id == 0) {
+            throw new Exception(__FILE__.__LINE__.'invalid 
acc_operation.j_id');
+        }
+        $source_j_id=$p_acc_operation->jrnx_id ;
+        $p_nd_amount->correct();
+        /*
+         * Save all the no deductible
+         *     
ATTR_DEF_ACCOUNT_ND_TVA,ATTR_DEF_ACCOUNT_ND_TVA_ND,ATTR_DEF_ACCOUNT_ND_PERSO,ATTR_DEF_ACCOUNT_ND
+         */
+        if ($p_nd_amount->amount_nd_rate != 0)
+        {
+            $dna_default = new Acc_Parm_Code($this->db, 'DNA');
+
+            /* save op. */
+            if (!$p_Fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND))
+            {
+                $dna = $p_Fiche->strAttribut(ATTR_DEF_ACCOUNT_ND);
+            } else
+            {
+                $dna = $dna_default->p_value;
+            }
+            $dna = ($dna == '') ? $dna_default->p_value : $dna;
+
+            $p_acc_operation->type = 'd';
+            $p_acc_operation->amount = $p_nd_amount->amount_nd_rate ;
+            $p_acc_operation->poste = $dna;
+            $p_acc_operation->qcode = '';
+            $p_acc_operation->desc=$this->find_label($dna)." ND 
".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE);
+            if ($p_nd_amount->amount_nd_rate > 0)
+                $p_tot_debit = bcadd($p_tot_debit, 
$p_nd_amount->amount_nd_rate);
+            $j_id = $p_acc_operation->insert_jrnx();
+        }
+        /*
+         * ATTR_DEF_ACCOUNT_ND_PERSO
+         */
+        if ($p_nd_amount->amount_perso != 0)
+        {
+            $dna_default = new Acc_Parm_Code($this->db, 'DEP_PRIV');
+
+            /* save op. */
+            $p_acc_operation->type = 'd';
+            if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_PERSO))
+            {
+                $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_PERSO);
+            } else
+            {
+                $dna = $dna_default->p_value;
+            }
+            $dna = ($dna == '') ? $dna_default->p_value : $dna;
+
+            $p_acc_operation->amount = $p_nd_amount->amount_perso ;
+            $p_acc_operation->poste = $dna;
+            $p_acc_operation->qcode = '';
+            $p_acc_operation->desc=$this->find_label($dna)." ND_PRIV 
".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE);
+            if ($p_nd_amount->amount_perso> 0)
+                $p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->amount_perso);
+            $j_id = $p_acc_operation->insert_jrnx();
+        }
+        if ($p_nd_amount->nd_vat != 0)
+        {
+            $dna_default = new Acc_Parm_Code($this->db, 'TVA_DNA');
+
+            /* save op. */
+            $p_acc_operation->type = 'd';
+            $p_acc_operation->qcode = '';
+            if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND) && 
$p_tva_both == 0)
+            {
+                $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA_ND);
+            } else
+            {
+                $dna = $dna_default->p_value;
+            }
+            $dna = ($dna == '') ? $dna_default->p_value : $dna;
+
+            $p_acc_operation->amount = $p_nd_amount->nd_vat;
+            $p_acc_operation->poste = $dna;
+            $p_acc_operation->desc=$this->find_label($dna)." ND_TVA 
".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE);
+            $j_id = $p_acc_operation->insert_jrnx();
+            if ( $g_parameter->MY_ANALYTIC != "nu" )
+            {
+                $op=new Anc_Operation($this->db);
+                $op->oa_group=$p_group;
+                $op->j_id=$j_id;
+                $op->oa_date=$p_acc_operation->date;
+
+                $op->oa_debit=($p_nd_amount->nd_vat > 0 )?'t':'f';
+                $op->oa_description=sql_string('ND_TVA');
+                $op->oa_jrnx_id_source=$source_j_id;
+                
$op->save_form_plan_vat_nd($_POST,$idx,$j_id,$p_nd_amount->nd_vat,$p_acc_operation->jrnx_id);
+            }
+        }
+        if ($p_nd_amount->nd_ded_vat != 0)
+        {
+            $dna_default = new Acc_Parm_Code($this->db, 'TVA_DED_IMPOT');
+            /* save op. */
+            if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA) && 
$p_tva_both == 0)
+            {
+                $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA);
+            } else
+            {
+                $dna = $dna_default->p_value;
+            }
+            $dna = ($dna == '') ? $dna_default->value : $dna;
+
+
+
+            $p_acc_operation->type = 'd';
+            $p_acc_operation->qcode = '';
+            $p_acc_operation->amount = $p_nd_amount->nd_ded_vat;
+            $p_acc_operation->poste = $dna;
+            $p_acc_operation->desc=$this->find_label($dna)." DED_TVA 
".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE);
+            if ($p_nd_amount->nd_ded_vat > 0)
+                $p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->nd_ded_vat);
+            $j_id = $p_acc_operation->insert_jrnx();
+           if ( $g_parameter->MY_ANALYTIC != "nu" )
+            {
+                $op=new Anc_Operation($this->db);
+                $op->oa_group=$p_group;
+                $op->j_id=$j_id;
+                $op->oa_date=$p_acc_operation->date;
+
+                $op->oa_debit=($p_nd_amount->nd_ded_vat > 0 )?'t':'f';
+                $op->oa_description=sql_string('DED_TVA ');
+                $op->oa_jrnx_id_source=$source_j_id;
+                
$op->save_form_plan_vat_nd($_POST,$idx,$j_id,$p_nd_amount->nd_ded_vat);
+            }
+        }
+    }
+
     /*!\brief insert into the database, it calls first the verify function
      * change the value of this->jr_id and this->jr_internal.
      * It generates the document and save the middle of payment, if 
'gen_invoice is set
@@ -346,11 +523,9 @@
             /* Save all the items without vat and no deductible vat and 
expense*/
             for ($i=0;$i< $nb_item;$i++)
             {
-                               $n_both=0;
+               $n_both=0;
                 if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
-           /*     if ( ${'e_march'.$i.'_price'} == 0 ) continue;
-                if ( ${'e_quant'.$i} == 0 ) continue;
-*/
+
                 /* First we save all the items without vat */
                 $fiche=new Fiche($this->db);
                 $fiche->get_by_qcode(${"e_march".$i});
@@ -364,12 +539,24 @@
                     $oTva->load();
                                        
$tva_both=$oTva->get_parameter("both_side");
                 }
-
+                /* -- Create acc_operation -- */
+                $acc_operation=new Acc_Operation($this->db);
+                $acc_operation->date=$e_date;
+                $acc_operation->grpt=$seq;
+                $acc_operation->jrn=$p_jrn;
+                $acc_operation->type='d';
+                $acc_operation->periode=$tperiode;
+                $acc_operation->qcode="";
+                
+                
                 /* We have to compute all the amount thanks Acc_Compute */
                 $amount=bcmul(${'e_march'.$i.'_price'},${'e_quant'.$i});
+                
                 $acc_amount=new Acc_Compute();
                 $acc_amount->check=false;
                 $acc_amount->set_parameter('amount',$amount);
+                
+                
                 if ( $g_parameter->MY_TVA_USE=='Y')
                 {
                     
$acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
@@ -386,54 +573,15 @@
                     if ($tva_both==0) 
$tot_tva=bcadd($tot_tva,$acc_amount->amount_vat);
                 }
 
-                $acc_operation=new Acc_Operation($this->db);
-                $acc_operation->date=$e_date;
-                $acc_operation->grpt=$seq;
-                $acc_operation->jrn=$p_jrn;
-                $acc_operation->type='d';
-                $acc_operation->periode=$tperiode;
-                $acc_operation->qcode="";
-                if ( $g_parameter->MY_UPDLAB=='Y')
-                    $acc_operation->desc=strip_tags(${"e_march".$i."_label"});
-                else
-                    $acc_operation->desc=null;
+               
+                /* compute ND */
+                $this->compute_no_deductible($acc_amount, $fiche, $tva_both);
 
+                
 
+              
+                $tot_amount=bcadd($tot_amount,$amount);
 
-
-                if ( ! 
$fiche->empty_attribute(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE))
-                {
-                    
$acc_amount->amount_nd_rate=$fiche->strAttribut(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE);
-                    $acc_amount->compute_nd();
-                    $tot_nd+=$acc_amount->amount_nd;
-
-                }
-
-                if ( ! $fiche->empty_attribute(ATTR_DEF_DEP_PRIV))
-                {
-                    
$acc_amount->amount_perso_rate=$fiche->strAttribut(ATTR_DEF_DEP_PRIV);
-                    $acc_amount->compute_perso();
-                    $tot_perso+=$acc_amount->amount_perso;
-                }
-
-                if ( ! $fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) && 
$tva_both==0)
-                {
-                    
$acc_amount->nd_vat_rate=$fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE);
-                    $acc_amount->compute_nd_vat();
-                    $tot_tva_nd+=$acc_amount->nd_vat;
-                    /* save op. */
-
-                }
-                if ( ! 
$fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP) && $tva_both==0)
-                {
-                    
$acc_amount->nd_ded_vat_rate=$fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP);
-                    $acc_amount->compute_ndded_vat();
-                    /* save op. */
-                    $tot_tva_ndded+=$acc_amount->nd_ded_vat;
-                }
-                $acc_amount->correct();
-                $tot_amount+=$amount;
-
                 /* get the account and explode if necessary */
                 $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
                 // if 2 accounts, take only the debit one for customer
@@ -446,21 +594,27 @@
                 {
                     $poste_val=$sposte;
                 }
-
+                if ( $g_parameter->MY_UPDLAB=='Y')
+                    $acc_operation->desc=strip_tags(${"e_march".$i."_label"});
+                else
+                    $acc_operation->desc=null;
                 $acc_operation->poste=$poste_val;
                 $acc_operation->amount=$acc_amount->amount;
                 $acc_operation->qcode=${"e_march".$i};
                 if( $acc_amount->amount > 0 ) 
$tot_debit=bcadd($tot_debit,$acc_amount->amount);
                 $j_id=$acc_operation->insert_jrnx();
+                
+                /* insert ND */
+                $this->insert_no_deductible($acc_amount, $fiche, $tva_both, 
$tot_debit,$acc_operation,$group,$i);
 
+                
                 /* Compute sum vat */
-
                 if ( $g_parameter->MY_TVA_USE=='Y')
                 {
                     $tva_item=$acc_amount->amount_vat;
 
                     if (isset($tva[$idx_tva] ) )
-                        $tva[$idx_tva]+=$tva_item;
+                        $tva[$idx_tva]=bcadd($tva[$idx_tva],$tva_item);
                     else
                         $tva[$idx_tva]=$tva_item;
 
@@ -486,8 +640,7 @@
                     $op->oa_group=$group;
                     $op->j_id=$j_id;
                     $op->oa_date=$e_date;
-
-                    $op->oa_debit=($amount > 0 )?'t':'f';
+                    $op->oa_debit='t';
                     $op->oa_description=sql_string($e_comm);
                     $op->save_form_plan($_POST,$i,$j_id);
                 }
@@ -508,7 +661,7 @@
                                            ",".$acc_amount->amount_nd.     /* 
8 */
                                            ",".$acc_amount->nd_vat.         /* 
9 */
                                            ",".$acc_amount->nd_ded_vat.    /* 
10 */
-                                           ",".$acc_amount->amount_perso.  /* 
11 */
+                                           ",".$acc_amount->amount_perso.  /* 
11 */ 
                                            ",'".$e_client."',".$n_both.")");   
     /* 12 */
 
                 }
@@ -546,108 +699,8 @@
             if ( $cust_amount < 0 )
                                $tot_debit=bcadd($tot_debit,abs($cust_amount));
             $let_client=$acc_operation->insert_jrnx();
-            /*
-             * Save all the no deductible
-            *     
ATTR_DEF_ACCOUNT_ND_TVA,ATTR_DEF_ACCOUNT_ND_TVA_ND,ATTR_DEF_ACCOUNT_ND_PERSO,ATTR_DEF_ACCOUNT_ND
-             */
-            if ( $tot_nd != 0)
-            {
-                 $dna_default=new Acc_Parm_Code($this->db,'DNA');
+            
 
-                /* save op. */
-             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND))
-               {
-                 $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND);
-               }
-             else
-               {
-                 $dna=$dna_default->p_value;
-               }
-             $dna=($dna=='')?$dna_default->p_value:$dna;
-
-                $acc_operation->type='d';
-                $acc_operation->amount=$tot_nd;
-                $acc_operation->poste=$dna;
-                $acc_operation->qcode='';
-                if ( $tot_nd > 0 ) $tot_debit=bcadd($tot_debit,$tot_nd);
-                $j_id=$acc_operation->insert_jrnx();
-
-            }
-           /*
-            *ATTR_DEF_ACCOUNT_ND_PERSO
-            */
-            if ( $tot_perso != 0)
-            {
-             $dna_default=new Acc_Parm_Code($this->db,'DEP_PRIV');
-
-                /* save op. */
-                $acc_operation->type='d';
-               if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_PERSO))
-                 {
-                   $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_PERSO);
-                 }
-               else
-                 {
-                   $dna=$dna_default->p_value;
-                 }
-               $dna=($dna=='')?$dna_default->p_value:$dna;
-
-                $acc_operation->amount=$tot_perso;
-                $acc_operation->poste=$dna;
-                $acc_operation->qcode='';
-                if ( $tot_perso > 0 ) $tot_debit=bcadd($tot_debit,$tot_perso);
-                $j_id=$acc_operation->insert_jrnx();
-
-            }
-            if ( $tot_tva_nd != 0)
-            {
-             $dna_default=new Acc_Parm_Code($this->db,'TVA_DNA');
-
-                /* save op. */
-                $acc_operation->type='d';
-                $acc_operation->qcode='';
-             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND) && 
$tva_both==0)
-               {
-                 $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA_ND);
-               }
-             else
-               {
-                 $dna=$dna_default->p_value;
-               }
-             $dna=($dna=='')?$dna_default->p_value:$dna;
-
-                $acc_operation->amount=$tot_tva_nd;
-                $acc_operation->poste=$dna;
-                if ( $tot_tva_nd > 0 ) 
$tot_debit=bcadd($tot_debit,$tot_tva_nd);
-                $j_id=$acc_operation->insert_jrnx();
-
-            }
-            if ( $tot_tva_ndded != 0)
-            {
-             $dna_default=new Acc_Parm_Code($this->db,'TVA_DED_IMPOT');
-                /* save op. */
-             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA) && 
$tva_both==0)
-               {
-                 $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA);
-               }
-             else
-               {
-                 $dna=$dna_default->p_value;
-               }
-             $dna=($dna=='')?$dna_default->value:$dna;
-
-
-
-                $acc_operation->type='d';
-                $acc_operation->qcode='';
-                $acc_operation->amount=$tot_tva_ndded;
-                $acc_operation->poste=$dna;
-                if ( $tot_tva_ndded > 0 ) 
$tot_debit=bcadd($tot_debit,$tot_tva_ndded);
-                $j_id=$acc_operation->insert_jrnx();
-
-
-            }
-
             if ( $g_parameter->MY_TVA_USE=='Y')
             {
                 /* save all vat

Modified: phpcompta/trunk/include/class_acc_operation.php
===================================================================
--- phpcompta/trunk/include/class_acc_operation.php     2014-01-09 15:41:07 UTC 
(rev 5664)
+++ phpcompta/trunk/include/class_acc_operation.php     2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -566,12 +566,13 @@
     {
         $_SESSION['g_user']='phpcompta';
         $_SESSION['g_pass']='dany';
-
+        global $g_user;
         $cn=new Database(dossier::id());
+        $g_user=new User($cn);
         $a=new Acc_Operation($cn);
-        $a->jr_id=11;
+        $a->jr_id=1444;
         $b=$a->get_quant();
-        var_dump($b->det);
+        var_dump($b);
     }
 }
 /////////////////////////////////////////////////////////////////////////////
@@ -653,6 +654,7 @@
              FROM quant_sold  join jrnx using(j_id) where j_grpt=$1";
         
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
     }
+    
 }
 /////////////////////////////////////////////////////////////////////////////
 /**

Modified: phpcompta/trunk/include/class_anc_balance_double.php
===================================================================
--- phpcompta/trunk/include/class_anc_balance_double.php        2014-01-09 
15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/include/class_anc_balance_double.php        2014-01-09 
19:06:29 UTC (rev 5665)
@@ -65,7 +65,7 @@
         {
             $odd++;
 
-            $r.=($odd%2==0)?'<tr class="odd">':'</tr>';
+            $r.=($odd%2==0)?'<tr class="odd">':'<tr class="even">';
 
             if ( $old == $row['a_po_name'] )
             {

Modified: phpcompta/trunk/include/class_anc_balance_simple.php
===================================================================
--- phpcompta/trunk/include/class_anc_balance_simple.php        2014-01-09 
15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/include/class_anc_balance_simple.php        2014-01-09 
19:06:29 UTC (rev 5665)
@@ -141,7 +141,7 @@
         {
             $odd++;
 
-            $r.=($odd%2==0)?'<tr class="odd">':'</tr>';
+            $r.=($odd%2==0)?'<tr class="odd">':'<tr class="even">';
             // the name and po_id
             //   $r.=sprintf("<td>%s</td>",$row['po_id']);
             $r.=sprintf("<td align=\"left\">%s</td>",h($row['po_name']));

Modified: phpcompta/trunk/include/class_anc_grandlivre.php
===================================================================
--- phpcompta/trunk/include/class_anc_grandlivre.php    2014-01-09 15:41:07 UTC 
(rev 5664)
+++ phpcompta/trunk/include/class_anc_grandlivre.php    2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -138,8 +138,9 @@
             return $r;
         }
         $r.= '<table class="result" style="width=100%">';
-       $ix=0;$prev='xx';
+       $ix=0;$prev='xx';$idx=0;
        $tot_deb=$tot_cred=0;
+        
         foreach ( $array as $row )
         {
          if ($prev != $row['po_name'])
@@ -166,8 +167,8 @@
              $prev=$row['po_name'];
              $ix++;
            }
-
-            $r.= '<tr>';
+            $class=($idx%2==0)?'even':'odd'; $idx++;
+            $r.='<tr class="'.$class.'">';
            $detail=($row['jr_id'] != 
null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
            $post_detail=($row['j_poste'] != 
null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
            $card_detail=($row['f_id'] != 
null)?HtmlInput::history_card($row['f_id'],$row['qcode']):'';

Modified: phpcompta/trunk/include/class_anc_listing.php
===================================================================
--- phpcompta/trunk/include/class_anc_listing.php       2014-01-09 15:41:07 UTC 
(rev 5664)
+++ phpcompta/trunk/include/class_anc_listing.php       2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -63,6 +63,7 @@
 
     function display_html()
     {
+        $idx=0;
         $r="";
         //---Html
         $array=$this->load();
@@ -91,7 +92,9 @@
              '</tr>';
         foreach ( $array as $row )
         {
-            $r.= '<tr>';
+            $class=($idx%2==0)?'even':'odd';
+            $idx++;
+            $r.= '<tr class="'.$class.'">';
            $detail=($row['jr_id'] != 
null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
            $post_detail=($row['j_poste'] != 
null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
            $card_detail=($row['f_id'] != 
null)?HtmlInput::history_card($row['f_id'],$row['qcode']):'';

Modified: phpcompta/trunk/include/class_anc_operation.php
===================================================================
--- phpcompta/trunk/include/class_anc_operation.php     2014-01-09 15:41:07 UTC 
(rev 5664)
+++ phpcompta/trunk/include/class_anc_operation.php     2014-01-09 19:06:29 UTC 
(rev 5665)
@@ -50,7 +50,17 @@
     var $oa_group;   /*!< group of operation  */
     var $oa_date;         /*!< equal to j_date if j_id is not    null */
     var $pa_id;        /*!< the plan analytique id */
-
+    /**
+     * In the case, the amount comes from a ND VAT, the variable
+     * contents the jrnx.j_id of the source which was used to compute 
+     * the amount
+     */
+    var $oa_jrnx_id_source; 
+    /**
+     * @brief signed of the amount
+     */
+    var $oa_positive;
+    
     /*!\brief constructor
      *
      */
@@ -58,6 +68,8 @@
     {
         $this->db=$p_cn;
         $this->id=$p_id;
+        $this->oa_jrnx_id_source=null;
+        $this->oa_positive='Y';
     }
     /*!\brief add a row  to the table operation_analytique
      * \note if $this->oa_group if 0 then a sequence id will be computed for
@@ -74,36 +86,47 @@
 
         if ( $this->j_id == 0 )
         {
-            $this->j_id="null";
+            $this->j_id=null;
         }
 
 
         // we don't save null operations
         if ( $this->oa_amount == 0 || $this->po_id==-1)
             return;
-
-        $oa_row=(isset($this->oa_row))?$this->oa_row:"NULL";
-        $sql='insert into operation_analytique (
-             po_id,
+        
+        if ( $this->oa_amount< 0) 
+        {
+            $this->oa_debit=($this->oa_debit=='t')?'f':'t';
+            $this->oa_positive='N';
+        }
+        
+        $oa_row=(isset($this->oa_row))?$this->oa_row:null;
+        $sql="insert into operation_analytique (
+             po_id, 
              oa_amount,
              oa_description,
              oa_debit,
              oa_group,
              j_id,
              oa_date,
-             oa_row
-             ) values ('.
-             $this->po_id.",".
-             $this->oa_amount.",".
-             "' ".Database::escape_string($this->oa_description)."',".
-             "'".$this->oa_debit."',".
-             $this->oa_group.",".
-             $this->j_id.",".
-             "to_date('".$this->oa_date."','DD.MM.YYYY'),".$oa_row.")";
+             oa_row,
+             oa_jrnx_id_source,
+             oa_positive
+             ) values ($1,$2,$3,$4,$5,$6,to_date($7,'DD.MM.YYYY'),$8,$9,$10)";
 
+        $this->db->exec_sql($sql,array(
+                $this->po_id, // 1
+                abs($this->oa_amount), //2
+                $this->oa_description, //3
+                $this->oa_debit, //4
+                $this->oa_group, //5
+                $this->j_id, //6
+                $this->oa_date, //7
+                $oa_row, //8
+                $this->oa_jrnx_id_source, //8
+                $this->oa_positive
+                ));
 
-        $this->db->exec_sql($sql);
-
     }
     /*!\brief delete a row from the table operation_analytique
      * \note be carefull : do not delete a row when we have a group
@@ -247,7 +270,7 @@
 
             }
 
-            $class=($count%2==0)?"odd":"";
+            $class=($count%2==0)?"odd":"even";
             $count++;
             $cred= ( $row['oa_debit'] == 'f')?"CREDIT":"DEBIT";
             $ret.="<tr class=\"$class\">";
@@ -289,7 +312,7 @@
     }
     /*!\brief retrieve an operation thanks a jrnx.j_id
      * \param the jrnx.j_id
-     * \return false if nothing is found other true
+     * \return null if nothing is found other an array
      */
     function get_by_jid($p_jid)
     {
@@ -302,7 +325,8 @@
              oa_group,
              oa_date,
              pa_id,
-             oa_row
+             oa_row,
+             oa_positive
              from operation_analytique join poste_analytique using (po_id)
              where
              j_id=$p_jid order by j_id,oa_row,pa_id";
@@ -502,7 +526,7 @@
                        
$value->javascript='onchange="format_number(this);anc_refresh_remain(\''.$table_id.'\',\''.$p_seq.'\')"';
             $value->name="val[".$p_seq."][]";
             $value->size=6;
-            
$value->value=abs((isset($val[$p_seq][$i]))?$val[$p_seq][$i]:$p_amount);
+            $value->value=(isset($val[$p_seq][$i]))?$val[$p_seq][$i]:$p_amount;
             $value->readOnly=($p_mode==1)?false:true;
                        $remain=bcsub($remain,$value->value);
             $result.='<td>'.$value->input().'</td>';
@@ -511,21 +535,100 @@
         }
 
         $result.="</table>";
-               $style_remain=($remain==0)?'style="color:green"':' 
style="color:red"';
-               $result.=" Reste à imputer =  ".
-                               '<span class="remain" '.$style_remain.' 
id="'.$ctrl_remain.'">'.
-                               $remain.'</span>';
+        if ( $p_mode == 1 )
+        {
+            $style_remain=($remain==0)?'style="color:green"':' 
style="color:red"';
+            $result.=" Reste à imputer =  ".
+                            '<span class="remain" '.$style_remain.' 
id="'.$ctrl_remain.'">'.
+                            $remain.'</span>';
 
-        // add a button to add a row
-        $button=new IButton();
-        $button->javascript="add_row('".$p_id."$table_id',$p_seq);";
-        $button->name="js".$p_id.$p_seq;
-        $button->label="Nouvelle ligne";
-        if ( $p_mode == 1 )
+            // add a button to add a row
+            $button=new IButton();
+            $button->javascript="add_row('".$p_id."$table_id',$p_seq);";
+            $button->name="js".$p_id.$p_seq;
+            $button->label="Nouvelle ligne";
+
             $result.="<br>".$button->input();
+        }
 
         return $result;
     }
+    /**
+     * Save the ND VAT with prorata
+     * 
+     * @param $p_array usually $_POST
+     * @param $p_item item of the form
+     * @param $p_j_id jrnx.j_id concerned writing
+     * @param $p_nd amount nd vat
+     * @see Anc_Operation::save_form_plan_vat_nd
+     * @return type
+     */
+    function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd)
+    {
+        bcscale(4);
+        extract($p_array);
+       if (! isset ($hplan) ) return;
+        
+        if ( ! isset(${'amount_t'.$p_item}) )
+            throw new Exception ('amount not set');
+        
+        $tot=0;
+        /* variable for in array
+           pa_id array of existing pa_id
+           hplan double array with the pa_id (column)
+           val double array by row with amount
+           op contains sequence
+           p_item is used to identify what op is concerned
+        */
+        /* echo "j_id = $j_id p_item = $p_item 
hplan=".var_export($hplan[$p_item],true)." val = 
".var_export($val[$p_item],true).'<br>'; */
+        /* for each row */
+        //   for ($i=0;$i<count($val[$p_item]);$i++) {
+        $idx_pa_id=0;
+        $row=0;
+        $a_Anc_Operation=array();
+        // foreach col PA
+        for ($e=0;$e<count($hplan[$p_item]);$e++)
+        {
+            if ( $idx_pa_id == count($pa_id))
+            {
+                $idx_pa_id=0;
+                $row++;
+            }
+            if ($hplan[$p_item][$e] != -1 && $val[$p_item][$row] != '')
+            {
+                $op=new Anc_Operation($this->db);
+                $op->po_id=$hplan[$p_item][$e];
+                $op->oa_group=$this->oa_group;
+                $op->j_id=$p_j_id;
+                $ratio=bcdiv($val[$p_item][$row],${"amount_t".$p_item});
+                $amount=  bcmul($p_nd, $ratio);
+                $op->oa_amount=abs(round($amount,2));
+                $op->oa_debit=$this->oa_debit;
+                $op->oa_date=$this->oa_date;
+
+                $op->oa_description=$this->oa_description;
+                $op->oa_row=$row;
+                $op->oa_jrnx_id_source=$this->oa_jrnx_id_source;
+                $a_Anc_Operation[]=clone $op;
+            }
+            $idx_pa_id++;
+        }
+        $nb_op=count($a_Anc_Operation);
+        bcscale(2);
+        for ($i=0;$i<$nb_op;$i++)
+        {
+            $tot=bcadd($tot,$a_Anc_Operation[$i]->oa_amount);
+        }
+        if ( $tot != $p_nd )
+        {
+            $diff=  bcsub($tot, $p_nd);
+            
$a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
+        }
+        for ($i=0;$i<$nb_op;$i++)
+        {
+            $a_Anc_Operation[$i]->add();
+        }
+    }
     /*!\brief it called for each item, the data are taken from $p_array
      *  data and set before in this.
      * \param $p_item if the item nb for each item (purchase or selling
@@ -577,7 +680,7 @@
                 $op->po_id=$hplan[$p_item][$e];
                 $op->oa_group=$this->oa_group;
                 $op->j_id=$p_j_id;
-                $op->oa_amount=abs($val[$p_item][$row]);
+                $op->oa_amount=$val[$p_item][$row];
                 $op->oa_debit=$this->oa_debit;
                 $op->oa_date=$this->oa_date;
 
@@ -602,24 +705,49 @@
     */
     function save_update_form($p_array)
     {
-        extract ($p_array);
-        for ($i=0;$i < count($op);$i++)
+        extract($p_array);
+        for ($i = 0; $i < count($op); $i++)
         {
             /* clean jrnx */
-            $this->db->exec_sql('delete from operation_analytique where 
j_id=$1',array($op[$i]));
+            $this->db->exec_sql('delete from operation_analytique where 
j_id=$1', array($op[$i]));
+
             /* get missing data for adding */
-            $a_missing=$this->db->get_array("select 
to_char(jr_date,'DD.MM.YYYY') as mdate,j_montant,j_debit,jr_comment from jrnx 
join jrn on (j_grpt=jr_grpt_id) where j_id=$1",
-                                            array($op[$i]));
-            $missing=$a_missing[0];
-            $this->oa_debit=$missing['j_debit'];
-            $this->oa_description=$missing['jr_comment'];
-            $this->j_id=$op[$i];
-            $group=$this->db->get_next_seq("s_oa_group"); /* for analytic */
-            $this->oa_group=$group;
-            $this->oa_date=$missing['mdate'];
-            $this->save_form_plan($p_array,$i,$op[$i]);
+            $a_missing = $this->db->get_array("select 
to_char(jr_date,'DD.MM.YYYY') as mdate,j_montant,j_debit,jr_comment from jrnx 
join jrn on (j_grpt=jr_grpt_id) where j_id=$1", array($op[$i]));
+            $missing = $a_missing[0];
+            $this->oa_debit = $missing['j_debit'];
+            $this->oa_description = $missing['jr_comment'];
+            $this->j_id = $op[$i];
+            $group = $this->db->get_next_seq("s_oa_group"); /* for analytic */
+            $this->oa_group = $group;
+            $this->oa_date = $missing['mdate'];
+            $this->save_form_plan($p_array, $i, $op[$i]);
+            
+            // There is ND VAT amount
+            $a_nd = $this->db->get_array('select j_id from operation_analytique
+                where oa_jrnx_id_source=$1', array($op[$i]));
+            if (count($a_nd) > 0)
+            {
+                // for each ND VAT amount
+                for ($e=0;$e<count($a_nd);$e++)
+                {
+                    $this->db->exec_sql('delete from operation_analytique 
where j_id=$1', array($a_nd[$e]['j_id']));
+                    /* get missing data for adding */
+                    $a_missing_vat = $this->db->get_array("select 
to_char(jr_date,'DD.MM.YYYY') as mdate,j_montant,j_debit,jr_comment from jrnx 
join jrn on (j_grpt=jr_grpt_id) where j_id=$1", array($a_nd[$e]['j_id']));
+                    $missing_vat = $a_missing_vat[0];
+                    $this->oa_debit = $missing_vat['j_debit'];
+                    $this->oa_description = $missing_vat['jr_comment'];
+                    $this->j_id = $op[$i];
+                    $group = $this->db->get_next_seq("s_oa_group"); /* for 
analytic */
+                    $this->oa_group = $group;
+                    $this->oa_date = $missing_vat['mdate'];
+                    $this->oa_jrnx_id_source=$op[$i];
+                    $p_array['amount_t'.$i]=$missing['j_montant'];
+                    $this->save_form_plan_vat_nd($p_array, $i, 
$a_nd[$e]['j_id'],$missing_vat['j_montant']);
+                }
+            }
         }
     }
+
     /*\brief transform a array of operation into a array usage by
      *display_form_plan & save_form_plan
      *\param $p_array array of operation
@@ -651,7 +779,7 @@
         $idx_pa=0;
         for ($i=0;$i < count($p_array);$i++)
         {
-            $val[$p_line][$p_array[$i]->oa_row]=$p_array[$i]->oa_amount;
+            
$val[$p_line][$p_array[$i]->oa_row]=($p_array[$i]->oa_positive=='Y')?$p_array[$i]->oa_amount:($p_array[$i]->oa_amount*(-1));
         }
         $result['val']=$val;
         return $result;

Modified: phpcompta/trunk/include/class_anc_table.php
===================================================================
--- phpcompta/trunk/include/class_anc_table.php 2014-01-09 15:41:07 UTC (rev 
5664)
+++ phpcompta/trunk/include/class_anc_table.php 2014-01-09 19:06:29 UTC (rev 
5665)
@@ -144,7 +144,8 @@
        $tot_global=0;
        for ($i=0;$i<count($this->arow);$i++)
          {
-           echo '<tr>';
+           $tr=($i%2==0)?'<tr class="even">':'<tr class="odd">';
+            echo $tr;
            echo 
td(HtmlInput::history_card($this->arow[$i]['f_id'],$this->arow[$i]['card_account'].'
 '.$this->arow[$i]['name']));
            $tot_row=0;
            for ($x=0;$x<count($this->aheader);$x++)
@@ -197,8 +198,9 @@
        $tot_global=0;
        for ($i=0;$i<count($this->arow);$i++)
          {
-           echo '<tr>';
-           echo 
td(HtmlInput::history_account($this->arow[$i]['card_account'],$this->arow[$i]['card_account'].'
 '.$this->arow[$i]['name']));
+            $tr=($i%2==0)?'<tr class="even">':'<tr class="odd">';
+            echo $tr;
+            echo 
td(HtmlInput::history_account($this->arow[$i]['card_account'],$this->arow[$i]['card_account'].'
 '.$this->arow[$i]['name']));
            $tot_row=0;
            for ($x=0;$x<count($this->aheader);$x++)
              {

Modified: phpcompta/trunk/include/class_document.php
===================================================================
--- phpcompta/trunk/include/class_document.php  2014-01-09 15:41:07 UTC (rev 
5664)
+++ phpcompta/trunk/include/class_document.php  2014-01-09 19:06:29 UTC (rev 
5665)
@@ -865,15 +865,17 @@
                     // check if the march exists
                     if (!isset(${$id}))
                         $r= "";
+                    else 
+                    {
                     // check that something is sold
-                    if (${'e_march' . $counter . '_price'} != 0 && ${'e_quant' 
. $counter} != 0)
-                    {
-                        $f = new Fiche($this->db);
-                        $f->get_by_qcode(${$id}, false);
-                        $r = $f->strAttribut(ATTR_DEF_NAME);
+                        if (${'e_march' . $counter . '_price'} != 0 && 
${'e_quant' . $counter} != 0)
+                        {
+                            $f = new Fiche($this->db);
+                            $f->get_by_qcode(${$id}, false);
+                            $r = $f->strAttribut(ATTR_DEF_NAME);
+                        } else
+                            $r = "";
                     }
-                                       else
-                                               $r="";
                 }
                 else
                     $r=${'e_march'.$counter.'_label'};

Modified: phpcompta/trunk/include/constant.php
===================================================================
--- phpcompta/trunk/include/constant.php        2014-01-09 15:41:07 UTC (rev 
5664)
+++ phpcompta/trunk/include/constant.php        2014-01-09 19:06:29 UTC (rev 
5665)
@@ -71,7 +71,7 @@
 define 
("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt');
 
 
-define ("DBVERSION",112);
+define ("DBVERSION",113);
 define ("MONO_DATABASE",25);
 define ("DBVERSIONREPO",14);
 define ('NOTFOUND','--not found--');

Modified: phpcompta/trunk/include/template/anc_balance_group.php
===================================================================
--- phpcompta/trunk/include/template/anc_balance_group.php      2014-01-09 
15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/include/template/anc_balance_group.php      2014-01-09 
19:06:29 UTC (rev 5665)
@@ -51,7 +51,7 @@
 <?php
 }
 if ($idx %2 == 0)
-  echo '<tr>';
+  echo '<tr class="even">';
 else
   echo '<tr class="odd">';
                echo td($array[$i]['po_name']);

Modified: phpcompta/trunk/include/template/ledger_detail_ach.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ach.php      2014-01-09 
15:41:07 UTC (rev 5664)
+++ phpcompta/trunk/include/template/ledger_detail_ach.php      2014-01-09 
19:06:29 UTC (rev 5665)
@@ -128,6 +128,7 @@
                 if ($owner->MY_TVA_USE == 'Y')
                 {
                     echo th(_('HTVA'), 'style="text-align:right"');
+                    echo th(_('TVA ND'), 'style="text-align:right"');
                     echo th(_('TVA'), 'style="text-align:right"');
                     echo th(_('TVAC'), 'style="text-align:right"');
                 } else
@@ -194,15 +195,15 @@
 
                     if ($owner->MY_TVA_USE == 'Y')
                     {
-                        $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']);
-                        $tva_amount = bcadd($tva_amount, 
$q['qp_nd_tva_recup']);
+                        $tva_amount_nd = bcadd($q['qp_nd_tva_recup'], 
$q['qp_nd_tva']);
                         $class = "";
                         if ($q['qp_vat_sided'] <> 0)
                         {
                             $class = ' style="text-decoration:line-through"';
                             $tvac = bcsub($tvac, $q['qp_vat']);
                         }
-                        $row.=td(nbm($tva_amount), 'class="num" ' . $class);
+                        $row.=td(nbm($tva_amount_nd), 'class="num" ' . $class);
+                        $row.=td(nbm($q['qp_vat']), 'class="num" ' . $class);
                         $row.=td(nbm($tvac), 'class="num"');
                     }
                     $total_tvac+=$tvac;
@@ -233,7 +234,7 @@
                     $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
                 $row.=td(nbm($total_htva), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
                 if ($owner->MY_TVA_USE == 'Y')
-                    $row.=td("") . td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+                    $row.=td("") . td("").td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
                 echo tr($row);
                 ?>
             </table>
@@ -286,20 +287,25 @@
                         } else
                             $view_history = '';
                         $row.=td($view_history);
-                        /* $row=td($q[$e]['j_poste']); */
-                        /* $row.=td($q[$e]['j_qcode']); */
-                        if ($q[$e]['j_qcode'] != '')
+                        
+                        if ($q[$e]['j_text']=="")
                         {
+                            if ($q[$e]['j_qcode'] != '')
+                            {
                             // nom de la fiche
-                            $ff = new Fiche($cn);
-                            $ff->get_by_qcode($q[$e]['j_qcode']);
-                            $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
-                        } else
-                        {
-                            // libellé du compte
-                            $name = $cn->get_value('select pcm_lib from 
tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
-                            $row.=td(h($name));
+                                $ff = new Fiche($cn);
+                                $ff->get_by_qcode($q[$e]['j_qcode']);
+                                $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
+                            } else
+                            {
+                                // libellé du compte
+                                $name = $cn->get_value('select pcm_lib from 
tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
+                                $row.=td(h($name));
+                            }
                         }
+                        else 
+                            $row.=td(h($q[$e]['j_text']));
+                        
                         $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
                         $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
                         $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]