<?php include('security.php');
?>
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <meta http-equiv="imagetoolbar" content="no"/>
    <title>Yearly Sales Summery Report</title>
    <link media="screen" rel="stylesheet" type="text/css" href="css/admin.css"/>
    <!--[if lte IE 6]>
    <link media="screen" rel="stylesheet" type="text/css" href="css/admin-ie.css"/><![endif]-->
    <script type="text/javascript" src="js/css.js"></script>
    <script type="text/javascript" src="js/behaviour.js"></script>

    <script language="JavaScript" src="js/sel_item.js"></script>

</head>
<body>
<!--[if !IE]>start wrapper<![endif]-->
<div id="wrapper">
    <!--[if !IE]>start head<![endif]-->
    <div id="head">
        <!--[if !IE]>start logo and user details<![endif]-->
        <!--[if !IE]>end logo end user details<![endif]-->
        <!--[if !IE]>start menus_wrapper<![endif]-->

        <!--[if !IE]>end menus_wrapper<![endif]-->
    </div>
    <!--[if !IE]>end head<![endif]-->

    <!--[if !IE]>start content<![endif]-->
    <div id="content">
        <!--[if !IE]>start page<![endif]-->
        <div id="page">
            <div class="inner">
                <div class="section">
                    <!--[if !IE]>start title wrapper<![endif]-->
                    <div class="title_wrapper">
                        <h2>Yearly Sales Summery Report</h2>
                        <span class="title_wrapper_left"></span>
                        <span class="title_wrapper_right"></span>
                    </div>
                    <!--[if !IE]>end title wrapper<![endif]-->
                    <!--[if !IE]>start section content<![endif]-->
                    <div class="section_content">
                        <!--[if !IE]>start section content top<![endif]-->
                        <div class="sct">
                            <div class="sct_left">
                                <div class="sct_right">
                                    <div class="sct_left">
                                        <div class="sct_right">
                                            <!--[if !IE]>start dashboard menu<![endif]-->
                                            <ul class="dashboard_menu">
                                                <!--<li><a href="#" class="d7"><span>Delete</span></a></li>-->
                                                <li><a class="d8" onclick="close_form();"><span>Close</span></a></li>
                                            </ul>
                                            <!--[if !IE]>end dashboard menu<![endif]-->
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--[if !IE]>end section content top<![endif]-->
                        <!--[if !IE]>start section content bottom<![endif]-->
                        <span class="scb"><span class="scb_left"></span><span class="scb_right"></span></span>
                        <!--[if !IE]>end section content bottom<![endif]-->

                    </div>
                    <!--[if !IE]>end section content<![endif]-->
                </div>

                <!--[if !IE]>start section<![endif]-->
                <div class="section">
                    <!--[if !IE]>start title wrapper<![endif]-->
                    <!--[if !IE]>end title wrapper<![endif]-->
                    <!--[if !IE]>start section content<![endif]-->
                    <!--[if !IE]>end section<![endif]-->
                    <!--[if !IE]>start section<![endif]-->
                    <!--[if !IE]>start section<![endif]-->

                    <div class="section">
                        <!--[if !IE]>start title wrapper<![endif]-->
                        <div class="title_wrapper1"></div>

                        <!--[if !IE]>end title wrapper<![endif]-->
                        <!--[if !IE]>start section content<![endif]-->
                        <div class="section_content">
                            <!--[if !IE]>start section content top<![endif]-->
                            <div class="sct">
                                <div class="sct_left">
                                    <div class="sct_right">
                                        <div class="sct_left">
                                            <div class="sct_right">
                                                <!--[if !IE]>start fieldset<![endif]-->
                                                <!--[if !IE]>start forms<![endif]-->

                                                <?php
                                                include('rep_yearly_sales_details.php');
                                                ?>
                                                <!--[if !IE]>end forms<![endif]-->
                                                <!--[if !IE]>end fieldset<![endif]-->
                                                <!--[if !IE]>end forms<![endif]-->
                                                <!--[if !IE]>start system messages<![endif]-->
                                                <!--[if !IE]>end system messages<![endif]-->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--[if !IE]>end section content top<![endif]-->
                            <!--[if !IE]>start section content bottom<![endif]-->
                            <span class="scb"><span class="scb_left"></span><span class="scb_right"></span></span>
                            <!--[if !IE]>end section content bottom<![endif]-->
                        </div>
                        <!--[if !IE]>end section content<![endif]-->
                    </div>

                    <!--[if !IE]>end section<![endif]-->
                    <!--[if !IE]>start section<![endif]-->
                </div>
            </div>
            <!--[if !IE]>end page<![endif]-->
            <!--[if !IE]>start sidebar<![endif]--><!--[if !IE]>end sidebar<![endif]-->
        </div>
        <!--[if !IE]>end content<![endif]-->
    </div>
    <!--[if !IE]>end wrapper<![endif]-->
    <!--[if !IE]>start footer<![endif]-->
    <!--[if !IE]>end footer<![endif]-->
    <script>


        function set_other_year() {
            // =================================================================================
            // ================================ Set 3 Year ====================================
            // ================================================================================
            let month1 = document.getElementById("month1").value;
            if (!month1) {
                alert("Please select the first month.");
                return;
            }

            let date = new Date(month1);

            let year2 = new Date(date);
            year2.setFullYear(date.getFullYear() + 1);

            let year3 = new Date(date);
            year3.setFullYear(date.getFullYear() + 2);

            let month12 = new Date(date);
            month12.setMonth(date.getMonth() + 11, 31);

            let month22 = new Date(year2);
            month22.setMonth(year2.getMonth() + 11, 31);

            let month32 = new Date(year3);
            month32.setMonth(year3.getMonth() + 11, 31);

            let formatDate = (dateObj) => {
                let yyyy = dateObj.getFullYear();
                let mm = String(dateObj.getMonth() + 1).padStart(2, '0');
                let dd = String(dateObj.getDate()).padStart(2, '0');
                return `${yyyy}-${mm}-${dd}`;
            };

            document.getElementById("month2").value = formatDate(year2);
            document.getElementById("month3").value = formatDate(year3);
            document.getElementById("month12").value = formatDate(month12);
            document.getElementById("month22").value = formatDate(month22);
            document.getElementById("month32").value = formatDate(month32);
        }

    </script>
</body>
</html>
