phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5613 - in phpcompta/trunk/include: . template


From: phpcompta-dev
Subject: [Phpcompta-dev] r5613 - in phpcompta/trunk/include: . template
Date: Sat, 21 Dec 2013 03:23:45 +0100 (CET)

Author: danydb
Date: 2013-12-21 03:23:44 +0100 (Sat, 21 Dec 2013)
New Revision: 5613

Modified:
   phpcompta/trunk/include/action.common.inc.php
   phpcompta/trunk/include/action.inc.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/compta_ven.inc.php
   phpcompta/trunk/include/template/action_other_action.php
   phpcompta/trunk/include/template/action_search.php
   phpcompta/trunk/include/template/detail-action.php
Log:
task #952 Transforme une action en facture
Et correction d'un bug dans la recherche
Task #952 - Transform une action en facture

Modified: phpcompta/trunk/include/action.common.inc.php
===================================================================
--- phpcompta/trunk/include/action.common.inc.php       2013-12-21 00:49:48 UTC 
(rev 5612)
+++ phpcompta/trunk/include/action.common.inc.php       2013-12-21 02:23:44 UTC 
(rev 5613)
@@ -227,7 +227,7 @@
        // Add a button to export to Csv
        echo '<form method="GET" style="display:inline;" ACTION="export.php">';
        echo 
HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref",
 "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", 
"end_date", "ag_id", "ag_dest_query",
-               "tdoc",   
"query","date_start","date_end","hsstate","searchtag"));
+               "tdoc",   
"action_query","date_start","date_end","hsstate","searchtag"));
        echo HtmlInput::hidden("act", "CSV:ActionGestion");
        echo HtmlInput::submit("follow_up_csv", "Export CSV",'','smallbutton');
        echo "</form>";

Modified: phpcompta/trunk/include/action.inc.php
===================================================================
--- phpcompta/trunk/include/action.inc.php      2013-12-21 00:49:48 UTC (rev 
5612)
+++ phpcompta/trunk/include/action.inc.php      2013-12-21 02:23:44 UTC (rev 
5613)
@@ -25,7 +25,7 @@
 require_once('class_ipopup.php');
 global $g_user;
 $retour=HtmlInput::button_anchor(_('Retour liste'),
-       
HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate","searchtag")));
+       
HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","action_query","tdoc","date_start","date_end","hsstate","searchtag")));
 //-----------------------------------------------------
 // Follow_Up
 //-----------------------------------------------------

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-12-21 00:49:48 UTC 
(rev 5612)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-12-21 02:23:44 UTC 
(rev 5613)
@@ -3677,6 +3677,44 @@
                $array=$this->get_operation_date(Date('d.m.Y'), 'VEN', '<');
                return $array;
        }
