<?php
include "header.php";
include "connectioni.php";
require_once ("connection_sql.php");
?>

<?php

date_default_timezone_set('Asia/Colombo');
include ("connection_sql.php");
// ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);
// session_start();

if ($_SESSION["CURRENT_USER"] == "") {
    echo "Please Logging Again..";

    // exit();
}
// if ($_SESSION['company'] !="THT") {
//     echo "Please Loging Again.. Different Company !!!";
//     exit();
// }


$sqlcumas = "select * from view_userpermission where username='" . $_SESSION["CURRENT_USER"] . "' and  block='0' and name='".$_GET['url']."' and doc_view='1'";
$resultcumas = $conn->query($sqlcumas);
if ($rowsumas = $resultcumas->fetch()) {
    if (isset($_GET['url'])) {

        if ($_GET['url'] == "profit") {
            include_once './profit.php';
        }
        if ($_GET['url'] == "unlock_cash_book") {
            include_once './unlock_cash_book.php';
        }
        if ($_GET['url'] == "unlock_rec") {
            include_once './unlock_rec.php';
        }
        if ($_GET['url'] == "invoice_batch_posting") {
            include_once './invoice_batch_posting.php';
        }
        if ($_GET['url'] == "sales") {
            include_once './sales.php';
        }
        if ($_GET['url'] == "labour") {
            include_once './labour.php';
        }
        if ($_GET['url'] == "payments") {
            include_once './payments.php';
        }
        if ($_GET['url'] == "cash_handover") {
            include_once './cash_handover.php';
        }
        // if ($_GET['url'] == "dealer_sch") {
        //     include_once './dealer_schedule.php';
        // }
        if ($_GET['url'] == "dealer_remark") {
            include_once './dealer_remark.php';
        }
        if ($_GET['url'] == "cust_mast") {
            include_once './subcusmas.php';
        }
        if ($_GET['url'] == "rep_profile") {
            include_once './rep_profile.php';
        }

        if ($_GET['url'] == "gin") {
            include_once './gin_m.php';
        }
        if ($_GET['url'] == "rep_stock_adjustment") {
            include_once './rep_stock_adjustment.php';
        }
        if ($_GET['url'] == "defect_inv") {
            include_once './defect_inv.php';
        }
        if ($_GET['url'] == "vatshdule") {
            include_once './vatshdule.php';
        }
        if ($_GET['url'] == "Dealer_share") {
            include_once './Dealer_share.php';
        }
        if ($_GET['url'] == "def_inv") {
            include_once './def_inv.php';
        }
        if ($_GET['url'] == "price_control") {
            include_once './price_control.php';
        }
        if ($_GET['url'] == "invoice_info") {
            include_once './invoice_info.php';
        }
        if ($_GET['url'] == "dealer_comm") {
            include_once './dealer_comman.php';
        }
        if ($_GET['url'] == "sales_inv") {
            include_once './sales_inv.php';
        }
        if ($_GET['url'] == "pos_inv") {
            include_once './pos_inv.php';
        }
        if ($_GET['url'] == "bin_card") {
            include_once './bincard.php';
        }
        if ($_GET['url'] == "dealer_insc") {
            include_once './dealer_insc.php';
        }

        if ($_GET['url'] == "login_report") {
            include_once './login_report.php';
        }
        if ($_GET['url'] == "rep_lock_active") {
            include_once './rep_lock_active.php';
        }
        if ($_GET['url'] == "sms_fire") {
            include_once './sms_fire.php';
        }
        if ($_GET['url'] == "insen_pay_modifi") {
            include_once './insen_pay_modifi.php';
        }
        // if ($_GET['url'] == "discount_item") {
        //     include_once './discount_item.php';
        // }

        if ($_GET['url'] == "reqdata_modification") {
            include_once './reqdata_modification.php';
        }
        if ($_GET['url'] == "problems") {
            include_once './problems.php';
        }
        if ($_GET['url'] == "report_vehicle") {
            include_once './report_vehicle.php';
        }
        if ($_GET['url'] == "trans_pay") {
            include_once './trans_pay.php';
        }
        if ($_GET['url'] == "credit_note_app") {
            include_once './credit_note_app.php';
        }

        if ($_GET['url'] == "invoicedis") {
            include_once './invoicedis.php';
        }
        if ($_GET['url'] == "cancel") {
            include_once './cancel.php';
        }
        if ($_GET['url'] == "battery_status") {
            include_once './battery_status.php';
        }
        if ($_GET['url'] == "invrepchange") {
            include_once './invrepchange.php';
        }
        if ($_GET['url'] == "itemthreadup") {
            include_once './itemthreadup.php';
        }
        if ($_GET['url'] == "checker") {
            include_once './checker.php';
        }
        if ($_GET['url'] == "cussummery") {
            include_once './cussummery.php';
        }
        if ($_GET['url'] == "live_stock") {
            include_once './live_stock.php';
        }
        if ($_GET['url'] == "stkrepnew") {
            include_once './stkrepnew.php';
        }
        if ($_GET['url'] == "invoice_excel") {
            include_once './invoice_excel.php';
        }
        if ($_GET['url'] == "inv_barcode_up") {
            include_once './inv_barcode_up.php';
        }

        if ($_GET['url'] == "barcodelist") {
            include_once './barcodelist.php';
        }
        if ($_GET['url'] == "reject_list") {
            include_once './reject_list.php';
        }
        if ($_GET['url'] == "othersendlist") {
            include_once './othersendlist.php';
        }

        if ($_GET['url'] == "dag") {
            include_once './dag.php';
        }
        if ($_GET['url'] == "comp_list") {
            include_once './comp_list.php';
        }
        if ($_GET['url'] == "all_list") {
            include_once './all_list.php';
        }
        if ($_GET['url'] == "otherreclist") {
            include_once './otherreclist.php';
        }
        if ($_GET['url'] == "onhandlist") {
            include_once './onhandlist.php';
        }
        // =====
        if ($_GET['url'] == "inquiry") {
            include_once './inquiry.php';
        }
        if ($_GET['url'] == "outstanding") {
            include_once './outstanding.php';
        }
        if ($_GET['url'] == "settlement") {
            include_once './settlement.php';
        }
        if ($_GET['url'] == "category_mas") {
            include_once './category_mas.php';
        }
        if ($_GET['url'] == "grn") {
            include_once './grn.php';
        }
        if ($_GET['url'] == "costup") {
            include_once './costup.php';
        }
        if ($_GET['url'] == "stockmovment") {
            include_once './stockmovment.php';
        }
        if ($_GET['url'] == "stock_gin_transfer") {
            include_once './stock_gin_transfer.php';
        }

        if ($_GET['url'] == "dag_transfer") {
            include_once './dag_transfer.php';
        }

        if ($_GET['url'] == "dag_gin_transfer") {
            include_once './dag_gin_transfer.php';
        }

        if ($_GET['url'] == "stocktransreport") {
            include_once './stocktransreport.php';
        }
        if ($_GET['url'] == "dag_purchase") {
            include_once './dag_purchase.php';
        }
        if ($_GET['url'] == "setting") {
            include_once './setting.php';
        }

        if ($_GET['url'] == "import_po") {
            include_once './import_po.php';
        }
        if ($_GET['url'] == "provision_report") {
            include_once './provision_report.php';
        }
        if ($_GET['url'] == "report_qtysales") {
            include_once './report_qtysales.php';
        }
        if ($_GET['url'] == "profit") {
            include_once './profit.php';
        }
    }else{
        include_once './fpage.php';
    }
}else{
    // echo "You Dont  Have Permission This Page";
    include_once './fpage.php';
}
if (($_GET['url'] != "live_stock") and ($_GET['url'] != "invoice_excel") and ($_GET['url'] != "inv_barcode_up")  and ($_GET['url'] != "onhandlist") and ($_GET['url'] != "othersendlist") and ($_GET['url'] != "otherreclist") and ($_GET['url'] != "comp_list") and ($_GET['url'] != "all_list") and ($_GET['url'] != "reject_list")) {?>
    <script src="js/jquery.js"></script>
<?php }
?>

