Skip to content

Commit

Permalink
Design outlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatoliy committed Nov 11, 2009
1 parent f7da039 commit d99de8c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion httpdocs/controller/outlay.php
Expand Up @@ -20,7 +20,7 @@ function index() {
outlay_category c ON c.id = outlay.outlay_category_id LEFT JOIN outlay_category c ON c.id = outlay.outlay_category_id LEFT JOIN
user ON user.id = outlay.user_id user ON user.id = outlay.user_id
WHERE WEEK(TIMESTAMPADD(DAY, -1, outlay.created_at)) = WEEK(NOW()) 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)); $this->tpl->add('index', db_fetch_all($sql));
} }
Expand Down
30 changes: 25 additions & 5 deletions httpdocs/view/outlay.index.tpl
Expand Up @@ -19,13 +19,30 @@
max-width: 50px; max-width: 50px;
clear: right; 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} {/literal}
</style> </style>
<h2>Расходы за текущую неделю</h2> <h2>Расходы за текущую неделю</h2>
<div id="outlay_index"> <div id="outlay_index">
{if $index} {if $index}
{assign var=block_number value=1}
{foreach name=weekday from=$index item=outlay} {foreach name=weekday from=$index item=outlay}
{assign var=day value=$outlay->created_at|date_format:'%A, %e %b'} {assign var=day value=$outlay->created_at|date_format:'%A, %e %b'}
Expand All @@ -34,12 +51,12 @@
{assign var=total value=0} {assign var=total value=0}
{/if} {/if}
{* accumulat value if the same day as previous or first record in day *}
{if !$prev_day || $prev_day == $day} {if !$prev_day || $prev_day == $day}
{assign var=total value=$total+$outlay->value} {assign var=total value=$total+$outlay->value}
{/if} {/if}
{capture assign=outlay_record}
{capture name=outlay_record assign=outlay_record}
<div class="outlay_record"> <div class="outlay_record">
<div class="outlay_description"> <div class="outlay_description">
{$outlay->name}{if $outlay->note}: {$outlay->note}{/if} {$outlay->name}{if $outlay->note}: {$outlay->note}{/if}
Expand All @@ -56,7 +73,7 @@
{if $smarty.foreach.weekday.last && $prev_day == $day} {if $smarty.foreach.weekday.last && $prev_day == $day}
{$outlay_record} {$outlay_record}
{/if} {/if}
<div class="outlay_record"> <div class="outlay_record daily_total">
<div class="outlay_description"> <div class="outlay_description">
<strong>Итого:</strong> <strong>Итого:</strong>
</div> </div>
Expand All @@ -66,12 +83,16 @@
</div> </div>
</div> </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} {assign var=total value=$outlay->value}
{/if} {/if}
{if !$smarty.foreach.weekday.last || $prev_day != $day} {if !$smarty.foreach.weekday.last || $prev_day != $day}
<div style="float: left; padding: 10px;"> <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} {$day}
</div> </div>
{/if} {/if}
Expand All @@ -84,7 +105,6 @@
{/if} {/if}
{assign var=prev_day value=$day} {assign var=prev_day value=$day}
{/foreach} {/foreach}
</div> </div>
{else} {else}
Expand Down

0 comments on commit d99de8c

Please sign in to comment.