+        function convert_from_follow($p_ag_id)
+        {
+            if (isNumber($p_ag_id)==0) return null;
+            
+            $array=array();
+            
+            // retrieve info from action_gestion
+            $tiers_id=$this->db->get_value('select f_id_dest from 
action_gestion where ag_id=$1',array($p_ag_id));
+            if ( $this->db->size() !=0 )
+                $qcode=$this->db->get_value('select j_qcode from 
vw_poste_qcode where f_id=$1',array($tiers_id));
+            else
+                $qcode="";
+            
+            $comment=$this->db->get_value('select ag_title from action_gestion 
where ag_id=$1',array($p_ag_id));
+            $array['e_client']=$qcode;
+            $array['e_comm']=$comment;
+            
+            // retrieve info from action_detail
+            $a_item=$this->db->get_array('select 
f_id,ad_text,ad_pu,ad_quant,ad_tva_id,ad_tva_amount,j_qcode 
+                    from 
+                  action_detail 
+                  left join vw_poste_qcode using(f_id)
+                  where
+                    ag_id=$1',array($p_ag_id));
+            $array['nb_item']=$this->db->size();
+            for ($i=0;$i<$array['nb_item'];$i++)
+            {
+                $array['e_march'.$i]=$a_item[$i]['j_qcode'];
+                $array['e_march'.$i.'_label']=$a_item[$i]['ad_text'];
+                $array['e_march'.$i.'_price']=$a_item[$i]['ad_pu'];
+                $array['e_march'.$i.'_tva_id']=$a_item[$i]['ad_tva_id'];
+                
$array['e_march'.$i.'_tva_amount']=$a_item[$i]['ad_tva_amount'];
+                $array['e_quant'.$i]=$a_item[$i]['ad_quant'];
+                
+            }
+            return $array;
+                       
+        }
 
 }
 ?>
\ No newline at end of file

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2013-12-21 00:49:48 UTC (rev 
5612)
+++ phpcompta/trunk/include/class_follow_up.php 2013-12-21 02:23:44 UTC (rev 
5613)
@@ -519,7 +519,7 @@
                /* add the number of item */
                $Hid = new IHidden();
                $r.=$Hid->input("nb_item", $article_count);
-               
$r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate","searchtag"));
+               
$r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", 
"hsstate","searchtag"));
                 $a_tag=$this->tag_get();
                /* get template */
                ob_start();
@@ -693,7 +693,7 @@
        function myList($p_base, $p_filter = "", $p_search = "")
        {
                // for the sort
-               $url = 
HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate","searchtag")) . '&' . $p_base;
+               $url = 
HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", 
"hsstate","searchtag")) . '&' . $p_base;
 
                $table = new Sort_Table();
                $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 
