
            <div class="row">
                <div class="col-md-12">
                    <?php if(isset($success_msg) && $success_msg!=NULL){ ?>
                    <div class="alert alert-success"><?php echo $success_msg; ?></div>
                    <?php } ?>
                    <div id="response_msg"></div>
                
                    <div class="tabbable tabbable-custom boxless">
                        <ul class="nav nav-tabs">
                            <li class="<?php echo $all; ?>">
                                <a href="#tab_1" data-toggle="tab"> All DXB Sales </a>
                            </li>
                            <li class="<?php echo $pay_completed; ?>">
                                <a href="#tab_2" data-toggle="tab"> Payment Completed </a>
                            </li>
                            <li class="<?php echo $pay_incompleted; ?>">
                                <a href="#tab_3" data-toggle="tab"> Payment Incomplete </a>
                            </li>
                            <li class="<?php echo $pay_pending; ?>">
                                <a href="#tab_4" data-toggle="tab"> Payment Pending </a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            
                            <div class="tab-pane <?php echo $all; ?>" id="tab_1">
                                <script type="text/javascript" language="javascript" >
                                    $(document).ready(function () {
                                        var dataTable = $('#all_sales').DataTable({
                                            order: [[ 0, "desc" ]],
                                            select: true,
                                            pageLength: 10,
                                            processing: true,
                                            serverSide: true,
                                            ajax: {
                                                url: "Json_data/json_data_records?json_type=sales&status=all", // json datasource
                                                type: "post", // method  , by default get
                                                error: function () {  // error handling
                                                    $(".employee-grid-error").html("");
                                                    $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="6">No data found in the server</th></tr></tbody>');
                                                    $("#employee-grid_processing").css("display", "none");

                                                }
                                            }, "aoColumns": [
                                                {"sTitle": "", "sClass": "hidden"},
                                                {"sTitle": "Invoice No."},
                                                {"sTitle": "Date"},
                                                {"sTitle": "Customer Name"},
                                                {"sTitle": "Sale Type"},
                                                {"sTitle": "Sale Status"},
                                                {"sTitle": "Credit Duration Days", "sClass": "hidden"},
                                                {"sTitle": "Cr. Du"},
                                                {"sTitle": "Total Amount"},
                                                {"sTitle": "Actions", "sClass": "actionWidthMembers"}
                                            ], "fnCreatedRow": function (nRow, aData, iDataIndex) {
                                                $(nRow).attr('id', '' + aData[0]);
                                                if ( aData[6] >= 7 )
                                                {
                                                    $('td', nRow).css('background-color', '#FA5858');
                                                }

                                            }
                                        });
                                        
                                        $('#all_sales tbody').on('click', 'tr', function () {
                                            var data = dataTable.row( this ).data();
                                            
                                            <?php if($user_type == 2 || $user_type == 4){ ?>
                                                window.open(
                                                    BASE_URL+'view_sale?sale_id='+data[0],
                                                    '_blank' // <- This is what makes it open in a new window.
                                                );
                                            
                                            <?php } else { ?>
                                                window.location.href = BASE_URL+'view_sale?sale_id='+data[0];
                                                
                                            <?php } ?>
                                        } );

                                    });
                                </script>
                                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                                <div class="portlet box grey-cascade">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-money"></i>All DXB Sales
                                        </div>
                                    </div>
                                    <div class="portlet-body">
                                        <div class="table-toolbar">
                                            <div class="btn-group">
                                                <a class="btn green" data-toggle="modal" href="<?php echo base_url().'do_sales'; ?>">
                                                    Do Sales <i class="fa fa-plus"></i>
                                                </a>
                                            </div>
                                            <div class="btn-group pull-right hidden">
                                                <button class="btn dropdown-toggle" data-toggle="dropdown">Tools <i class="fa fa-angle-down"></i>
                                                </button>
                                                <ul class="dropdown-menu pull-right">
                                                    <li>
                                                        <a href="#">
                                                        Print </a>
                                                    </li>
                                                    <li>
                                                        <a href="#">
                                                        Save as PDF </a>
                                                    </li>
                                                    <li>
                                                        <a href="#">
                                                        Export to Excel </a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                        <table id="all_sales" class="table table-striped table-bordered table-hover"></table>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane <?php echo $pay_completed; ?>" id="tab_2">
                                <script type="text/javascript" language="javascript" >
                                    $(document).ready(function () {
                                        var dataTable = $('#completed_sales').DataTable({
                                            select: true,
                                            pageLength: 10,
                                            processing: true,
                                            serverSide: true,
                                            ajax: {
                                                url: "Json_data/json_data_records?json_type=sales&status=1", // json datasource
                                                type: "post", // method  , by default get
                                                error: function () {  // error handling
                                                    $(".employee-grid-error").html("");
                                                    $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="6">No data found in the server</th></tr></tbody>');
                                                    $("#employee-grid_processing").css("display", "none");

                                                }
                                            }, "aoColumns": [
                                                {"sTitle": "", "sClass": "hidden"},
                                                {"sTitle": "Invoice No."},
                                                {"sTitle": "Date"},
                                                {"sTitle": "Customer Name"},
                                                {"sTitle": "Sale Type"},
                                                {"sTitle": "Sale Status"},
                                                {"sTitle": "Credit Duration Days", "sClass": "hidden"},
                                                {"sTitle": "Cr. Du"},
                                                {"sTitle": "Total Amount"},
                                                {"sTitle": "Actions", "sClass": "actionWidthMembers"}
                                            ], "fnCreatedRow": function (nRow, aData, iDataIndex) {
                                                $(nRow).attr('id', '' + aData[0]);
                                                if ( aData[6] >= 7 )
                                                {
                                                    $('td', nRow).css('background-color', '#FA5858');
                                                }

                                            }
                                        });
                                        
                                        $('#completed_sales tbody').on('click', 'tr', function () {
                                            var data = dataTable.row( this ).data();
                                            
                                            <?php if($user_type == 2 || $user_type == 4){ ?>
                                                window.open(
                                                    BASE_URL+'view_sale?sale_id='+data[0],
                                                    '_blank' // <- This is what makes it open in a new window.
                                                );
                                            
                                            <?php } else { ?>
                                                window.location.href = BASE_URL+'view_sale?sale_id='+data[0];
                                                
                                            <?php } ?>
                                        } );

                                    });
                                </script>
                                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                                <div class="portlet box grey-cascade">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-money"></i>Payment Completed DXB Sales
                                        </div>
                                    </div>
                                    <div class="portlet-body">
                                        <table id="completed_sales" class="table table-striped table-bordered table-hover"></table>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane <?php echo $pay_incompleted; ?>" id="tab_3">
                                <script type="text/javascript" language="javascript" >
                                    $(document).ready(function () {
                                        var dataTable = $('#incompleted_sales').DataTable({
                                            select: true,
                                            pageLength: 10,
                                            processing: true,
                                            serverSide: true,
                                            ajax: {
                                                url: "Json_data/json_data_records?json_type=sales&status=2", // json datasource
                                                type: "post", // method  , by default get
                                                error: function () {  // error handling
                                                    $(".employee-grid-error").html("");
                                                    $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="6">No data found in the server</th></tr></tbody>');
                                                    $("#employee-grid_processing").css("display", "none");

                                                }
                                            }, "aoColumns": [
                                                {"sTitle": "", "sClass": "hidden"},
                                                {"sTitle": "Invoice No."},
                                                {"sTitle": "Date"},
                                                {"sTitle": "Customer Name"},
                                                {"sTitle": "Sale Type"},
                                                {"sTitle": "Sale Status"},
                                                {"sTitle": "Credit Duration Days", "sClass": "hidden"},
                                                {"sTitle": "Cr. Du"},
                                                {"sTitle": "Total Amount"},
                                                {"sTitle": "Actions", "sClass": "actionWidthMembers"}
                                            ], "fnCreatedRow": function (nRow, aData, iDataIndex) {
                                                $(nRow).attr('id', '' + aData[0]);
                                                if ( aData[6] >= '7' )
                                                {
                                                    $('td', nRow).css('background-color', '#FA5858');
                                                }

                                            }
                                        });
                                        
                                        $('#incompleted_sales tbody').on('click', 'tr', function () {
                                            var data = dataTable.row( this ).data();
                                            
                                            <?php if($user_type == 2 || $user_type == 4){ ?>
                                                window.open(
                                                    BASE_URL+'view_sale?sale_id='+data[0],
                                                    '_blank' // <- This is what makes it open in a new window.
                                                );
                                            
                                            <?php } else { ?>
                                                window.location.href = BASE_URL+'view_sale?sale_id='+data[0];
                                                
                                            <?php } ?>
                                        } );

                                    });
                                </script>
                                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                                <div class="portlet box grey-cascade">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-money"></i>Payment Incomplete DXB Sales
                                        </div>
                                    </div>
                                    <div class="portlet-body">
                                        <table id="incompleted_sales" class="table table-striped table-bordered table-hover"></table>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane <?php echo $pay_pending; ?>" id="tab_4">
                                <script type="text/javascript" language="javascript" >
                                    $(document).ready(function () {
                                        var dataTable = $('#pending_sales').DataTable({
                                            select: true,
                                            pageLength: 10,
                                            processing: true,
                                            serverSide: true,
                                            ajax: {
                                                url: "Json_data/json_data_records?json_type=sales&status=3", // json datasource
                                                type: "post", // method  , by default get
                                                error: function () {  // error handling
                                                    $(".employee-grid-error").html("");
                                                    $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="6">No data found in the server</th></tr></tbody>');
                                                    $("#employee-grid_processing").css("display", "none");

                                                }
                                            }, "aoColumns": [
                                                {"sTitle": "", "sClass": "hidden"},
                                                {"sTitle": "Invoice No."},
                                                {"sTitle": "Date"},
                                                {"sTitle": "Customer Name"},
                                                {"sTitle": "Sale Type"},
                                                {"sTitle": "Sale Status"},
                                                {"sTitle": "Credit Duration Days", "sClass": "hidden"},
                                                {"sTitle": "Cr. Du"},
                                                {"sTitle": "Total Amount"},
                                                {"sTitle": "Actions", "sClass": "actionWidthMembers"}
                                            ], "fnCreatedRow": function (nRow, aData, iDataIndex) {
                                                $(nRow).attr('id', '' + aData[0]);
                                                if ( aData[6] >= '7' )
                                                {
                                                    $('td', nRow).css('background-color', '#FA5858');
                                                }

                                            }
                                        });
                                        
                                        $('#pending_sales tbody').on('click', 'tr', function () {
                                            var data = dataTable.row( this ).data();
                                            
                                            <?php if($user_type == 2 || $user_type == 4){ ?>
                                                window.open(
                                                    BASE_URL+'view_sale?sale_id='+data[0],
                                                    '_blank' // <- This is what makes it open in a new window.
                                                );
                                            
                                            <?php } else { ?>
                                                window.location.href = BASE_URL+'view_sale?sale_id='+data[0];
                                                
                                            <?php } ?>
                                        });

                                    });
                                </script>
                                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                                <div class="portlet box grey-cascade">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-money"></i>Payment Pending DXB Sales
                                        </div>
                                    </div>
                                    <div class="portlet-body">
                                        <table id="pending_sales" class="table table-striped table-bordered table-hover"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> 
            </div>
            <!-- END DASHBOARD STATS -->
        </div>
    </div>
    <!-- END CONTENT -->
</div>
<!-- END CONTAINER -->