<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button> -->


<script src="js/bootstrap.min.js"></script>

<?php
include_once './footer.php';
?>

</body>
</html>
<!--<script src="js/jquery.js"></script>-->
<script src="js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="js/app.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script type="text/javascript">
    $(function() {
        $('.dt').datepicker({
            format: 'yyyy-mm-dd'
        });


    });

    $(function() {
        $('.dt1').datepicker({
            format: 'yyyy-mm'

        });


    });
    function ondate() {
        var a = document.getElementById('months').value;

        var x = a.substr(0, 7);

        document.getElementById('months').value = x;
    }
</script>
<script type="text/javascript">

    function getrep1() {

        $(function() {
            Highcharts.chart('container', {
                data: {
                    table: 'datatable'
                },
                chart: {
                    type: 'line'
                },
                title: {
                    text: 'Current Year With Previous Year Sales'
                },
                yAxis: {
                    allowDecimals: false,
                    title: {
                        text: 'Sale'
                    }
                },
                tooltip: {
                    pointFormat: "Value: {point.y:,.0f}"
                }
            });
        });
    }

    // $('#click').click(function() {
</script>

<script src="js/comman.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script>
    $("body").addClass("sidebar-collapse");
</script>

<script src="https://cdn.tailwindcss.com?plugins=forms,typography"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&amp;display=swap" rel="stylesheet"/>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
    <script>
        tailwind.config = {
            darkMode: "class",
            theme: {
                extend: {
                    colors: {
                        primary: "#3b82f6", 
                        success: "#22c55e",
                        danger: "#ef4444",
                        warning: "#f59e0b",
                        secondary: "#64748b",
                        "background-light": "#f1f5f9",
                        "background-dark": "#0f172a",
                    },
                    fontFamily: {
                        display: ["Roboto", "sans-serif"],
                    },
                },
            },
        };
    </script>


<?php
include 'login.php';
?>
<script>
    var myVar = setInterval(myTimer, 1000);

    function myTimer() {

        var d = new Date();
        //        var dd = d.toLocaleDateString();
        var tt = d.toLocaleTimeString();
        document.getElementById("time").innerHTML = tt;
    }

</script>