ok

Mini Shell

Direktori : /home2/selectio/www/mm-tailor-billing/themes/default/views/sales/
Upload File :
Current File : /home2/selectio/www/mm-tailor-billing/themes/default/views/sales/trail_sales.php

<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<?php
$v = "?v=1";

if ($this->input->post('customer')){
    $v .= "&customer=".$this->input->post('customer');
}
if ($this->input->post('user')){
    $v .= "&user=".$this->input->post('user');
}
if ($this->input->post('hold_ref')){
    $v .= "&hold_ref=".$this->input->post('hold_ref');
}
if ($this->input->post('start_date')){
    $v .= "&start_date=".$this->input->post('start_date');
}
if ($this->input->post('end_date')) {
    $v .= "&end_date=".$this->input->post('end_date');
}
if ($this->input->post('process_status')) {
    $v .= "&process_status=".$this->input->post('process_status');
}
if ($this->input->post('payment')) {
    $v .= "&payment=".$this->input->post('payment');
}
?>

<script type="text/javascript">
    $(document).ready(function() {

        function cutting(c) {
            var paid = '<?= lang('paid'); ?>';
            var partial = '<?= lang('partial'); ?>';
            var due = '<?= lang('due'); ?>';
            var cut = 'Cutting';
            if (c == 'paid') {
                return '<div class="text-center"><span class="cutting_status label label-success">'+paid+'</span></div>';
            } else if (c == 'partial') {
                return '<div class="text-center"><span class="cutting_status label label-primary">'+partial+'</span></div>';
            } else if (c == 'due') {
                return '<div class="text-center"><span class="cutting_status label label-danger">'+due+'</span></div>';
            } else {
                return '<div class="text-center"><span class="cutting_status label label-default">'+cut+'</span></div>';
            }
        }
        
        function stitching(c) {
            var paid = '<?= lang('paid'); ?>';
            var partial = '<?= lang('partial'); ?>';
            var due = '<?= lang('due'); ?>';
            var stitch = 'Stitching';
            if (c == 'paid') {
                return '<div class="text-center"><span class="stitching_status label label-success">'+paid+'</span></div>';
            } else if (c == 'partial') {
                return '<div class="text-center"><span class="stitching_status label label-primary">'+partial+'</span></div>';
            } else if (c == 'due') {
                return '<div class="text-center"><span class="stitching_status label label-danger">'+due+'</span></div>';
            } else {
                return '<div class="text-center"><span class="stitching_status label label-default">'+stitch+'</span></div>';
            }
        }
        
        function status(x) {
            var paid = '<?= lang('paid'); ?>';
            var partial = '<?= lang('partial'); ?>';
            var due = '<?= lang('due'); ?>';
            if (x == 'paid') {
                return '<div class="text-center"><span class="sale_status label label-success">'+paid+'</span></div>';
            } else if (x == 'partial') {
                return '<div class="text-center"><span class="sale_status label label-primary">'+partial+'</span></div>';
            } else if (x == 'due') {
                return '<div class="text-center"><span class="sale_status label label-danger">'+due+'</span></div>';
            } else {
                return '<div class="text-center"><span class="sale_status label label-default">'+x+'</span></div>';
            }
        }
        
        function up_status(y) {
            var mcollected = 'Measurement collected';
            var cuttingpartial = 'Cutting Unit (Partial Assigned)';
            var cuttingunit = 'Cutting Unit (Fully Assigned)';
            var stitchingpartial = 'Stitching Unit (Partial Assigned)';
            var stitchingunit = 'Stitching Unit (Fully Assigned)';
            var partialdelivery = 'Ready to Delivery (Partial)';
            var rdelivery = 'Ready to Delivery';
            var partialdelivered = 'Order Delivered (Partial)';
            var delivered = 'Order Delivered';
            
            if (y == '1') {
                return '<div class="text-center"><span class="upsale_status label label-info">'+mcollected+'</span></div>';
            } else if (y == '2') {
                return '<div class="text-center"><span class="upsale_status label label-danger">'+cuttingpartial+'</span></div>';
            } else if (y == '3') {
                return '<div class="text-center"><span class="upsale_status label label-warning">'+cuttingunit+'</span></div>';
            } else if (y == '4') {
                return '<div class="text-center"><span class="upsale_status label label-danger">'+stitchingpartial+'</span></div>';
            } else if (y == '5') {
                return '<div class="text-center"><span class="upsale_status label label-warning">'+stitchingunit+'</span></div>';
            } else if (y == '6') {
                return '<div class="text-center"><span class="upsale_status label label-warning">'+partialdelivery+'</span></div>'; 
            } else if (y == '7') {
                return '<div class="text-center"><span class="upsale_status label label-primary">'+rdelivery+'</span></div>';
            } else if (y == '8') {
                return '<div class="text-center"><span class="upsale_status label label-warning">'+partialdelivered+'</span></div>'; 
            } else if (y == '9') {
                return '<div class="text-center"><span class="upsale_status label label-success">'+delivered+'</span></div>';   
            } else {
                return '<div class="text-center"><span class="upsale_status label label-default">'+y+'</span></div>';
            }
        }


        var table = $('#SLData').DataTable({

            'ajax' : { url: '<?=site_url('sales/get_trail_sales'. $v);?>', type: 'POST', "data": function ( d ) {
                d.<?=$this->security->get_csrf_token_name();?> = "<?=$this->security->get_csrf_hash()?>";
            }},
            "buttons": [
            { extend: 'copyHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] } },
            /*{ extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] } },*/
            { extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 2, 3] } },
            { extend: 'csvHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': true,
            exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] } },
            { extend: 'colvis', text: 'Columns'},
            ],
            "columns": [
            { "data": "id", "visible": false },
            { "data": "hold_ref" },
            { "data": "customer_name" },
            { "data": "customer_phone_no" },
            { "data": "date", "render": hrld },
            { "data": "total_items", className: "text-center"},
            { "data": "due_date", className: "text-center"},
            { "data": "unit_process_status", "render": up_status },
            { "data": "Clone","searchable": false, "orderable": false },
            { "data": "Actions", "searchable": false, "orderable": false }
            
            
            /*{ "data": "total_tax", "render": currencyFormat },
            { "data": "total_discount", "render": currencyFormat },
            { "data": "grand_total", "render": currencyFormat },
            { "data": "paid", "render": currencyFormat },
            { "data": "cutting", "render": cutting,"searchable": false, "orderable": false },
            { "data": "stitching", "render": stitching,"searchable": false, "orderable": false },
            { "data": "status", "render": status },
            { "data": "deliver_date" },*/
            
            ],
            "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                nRow.id = aData.id;
                return nRow;
            },
            "footerCallback": function (  tfoot, data, start, end, display ) {
                var api = this.api(), data;
               // $(api.column(3).footer()).html( cf(api.column(3).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
               // $(api.column(4).footer()).html( cf(api.column(4).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                /*$(api.column(5).footer()).html( cf(api.column(5).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                $(api.column(6).footer()).html( cf(api.column(6).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                $(api.column(7).footer()).html( cf(api.column(7).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                $(api.column(8).footer()).html( cf(api.column(8).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                $(api.column(9).footer()).html( cf(api.column(9).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );*/
            }

        });

        $('#search_table').on( 'keyup change', function (e) {
            var code = (e.keyCode ? e.keyCode : e.which);
            if (((code == 13 && table.search() !== this.value) || (table.search() !== '' && this.value === ''))) {
                table.search( this.value ).draw();
            }
        });

        table.columns().every(function () {
            var self = this;
            $( 'input.datepicker', this.footer() ).on('dp.change', function (e) {
                self.search( this.value ).draw();
            });
            $( 'input:not(.datepicker)', this.footer() ).on('keyup change', function (e) {
                var code = (e.keyCode ? e.keyCode : e.which);
                if (((code == 13 && self.search() !== this.value) || (self.search() !== '' && this.value === ''))) {
                    self.search( this.value ).draw();
                }
            });
            $( 'select', this.footer() ).on( 'change', function (e) {
                self.search( this.value ).draw();
            });
        });

    });
