]> git.nbdom.net Git - nb.git/commitdiff
rent_yead
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 16 May 2016 16:07:17 +0000 (18:07 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 16 May 2016 16:07:17 +0000 (18:07 +0200)
etc/dbs/rent.php

index b2bcaa3bbf5de2be6d2c3f6e9a07d290fac62c12..e879d623d0e3f83b3629ff680f332f4275a7ea5c 100644 (file)
@@ -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) {