<?php
include "../../pidbco/pidbjoin.php";

if(!isset($_SESSION))
{
    session_start();
}


if(!isset($_SESSION['jay_proj_mngmnt']) && empty($_SESSION['jay_proj_mngmnt']))
{
    echo '<script type="text/javascript">alert("You Want To Login Now.."); window.location.href="../Login";</script>';
}

include "../ses_write.php";


?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Marketing</title>

    <!-- Bootstrap core CSS -->

    <link href="../components/css/bootstrap.min.css" rel="stylesheet">

    <link href="../components/fonts/css/font-awesome.min.css" rel="stylesheet">
    <link href="../components/css/animate.min.css" rel="stylesheet">

    <!-- Custom styling plus plugins -->
    <link href="../components/css/custom.css" rel="stylesheet">
    <link href="../components/css/icheck/flat/green.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../components/css/maps/jquery-jvectormap-2.0.1.css" />
    <link href="../components/css/floatexamples.css" rel="stylesheet" type="text/css" />


    <script src="../components/js/jquery.min.js"></script>
    <script src="../components/js/nprogress.js"></script>
    <script>
        NProgress.start();
    </script>

    <style>
        input[type=number] {
            -moz-appearance:textfield;
        }

        input[type=number]::-webkit-inner-spin-button,
        input[type=number]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
    </style>


    <!--[if lt IE 9]>
    <script src="../assets/js/ie8-responsive-file-warning.js"></script>
    <![endif]-->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- DataTables CSS -->
    <link href="../components/data_table/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">

    <!-- DataTables Responsive CSS -->
    <link href="../components/data_table/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">

    <script type="text/javascript" src="../auto-complete/jquery.js"></script>
    <script type="text/javascript" src="../auto-complete/typeahead.js"></script>

</head>


<body class="nav-md">

<div class="container body">


    <div class="main_container">

        <?php include("left_menu.php"); ?>

        <!-- top navigation -->
        <?php include("top_nav.php"); ?>
        <!-- /top navigation -->
         
        <!-- page content -->
        <div class="right_col" role="main">
            <div id="alert"></div>
            <div class="row">
                <div class="col-md-12">
                    <script>
                        $(document).ready(function() {

                            $('input.comp_name').typeahead({
                                name   : 'comp_name',
                                remote : 'list_companies.php?query=%QUERY'

                            });

                        })
                    </script>

                    <div class="row" id="view_data">
                        <div class="col-md-6">
                            <input type="text" name="comp_name" id="" class="form-control country" placeholder="Please Enter Company" style="margin: 5px;" >
                        </div>
                    </div>

                    <div class="row">
                        <!-- VIEW SECTION -->
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>Order Details<small>View</small></h2>
                                    <ul class="nav navbar-right panel_toolbox">
                                        <li>
                                            <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                        </li>
                                        <li>
                                            <a class="close-link"><i class="fa fa-close"></i></a>
                                        </li>
                                    </ul>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content" id="show_data">
                                    <div class="dataTables_wrapper">
                                        <table class="table table-striped table-bordered table-hover table-responsive" id="dataTables-example">
                                            <thead>
                                            <tr>
                                                <!--<th>#</th>-->
                                                <th>#</th>
                                                <th class="hidden-xs">Ord.Date</th>
                                                <th>Company</th>
                                                <th class="hidden-xs">Person</th>
                                                <th class="hidden-xs">Qtn.Num</th>
                                                <th class="hidden-xs">Phone</th>
                                                <th>Estimate Date</th>
                                                <th>Order Amount</th>
                                                <th class="hidden-xs">Status</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            $stmt = mysqli_query($con,"SELECT * FROM order_det ORDER BY id DESC ");
                                            $i=1;
                                            while($res = mysqli_fetch_object($stmt))
                                            {
                                                $cid = $res->cust_id;
                                                $qry15 = mysqli_query($con,"SELECT id,company_name,contact_person,mob1 FROM customers_det WHERE id='$cid'");
                                                $qry15_fet = mysqli_fetch_object($qry15);

                                                list($o_year,$o_month,$o_day) = explode('-', $res->ord_date);
                                                list($e_year,$e_month,$e_day) = explode('-', $res->est_date);
                                                ?>
                                                <tr class="odd gradeX" onclick="view_order_dt('<?php echo base64_encode($res->id); ?>');" style="cursor: pointer;" title="Orders" >
                                                    <td><?php echo $i; ?></td>
                                                    <td class="hidden-xs"><?php echo $o_day.' - '.$o_month.' - '.$o_year; ?></td>
                                                    <td><?php  echo $qry15_fet->company_name; ?></td>
                                                    <td class="hidden-xs"><?php echo $qry15_fet->contact_person; ?></td>
                                                    <td class="hidden-xs"><?php echo $res->qtn_num; ?></td>
                                                    <td class="hidden-xs"><?php echo $qry15_fet->mob1; ?></td>
                                                    <td><?php echo $e_day.' - '.$e_month.' - '.$e_year; ?></td>
                                                    <td><?php echo number_format((float)$res->ord_amt, 2, '.', '').' Rs'; ?></td>
                                                    <td class="hidden-xs"><?php if($res->status == 1){ echo 'Order Placed'; }  ?></td>
                                                </tr>
                                                <?php
                                                $i++;
                                            }
                                            $stmt->close();
                                            ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <!-- /.table-responsive -->
                                </div>
                            </div>
                        </div>
                        <!-- END VIEW SECTION -->
                    </div>

                </div>
            </div>


        </div>
        <!-- /page content -->

    </div>
</div>

<div id="custom_notifications" class="custom-notifications dsp_none">
    <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
    </ul>
    <div class="clearfix"></div>
    <div id="notif-group" class="tabbed_notifications"></div>
</div>

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


<!-- bootstrap progress js -->
<script src="../components/js/progressbar/bootstrap-progressbar.min.js"></script>
<script src="../components/js/nicescroll/jquery.nicescroll.min.js"></script>
<!-- icheck -->
<script src="../components/js/icheck/icheck.min.js"></script>
<!-- tags -->
<script src="../components/js/tags/jquery.tagsinput.min.js"></script>
<!-- switchery -->
<script src="../components/js/switchery/switchery.min.js"></script>
<!-- daterangepicker -->
<script type="text/javascript" src="../components/js/moment.min2.js"></script>
<script type="text/javascript" src="../components/js/datepicker/daterangepicker.js"></script>

<!-- form validation -->
<!--<script type="text/javascript" src="js/parsley/parsley.min.js"></script>-->

<!-- textarea resize -->
<script src="../components/js/textarea/autosize.min.js"></script>
<script>
    autosize($('.resizable_textarea'));
</script>
<script src="../components/js/custom.js"></script>

<!-- DataTables JavaScript -->
<script src="../components/data_table/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="../components/data_table/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script>
    $(document).ready(function() {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>


</body>

</html>