'order by ag_timestamp desc', 'da', 'dd');
@@ -772,7 +772,7 @@
                //show the sub_action
                foreach ($a_row as $row)
                {
-                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate", "searchtag","ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
+                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", 
"hsstate", "searchtag","ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
                        $i++;
                        $tr = ($i % 2 == 0) ? 'even' : 'odd';
                        if ($row['ag_priority'] < 2)
@@ -1140,7 +1140,7 @@
         */
        static function display_search($cn, $inner = false)
        {
-               $a = (isset($_GET['query'])) ? $_GET['query'] : "";
+               $a = (isset($_GET['action_query'])) ? $_GET['action_query'] : 
"";
                $qcode = (isset($_GET['qcode'])) ? $_GET['qcode'] : "";
 
                $supl_hidden = '';
@@ -1286,15 +1286,15 @@
                        $p_array = $_GET;
 
                extract($p_array);
-               $query = "";
+               $action_query = "";
 
 
-        if (isset($_REQUEST['query']))
+        if (isset($_REQUEST['action_query']))
                {
                        // if a query is request build the sql stmt
-                       $query = "and (ag_title ~* '" . 
sql_string($_REQUEST['query']) . "' " .
-                                       "or ag_ref ='" . 
trim(sql_string($_REQUEST['query'])) .
-                                       "' or ag_id in (select ag_id from 
action_gestion_comment where agc_comment ~* '" . 
trim(sql_string($_REQUEST['query'])) . "')" .
+                       $action_query = "and (ag_title ~* '" . 
sql_string($_REQUEST['action_query']) . "' " .
+                                       "or ag_ref ='" . 
trim(sql_string($_REQUEST['action_query'])) .
+                                       "' or ag_id in (select ag_id from 
action_gestion_comment where agc_comment ~* '" . 
trim(sql_string($_REQUEST['action_query'])) . "')" .
                                        ")";
                }
 
@@ -1316,15 +1316,15 @@
                }
                if (isset($tdoc) && $tdoc != -1)
                {
-                       $query .= ' and dt_id = ' . sql_string($tdoc);
+                       $action_query .= ' and dt_id = ' . sql_string($tdoc);
                }
                if (isset($state) && $state!= -1)
                {
-                       $query .= ' and ag_state= ' . sql_string($state);
+                       $action_query .= ' and ag_state= ' . sql_string($state);
                }
         if (isset($hsstate) && $hsstate!= -1)
                {
-                       $query .= ' and ag_state <> ' . sql_string($hsstate);
+                       $action_query .= ' and ag_state <> ' . 
sql_string($hsstate);
                }
                if (isset($sag_ref) && trim($sag_ref) != "")
                {
@@ -1332,46 +1332,46 @@
                }
 
                if (isset($_GET['only_internal']))
-                       $query .= ' and f_id_dest=0 ';
+                       $action_query .= ' and f_id_dest=0 ';
 
                if (isset($date_start) && isDate($date_start) != null)
                {
-                       $query.=" and ag_timestamp >= 
to_date('$date_start','DD.MM.YYYY')";
+                       $action_query.=" and ag_timestamp >= 
to_date('$date_start','DD.MM.YYYY')";
                }
                if (isset($date_end) && isDate($date_end) != null)
                {
-                       $query.=" and ag_timestamp <= 
to_date('$date_end','DD.MM.YYYY')";
+                       $action_query.=" and ag_timestamp <= 
to_date('$date_end','DD.MM.YYYY')";
                }
                if (isset($ag_dest_query) && $ag_dest_query != -2 )
                {
-                    $query.= " and ((ag_dest = " . 
sql_string($ag_dest_query)." and ".self::sql_security_filter($cn, "R").") or ".
+                    $action_query.= " and ((ag_dest = " . 
sql_string($ag_dest_query)." and ".self::sql_security_filter($cn, "R").") or ".
                                " ag_owner='" . $_SESSION['g_user'] . "')";
                }
                else
                {
-                       $query .=" and (ag_owner='" . $_SESSION['g_user'] . "' 
or ".self::sql_security_filter($cn, "R")." or ag_dest=-1 )";
+                       $action_query .=" and (ag_owner='" . 
$_SESSION['g_user'] . "' or ".self::sql_security_filter($cn, "R")." or 
ag_dest=-1 )";
                }
 
 
                if (isNumber($ag_id) == 1 && $ag_id != 0)
                {
-                       $query = " and ag_id= " . sql_string($ag_id);
+                       $action_query = " and ag_id= " . sql_string($ag_id);
                }
                if ( isset($remind_date) && $remind_date != "" && 
isDate($remind_date)==$remind_date)
                {
-                       $query .= " and 
to_date('".sql_string($remind_date)."','DD.MM.YYYY')<= ag_remind_date";
+                       $action_query .= " and 
to_date('".sql_string($remind_date)."','DD.MM.YYYY')<= ag_remind_date";
                }
                if ( isset($remind_date_end) && $remind_date_end != "" && 
isDate($remind_date_end)==$remind_date_end)
                {
-                       $query .= " and 
to_date('".sql_string($remind_date_end)."','DD.MM.YYYY')>= ag_remind_date";
+                       $action_query .= " and 
to_date('".sql_string($remind_date_end)."','DD.MM.YYYY')>= ag_remind_date";
                }
                if ( ! isset ($closed_action)) {
-                       $query.=" and s_status is null ";
+                       $action_query.=" and s_status is null ";
                }
                 if ( isset ($searchtag)) {
-                    $query .= Follow_Up::filter_by_tag($cn,$p_array);
+                    $action_query .= Follow_Up::filter_by_tag($cn,$p_array);
                 }
