forecast_id = -1; } static function build($p_id = -1) { $cn = Dossier::connect(); $forecast_sql = new Forecast_Item_SQL($cn, $p_id); $forecast_item = new Forecast_Item_MTable($forecast_sql); $forecast_item->add_json_param('ac', 'FORECAST'); $forecast_item->add_json_param("op", "forecast_item"); $forecast_item->set_callback("ajax_misc.php"); if ( $p_id != -1 ) { $forecast_id=$cn->get_value("select f_id from forecast_item fi join forecast_category fc on (fi.fc_id=fc.fc_id) where fi_id=$1",array($p_id)); $forecast_item->set_forecast_id($forecast_id); } return $forecast_item; } /** * @return int */ public function get_forecast_id(): int { return $this->forecast_id; } /** * @param int $forecast_id */ public function set_forecast_id(int $forecast_id) { $this->forecast_id = $forecast_id; $this->add_json_param("forecast_id", $forecast_id); } function count_category() { $object=$this->get_table(); $nCategory = $object->cn->get_value("select count(*) from forecast_category where f_id=$1",[$this->forecast_id]); return $nCategory; } /** * Display list of items, if there is no category the list is empty and you cannot add new ones * @param type $p_string * @param type $p_array */ public function display_table($p_string = "", $p_array = NULL) { $sql = "select fi_id,fi_text,fi_account, fi_account str_account_card, fc_desc, fi.fi_amount , (select p_start from parm_periode pp where pp.p_id=fi.fi_pid) as str_periode from forecast_item fi join forecast_category fc on (fi.fc_id=fc.fc_id) where fc.f_id =$1 order by fc_desc,fi_text "; $a_row = $this->get_table()->cn->get_array($sql, array($this->forecast_id)); require_once NOALYSS_TEMPLATE . "/forecast_item_mtable-display_table.php"; } public function display_row($p_row) { if ( ! isset($p_row['fc_desc'])) { $cn=$this->get_table()->cn; $sql= "select fi_id,fi_text,fi_account, fi_account str_account_card, fc_desc, fi.fi_amount , (select p_start from parm_periode pp where pp.p_id=fi.fi_pid) as str_periode from forecast_item fi join forecast_category fc on (fi.fc_id=fc.fc_id) where fi_id=$1"; $p_row=$cn->get_row($sql,[$p_row['fi_id']]); } if ( ! isset ($p_row['str_account_card'])) { $p_row['str_account_card']=""; } if ( !isset ($p_row['str_periode'])){ $p_row['str_periode']=""; } printf('