Ejemplo n.º 1
0
 /**
  * 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;
     if ($p_array != null) {
         extract($p_array);
     } else {
         $p_date = '';
         $p_motif = '';
         $p_depot = 0;
     }
     $date = new IDate('p_date', $p_date);
     $date->setReadOnly($p_readonly);
     $motif = new IText('p_motif', $p_motif);
     $motif->setReadOnly($p_readonly);
     $motif->size = 80;
     $idepo = HtmlInput::select_stock($cn, "p_depot", "W");
     $idepo->setReadOnly($p_readonly);
     if (count($idepo->value) == 0) {
         NoAccess();
         die;
     }
     $idepo->selected = $p_depot;
     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]  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} : '';
         $sg_quantity[$e] = new INum('sg_quantity' . $e);
         $sg_quantity[$e]->value = isset(${'sg_quantity' . $e}) ? ${'sg_quantity' . $e} : '';
         $label[$e] = new ISpan("label{$e}");
         if (trim($sg_code[$e]->value) != '') {
             $label[$e]->value = $cn->get_value("select vw_name from vw_fiche_attr where quick_code=\$1", array($sg_code[$e]->value));
         }
         $sg_code[$e]->setReadOnly($p_readonly);
         $sg_quantity[$e]->setReadOnly($p_readonly);
         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});
         }
     }
     $select_exercice = new ISelect('p_exercice');
     $select_exercice->value = $cn->make_array('select distinct p_exercice,p_exercice from parm_periode order by 1 desc');
     require_once NOALYSS_INCLUDE . '/template/stock_inv.php';
 }
Ejemplo n.º 2
0
 function search_box($p_array)
 {
     // Declaration
     global $g_user;
     $wrepo = HtmlInput::select_stock($this->cn, "wrepo", 'R');
     $wrepo->value[] = array('value' => -1, 'label' => 'Tous les dépôts');
     $wdate_start = new IDate('wdate_start');
     $wdate_end = new IDate('wdate_end');
     $wamount_start = new INum('wamount_start');
     $wamount_end = new INum('wamount_end');
     $wcard = new ICard('wcard');
     $wcode_stock = new ICard('wcode_stock');
     $wdirection = new ISelect("wdirection");
     // value
     $wrepo->selected = HtmlInput::default_value("wrepo", -1, $p_array);
     // Date start / end
     $exercice = $g_user->get_exercice();
     $periode = new Periode($this->cn);
     list($periode_start, $periode_end) = $periode->get_limit($exercice);
     $wdate_start->value = HtmlInput::default_value("wdate_start", $periode_start->first_day(), $p_array);
     $wdate_end->value = HtmlInput::default_value("wdate_end", $periode_end->last_day(), $p_array);
     //amounts
     $wamount_start->value = HtmlInput::default_value("wamount_start", 0, $p_array);
     $wamount_end->value = HtmlInput::default_value("wamount_end", 0, $p_array);
     //Card
     $wcard->extra = "all";
     $wcard->set_attribute("typecard", "all");
     $wcard->value = HtmlInput::default_value("wcard", "", $p_array);
     //Card stock
     $wcode_stock->extra = " [sql] fd_id=500000 ";
     $wcode_stock->set_attribute("typecard", "[sql] fd_id=500000");
     $wcode_stock->value = HtmlInput::default_value("wcard", "", $p_array);
     // Repository
     $wcode_stock->value = HtmlInput::default_value("wcode_stock", "", $p_array);
     //Direction
     $wdirection->value = array(array('value' => "-1", 'label' => "Tout"), array('value' => "c", 'label' => "OUT"), array('value' => "d", 'label' => "IN"));
     $wdirection->selected = HtmlInput::default_value("wdirection", "-1", $p_array);
     require_once NOALYSS_INCLUDE . '/template/stock_histo_search.php';
 }
Ejemplo n.º 3
0
 /**
  * Let you select the repository before confirming a sale or a purchase.
  * Returns an empty string if the company doesn't use stock
  * @brief Let you select the repository before confirming a sale or a purchase.
  * @global type $g_parameter check if company is using stock
  * @param type $p_readonly 
  * @param type $p_repo
  * @return string
  */
 public function select_depot($p_readonly, $p_repo)
 {
     global $g_parameter;
     $r = $p_readonly == false ? '<div id="repo_div_id" style="height:185px;height:10rem;">' : '<div id="repo_div_id" >';
     // Show the available repository
     if ($g_parameter->MY_STOCK == 'Y') {
         $sel = HtmlInput::select_stock($this->db, 'repo', 'W');
         $sel->readOnly = $p_readonly;
         if ($p_readonly == true) {
             $sel->selected = $p_repo;
         }
         $r .= "<p class=\"decale\">" . _('Dans le dépôt') . " : ";
         $r .= $sel->input();
         $r .= '</p>';
     } else {
         $r .= '<span class="notice">' . 'Stock non utilisé' . '</span>';
     }
     $r .= '</div>';
     return $r;
 }