minor accounting improvements

This commit is contained in:
SJ 2013-09-18 22:59:51 +02:00
parent bf3da73f17
commit a68710d507
4 changed files with 23 additions and 7 deletions

View File

@ -14,6 +14,7 @@ class ControllerAccountingAccounting extends Controller {
$this->load->model('user/user');
$this->load->model('group/group');
$this->load->model('domain/domain');
$this->load->model('accounting/accounting');
if(ENABLE_SAAS == 1) {
$this->load->model('saas/ldap');
@ -70,12 +71,18 @@ class ControllerAccountingAccounting extends Controller {
$this->data['accounting'] = $this->model_accounting_accounting->get_accounting('domain',$this->data['search'], $this->data['page'], $this->data['page_len'], $this->data['sort'], $this->data['order']);
$this->data['total_records'] = $this->model_accounting_accounting->count_accounting('domain',$this->data['search']);
$this->data['mydomain_count'] = $this->model_domain_domain->count_mydomains();
$this->data['user_count'] = 0;
if(ENABLE_SAAS == 1) {
$this->data['accounts'] = array();
foreach($this->data['accounting'] as $a) {
$this->data['accounts'][$a['item']] = $this->model_saas_ldap->get_accounts_in_domain($a['item']);
$this->data['user_count'] += count($this->data['accounts'][$a['item']]);
}
}
}

View File

@ -2,6 +2,12 @@
class ModelDomainDomain extends Model {
public function count_mydomains() {
$query = $this->db->query("SELECT count(*) AS num FROM " . TABLE_DOMAIN);
return $query->row['num'];
}
public function getDomains($s = '') {
$data = array();

View File

@ -27,15 +27,15 @@
<table class="table table-striped table-condensed">
<tr>
<th colspan="3">&nbsp;</th>
<th colspan="<?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>5<?php } else { ?>4<?php } ?>">&nbsp;</th>
<th colspan="3"><?php print $text_sent; ?></th>
<th colspan="3"><?php print $text_received; ?></th>
</tr>
<tr>
<th><?php echo $viewname; ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=1"><i class="icon-chevron-down"></i></a></th>
<th><?php echo $viewname; ?> <?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>(<?php print $mydomain_count; ?>)<?php } ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=1"><i class="icon-chevron-down"></i></a></th>
<?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>
<th><?php print $text_users; ?></th>
<th><?php print $text_users; ?> (<?php print $user_count; ?>)</th>
<?php } ?>
<th><?php print $text_oldest_record; ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=oldest&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=oldest&amp;order=1"><i class="icon-chevron-down"></i></a></th>

View File

@ -22,17 +22,20 @@
<div class="domaincell">&nbsp;</div>
<div class="domaincell">&nbsp;</div>
<div class="domaincell">&nbsp;</div>
<?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>
<div class="domaincell">&nbsp;</div>
<?php } ?>
<div class="domaincell">&nbsp;</div>
<div class="domaincell"><?php print $text_sent; ?></div>
<div class="domaincell">&nbsp;</div>
<div class="domaincell">&nbsp;</div>
<div class="domaincell"><?php print $text_received; ?></div>
<div class="domaincell">&nbsp;</div>
<div class="domaincell">&nbsp;</div>
</div>
<div class="domainrow">
<div class="domaincell"><?php echo $viewname; ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=1"><i class="icon-chevron-down"></i></a></div>
<div class="domaincell"><?php echo $viewname; ?> <?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>(<?php print $mydomain_count; ?>)<?php } ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=item&amp;order=1"><i class="icon-chevron-down"></i></a></div>
<?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>
<div class="domaincell"><?php print $text_users; ?></div>
<div class="domaincell"><?php print $text_users; ?> (<?php print $user_count; ?>)</div>
<?php } ?>
<div class="domaincell"><?php print $text_oldest_record; ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=oldest&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=oldest&amp;order=1"><i class="icon-chevron-down"></i></a></div>
<div class="domaincell"><?php print $text_newest_record; ?> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=newest&amp;order=0"><i class="icon-chevron-up"></i></a> <a href="index.php?route=accounting/accounting&amp;view=<?php echo $view; ?>&amp;sort=newest&amp;order=1"><i class="icon-chevron-down"></i></a></div>
@ -50,7 +53,7 @@
<div class="domaincell"><?php echo $details['item']; ?></div>
<?php if(ENABLE_SAAS == 1 && $view == 'domain') { ?>
<div><a href="index.php?route=accounting/accounting&amp;view=accounts&amp;domain=<?php echo $details['item']; ?>"><?php echo count($accounts[$details['item']]); ?></a></div>
<div class="domaincell center"><a href="index.php?route=accounting/accounting&amp;view=accounts&amp;domain=<?php echo $details['item']; ?>"><?php echo count($accounts[$details['item']]); ?></a></div>
<?php } ?>
<div class="domaincell"><?php echo date(DATE_TEMPLATE, $details['oldest']); ?></div>