diff --git a/html/js/scripts.js b/html/js/scripts.js index d5de354a2..71a153532 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2353,3 +2353,40 @@ function calendar_zoom(obj) } +/** + * @brief add a line in the form for the stock + */ +function stock_add_row() +{ + try{ + style='class="input_text"'; + var mytable=g("stock_tb").tBodies[0]; + var ofirstRow=mytable.rows[1]; + var line=mytable.rows.length; + var nCell=mytable.rows[1].cells.length; + var row=mytable.insertRow(line); + var nb=g("row"); + for (var e=0;einput($p_array,true); ?> diff --git a/include/class_stock_goods.php b/include/class_stock_goods.php index a5cd788e2..e8ccaeccd 100644 --- a/include/class_stock_goods.php +++ b/include/class_stock_goods.php @@ -75,10 +75,20 @@ class Stock_Goods extends Stock_Goods_Sql exit(); } $idepo->selected = $p_depot; - for ($e = 0; $e < MAX_ARTICLE; $e++) + if ($p_readonly ) { + $nb=$row; + } else { + if (isset ($row ) ) + { + $nb=($row > MAX_ARTICLE_STOCK)?$row:MAX_ARTICLE_STOCK; + }else { + $nb=MAX_ARTICLE_STOCK; + } + } + for ($e = 0; $e < $nb; $e++) {//ATTR_DEF_STOCKfiche_ $sg_code[$e] = new ICard('sg_code' . $e); - $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]->extra = "[sql] fd_id = 500000"; $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} : ''; @@ -109,7 +119,7 @@ class Stock_Goods extends Stock_Goods_Sql if (isDate($p_array['p_date']) == null) throw new Exception('Date invalide'); $cn->start(); - $ch = new Stock_Change_Sql(); + $ch = new Stock_Change_Sql($cn); $ch->setp("c_comment", $p_array['p_motif']); $ch->setp("r_id", $p_array['p_depot']); $ch->setp("c_date", $p_array['p_date']); @@ -118,10 +128,10 @@ class Stock_Goods extends Stock_Goods_Sql $per = new Periode($cn); $periode = $per->find_periode($p_array['p_date']); $exercice = $per->get_exercice($periode); - - for ($i = 0; $i < MAX_ARTICLE; $i++) + $nb=$p_array['row']; + for ($i = 0; $i < $nb; $i++) { - $a = new Stock_Goods_Sql(); + $a = new Stock_Goods_Sql($cn); if ($p_array['sg_quantity' . $i] != 0 && trim($p_array['sg_code' . $i]) != '') { diff --git a/include/constant.php b/include/constant.php index e6a2eded7..066d1d5a2 100644 --- a/include/constant.php +++ b/include/constant.php @@ -78,6 +78,7 @@ define ('NOTFOUND','--not found--'); define ("MAX_COMPTE",4); define ('MAX_ARTICLE',5); +define ('MAX_ARTICLE_STOCK',20); define ('MAX_CAT',15); define ('MAX_CARD_SEARCH',550); define ('MAX_FORECAST_ITEM',10); diff --git a/include/template/stock_inv.php b/include/template/stock_inv.php index b7f76ba8c..36ca86d67 100644 --- a/include/template/stock_inv.php +++ b/include/template/stock_inv.php @@ -54,7 +54,7 @@ - + Code Stock @@ -68,7 +68,7 @@ Quantité - + @@ -86,9 +86,9 @@ - value==0 && $p_readonly==true):?> + value==0 && $p_readonly==true):?> - + input()?> @@ -100,6 +100,8 @@ + + \ No newline at end of file