phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r5040 - in phpcompta/trunk/include: . template
Date: Fri, 29 Jun 2012 22:52:40 +0200 (CEST)

Author: danydb
Date: 2012-06-29 22:52:39 +0200 (Fri, 29 Jun 2012)
New Revision: 5040

Modified:
   phpcompta/trunk/include/ajax_view_mod_stock.php
   phpcompta/trunk/include/class_stock_goods.php
   phpcompta/trunk/include/template/stock_inv.php
Log:
Add detail to stock

Modified: phpcompta/trunk/include/ajax_view_mod_stock.php
===================================================================
--- phpcompta/trunk/include/ajax_view_mod_stock.php     2012-06-29 20:25:50 UTC 
(rev 5039)
+++ phpcompta/trunk/include/ajax_view_mod_stock.php     2012-06-29 20:52:39 UTC 
(rev 5040)
@@ -37,6 +37,7 @@
 $p_array['p_depot']=$cn->get_value("select r_id from stock_change where 
c_id=$1",array($_GET['c_id']));
 for ($i=0;$i<count($array);$i++)
 {
+       $p_array['f_id'.$i]=$array[$i]['f_id'];
        $p_array['sg_code'.$i]=$array[$i]['sg_code'];
        $p_array['sg_quantity'.$i]=$array[$i]['sg_quantity'];
        $p_array['sg_type'.$i]=$array[$i]['sg_type'];

Modified: phpcompta/trunk/include/class_stock_goods.php
===================================================================
--- phpcompta/trunk/include/class_stock_goods.php       2012-06-29 20:25:50 UTC 
(rev 5039)
+++ phpcompta/trunk/include/class_stock_goods.php       2012-06-29 20:52:39 UTC 
(rev 5040)
@@ -30,7 +30,24 @@
 
 class Stock_Goods extends Stock_Goods_Sql
 {
-
+/**
+ * if an array if receive the keys are
+ *  p_date
+ *  p_depot
+ *  f_idX f_id
+ *  sg_codeX
+ *  sg_type0
+ *
+ * @global $cn database connx
+ * @param $p_array
+ * if an array if receive the keys are
+ *  p_date
+ *  p_depot
+ *  f_idX f_id
+ *  sg_codeX
+ *  sg_type0
+ * @param $p_readonly true or false
+ */
        function input($p_array = null, $p_readonly = false)
        {
                global $cn;
@@ -59,9 +76,9 @@
                }
                $idepo->selected = $p_depot;
                for ($e = 0; $e < MAX_ARTICLE; $e++)
-               {
+               {//ATTR_DEF_STOCKfiche_
                        $sg_code[$e] = new ICard('sg_code' . $e);
-                       $sg_code[$e]->extra = '[sql] fd_id = 500000';
+                       $sg_code[$e]->extra = "[sql]  f_id in (select distinct 
f_id from fiche_Detail where ad_id=19 and coalesce(ad_value,\'\') <> \'\')";
                        $sg_code[$e]->set_attribute("typecard", 
$sg_code[$e]->extra);
                        $sg_code[$e]->set_attribute("label", "label" . $e);
                        $sg_code[$e]->value = (isset(${'sg_code' . $e})) ? 
${'sg_code' . $e} : '';
@@ -77,6 +94,9 @@
                        if ( isset (${'sg_type'.$e})) {
                                $sg_type[$e]=(${'sg_type'.$e}=='c')?'OUT':'IN';
                        }
+                       if ( isset (${'f_id'.$e})) {
+                               $fiche[$e]=new Fiche($this->cn,${'f_id'.$e});
+                       }
                }
                require_once 'template/stock_inv.php';
        }
@@ -105,7 +125,11 @@
                                if ($p_array['sg_quantity' . $i] != 0 &&
                                                trim($p_array['sg_code' . $i]) 
!= '')
                                {
-                                       $a->sg_code = $p_array['sg_code' . $i];
+                                       $fiche=new Fiche($cn);
+                                       $fiche->get_by_qcode($p_array['sg_code' 
. $i]);
+                                       
$stock=$fiche->strAttribut(ATTR_DEF_STOCK);
+                                       $a->f_id=$fiche->id;
+                                       $a->sg_code = $stock;
                                        $a->sg_quantity = 
abs($p_array['sg_quantity' . $i]);
                                        $a->sg_type = ($p_array['sg_quantity' . 
$i] > 0) ? 'd' : 'c';
                                        $a->sg_comment = $p_array['p_motif'];

Modified: phpcompta/trunk/include/template/stock_inv.php
===================================================================
--- phpcompta/trunk/include/template/stock_inv.php      2012-06-29 20:25:50 UTC 
(rev 5039)
+++ phpcompta/trunk/include/template/stock_inv.php      2012-06-29 20:52:39 UTC 
(rev 5040)
@@ -56,9 +56,14 @@
 </table>
 <table style="width: 80%">
        <tr>
-               <th >
+               <th style="text-align: left">
                        Code Stock
                </th>
+<? if ( $p_readonly == true ) :?>
+               <th style="text-align: left">
+                       Fiche
+               </th>
+<? endif;?>
                <th style="text-align:right">
                        Quantité
                </th>
@@ -66,10 +71,20 @@
 <? for($i=0;$i<MAX_ARTICLE;$i++): ?>
        <tr>
                <td>
+<? if ( $p_readonly == false) : ?>
                        <?=$sg_code[$i]->input()?>
                        <?=$sg_code[$i]->search()?>
                        <?=$label[$i]->input()?>
+<? else: ?>
+                       <? if ( trim($sg_code[$i]->value) != "")  echo 
HtmlInput::card_detail($sg_code[$i]->value,h($sg_code[$i]->value),' 
class="line"')?>
+<? endif ?>
+
                </td>
+<? if ( $p_readonly == true && isset ($fiche[$i])) :?>
+               <td>
+                       
<?=HtmlInput::card_detail($fiche[$i]->get_quick_code(),h($fiche[$i]->getName()),'
 class="line"');?>
+               </td>
+<? endif;?>
                <TD class="num"">
                        <? if ($sg_quantity[$i]->value==0 && 
$p_readonly==true):?>
 



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