Permalink
Browse files

Design outlay

  • Loading branch information...
1 parent f7da039 commit d99de8c1caae678f8b6c21e4f6ef900357cf3182 Anatoliy committed Nov 11, 2009
Showing with 26 additions and 6 deletions.
  1. +1 −1 httpdocs/controller/outlay.php
  2. +25 −5 httpdocs/view/outlay.index.tpl
@@ -20,7 +20,7 @@ function index() {
outlay_category c ON c.id = outlay.outlay_category_id LEFT JOIN
user ON user.id = outlay.user_id
WHERE WEEK(TIMESTAMPADD(DAY, -1, outlay.created_at)) = WEEK(NOW())
- ORDER BY outlay.created_at ASC
+ ORDER BY DAY(outlay.created_at) ASC, c.name ASC
';
$this->tpl->add('index', db_fetch_all($sql));
}
@@ -19,13 +19,30 @@
max-width: 50px;
clear: right;
}
+
+.daily_total {
+ border-top: 1px solid #000;
+ height: 20px;
+}
+
+.block_header {
+ font-weight: 700;
+ text-decoration: underline;
+ padding-bottom: 14px;
+}
+
+.active {
+ color: blue;
+}
+
{/literal}
</style>
<h2>Расходы за текущую неделю</h2>
<div id="outlay_index">
{if $index}
+ {assign var=block_number value=1}
{foreach name=weekday from=$index item=outlay}
{assign var=day value=$outlay->created_at|date_format:'%A, %e %b'}
@@ -34,12 +51,12 @@
{assign var=total value=0}
{/if}
+ {* accumulat value if the same day as previous or first record in day *}
{if !$prev_day || $prev_day == $day}
{assign var=total value=$total+$outlay->value}
{/if}
-
- {capture name=outlay_record assign=outlay_record}
+ {capture assign=outlay_record}
<div class="outlay_record">
<div class="outlay_description">
{$outlay->name}{if $outlay->note}: {$outlay->note}{/if}
@@ -56,7 +73,7 @@
{if $smarty.foreach.weekday.last && $prev_day == $day}
{$outlay_record}
{/if}
- <div class="outlay_record">
+ <div class="outlay_record daily_total">
<div class="outlay_description">
<strong>Итого:</strong>
</div>
@@ -66,12 +83,16 @@
</div>
</div>
</div>
+ {if $block_number%3==0}
+ <div class="clear"></div>
+ {/if}
+ {assign var=block_number value=$block_number+1}
{assign var=total value=$outlay->value}
{/if}
{if !$smarty.foreach.weekday.last || $prev_day != $day}
<div style="float: left; padding: 10px;">
- <div style="font-weight: 700; text-decoration: underline; padding-bottom: 14px;">
+ <div class="block_header{if $smarty.now|date_format == $outlay->created_at|date_format} active{/if}">
{$day}
</div>
{/if}
@@ -84,7 +105,6 @@
{/if}
{assign var=prev_day value=$day}
-
{/foreach}
</div>
{else}

0 comments on commit d99de8c

Please sign in to comment.