<?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);

$a = "Hello World";

if (isset($_REQUEST["year"])) {
    $year = $_REQUEST["year"];

    for ($j = 1; $j <= 12; $j++) {
        $getfit = mysqli_query($conn, "SELECT *,DATE_FORMAT(`date`,'%d-%m-%Y') AS invdt FROM pax WHERE MONTH(date) = $j") or die(mysqli_error($conn));
        $fetfit = mysqli_fetch_array($getfit);
        $fitmonth = $fetfit['tiktamt'] + $fetfit['hotelinramt'] + $fetfit['foodinramt'] + $fetfit['laundinramt'] + $fetfit['transinramt'] + $fetfit['visaamt'];
        $zero = 0;

        if ($j == 1) {
            if ($fitmonth > 0) {
                $fitjan = $fitmonth;
            } else {
                $fitjan = $zero;
            }
        } else if ($j == 2) {
            if ($fitmonth > 0) {
                $fitfeb = $fitmonth;
            } else {
                $fitfeb = $zero;
            }
        } else if ($j == 3) {
            if ($fitmonth > 0) {
                $fitmarch = $fitmonth;
            } else {
                $fitmarch = $zero;
            }
        } else if ($j == 4) {
            if ($fitmonth > 0) {
                $fitapril = $fitmonth;
            } else {
                $fitapril = $zero;
            }
        } else if ($j == 5) {
            if ($fitmonth > 0) {
                $fitmay = $fitmonth;
            } else {
                $fitmay = $zero;
            }
        } else if ($j == 6) {
            if ($fitmonth > 0) {
                $fitjune = $fitmonth;
            } else {
                $fitjune = $zero;
            }
        } else if ($j == 7) {
            if ($fitmonth > 0) {
                $fitjuly = $fitmonth;
            } else {
                $fitjuly = $zero;
            }
        } else if ($j == 8) {
            if ($fitmonth > 0) {
                $fitaug = $fitmonth;
            } else {
                $fitaug = $zero;
            }
        } else if ($j == 9) {
            if ($fitmonth > 0) {
                $fitsept = $fitmonth;
            } else {
                $fitsept = $zero;
            }
        } else if ($j == 10) {
            if ($fitmonth > 0) {
                $fitoct = $fitmonth;
            } else {
                $fitoct = $zero;
            }
        } else if ($j == 11) {
            if ($fitmonth > 0) {
                $fitnov = $fitmonth;
            } else {
                $fitnov = $zero;
            }
        } else if ($j == 12) {
            if ($fitmonth > 0) {
                $fitdec = $fitmonth;
            } else {
                $fitdec = $zero;
            }
        }
    }
}
