This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/statement/classes/Controller/User/Statement.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2013-10-10 02:44:53 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides User Statement functions
*
* @package Statement
* @category Controllers/User
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_User_Statement extends Controller_Statement {
2013-10-10 02:44:53 +00:00
protected $secure_actions = array(
'show'=>TRUE,
);
/**
* Show a payments received
*/
public function action_show() {
2016-07-29 01:19:30 +00:00
$this->meta->title = 'Statement';
$result = array();
$total = 0;
2013-10-10 02:44:53 +00:00
foreach ($this->ao->payment->find_all() as $o) {
$key = $o->date_payment;
2013-10-10 02:44:53 +00:00
while (isset($result[$key]))
$key += 1;
2013-10-10 02:44:53 +00:00
$result[$key] = $o;
2013-10-10 02:44:53 +00:00
2014-02-18 03:51:29 +00:00
$total -= Currency::round($o->total());
2013-10-10 02:44:53 +00:00
}
foreach ($this->ao->invoice->list_active() as $o) {
$key = $o->date_orig;
2013-10-10 02:44:53 +00:00
while (isset($result[$key]))
$key += 1;
2013-10-10 02:44:53 +00:00
$result[$key] = $o;
2013-10-10 02:44:53 +00:00
2014-02-18 03:51:29 +00:00
$total += Currency::round($o->total());
2013-10-10 02:44:53 +00:00
}
krsort($result);
2013-10-10 02:44:53 +00:00
Block::factory()
->title(sprintf('%s: %s - %s',_('Transactions For'),$this->ao->accnum(),$this->ao->name(TRUE)))
->title_icon('icon-tasks')
->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total));
2013-10-10 02:44:53 +00:00
}
}
?>