-               return $query . $str;
+               return $action_query . $str;
        }
 
        /**

Modified: phpcompta/trunk/include/compta_ven.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ven.inc.php  2013-12-21 00:49:48 UTC (rev 
5612)
+++ phpcompta/trunk/include/compta_ven.inc.php  2013-12-21 02:23:44 UTC (rev 
5613)
@@ -207,6 +207,20 @@
         echo 'compute_all_ledger();';
         echo '</script>';
     }
+    else if ( isset ($_GET['create_invoice']))
+    {
+        $array=$Ledger->convert_from_follow($_GET ['ag_id']);
+        echo HtmlInput::hidden("ledger_type","VEN");
+       echo HtmlInput::hidden("ac",$_REQUEST['ac']);
+        echo HtmlInput::hidden("sa","p");
+        echo $Ledger->input($array);
+        echo '<div class="content">';
+        echo $Ledger->input_paid();
+        echo '</div>';
+        echo '<script>';
+        echo 'compute_all_ledger();';
+        echo '</script>';
+    }
     else
     {
         echo HtmlInput::hidden("ledger_type","VEN");

Modified: phpcompta/trunk/include/template/action_other_action.php
===================================================================
--- phpcompta/trunk/include/template/action_other_action.php    2013-12-21 
00:49:48 UTC (rev 5612)
+++ phpcompta/trunk/include/template/action_other_action.php    2013-12-21 
02:23:44 UTC (rev 5613)
@@ -8,7 +8,7 @@
  * Hidden values for a previous search
  */
 echo 
HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref",
 "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", 
"end_date", "ag_id", "ag_dest_query",
-               "tdoc",   
"query","date_start","date_end","hsstate","searchtag"));
+               "tdoc",   
"action_query","date_start","date_end","hsstate","searchtag"));
 ?>
 <div id="other_div" class="inner_box" style="width:40%;display: none">
     <?php echo HtmlInput::title_box('Actions sur plusieurs 
documents','other_div', 'hide') ?>

Modified: phpcompta/trunk/include/template/action_search.php
===================================================================
--- phpcompta/trunk/include/template/action_search.php  2013-12-21 00:49:48 UTC 
(rev 5612)
+++ phpcompta/trunk/include/template/action_search.php  2013-12-21 02:23:44 UTC 
(rev 5613)
@@ -108,7 +108,7 @@
                                <td><?php echo  
$hsExcptype_state->input()?></td>
                        </tr>
                        <td style="text-align:right"><?php printf(_('contenant 
le mot'))?></td>
-                       <td ><input class="input_text" style="width:100%" 
type="text" name="query" value="<?php echo  $a?>"></td>
+                       <td ><input class="input_text" style="width:100%" 
type="text" name="action_query" value="<?php echo  $a?>"></td>
                        </tr>
                        <tr>
                                <td style="text-align:right"><?php echo  
_('Type de document')?></td>

Modified: phpcompta/trunk/include/template/detail-action.php
===================================================================
--- phpcompta/trunk/include/template/detail-action.php  2013-12-21 00:49:48 UTC 
(rev 5612)
+++ phpcompta/trunk/include/template/detail-action.php  2013-12-21 02:23:44 UTC 
(rev 5613)
@@ -351,12 +351,25 @@
     <br>Total TVA
     <br>Total TVAC
  </div>
-<div>
+
  <?php if ( ! $readonly ) :  ?>
-    <input name="act" id="act_bt" class="button" value="<?php echo 
_('Actualiser')?>" onclick="compute_all_ledger();" type="button">
-     <input type="button" class="button" onclick="gestion_add_row()" 
value="Ajouter une ligne">
+    <div  style="position:float;float:right">
+    <input name="act" id="act_bt" class="smallbutton" value="<?php echo 
_('Actualiser')?>" onclick="compute_all_ledger();" type="button">
+     <input type="button" class="smallbutton" onclick="gestion_add_row()" 
value="Ajouter une ligne">
+     </div>
+     
 <?php endif; ?>         
 </div>
+<?php if ( $this->ag_id != 0 && ! $readonly) : ?>
+     <div  style="position:float;float:left">
+         <p>
+         <?php
+         $query=  
http_build_query(array('gDossier'=>Dossier::id(),'ag_id'=>$this->ag_id,'create_invoice'=>1,'ac'=>'VEN'));
+            echo HtmlInput::button_anchor("Transformer en 
facture","do.php?".$query,"create_invoice", "","button");
+         ?>
+         </p>
+      </div>
+     <?php endif; ?>
 <?php endif; ?>
 </fieldset>
 <?php endif; ?>



---
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]