355 |
$a=pg_fetch_array($ret,0); |
$a=pg_fetch_array($ret,0); |
356 |
return $a['t']; |
return $a['t']; |
357 |
} |
} |
358 |
|
/* function getPeriodeFromMonth |
359 |
|
************************************************** |
360 |
|
* Purpose : Return the period corresponding to the |
361 |
|
* date |
362 |
|
* |
363 |
|
* parm : |
364 |
|
* - p_cn database connection |
365 |
|
* - the month + year 'MM.YYYY' |
366 |
|
* gen : |
367 |
|
* - none |
368 |
|
* |
369 |
|
* return: |
370 |
|
* parm_periode.p_id |
371 |
|
*/ |
372 |
|
function getPeriodeFromMonth($p_cn,$p_date) { |
373 |
|
$R=ExecSql($p_cn,"select p_id from parm_periode where |
374 |
|
to_char(p_start,'DD.MM.YYYY') = '01.$p_date'"); |
375 |
|
if ( pg_NumRows($R) == 0 ) |
376 |
|
return -1; |
377 |
|
$a=pg_fetch_array($R,0); |
378 |
|
|
379 |
|
return $a['p_id']; |
380 |
|
} |
381 |
/* function getPeriodeFromDate |
/* function getPeriodeFromDate |
382 |
************************************************** |
************************************************** |
383 |
* Purpose : Return the period corresponding to the |
* Purpose : Return the period corresponding to the |
385 |
* |
* |
386 |
* parm : |
* parm : |
387 |
* - p_cn database connection |
* - p_cn database connection |
388 |
* - the date 'MM.YYYY' |
* - the date 'DD.MM.YYYY' |
389 |
* gen : |
* gen : |
390 |
* - none |
* - none |
391 |
* |
* |
394 |
*/ |
*/ |
395 |
function getPeriodeFromDate($p_cn,$p_date) { |
function getPeriodeFromDate($p_cn,$p_date) { |
396 |
$R=ExecSql($p_cn,"select p_id from parm_periode where |
$R=ExecSql($p_cn,"select p_id from parm_periode where |
397 |
to_char(p_start,'DD.MM.YYYY') = '01.$p_date'"); |
p_start <= to_date('$p_date','DD.MM.YYYY') |
398 |
|
and p_end >= to_date('$p_date','DD.MM.YYYY') |
399 |
|
"); |
400 |
if ( pg_NumRows($R) == 0 ) |
if ( pg_NumRows($R) == 0 ) |
401 |
return -1; |
return -1; |
402 |
$a=pg_fetch_array($R,0); |
$a=pg_fetch_array($R,0); |