[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r5512 - in phpcompta/trunk: html/js include include/temp
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r5512 - in phpcompta/trunk: html/js include include/template |
Date: |
Sat, 19 Oct 2013 16:53:49 +0200 (CEST) |
Author: danydb
Date: 2013-10-19 16:53:49 +0200 (Sat, 19 Oct 2013)
New Revision: 5512
Modified:
phpcompta/trunk/html/js/scripts.js
phpcompta/trunk/include/ajax_view_mod_stock.php
phpcompta/trunk/include/class_stock_goods.php
phpcompta/trunk/include/constant.php
phpcompta/trunk/include/template/stock_inv.php
Log:
Unlimited stock code
Fix bug in STOCK_INV
Set MAX_ARTICLE_STOCK
Add button to add a row
Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js 2013-10-19 13:44:24 UTC (rev 5511)
+++ phpcompta/trunk/html/js/scripts.js 2013-10-19 14:53:49 UTC (rev 5512)
@@ -2353,3 +2353,40 @@
}
+/**
+ * @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;e<nCell;e++)
+ {
+ var newCell=row.insertCell(e);
+ if (mytable.rows[1].cells[e].hasClassName('num') ) {
newCell.addClassName("num");}
+
+ var tt=ofirstRow.cells[e].innerHTML;
+ var new_tt=tt.replace(/sg_code0/g,"sg_code"+nb.value);
+ new_tt=new_tt.replace(/sg_quantity0/g,"sg_quantity"+nb.value);
+ new_tt=new_tt.replace(/label0/g,"label"+nb.value);
+ newCell.innerHTML=new_tt;
+ new_tt.evalScripts();
+ }
+
+ g("sg_code"+nb.value).innerHTML=' ';
+ g("sg_code"+nb.value).value='';
+ g("label"+nb.value).innerHTML='';
+ g("sg_quantity"+nb.value).value='0';
+
+ nb.value++;
+
+ new_tt.evalScripts();
+ } catch(e) {alert(e.message);}
+
+}
\ No newline at end of file
Modified: phpcompta/trunk/include/ajax_view_mod_stock.php
===================================================================
--- phpcompta/trunk/include/ajax_view_mod_stock.php 2013-10-19 13:44:24 UTC
(rev 5511)
+++ phpcompta/trunk/include/ajax_view_mod_stock.php 2013-10-19 14:53:49 UTC
(rev 5512)
@@ -42,7 +42,7 @@
$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'];
-
+ $p_array['row']=$i+1;
}
echo $st->input($p_array,true);
?>
Modified: phpcompta/trunk/include/class_stock_goods.php
===================================================================
--- phpcompta/trunk/include/class_stock_goods.php 2013-10-19 13:44:24 UTC
(rev 5511)
+++ phpcompta/trunk/include/class_stock_goods.php 2013-10-19 14:53:49 UTC
(rev 5512)
@@ -75,10 +75,20 @@
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 @@
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 @@
$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])
!= '')
{
Modified: phpcompta/trunk/include/constant.php
===================================================================
--- phpcompta/trunk/include/constant.php 2013-10-19 13:44:24 UTC (rev
5511)
+++ phpcompta/trunk/include/constant.php 2013-10-19 14:53:49 UTC (rev
5512)
@@ -78,6 +78,7 @@
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);
Modified: phpcompta/trunk/include/template/stock_inv.php
===================================================================
--- phpcompta/trunk/include/template/stock_inv.php 2013-10-19 13:44:24 UTC
(rev 5511)
+++ phpcompta/trunk/include/template/stock_inv.php 2013-10-19 14:53:49 UTC
(rev 5512)
@@ -54,7 +54,7 @@
</td>
</tr>
</table>
-<table style="width: 80%">
+<table id="stock_tb" style="width: 80%">
<tr>
<th style="text-align: left">
Code Stock
@@ -68,7 +68,7 @@
Quantité
</th>
</tr>
-<?php for($i=0;$i<MAX_ARTICLE;$i++): ?>
+<?php for($i=0;$i<$nb;$i++): ?>
<tr>
<td>
<?php if ( $p_readonly == false) : ?>
@@ -86,9 +86,9 @@
</td>
<?php endif;?>
<TD class="num"">
- <?php if ($sg_quantity[$i]->value==0 &&
$p_readonly==true):?>
+ <?php if ($sg_quantity[$i]->value==0 && $p_readonly==true):?>
- <?php else : ?>
+ <?php else : ?>
<?php echo $sg_quantity[$i]->input()?>
<?php endif;?>
</td>
@@ -100,6 +100,8 @@
</tr>
<?php endfor; ?>
</table>
+<?php if ($p_readonly == false) echo HtmlInput::button_action('Ajouter une
ligne','stock_add_row();')?>
<?php if ($p_readonly == false) echo HtmlInput::submit('save','Sauver')?>
+<?php if ($p_readonly == false) echo HtmlInput::hidden('row',$nb)?>
</form>
</div>
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r5512 - in phpcompta/trunk: html/js include include/template,
phpcompta-dev <=