</script>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <a href="#" class="btn btn-default btn-sm toggle_form pull-right" style="margin-left: 6px;"><?= lang("show_hide"); ?></a>
                    <a href="pos" class="btn btn-success btn-sm pull-right">Add New Measurement</a>
                    <h3 class="box-title"><?= lang('list_results'); ?></h3>
                </div>
                <div class="box-body"> 
                    <!-- Filter Section Starts Here -->
                    <div id="form" class="panel panel-warning">
                        <div class="panel-body">
                            <?= form_open("sales");?>

                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="customer"><?= lang("customer"); ?></label>
                                        <?php
                                        $cu[0] = lang("select")." ".lang("customer");
                                        foreach($customers as $customer){
                                            $cu[$customer->id] = $customer->name.' - '.$customer->phone;
                                        }
                                        echo form_dropdown('customer', $cu, set_value('customer'), 'class="form-control select2" style="width:100%" id="customer"'); ?>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="user"><?= lang("user"); ?></label>
                                        <?php
                                        $us[""] = "";
                                        foreach ($users as $user) {
                                            $us[$user->id] = $user->first_name . " " . $user->last_name;
                                        }
                                        echo form_dropdown('user', $us, (isset($_POST['user']) ? $_POST['user'] : ""), 'class="form-control select2" id="user" data-placeholder="' . lang("select") . " " . lang("user") . '" style="width:100%;"');
                                        ?>
                                    </div>
                                </div>
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="process_status">Status</label>
                                        <select name="process_status" id="process_status" class="form-control select2" style="width:100%">
                                                <option value="">All Status</option>
                                                <option value="1">Measurement Collected</option>
                                                <option value="2">Cutting Unit (Partial Assigned)</option>
                                                <option value="3">Cutting Unit (Fully Assigned)</option>
                                                <option value="4">Stitching Unit (Partial Assigned)</option>
                                                <option value="5">Stitching Unit (Fully Assigned)</option>
                                                <option value="6">Ready to Delivery (Partial)</option>
                                                <option value="7">Ready to Delivery</option>
                                                <option value="8">Order Delivered (Partial)</option>
                                                <option value="9">Order Delivered</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="process_status">Payment Status</label>
                                        <select name="payment" id="payment" class="form-control select2" style="width:100%">
                                                <option value="">All Status</option>
                                                <option value="paid">Paid</option>
                                                <option value="due">Due</option>
                                                <option value="partial">Partial</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="hold_ref"><?= lang("dc_number"); ?></label>
                                        <input type="text" name="hold_ref" class="form-control" id="hold_ref">
                                        <?//= form_input('hold_ref', set_value('hold_ref'), 'class="form-control" id="hold_ref"');?>
                                    </div>
                                </div>
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="start_date"><?= lang("start_date"); ?></label>
                                        <?= form_input('start_date', set_value('start_date'), 'class="form-control datetimepicker" id="start_date"');?>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="end_date"><?= lang("end_date"); ?></label>
                                        <?= form_input('end_date', set_value('end_date'), 'class="form-control datetimepicker" id="end_date"');?>
                                    </div>
                                </div>
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-primary"><?= lang("submit"); ?></button>
                                </div>
                            </div>
                            <?= form_close();?>
                        </div>
                    </div>
                    <!-- Filter Section Ends Here -->
                    <div class="table-responsive">
                        <table id="SLData" class="table table-striped table-bordered table-condensed table-hover">
                            <thead>
                                <tr>
                                    <td colspan="17" class="p0"><input type="text" class="form-control b0" name="search_table" id="search_table" placeholder="<?= lang('type_hit_enter'); ?>" style="width:100%;"></td>
                                </tr>
                                <tr class="active">
                                    <th style="max-width:30px;"><?= lang("id"); ?></th>
                                    <th>DC&nbsp;Number</th>
                                    <th><?= lang("customer"); ?></th>
                                    <th>Phone&nbsp;Number</th>
                                    <th style="min-width:130px;" class="col-xs-2"><?= lang("date"); ?></th>
                                    
                                    <th>Total&nbsp;Items</th>
                                    <!--<th>Total&nbsp;Shirt</th>-->
                                    
                                    <th>Due&nbsp;Date</th>
                                    <th class="col-xs-1">Unit Process Status</th>
                                    <th class="col-xs-1">Clone</th>
                                    <th style="min-width:115px; max-width:115px; text-align:center;"><?= lang("actions"); ?></th>
                                    
                                    <!--<th class="col-xs-1"><?= lang("total"); ?></th>
                                    <th class="col-xs-1"><?= lang("tax"); ?></th>
                                    <th class="col-xs-1"><?= lang("discount"); ?></th>
                                    <th class="col-xs-1"><?= lang("grand_total"); ?></th>
                                    <th class="col-xs-1"><?= lang("paid"); ?></th>
                                    <th class="col-xs-1">Cutting Reports</th>
                                    <th class="col-xs-1">Stitching Reports</th>
                                    <th class="col-xs-1"><?= lang("status"); ?></th>
                                    <th class="col-xs-1">Deliver&nbsp;Date</th>-->
                                    
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                   <td colspan="10" class="dataTables_empty"><?= lang('loading_data_from_server'); ?></td>
                               </tr>
                           </tbody>
                           <tfoot>
                            <tr class="active">
                                <th style="max-width:30px;"><input type="text" class="text_filter" placeholder="[<?= lang('id'); ?>]"></th>
                                <th class="col-sm-1"><input type="text" class="text_filter" placeholder="[DC]"></th>
                                <th class="col-sm-2"><input type="text" class="text_filter" placeholder="[<?= lang('customer'); ?>]"></th>
                                <th class="col-sm-1"><input type="text" class="text_filter" placeholder="[<?= lang('phone_no'); ?>]"></th>
                                <th class="col-sm-2"><span class="datepickercon"><input type="text" class="text_filter datepicker" placeholder="[<?= lang('date'); ?>]"></span></th>
                                
                                <th class="col-sm-1">Total Items</th>
                                <!--<th class="col-sm-1">Total Shirt</th>-->
                                <th class="col-sm-2"><span class="datepickercon"><input type="text" class="text_filter datepicker" placeholder="[<?= lang('date'); ?>]"></span></th>
                                <th class="col-sm-1">Unit Process Status</th>
                                <th class="col-sm-1">Clone</th>
                                <th class="col-sm-1"><?= lang("actions"); ?></th>
                                
                                <!--<th class="col-sm-1"><?= lang("total"); ?></th>
                                <th class="col-sm-1"><?= lang("tax"); ?></th>
                                <th class="col-sm-1"><?= lang("discount"); ?></th>
                                <th class="col-sm-2"><?= lang("grand_total"); ?></th>
                                <th class="col-sm-1"><?= lang("paid"); ?></th>
                                <th class="col-sm-1">
                                    <select class="select2 select_filter"><option value=""><?= lang("all"); ?></option><option value="paid"><?= lang("paid"); ?></option><option value="partial"><?= lang("partial"); ?></option><option value="due"><?= lang("due"); ?></option></select>
                                </th>
                                <th class="col-sm-1">Cutting Reports</th>
                                <th class="col-sm-1">Stitching Reports</th>
                                <th class="col-sm-1">Deliver&nbsp;Date</th>-->
                                
                            </tr>
                            
                        </tfoot>
                    </table>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
