<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);
mysqli_select_db($conn, $zdb);

    $yyear = $_REQUEST("year");

    for ($i = 1; $i <= 12; $i++) {
        $getmonth = mysqli_query($conn, "SELECT SUM(netamt) AS amt FROM bookform WHERE MONTH(vouchdt) = $i AND YEAR(vouchdt) = $yyear") or die(mysqli_error($conn));
        $fetmonth = mysqli_fetch_array($getmonth);
        $month = $fetmonth['amt'];
        $zero = 0;
        switch ($i) {
            case 1:
                if ($month > 0) {
                    $january = $month;
                } else {
                    $january = $zero;
                }
                break;

            case 2:
                if ($month > 0) {
                    $february = $month;
                } else {
                    $february = $zero;
                }
                break;

            case 3:
                if ($month > 0) {
                    $march = $month;
                } else {
                    $march = $zero;
                }
                break;
            case 4:
                if ($month > 0) {
                    $april = $month;
                } else {
                    $april = $zero;
                }
                break;
            case 5:
                if ($month > 0) {
                    $may = $month;
                } else {
                    $may = $zero;
                }
                break;
            case 6:
                if ($month > 0) {
                    $june = $month;
                } else {
                    $june = $zero;
                }
                break;
            case 7:
                if ($month > 0) {
                    $july = $month;
                } else {
                    $july = $zero;
                }
                break;
            case 8:
                if ($month > 0) {
                    $august = $month;
                } else {
                    $august = $zero;
                }
                break;
            case 9:
                if ($month > 0) {
                    $september = $month;
                } else {
                    $september = $zero;
                }
                break;
            case 10:
                if ($month > 0) {
                    $october = $month;
                } else {
                    $october = $zero;
                }
                break;
            case 11:
                if ($month > 0) {
                    $november = $month;
                } else {
                    $november = $zero;
                }
                break;
            case 12:
                if ($month > 0) {
                    $december = $month;
                } else {
                    $december = $zero;
                }
                break;
            default:
        }
    }
?>