33require_once NOALYSS_INCLUDE .
'/database/forecast_sql.class.php';
50 $this->forecast_id =
$p_id;
103 require_once NOALYSS_TEMPLATE .
"/anticipation-input_title.php";
111 echo
'<span style="margin-left:5em;font-style:normal;font-size:150%">';
116 echo
'<div id="anticipation_input_category" >';
120 .
" order by fc_order",
121 [$this->forecast_id]);
127 var icon=document.getElementById(
'{$visible}');
128icon.onclick=
function () {
130 if ( visible ) { visible =
false; $(
"anticipation_input_category").hide();icon.innerHTML=
""}
131 else { visible =
true;$(
"anticipation_input_category").show();icon.innerHTML=
""}
149 echo
h2(_(
"Eléments"));
154 $href=
"do.php?".http_build_query(array(
'ac'=>
$ac,
'sa'=>
'vw',
'gDossier'=>
Dossier::id(),
'f_id'=>$this->forecast_id));
157 $form=dossier::hidden();
162 echo
'<form method="get" id="form_del" onsubmit="return confirm_box(this,content[\'47\'])" style="display:inline-block">';
168 echo
'<form method="get" id="form_clone" onsubmit="return confirm_box(this,content[\'47\']) " style="display:inline-block" >';
193 if (
$start ==
'')
throw new Exception (_(
'Période de début non valable'));
194 if (
$end ==
'')
throw new Exception (_(
'Période de fin non valable'));
204 $aCat = $this->
cn->get_array(
'select fc_id,fc_desc from forecast_category where f_id=$1 order by fc_order',
205 array($this->forecast_id));
210 $aPeriode = $this->
cn->get_array(
"select p_id,to_char(p_start,'MM.YYYY') as myear from parm_periode
211 where p_start >= (select p_start from parm_periode where p_id=$1)
212 and p_end <= (select p_end from parm_periode where p_id=$2)
215 for ($j = 0; $j < count($aCat); $j++) {
218 $aItem[$j] = $this->
cn->get_array(
'select fi_account,fi_text,fi_amount,
220 from forecast_item where fc_id=$1 and fi_pid=0 order by fi_order ',
221 array($aCat[$j][
'fc_id']));
224 $aPerMonth[$j] = $this->
cn->get_array(
'select fi_pid,fi_account,fi_text,fi_amount
225 from forecast_item where fc_id=$1 and fi_pid !=0 order by fi_order ',
226 array($aCat[$j][
'fc_id']));
229 for ($k = 0; $k < count($aItem[$j]); $k++) {
232 if ($aItem[$j][$k][
'fi_account'] !=
'') {
234 $poste->id = $aItem[$j][$k][
'fi_account'];
236 $tmp_label = $aresult[
'desc'];
237 $amount[
'solde'] = $aresult[
'montant'];
239 if ($tmp_label !=
'OK') {
240 $error[] =
"<li> " . $aItem[$j][$k][
'fi_text'] .
$poste->id .
'</li>';
248 if ( DEBUGNOALYSS < 2 ) { ob_start(); }
249 require_once NOALYSS_TEMPLATE .
'/anticipation-display.php';
250 $r .= ob_get_contents();
251 if ( DEBUGNOALYSS < 2 ) { ob_end_clean(); }
255 public static function div()
257 $r =
'<div id="div_anti" style="display:none">';
270 $sql =
"insert into forecast(f_name,f_start_date,f_end_date) select 'clone '||f_name,f_start_date,f_end_date
272 where f_id=$1 returning f_id";
273 $new = $this->
cn->get_value(
$sql, array($this->forecast_id));
276 $sql =
"insert into forecast_category(fc_desc,f_id,fc_order)
277 select fc_desc,$1,fc_order
278 from forecast_category
279 where f_id=$2 returning fc_id";
280 $array = $this->
cn->get_array(
$sql, array($new, $this->forecast_id));
282 $old = $this->
cn->get_array(
"select fc_id from forecast_category where f_id=$1", array($this->forecast_id));
285 $this->
cn->exec_sql(
"insert into forecast_item (fi_text,fi_account,fi_order,fc_id,
286 fi_amount,fi_pid) " .
287 " select fi_text,fi_account,fi_order,$1,fi_amount,fi_pid " .
288 " from forecast_item where fc_id=$2", array(
$array[
$i][
'fc_id'],
$old[
$i][
'fc_id']));
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
h2($p_string, $p_class="", $raw="")
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
catch(Exception $e) $forecast_category
catch(Exception $e) $forecast_item
if(isset( $_REQUEST[ 'show'])) if(isset($_REQUEST['del'])) $ac
Manage the account from the table jrn, jrnx or tmp_pcmn.
display()
Display the result of the forecast.
$forecast_id
forecast.f_id
__construct($p_init, $p_id=0)
constructor
object_clone()
Clone completely Forecast and returns the new forecast_id.
input_form()
display the detail for the forecast , for modifying item, category or name
setForecastId($forecast_id)
static id()
return the 'gDossier' value after a check
ORM abstract of the table public.forecast.
static less($p_id, $p_javascript)
static parse_formula($p_cn, $p_label, $p_formula, $p_start, $p_end, $p_eval=true, $p_type_date=0, $p_sql="")
For the periode tables parm_periode and jrn_periode.