<?php
include("../public/impOpreation.php");
$do = $_GET['do'];
$today = date("Y-m-d H:i:s");
$date = date("Y-m-d");

if (empty($do)) {

    $savetype = R::findAll('savetype', 'del < 2');
    foreach ($savetype as $type) {
        $type->saves = R::getAll('select * from save where savetypeid = ' . $type->id . ' and conditions = 0');
        $type->total = R::getCell('select sum(savecurrentvalue) from save where savetypeid = ' . $type->id . ' and conditions = 0 group by savetypeid');
    }
    $smarty->assign('allSaveType', $savetype);
    $smarty->display("header.html");
    $smarty->display("savetypereportview/show.html");
    $smarty->display("footer.html");
} elseif ($do == "show") {
    $savetype = R::findAll('savetype', 'del < 2');
    $smarty->assign('allSaveType', $savetype);
    $smarty->display("header.html");
    $smarty->display("savetypereportview/show.html");
    $smarty->display("footer.html");
}
