From: Nicolas Boisselier Date: Mon, 16 May 2016 16:07:17 +0000 (+0200) Subject: rent_yead X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=369b274aa5f38f9dbb6c733cbc085e34e639841a;p=nb.git rent_yead --- diff --git a/etc/dbs/rent.php b/etc/dbs/rent.php index b2bcaa3b..e879d623 100644 --- a/etc/dbs/rent.php +++ b/etc/dbs/rent.php @@ -29,9 +29,10 @@ $CONF['_rent'] = array ( # NB 16.05.16 - # NB 16.05.16 ( date('m',strtotime($r['start'])) + 12 * date('Y',strtotime($r['start'])) ) # NB 16.05.16 )); - $r['rent_year'] = sprintf('%.2f',$r['rent'] * ( - 1 + 12 - date('m',strtotime($r['start'])) - )); + $start_month = date('m',strtotime($r['start'])); + $end_month = date('m',strtotime($r['end'])); + if (date('Y',strtotime($r['end'])) > date('Y',strtotime($r['start']))) $end_month = 12; + $r['rent_year'] = sprintf('%.2f',$r['rent'] * (1 + $end_month - $start_month)); }, 'row_parse_post' => ((empty($GLOBALS['Db']) or Db::php_cli()) ? null : function(&$r) {