phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4456 - in phpcompta/trunk: html include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4456 - in phpcompta/trunk: html include
Date: Wed, 23 Nov 2011 22:36:46 +0100 (CET)

Author: danydb
Date: 2011-11-23 22:36:44 +0100 (Wed, 23 Nov 2011)
New Revision: 4456

Modified:
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/include/class_acc_bilan.php
   phpcompta/trunk/include/class_acc_ledger_fin.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_contact.php
   phpcompta/trunk/include/compta_ach.inc.php
   phpcompta/trunk/include/compta_ods.inc.php
   phpcompta/trunk/include/compta_ven.inc.php
   phpcompta/trunk/include/export_fiche_balance_pdf.php
   phpcompta/trunk/include/impress_fiche.inc.php
   phpcompta/trunk/include/operation_ods_new.inc.php
   phpcompta/trunk/include/stock.inc.php
Log:

Fix a lot of small bugs


Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2011-11-23 19:50:38 UTC (rev 4455)
+++ phpcompta/trunk/html/ajax_misc.php  2011-11-23 21:36:44 UTC (rev 4456)
@@ -66,15 +66,10 @@
 switch ($op)
 {
        case "remove_anc":
-               if ($user->check_action(CAOD))
                        $cn->exec_sql("delete from operation_analytique where 
oa_group=$1", array($_GET['oa']));
                break;
        case "rm_stock":
                require_once('constant.security.php');
-               if ($user->check_action(STOWRITE) == 0)
-               {
-                       exit();
-               }
                $cn->exec_sql('delete from stock_goods where sg_id=$1', 
array($s_id));
                $html = escape_xml($s_id);
                header('Content-type: text/xml; charset=UTF-8');
@@ -537,5 +532,5 @@
          case 'autoanc':
                 require_once('ajax_auto_anc_card.php');
                 break;
-            
+
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/class_acc_bilan.php
===================================================================
--- phpcompta/trunk/include/class_acc_bilan.php 2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/class_acc_bilan.php 2011-11-23 21:36:44 UTC (rev 
4456)
@@ -144,6 +144,7 @@
     /*!\brief verify that the saldo is good for the type of account */
     function verify()
     {
+               bcscale(2);
         echo '<h3> Comptes normaux </h3>';
         $this->warning('Actif avec un solde crediteur','ACT','D');
         $this->warning('Passif avec un solde debiteur','PAS','C');
@@ -171,7 +172,7 @@
         $sql.="and $sql_periode";
 
         $credit_actif=$this->db->get_value($sql);
-        $total_actif=abs($debit_actif-$credit_actif);
+        $total_actif=abs(bcsub($debit_actif,$credit_actif));
         echo '<table >';
         echo tr(td( 'Total actif 
').td($total_actif,'style="text-align:right"'));
 
@@ -187,13 +188,13 @@
              " where j_debit='f' and (pcm_type='PAS' or pcm_type='PASINV') ";
         $sql.="and $sql_periode";
         $credit_passif=$this->db->get_value($sql);
-        $total_passif=abs($debit_passif-$credit_passif);
+        $total_passif=abs(bcsub($debit_passif,$credit_passif));
 
         /* diff actif / passif */
         echo tr(td('Total passif 
').td($total_passif,'style="text-align:right"'));
         if ( $total_actif != $total_passif )
         {
-            $diff=$total_actif-$total_passif;
+            $diff=bcsub($total_actif,$total_passif);
             echo tr(td(' Difference Actif - Passif 
').td($diff,'style="text-align:right"'),'style="font-weight:bolder"');
         }
 
@@ -208,7 +209,7 @@
              " where j_debit='f' and (pcm_type='CHA' or pcm_type='CHAINV')";
         $sql.="and $sql_periode";
         $credit_charge=$this->db->get_value($sql);
-        $total_charge=abs($debit_charge-$credit_charge);
+        $total_charge=abs(bcsub($debit_charge,$credit_charge));
         echo tr(td('Total charge 
').td($total_charge,'style="text-align:right"'));
 
 
@@ -223,10 +224,10 @@
              " where j_debit='f' and (pcm_type='PRO' or pcm_type='PROINV')";
         $sql.="and $sql_periode";
         $credit_pro=$this->db->get_value($sql);
-        $total_pro=abs($debit_pro-$credit_pro);
+        $total_pro=abs(bcsub($debit_pro,$credit_pro));
         echo tr(td('Total produit 
').td($total_pro,'style="text-align:right"'));
 
-        $diff=$total_pro-$total_charge;
+        $diff=bcsub($total_pro,$total_charge);
 
         echo tr( td("Difference Produit - 
Charge",'style="padding-right:20px"').td($diff,'style="text-align:right"'),'style="font-weight:bolder"');
         echo '</table>';
@@ -296,8 +297,8 @@
      * \param $p_handle the handle to the file
      * \param
      * \param
-     * 
      *
+     *
      * \return
      */
     function compute_formula($p_handle)
@@ -324,9 +325,9 @@
         }// end read form line per line
     }
     /*!\brief generate the ods document
-    * \param the handle to the template file 
-    * \return the xml 
-    address@hidden 
+    * \param the handle to the template file
+    * \return the xml
+    address@hidden
     * Sur une seule ligne il y a plusieurs données, donc il y a plusieurs 
boucles, pour les autres documents
     * cela devrait être fait aussi, actuellement ces documents, n'acceptent 
qu'une formule par ligne.
     address@hidden
@@ -352,13 +353,13 @@
         ob_start();
        /* unzip the document */
        $zip = new Zip_Extended;
-       if ($zip->open($work_file) === TRUE) 
+       if ($zip->open($work_file) === TRUE)
          {
            $zip->extractTo($dirname.DIRECTORY_SEPARATOR);
            $zip->close();
-         } else 
+         } else
          {
-           echo __FILE__.":".__LINE__."cannot unzip model ".$filename; 
+           echo __FILE__.":".__LINE__."cannot unzip model ".$filename;
          }
 
        ob_end_clean();
@@ -391,7 +392,7 @@
             // the line contains the magic <<
             $tmp="";
 
-           
+
            while (preg_match_all($regex,$line_rtf,$f2) > 0 )
              {
                 // the f2 array contains all the magic << in the line
@@ -606,13 +607,13 @@
         case 'ods':
             /*   header("Pragma: public");
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-            header("Cache-Control: must-revalidate"); 
+            header("Cache-Control: must-revalidate");
             if ( $this->b_type == 'odt' )
             header('Content-type: application/vnd.oasis.opendocument.text');
             if ( $this->b_type == 'ods' )
             header('Content-type: 
application/vnd.oasis.opendocument.spreadsheet');
             header('Content-Disposition: 
attachment;filename="'.$this->b_name.'.odt"',FALSE);
-            header("Accept-Ranges: bytes"); 
+            header("Accept-Ranges: bytes");
             */
             ob_start();
             // save the file in a temp folder
@@ -636,14 +637,14 @@
             */
             ob_start();
            $zip = new Zip_Extended;
-           if ($zip->open($work_file) === TRUE) 
+           if ($zip->open($work_file) === TRUE)
              {
                $zip->extractTo($dirname.DIRECTORY_SEPARATOR);
                $zip->close();
-             } 
-           else 
+             }
+           else
              {
-               echo __FILE__.":".__LINE__."cannot unzip model ".$filename;     
+               echo __FILE__.":".__LINE__."cannot unzip model ".$filename;
              }
 
             // Remove the file we do  not need anymore

Modified: phpcompta/trunk/include/class_acc_ledger_fin.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_fin.php    2011-11-23 19:50:38 UTC 
(rev 4455)
+++ phpcompta/trunk/include/class_acc_ledger_fin.php    2011-11-23 21:36:44 UTC 
(rev 4456)
@@ -472,7 +472,7 @@
         $r.="<TR>";
         $r.="<th colspan=\"2\">code</TH>";
         $r.="<th>Commentaire</TH>";
-        $r.="<th>Montant</TH>";
+        $r.="<th style=\"text-align:right\">Montant</TH>";
         $r.='<th colspan="2"> Op. Concern&eacute;e(s)</th>';
 
        /* if we use the AC */
@@ -521,8 +521,12 @@
             // amount
             $r.='<td class="num">'.nbm($tiers_amount).'</td>';
             // concerned
-            $r.='<td>';
-            $r.=${"e_concerned".$i};
+            $r.='<td style="text-align:center">';
+                       if (${"e_concerned".$i} != '')
+                       {
+                               $jr_internal=$this->db->get_value("select 
jr_internal from jrn where jr_id=$1",array(${"e_concerned".$i}));
+                   $r.=HtmlInput::detail_op(${"e_concerned".$i},$jr_internal);
+                       }
             $r.='</td>';
             // encode the pa
             if ( $g_parameter->MY_ANALYTIC!='nu' && 
preg_match("/^[6,7]/",$fTiers->strAttribut(ATTR_DEF_ACCOUNT))==1 ) // use of AA
@@ -636,7 +640,7 @@
             $amount=0.0;
             $idx_operation=0;
             $ret='<table class="result" style="width:75%">';
-            $ret.=tr(th('Quick Code').th('Nom').th('Libellé').th('Montant'));
+            $ret.=tr(th('Quick Code').th('Nom').th('Libellé').th('Montant',' 
style="text-align:right"'));
             // Credit = goods
             for ( $i = 0; $i < $nb_item;$i++)
             {

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-23 19:50:38 UTC 
(rev 4455)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-23 21:36:44 UTC 
(rev 4456)
@@ -331,7 +331,6 @@
                         $tva[$idx_tva]+=$tva_item;
                     else
                         $tva[$idx_tva]=$tva_item;
-                   var_dump($oTva->get_parameter("both_side"));
                     if ($oTva->get_parameter("both_side")==0) 
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
                 }
 
@@ -1283,7 +1282,6 @@
 
         $r.=HtmlInput::button('add_item',_('Ajout article'),      ' 
onClick="ledger_add_row()"');
 
-        $r.="</DIV>";
         return $r;
     }
 

Modified: phpcompta/trunk/include/class_contact.php
===================================================================
--- phpcompta/trunk/include/class_contact.php   2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/class_contact.php   2011-11-23 21:36:44 UTC (rev 
4456)
@@ -42,12 +42,12 @@
     /*!   Summary
      **************************************************
      * \brief  show the default screen
-     *        
+     *
      * \param  p_search (filter)
-     * 
+     *
      * \return string to display
      */
-    function Summary($p_search="",$p_action="",$p_sql="")
+    function Summary($p_search="",$p_action="",$p_sql="",$p_nothing=false)
     {
         $p_search=sql_string($p_search);
         $extra_sql="";

Modified: phpcompta/trunk/include/compta_ach.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ach.inc.php  2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/compta_ach.inc.php  2011-11-23 21:36:44 UTC (rev 
4456)
@@ -169,6 +169,9 @@
 else
        $Ledger->id = $_REQUEST ['p_jrn'];
 
+if (isset ($_REQUEST['p_jrn_predef'])){
+       $Ledger->id=$_REQUEST['p_jrn_predef'];
+}
 // pre defined operation
 //
 echo '<div id="predef_form">';

Modified: phpcompta/trunk/include/compta_ods.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ods.inc.php  2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/compta_ods.inc.php  2011-11-23 21:36:44 UTC (rev 
4456)
@@ -40,12 +40,12 @@
 $cn = new Database(dossier::id());
 
 $id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
+$id = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : -1;
 $ledger = new Acc_Ledger($cn, $id);
 $first_ledger = $ledger->get_first('ODS');
 $ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id;
 
 /* !\brief show a form for quick_writing */
-$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
 $def = -1;
 $ledger->with_concerned = true;
 

Modified: phpcompta/trunk/include/compta_ven.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ven.inc.php  2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/compta_ven.inc.php  2011-11-23 21:36:44 UTC (rev 
4456)
@@ -180,14 +180,17 @@
 // pre defined operation
 //
 
-    if ( !isset($_REQUEST ['p_jrn']))
+    if ( !isset($_REQUEST ['p_jrn']) )
     {
         $def_ledger=$Ledger->get_first('ven');
         $Ledger->id=$def_ledger['jrn_def_id'];
     }
     else
         $Ledger->id=$_REQUEST ['p_jrn'];
-
+       if (isset ($_REQUEST['p_jrn_predef'])){
+               $Ledger->id=$_REQUEST['p_jrn_predef'];
+       }
+       
    echo '<div id="predef_form">';
     echo '<form style="display:inline" method="GET" >';
        echo HtmlInput::hidden('ac',$_REQUEST['ac']);

Modified: phpcompta/trunk/include/export_fiche_balance_pdf.php
===================================================================
--- phpcompta/trunk/include/export_fiche_balance_pdf.php        2011-11-23 
19:50:38 UTC (rev 4455)
+++ phpcompta/trunk/include/export_fiche_balance_pdf.php        2011-11-23 
21:36:44 UTC (rev 4456)
@@ -72,7 +72,7 @@
                $afiche[0]=array('fd_id'=>$_REQUEST['cat']);
        }
 
-       if ( $allcard==0 && empty($aCard))
+       if ( $allcard==0 && empty($afiche))
     {
         $pdf->Cell(0,10, "Aucune fiche trouvée");//Save PDF to file
         $fDate=date('dmy-Hi');

Modified: phpcompta/trunk/include/impress_fiche.inc.php
===================================================================
--- phpcompta/trunk/include/impress_fiche.inc.php       2011-11-23 19:50:38 UTC 
(rev 4455)
+++ phpcompta/trunk/include/impress_fiche.inc.php       2011-11-23 21:36:44 UTC 
(rev 4456)
@@ -154,7 +154,7 @@
 
 
     $fd=new Fiche_Def($cn,$_REQUEST['cat']);
-    if ( $allcard==1 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
+    if ( $allcard==0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
     {
       echo alert("Cette catégorie n'ayant pas de poste comptable n'a pas de 
balance");
       exit;
@@ -172,10 +172,13 @@
        for ($e=0;$e<count($afiche);$e++)
        {
                $ret=$cn->exec_sql("select f_id,ad_value from fiche join 
fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 
",array($afiche[$e]['fd_id']));
-               if ( $cn->count()==0)
+               if ( $cn->count()==0 )
                {
-                       echo "Aucune fiche trouvée";
-                       exit;
+                       if ( $allcard==0) {
+                               echo "Aucune fiche trouvée";
+                               exit;
+                       } else
+                               continue;
                }
                echo '<h2>'.$cn->get_value("select fd_label from fiche_def 
where fd_id=$1",array($afiche[$e]['fd_id'])).'</h2>';
                echo '<table class="result" style="width:80%;margin-left:10%">';

Modified: phpcompta/trunk/include/operation_ods_new.inc.php
===================================================================
--- phpcompta/trunk/include/operation_ods_new.inc.php   2011-11-23 19:50:38 UTC 
(rev 4455)
+++ phpcompta/trunk/include/operation_ods_new.inc.php   2011-11-23 21:36:44 UTC 
(rev 4456)
@@ -31,7 +31,8 @@
 global $g_user;
 $cn=new Database(dossier::id());
 
-$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
+$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
+$id = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : -1;
 $ledger=new Acc_Ledger($cn,$id);
 $first_ledger=$ledger->get_first('ODS');
 $ledger->id=($ledger->id==-1)?$first_ledger['jrn_def_id']:$id;

Modified: phpcompta/trunk/include/stock.inc.php
===================================================================
--- phpcompta/trunk/include/stock.inc.php       2011-11-23 19:50:38 UTC (rev 
4455)
+++ phpcompta/trunk/include/stock.inc.php       2011-11-23 21:36:44 UTC (rev 
4456)
@@ -41,17 +41,12 @@
 
 $href=basename($_SERVER['PHP_SELF']);
 
-// Get The priv on the selected folder
-$g_user->can_request(STOLE,1);
-
-
 $action= ( isset ($_GET['action']))? $_GET['action']:"";
 include_once("stock_inc.php");
 
 // Adjust the stock
 if ( isset ($_POST['sub_change']))
 {
-    $g_user->can_request(STOWRITE,1);
     $change=$_POST['stock_change'];
     $sg_code=$_POST['sg_code'];
     $sg_date=$_POST['sg_date'];
@@ -121,8 +116,6 @@
 // View details
 if ( $action == 'detail' )
 {
-    // Check if User Can see the stock
-    $g_user->can_request(STOLE,1);
     $sg_code=(isset ($_GET['sg_code'] ))?$_GET['sg_code']:$_POST['sg_code'];
     $year=(isset($_GET['year']))?$_GET['year']:$_POST['year'];
     $a=ViewDetailStock($cn,$sg_code,$year);




reply via email to

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