From 369b274aa5f38f9dbb6c733cbc085e34e639841a Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 16 May 2016 18:07:17 +0200 Subject: [PATCH] rent_yead --- etc/dbs/rent.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) { -- 2.47.3