List of bills working on index page
This commit is contained in:
parent
4ff1ce890c
commit
ccb89358bf
7
TODO
7
TODO
@ -2,11 +2,14 @@
|
||||
* JSON output => do index view
|
||||
* API
|
||||
* Reattribute all invoices / paybacks to unknown user when deleting a user ?
|
||||
* User groups
|
||||
* cf TODO in files
|
||||
* French template
|
||||
* Favicon
|
||||
* Dépenses du dernier mois
|
||||
|
||||
Improvements :
|
||||
==============
|
||||
* User groups
|
||||
* Search invoice
|
||||
|
||||
Manage paybacks :
|
||||
=================
|
||||
|
@ -124,18 +124,22 @@ class Storage {
|
||||
$value = array($value);
|
||||
}
|
||||
|
||||
foreach($value as $value_array) {
|
||||
foreach($value as $key=>$value_array) {
|
||||
if($value_array == 'AND' || $value_array == 'OR') {
|
||||
$query .= ' '.$value_array.' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
if(substr($value_array, 0, 1) == "<")
|
||||
$query .= $field.'<:'.$field;
|
||||
if(substr($value_array, 0, 2) == "<=")
|
||||
$query .= $field.'<=:'.$field.$key;
|
||||
elseif(substr($value_array, 0, 1) == "<")
|
||||
$query .= $field.'<:'.$field.$key;
|
||||
elseif(substr($value_array, 0, 2) == ">=")
|
||||
$query .= $field.'>=:'.$field.$key;
|
||||
elseif(substr($value_array, 0, 1) == ">")
|
||||
$query .= $field.'>:'.$field;
|
||||
$query .= $field.'>:'.$field.$key;
|
||||
else
|
||||
$query .= $field.'=:'.$field;
|
||||
$query .= $field.'=:'.$field.$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,14 +154,16 @@ class Storage {
|
||||
if($fields[$field] == 'date')
|
||||
$value = $value->format('Y-m-d H:i:s');
|
||||
|
||||
foreach($value as $value_array) {
|
||||
foreach($value as $key=>$value_array) {
|
||||
if($value_array == 'AND' || $value_array == 'OR')
|
||||
continue;
|
||||
|
||||
if(substr($value_array, 0, 1) == ">" || substr($value_array, 0, 1) == "<")
|
||||
$query->bindValue(':'.$field, substr($value_array, 0, 1));
|
||||
else
|
||||
$query->bindValue(':'.$field, $value_array);
|
||||
if(substr($value_array, 0, 2) == ">=" || substr($value_array, 0, 2) == "<=")
|
||||
$value_array = substr($value_array, 2);
|
||||
elseif(substr($value_array, 0, 1) == ">" || substr($value_array, 0, 1) == "<")
|
||||
$value_array = substr($value_array, 1);
|
||||
|
||||
$query->bindValue(':'.$field.$key, $value_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
index.php
16
index.php
@ -606,8 +606,11 @@
|
||||
|
||||
|
||||
default:
|
||||
if(empty($_GET['all']))
|
||||
$_GET['all'] = 0;
|
||||
|
||||
// Display cached page in priority
|
||||
if($cache = $tpl->cache('index', $expire_time = 600, $cache_id = $current_user->getLogin())) {
|
||||
if($cache = $tpl->cache('index', $expire_time = 600, $cache_id = $current_user->getLogin().$_GET['all'])) {
|
||||
echo $cache;
|
||||
}
|
||||
else {
|
||||
@ -615,7 +618,14 @@
|
||||
$users_list = $users_list->load();
|
||||
|
||||
$invoices_list = new Invoice();
|
||||
$invoices_list = $invoices_list->load();
|
||||
if(empty($_GET['all'])) {
|
||||
$invoices_list = $invoices_list->load(array('date'=>array('>='.date('Y-m').'-01 00:00:00', 'AND', '<='.date('Y-m').'-31 23:59:59')));
|
||||
$tpl->assign('all', 0);
|
||||
}
|
||||
else {
|
||||
$invoices_list = $invoices_list->load();
|
||||
$tpl->assign('all', 1);
|
||||
}
|
||||
|
||||
if($invoices_list === false) $invoices_list = array();
|
||||
|
||||
@ -678,7 +688,7 @@
|
||||
$tpl->assign('balances', secureDisplay($balances));
|
||||
|
||||
// Cache the page (1 month to make it almost permanent and only regenerate it upon new invoice)
|
||||
$tpl->cache('index', 108000, $current_user->getLogin());
|
||||
$tpl->cache('index', 108000, $current_user->getLogin().$_GET['all']);
|
||||
|
||||
$tpl->draw('index');
|
||||
break;
|
||||
|
@ -4,7 +4,6 @@
|
||||
<meta charset="utf-8">
|
||||
<title>{$instance_title}</title>
|
||||
<link rel="stylesheet" media="screen" type="text/css" href="css/style.css" />
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -29,7 +29,13 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id="detailed_summary">
|
||||
<h2>Detailed list of bills for last month</h2>
|
||||
<h2>Detailed list of bills{if condition="$all == 0"} for last month{/if}</h2>
|
||||
|
||||
{if condition="$all == 0"}
|
||||
<p class="center"><a href="?all=1">Display all bills</a></p>
|
||||
{else}
|
||||
<p class="center"><a href="?all=0">Only display bills for last month</a></p>
|
||||
{/if}
|
||||
|
||||
{if condition="$invoices !== false && count($invoices)>=1"}
|
||||
<table id="list_expenses">
|
||||
|
Loading…
Reference in New Issue
Block a user