</section>


<?php if ($Admin) { ?>

<div class="modal fade" id="stModal" tabindex="-1" role="dialog" aria-labelledby="stModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times"></i></span></button>
                <h4 class="modal-title" id="stModalLabel"><?= lang('update_status'); ?> <span id="status-id"></span></h4>
            </div>
            <?= form_open('sales/status'); ?>
            <div class="modal-body">
                <input type="hidden" value="" id="sale_id" name="sale_id" />
                <div class="form-group">
                    <?= lang('status', 'status'); ?>
                    <?php $opts = array('paid' => lang('paid'), 'partial' => lang('partial'), 'due' => lang('due'))  ?>
                    <?= form_dropdown('status', $opts, set_value('status'), 'class="form-control select2 tip" id="status" required="required" style="width:100%;"'); ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?= lang('close'); ?></button>
                <button type="submit" class="btn btn-primary"><?= lang('update'); ?></button>
            </div>
            <?= form_close(); ?>
        </div>
    </div>
</div>


<div class="modal fade" id="cuttingModal" tabindex="-1" role="dialog" aria-labelledby="stModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times"></i></span></button>
                <h4 class="modal-title" id="stModalLabel">Cutting Reports<span id="status-id"></span></h4>
            </div>
            <?= form_open('sales/status'); ?>
            <div class="modal-body">
                <input type="hidden" value="" id="cutting_sale_id" name="cutting_sale_id" />
                <div id="cutting_part"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?= lang('close'); ?></button>
            </div>
            <?= form_close(); ?>
        </div>
    </div>
</div>


<div class="modal fade" id="stithcingModal" tabindex="-1" role="dialog" aria-labelledby="stModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times"></i></span></button>
                <h4 class="modal-title" id="stModalLabel">Stitching Reports<span id="status-id"></span></h4>
            </div>
            <?= form_open('sales/status'); ?>
            <div class="modal-body">
                <input type="hidden" value="" id="stitching_sale_id" name="stitching_sale_id" />
                <div id="stithcing_part"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?= lang('close'); ?></button>
            </div>
            <?= form_close(); ?>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $(document).on('click', '.sale_status', function() {
            var sale_id = $(this).closest('tr').attr('id');
            var curr_status = $(this).text();
            var status = curr_status.toLowerCase();
            $('#status-id').text('( <?= lang('sale_id'); ?> '+sale_id+' )');
            $('#sale_id').val(sale_id);
            $('#status').val(status);
            $('#status').select2('val', status);
            $('#stModal').modal()
        });
        
        // Cutting Box
        $(document).on('click', '.cutting_status', function() {
            var sale_id = $(this).closest('tr').attr('id');
            var curr_status = $(this).text();
            var status = curr_status.toLowerCase();
            $('#status-id').text('( <?= lang('sale_id'); ?> '+sale_id+' )');
            $('#cutting_sale_id').val(sale_id);
            $('#status').val(status);
            $('#status').select2('val', status);
            $('#cuttingModal').modal();
            
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_report_cutting_part');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#cutting_part').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#cutting_part').empty();
        });
        
        // Stiching Report
        $(document).on('click', '.stitching_status', function() {
            var sale_id = $(this).closest('tr').attr('id');
            var curr_status = $(this).text();
            var status = curr_status.toLowerCase();
            $('#status-id').text('( <?= lang('sale_id'); ?> '+sale_id+' )');
            $('#stitching_sale_id').val(sale_id);
            $('#status').val(status);
            $('#status').select2('val', status);
            $('#stithcingModal').modal();
            
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_report_stitching_part');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#stithcing_part').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#stithcing_part').empty();
        });
        
    });
</script>

<?php } ?>


<?php if ($Admin) { ?>
<div class="modal fade" id="stModal1" tabindex="-1" role="dialog" aria-labelledby="stModalLabel">
    <div class="modal-dialog" role="document" style="width: 80%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times"></i></span></button>
                <h4 class="modal-title" id="stModalLabel">Update Unit Process Status <span id="up_status_id"></span>&nbsp;<span id="dc_number_id"></span></h4>
            </div>
            <?//= form_open('sales/up_status'); ?>
            
            <div class="modal-body">
                <!-- New Popup Starts Here -->
                <div class="row">
                        <div  class="col-md-12">
                            <div class="col-md-3">
                              <ul class="nav nav-tabs tabs-left sideways">
                                <li id="step1" class=""><a href="#measurement" data-toggle="tab">Measurement Collected</a></li>
                                <li id="step2" class=""><a href="#cutting_partial" data-toggle="tab">Cutting Unit (Partial Assigned)</a></li>
                                <li id="step3" class=""><a href="#cutting_fully" data-toggle="tab">Cutting Unit (Fully Assigned)</a></li>
                                <li id="step4" class=""><a href="#stitching_partial" data-toggle="tab">Stitching Unit (Partial Assigned)</a></li>
                                <li id="step5" class=""><a href="#stitching_fully" data-toggle="tab">Stitching Unit (Fully Assigned)</a></li>
                                <li id="step6" class=""><a href="#ready_delivery_partial" data-toggle="tab">Ready to Delivery (Partial)</a></li>
                                <li id="step7" class=""><a href="#ready_delivery" data-toggle="tab">Ready to Delivery</a></li>
                                <li id="step8" class=""><a href="#order_delivery_partial" data-toggle="tab">Order Delivered (Partial)</a></li>
                                <li id="step9" class=""><a href="#order_delivery" id="a_step9" data-toggle="tab">Order Delivered</a></li>
                              </ul>
                            </div>
                    
                            <div class="col-md-9">
                              <div class="tab-content">
                                  <!-- Content Starts Here -->
                                  <!--<div id="stitching_assigned_section"></div>-->
                                    <div class="tab-pane" id="measurement">Measurement Collected</div>
                                    
                                    
                                    <div class="tab-pane" id="cutting_partial">
                                        <?= form_open('sales/up_status_new'); ?>
                                            <input type="hidden" value="" id="cutting_sale_ids" name="cutting_sale_id" />
                                            <input type="hidden" value="2" id="cutting_status" name="cutting_status" />
                                            <div id="cutting_assigned_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    <div class="tab-pane" id="cutting_fully">Cutting Unit (Fully Assigned)</div>
                                    
                                    <div class="tab-pane" id="stitching_partial">
                                        <?= form_open('sales/up_status_new'); ?>
                                            <input type="hidden" value="" id="stitching_sale_ids" name="cutting_sale_id" />
                                            <input type="hidden" value="4" id="cutting_status" name="cutting_status" />
                                            <div id="stitching_assigned_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    <div class="tab-pane" id="stitching_fully">Stitching Unit (Fully Assigned)</div>
                                    
                                    
                                    <div class="tab-pane" id="ready_delivery_partial">
                                        <?= form_open('sales/up_status_new'); ?>
                                            <input type="hidden" value="" id="ready_to_delivery_sale_ids" name="cutting_sale_id" />
                                            <input type="hidden" value="6" id="cutting_status" name="cutting_status" />
                                            <div id="ready_to_delivery_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    
                                    <div class="tab-pane" id="ready_delivery">Ready to Delivery</div>
                                    
                                    
                                    <div class="tab-pane" id="order_delivery_partial">
                                        <?= form_open('sales/up_status_new'); ?>
                                            <input type="hidden" value="" id="product_delivery_date" name="cutting_sale_id" />
                                            <input type="hidden" value="8" id="cutting_status" name="cutting_status" />
                                            <div id="delivery_items_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    
                                    <div class="tab-pane" id="order_delivery">
                                        <?= form_open('sales/up_status_new'); ?>
                                            <input type="hidden" value="" id="overall_delivery_date" name="cutting_sale_id" />
                                            <input type="hidden" value="9" id="cutting_status" name="cutting_status" />
                                            <div id="deliver_date_section">
                                            <label>Delivery Date</label>
                                            <input type="date" value="" id="delivery_date" class="form-control today_date" name="overall_products_delivery_date" />
                                            <div style="float: right; padding-top: 30px;"><input type="submit" id="delivery" class="btn btn-success" value="Submit"></div>
                                        </div>
                                        <?= form_close(); ?>
                                        
                                    </div>
                                <!-- Content Ends Here -->
                              </div>
                            </div> 
                            
                            <div class="clearfix"></div>
                            
                        </div>
                </div>
                
                
                <!-- New Popup Ends Here -->
                <!--<label>DC Number - <span id="dc_number"></span></label>
                <input type="hidden" value="" id="sale_id1" name="sale_id1" />
                
                <div class="form-group">
                    <h4>Unit Process Status</h4>
                    <?php $opts1 = array('1' => 'Measurement Collected', 
                                        '2' => 'Cutting Unit (Partial Assigned)',
                                        '3' => 'Cutting Unit (Fully Assigned)',
                                        '4' => 'Stitching Unit (Partial Assigned)',
                                        '5' => 'Stitching Unit (Fully Assigned)', 
                                        '6' => 'Ready to Delivery (Partial)', 
                                        '7' => 'Ready to Delivery', 
                                        '8' => 'Order Delivered (Partial)',
                                        '9' => 'Order Delivered')  
                                        ?>
                    <?= form_dropdown('upstatus', $opts1, 1, 'class="form-control select2 tip" id="upstatus" required="required" style="width:100%;"'); ?>
                </div>
                
                <input type="hidden" value="" id="multi_sell_id" name="multi_sell_id" />
                
                <div id="cutting_assigned_section"></div>
                <div id="stitching_assigned_section"></div>
                <div id="ready_to_delivery_section"></div>
                <div id="delivery_items_section"></div>
                
                <div id="deliver_date_section">
                    <label>Delivery Date</label>
                    <input type="date" value="" id="delivery_date" class="form-control today_date" name="delivery_date" />
                </div>-->
            </div>
            
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal" id="measurement_status"><?= lang('close'); ?></button>
                <!--<button type="submit" class="btn btn-primary"><?= lang('update'); ?></button>-->
            </div>
            
            <?= form_close(); ?>
        </div>
    </div>
</div>




<script type="text/javascript">
    $(document).ready(function() {
        
         var user_name =0;
        
                function isEven(n) {
                       return n % 2 == 0;
                    }
                function todaydate()
                {
                    var now = new Date();
                    var day = ("0" + now.getDate()).slice(-2);
                    var month = ("0" + (now.getMonth() + 1)).slice(-2);
                    var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
                    return today
                }
        
        $(function(){
            
             $('#stiching_unit_com_date').val(todaydate);
             $('#cutting_unit_com_date').val(todaydate);
            var dtToday = new Date();
        
            var month = dtToday.getMonth() + 1;
            var day = dtToday.getDate();
            var year = dtToday.getFullYear();
            var mxmonth = dtToday.getMonth() + 2;
            
            var mxdate=day-10;
            var mndate=day+10;
        
            if(month < 10)
                month = '0' + month.toString();
            if(day < 10)
                day = '0' + day.toString();
        
            var minDate = year + '-' + month + '-' + day;  
            var maxDate = year + '-' + mxmonth + '-' + day;    
            $('#cutting_unit_com_date').attr('max', mxdate);
            $('#cutting_unit_com_date').attr('min', mndate);
        });


        $(document).on('click', '.upsale_status', function() {
            
            
            //$('.today_date').val(todaydate);
                
            var sale_id = $(this).closest('tr').attr('id');
            console.log('Sale ID  : '+sale_id);
            
            
		    /* ----- Get Sale Details Here ----- */
            $.ajax({
			type: "get",
			url: base_url + "sales/customerInfo",
			data : {sale_id:sale_id},
			dataType: "json",
			success: function(t) {
			 console.log('Total:'+t['total']);
			 console.log('Grand Total:'+t['grand_total']);
			 console.log('Cutting User:'+t['cutting_unit_user']);
			 console.log('Stitching User:'+t['stitching_unit_user']);
			 console.log('Cutting Unit Date:'+t['cutting_unit_com_date']);
			 console.log('Stitching Unit Date:'+t['stitching_unit_com_date']);
			 console.log('Unit Process Status:'+t['unit_process_status']);
			 console.log('Delivery Date:'+t['deliver_date']);
			 console.log('Cutting Unit Asign Date:'+t['cutting_unit_asign_date']);
			 console.log('Stitching Unit Asign Date:'+t['stitching_unit_asign_date']);
			 console.log('Get DC Number:'+t['hold_ref']);
			 
			 
			 $('#delivery_date').val(t['deliver_date']);
			 $("#upstatus").val(t['unit_process_status']).trigger('change');
			 $('#dc_number_id').text("[DC Number:  "+t['hold_ref']+"]");
			 $('#dc_number').text(t['hold_ref']);
			 $('#input_id').val(t['cutting_unit_user']);
			}
            });	
            
            
            /* ----- Get Sale All Cutting Items Here ----- */
            var user=$('#user').val();
            var date=$('#date').val();
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_sale_cutting_items');?>',
			data : {sale_id:sale_id,user:user,date:date},
			dataType: "text",
			success: function(t) {
			    $('#cutting_assigned_section').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#cutting_assigned_section').empty();
            



            /* ----- Get Sale All Stitching Items Here ----- */
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_sale_stitching_items');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#stitching_assigned_section').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#stitching_assigned_section').empty();
            /* --- New Starts Here --- */
            
            /*function expand_sales(random_id){
                console.log("Expand Check");
            $(".expand_sale_items"+random_id).on('click', function() {
                 console.log("Expand Check");
                 $.ajax({
     			type: "get",
     			url: '<?=site_url('sales/get_expand_cutting_all_sale_items');?>',
    			data : {sale_id:sale_id},
     			dataType: "text",
     			success: function(t) {
     			    /*remove_expand*/
     			    /*for(var i=1;i<=8;i++)
     			    {
     			        console.log('content'+i);
     			        $('#expand_content_'+i).append(t);
     			    }*/
    			    
     			    /*$('.remove_expand').on('click', function() {
     			        for(var i=1;i<=8;i++)
     			    {
     			        console.log('content'+i);
     			        $('#expand_content_'+i).empty();
     			    }
     			    });*/
     			    /*console.log('content'+random_id);
     			    $('#expand_content_'+random_id).append(t);
     			},
     			error:function(err){
     			    alert(err);
     			}
     		    });
             });
            }
            $('#expand_content').empty();*/
            /* --- New Ends Here --- */
            
            
            /* ----- Get Sale All Ready Items Here ----- */
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_ready_items');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#ready_to_delivery_section').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#ready_to_delivery_section').empty();
            
            
            /* ----- Get Sale All Delivery Items Here ----- */
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_delivery_items');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#delivery_items_section').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#delivery_items_section').empty();
            
            
            
            
            var curr_upstatus = $(this).text();
            var upstatus = curr_upstatus;
            
            $('#up_status_id').text('( <?= lang('sale_id'); ?> '+sale_id+' )');
            $('#sale_id1').val(sale_id);
            
            // Cutting Unit & Stitching Unit
            $('#cutting_sale_ids').val(sale_id);
            $('#stitching_sale_ids').val(sale_id);
            $('#ready_to_delivery_sale_ids').val(sale_id);
            $('#product_delivery_date').val(sale_id);
            $('#overall_delivery_date').val(sale_id);
            
            
            

            
            
            $('#multi_sell_id').val(sale_id);
            
            $('#upstatus').val(upstatus);
                    
            var s=0;
            
            console.log(s);
            
            if(upstatus=='Measurement collected'){
                s=1;
                $("#step1").attr('class', 'active');
                $("#measurement").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Cutting Unit (Partial Assigned)'){
                s=2;
                $("#step2").attr('class', 'active');
                $("#cutting_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Cutting Unit (Fully Assigned)'){
                s=3;
                $("#step3").attr('class', 'active');
                $("#cutting_fully").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Stitching Unit (Partial Assigned)'){
                s=4;
                $("#step4").attr('class', 'active');
                $("#stitching_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Stitching Unit (Fully Assigned)'){
                s=5;
                $("#step5").attr('class', 'active');
                $("#stitching_fully").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Ready to Delivery (Partial)'){
                s=6;
                $("#step6").attr('class', 'active');
                $("#ready_delivery_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Ready to Delivery'){
                s=7;
                $("#step7").attr('class', 'active');
                $("#ready_delivery").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Order Delivered (Partial)'){
                s=8;
                $("#step8").attr('class', '');
                $("#step8").attr('class', 'active');
                $("#order_delivery_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Order Delivered'){
                s=9;
                $("#step9").attr('class', 'active');
                $("#order_delivery").attr('class', 'tab-pane active');
            }
           
            //$('#upstatus').select2('val', s);
            //$("#upstatus").val(s).trigger('change');
            
                /*if(s==1 || s==3 || s==5)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(s==2)
                {
                    $("#cutting_assigned_section").show();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(s==4)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").show();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(s==6)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").show();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(s==7)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(s==8)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").show();
                }
                else if(s==9)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").show();
                    $("#delivery_items_section").hide();
                }*/
                
                
            
            
//             // Cutting_Stitching Starts Here
//             $.ajax({
// 			type: "get",
// 			url: '<?=site_url('sales/get_all_sale_items_cutting_date');?>',
// 			data : {sale_id:sale_id},
// 			dataType: "text",
// 			success: function(t) {
// 			    $('#cutting_unit_com_date_div').append(t);
// 			    // Expand Section Starts Here
//                 $('.expand_sale_items').on('click', function() {
//                 console.log("Expand Check");
//                 $.ajax({
//     			type: "get",
//     			url: '<?=site_url('sales/get_expand_cutting_all_sale_items');?>',
//     			data : {sale_id:sale_id},
//     			dataType: "text",
//     			success: function(t) {
//     			    /*remove_expand*/
//     			    for(var i=1;i<=8;i++)
//     			    {
//     			        console.log('content'+i);
//     			        $('#expand_content_'+i).append(t);
//     			    }
    			    
//     			    $('.remove_expand').on('click', function() {
//     			        for(var i=1;i<=8;i++)
//     			    {
//     			        console.log('content'+i);
//     			        $('#expand_content_'+i).empty();
//     			    }
//     			    });
//     			    console.log('content'+i);
//     			    $('#expand_content_'+i).append(t);
//     			},
//     			error:function(err){
//     			    alert(err);
//     			}
//     		    });
//             });
//             $('#expand_content').empty();
//             // Expand Section Ends Here
// 			},
// 			error:function(err){
// 			    alert(err);
// 			}
// 		    });
		    
//             $('#cutting_unit_com_date_div').empty();
            
            
            /*$.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_sale_items_stitching_date');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#stiching_unit_com_date_div').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    
            $('#stiching_unit_com_date_div').empty();*/
            // Cutting_Stitching Ends Here
            
            
            
            
            /*$.ajax({
			type: "get",
			url: base_url + "sales/saleItemsInfo",
			data : {sale_id:sale_id},
			dataType: "json",
			success: function(s) {
			   
			 console.log('Product ID New:'+s['product_id']);
			 console.log('Product Name:'+s['product_name']);
			 console.log('Unit Price:'+s['unit_price']);
			 console.log('Sale Upstatus:'+s['unit_process_status']);
			 
			 
			 $('#sales_products').val(s['product_name']);
			}
            });*/
			
			
            
            
            
            $(document).on('change','#upstatus', function() {
                
                $("#cutting_unit_com_date_div").hide();
                $("#stiching_unit_com_date_div").hide();
                
                // emp_div
                var status = 0;
                user_name = $("#user_name").val();
                
                status=$('#upstatus').val();
                
                if(isEven(status))
                {
                    /*$("#emp_div").hide();
                    $("#multi-product-section").hide();
                    $("#cutting_unit_com_date_div").hide();
                    $("#stiching_unit_com_date_div").hide();
                    $("#deliver_date_content").hide();
                    $('.today_date').val(todaydate);*/
                    
                    /*$("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();*/
                    
                    
                    //$('.today_date').val(todaydate);
                }
                else
                {
                    /*$("#emp_div").show();
                    $('#cutting_unit_com_date').val(todaydate);
                    $('#stiching_unit_com_date').val(todaydate);
                    $('.today_date').val(todaydate);*/
                    
                    /*$("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();*/
                    
                    
                    
                    //$('.today_date').val(todaydate);
                }
                
                
                // 1 = Measurement Collected
                // 2 = Cutting Unit Partial Assigned
                // 3 = Cutting Unit Assigned
                // 4 = Stitching Unit Partial Assigned
                // 5 = Stitching Unit Assigned
                // 6 = Ready To Delivery
                // 7 = Order Delivered
                 
                 
               /* if(status==1 || status==3 || status==5)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(status==2)
                {
                    $("#cutting_assigned_section").show();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(status==4)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").show();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(status==6)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").show();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(status==7)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").hide();
                }
                else if(status==8)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").hide();
                    $("#delivery_items_section").show();
                }
                else if(status==9)
                {
                    $("#cutting_assigned_section").hide();
                    $("#stitching_assigned_section").hide();
                    $("#ready_to_delivery_section").hide();
                    $("#deliver_date_section").show();
                    $("#delivery_items_section").hide();
                }*/
                
            
                
            });
            
           
            
            $('#stModal1').modal()
        });
        
        
    });
    
    
</script>
<script>
$(document).ready(function(){
  $("#measurement_status").click(function(){
        for(var c=1;c<=9;c++)
        {
            $('#step'+c).attr('class', '');
        }
        /*$("#measurement").attr('class', 'tab-pane active');
        $("#cutting_partial").attr('class', 'tab-pane active');
        $("#cutting_fully").attr('class', 'tab-pane active');
        $("#stitching_partial").attr('class', 'tab-pane active');
        $("#stitching_fully").attr('class', 'tab-pane active');
        $("#ready_delivery_partial").attr('class', 'tab-pane active');
        $("#ready_delivery").attr('class', 'tab-pane active');
        $("#order_delivery_partial").attr('class', 'tab-pane active');
        $("#order_delivery").attr('class', 'tab-pane active');*/
  });
  $("body").click(function(){
      
        for(var c=1;c<=9;c++)
        {
            $('#step'+c).attr('class', '');
        }
  });
});
</script>
<?php } ?>



<script src="<?= $assets ?>plugins/bootstrap-datetimepicker/js/moment.min.js" type="text/javascript"></script>
<script src="<?= $assets ?>plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>


<script type="text/javascript">
    $(document).ready(function(){
        /*$('#form').hide();*/
        $('.toggle_form').click(function(){
            $("#form").slideToggle();
            return false;
        });
    });
</script>
<script type="text/javascript">
$(function () {
        $('.datetimepicker').datetimepicker({
            format: 'YYYY-MM-DD HH:mm'
        });
        $('.datepicker').datetimepicker({format: 'YYYY-MM-DD', showClear: true, showClose: true, useCurrent: false, widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, widgetParent: $('.dataTable tfoot')});
});   
</script>
<style>
        .tabs-left {
          border-bottom: none;
          border-right: 1px solid #ddd;
        }
        
        .tabs-left>li {
          float: none;
         margin:0px;
          
        }
        
        .tabs-left>li.active>a,
        .tabs-left>li.active>a:hover,
        .tabs-left>li.active>a:focus {
          border-bottom-color: #ddd;
          border-right-color: transparent;
          background:#f90;
          color: white;
          font-weight: 700;
          border:none;
          border-radius:0px;
          margin:0px;
        }
        .nav-tabs>li>a:hover {
            /* margin-right: 2px; */
            line-height: 1.42857143;
            border: 1px solid transparent;
            /* border-radius: 4px 4px 0 0; */
        }
        .tabs-left>li.active>a::after{content: "";
            position: absolute;
            top: 10px;
            right: -10px;
            border-top: 10px solid transparent;
            border-bottom: 10px solid transparent;
          
            border-left: 10px solid #f90;
            display: block;
            width: 0;
        }
      </style>

Zerion Mini Shell 1.0