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/working_index.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";

$page_count=25;

if(isset($_GET['cus'])){
    $v .= "&customer=".$_GET['cus'];$page_count=-1;
}

if(isset($_GET['sale_id'])){
    $v .= "&hold_ref=".$_GET['sale_id'];$page_count=-1;
}

if ($this->input->post('customer')){
    $v .= "&customer=".$this->input->post('customer');$page_count=-1;
    $_GET['cus']=$this->input->post('customer');
}


if ($this->input->post('hold_ref')){
    $hold_ref = implode(',',$this->input->post('hold_ref'));$page_count=-1;
    $v .= "&hold_ref=".$hold_ref;
}

if ($this->input->post('start_date')){
    $v .= "&start_date=".$this->input->post('start_date');$page_count=-1;
}

if ($this->input->post('end_date')) {
    $v .= "&end_date=".$this->input->post('end_date');$page_count=-1;
}

if ($this->input->post('process_status')) {
    $v .= "&process_status=".$this->input->post('process_status');$page_count=-1;
}

if ($this->input->post('payment')) {
    $v .= "&payment=".$this->input->post('payment');$page_count=-1;
}

if ($this->input->post('sells')) {
    $v .= "&sells=".$this->input->post('sells');$page_count=-1;
}

if ($this->input->post('start_dc')) {
    $v .= "&start_dc=".$this->input->post('start_dc');$page_count=-1;
}

if ($this->input->post('end_dc')) {
    $v .= "&end_dc=".$this->input->post('end_dc');$page_count=-1;
}

if ($this->input->post('due_date')){
    $v .= "&due_date=".$this->input->post('due_date');$page_count=-1;
}

if ($this->input->post('ready_status')){
    $v .= "&ready_status=".$this->input->post('ready_status');$page_count=-1;
}
if ($this->input->post('delivery_status')){
    $v .= "&delivery_status=".$this->input->post('delivery_status');$page_count=-1;
}

?>

<script type="text/javascript">

    
    
        
    $(document).ready(function() {
        
        
        $('#btn_assign').on('click',function(){
            
         var checkValues = $('input[name=assign_ids]:checked').map(function(){
                return $(this).val();
            }).get();
            
            if(checkValues != ''){
            var r = confirm("Confirm If You Want to Ready All Items?");
    	    console.log(checkValues);
            if (r == true) {
                var ids=[];
                ids = checkValues;
                $.ajax({
                    url: 'sales/BulkReadyAllSales',
                    type: 'get',
                    data: {type:'ready_all_items',assign_id:ids},
                    success: function(response){
                    console.log(response);
                    alert("Ready to Delivery Success!! Please Refresh Page");
              }
            });
        }
         
        }else{
            alert("Please Select Minimum One DC Number for Ready Items...");
        }
        });   

        $('.checkboxs').on('click',function(){
             console.log('clicked');
        });
        
        function new_status(data){
            if(data=='00'){
                return '<div class="text-center"><span class="label" style="background-color: #00ff4e; padding: 3px 8px 3px 8px; font-size: 12px; border: 1px solid #80808040; color: #2e2d2d;"><i class="fa fa-check"></i> Unit Ready</span></div>';
            }else{
                return '<div class="text-center"><span class="label" style="background-color: #ff0000; padding: 3px 8px 3px 8px; font-size: 12px;"><i class="fa fa-times"></i> Not Ready</span></div>';
            }
        }
        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 balance(c) {
            var no_amount = 'NULL';
            if(c == "0.00"){
                return "<div class='text-center'><span class='tip btn btn-info btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-inr'></i> "+c+"</span></div>";
            }else{
                 return "<div class='text-center'><span class='tip btn btn-danger btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-inr'></i> "+c+"</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)';
            var cuttingunit = 'Cutting Unit (Ready)';
            var stitchingpartial = 'Stitching Unit (Partial)';
            var unitAllReady = 'All Units Are Ready';
            /*var stitchingunit = 'Stitching Unit (Ready)';*/
            var partialdelivery = 'Ready to Delivery (Partial)';
            var rdelivery = 'Ready to Delivery';
            var partialdelivered = 'Order Delivered (Partial)';
            var delivered = 'Order Delivered';
            var bill_cancel = 'Bill Cancelled';
            
            /*Vilot Color: #c000ff;*/
            
            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-danger">'+stitchingpartial+'</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" style="background-color: #002bff; padding: 3px 8px 3px 8px; font-size: 12px;">'+unitAllReady+'</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" style="padding: 3px 5px 3px 5px; font-size: 13px; background: #fff700; color: black; border: 1px solid black; box-shadow: 3px 4px 2px;">'+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 if (y == '10') {
                return '<div class="text-center"><span class="upsale_status label label-danger">'+bill_cancel+'</span></div>'; 
            } else {
                return '<div class="text-center"><span class="upsale_status label label-default">'+y+'</span></div>';
            }
        }
        
        function cutting_stitching(ces) {
            if(ces == '0'){
                return '<b style="color: green;font-size: 23px;">'+ces+'</b>';
            } else {
                return '<b style="color: red;font-size: 23px;">'+ces+'</b>'
            }
        }
        
        function checkbox(check){
            return '<div class="text-center"><input type="checkbox" class="s checkboxs" id="xyz_'+check+'" style="height: 21px;width: 31px;" name="assign_ids" value="'+check+'"><b style="color: green;font-size: 23px;">'+check+'</b></div>';
        }
        
        
         function up_saletype(st) {
            var sales = 'Sales';
            var trailready = 'Trail Ready';
            var trail = 'Trail';
            var trailcompleted = 'Trail Completed';
            if (st == '1') {
                return '<div class="text-center"><span class="label label-default">'+sales+'</span></div>';
            } else if (st == '2') {
                return '<div class="text-center"><span class="label label-danger">'+trail+'</span></div>';
            } else if (st == '3') {
                return '<div class="text-center"><span class="label label-info">'+trailready+'</span></div>';
            }else if (st == '4') {
                return '<div class="text-center"><span class="label label-success">'+trailcompleted+'</span></div>';
            }
         }
         
 
        var table = $('#SLData').DataTable({

            'ajax' : { url: '<?=site_url('sales/get_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: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 ] } },
            /*{ extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] } },*/
            { extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14] } },
            { extend: 'csvHtml5', 'footer': true, exportOptions: { columns: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': true,
            exportOptions: { columns: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 ] } },
            { extend: 'colvis', text: 'Columns'},
            ],
            
            "pageLength": <?=$page_count?>,
            
            
            "aaSorting": [[ 1, "desc" ]],
            "columns": [
            { "data": "id", "visible": false },
            { "data": "hold_ref", "orderable": true, "render": checkbox },
            { "data": "sale_date", className:"text-center" },
            { "data": "cus_name" },
            { "data": "customer_phone", "searchable": false},
            
            { "data": "pant_count", className: "text-center"},
            { "data": "shirt_count", className: "text-center"},
            { "data": "grand_total", "render": currencyFormat },
            { "data": "paid", "render": currencyFormat },
            { "data": "balance", "searchable": false, "render": balance},
           
            { "data": "due_date", className: "text-center"},

            
            { "data": "neww_musthafa_cutting", className: "text-center", "render": cutting_stitching},
            { "data": "neww_musthafa_stitching", className: "text-center", "render": cutting_stitching},
            
            { "data": "Ready", className: "text-center", "render": new_status, "searchable": false},
            
            { "data": "unit_process_status", "render": up_status},
            { "data": "View", "searchable": false, "orderable": false },
            { "data": "sells", "searchable": false, "orderable": false, className: "text-center", "render": up_saletype},
            { "data": "Actions", "searchable": false, "orderable": false }
            
            
            /*{ "data": "discount", className: "text-center"},*/
            /*{ "data": "cutting_remaining_new", className: "text-center"},
            { "data": "stitching_remaining_new", className: "text-center"},*/
            
            /*{ "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(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)) );
                  $(api.column(11).footer()).html( cf(api.column(11).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
                  $(api.column(12).footer()).html( cf(api.column(12).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();
            });
        });

    });
    
    function readyAllproductsClick(id,cutting_count,stitching_count){
        
        if(cutting_count==0 && stitching_count==0){
            var result = confirm("Confirm Want to Ready All Products !!! Id is"+id+"?");
        }
        
       // var result = confirm("Confirm Want to Ready All Products !!! Id is"+id+"?");
        if (result) {
                $.ajax({
    			type: "get",
    			url: "<?=site_url("sales/readyAllProducts");?>",
    			data : {id:id},
    			dataType: "text",
    			success: function(t) {
    			    alert("Success - All Products are Ready to Delivery");
    			    location.reload();
    			   },
    			error:function(err){
    			    alert(err);
    			}
    		    });
        }
        
    }
</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 Sale / POS</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>
                                        <select name="customer" class="form-control select2" style="width:100%" id="customer">
                                            <option value="">Select Customer</option>
                                            <?php
                                            foreach($customers as $customer){   ?>
                                               <option value="<?=$customer->id?>" <?php if($_GET['cus']==$customer->id){echo "selected";}?>><?=$customer->name?> - <?=$customer->phone?></option> 
                                            <?php } ?>
                                        </select>
                                    </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" <?php if ($this->input->post('process_status')=='1') { echo "selected"; } ?>>Measurement Collected</option>
                                                <option value="2" <?php if ($this->input->post('process_status')=='2') { echo "selected"; } ?>>Cutting Unit (Partial)</option>
                                                <option value="3" <?php if ($this->input->post('process_status')=='3') { echo "selected"; } ?>>Cutting Unit (Ready)</option>
                                                <option value="4" <?php if ($this->input->post('process_status')=='4') { echo "selected"; } ?>>Stitching Unit (Partial)</option>
                                                <option value="5" <?php if ($this->input->post('process_status')=='5') { echo "selected"; } ?>>All Units Are Ready</option>
                                                <option value="6" <?php if ($this->input->post('process_status')=='6') { echo "selected"; } ?>>Ready to Delivery (Partial)</option>
                                                <option value="7" <?php if ($this->input->post('process_status')=='7') { echo "selected"; } ?>>Ready to Delivery</option>
                                                <option value="8" <?php if ($this->input->post('process_status')=='8') { echo "selected"; } ?>>Order Delivered (Partial)</option>
                                                <option value="9" <?php if ($this->input->post('process_status')=='9') { echo "selected"; } ?>>Order Delivered</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="col-sm-2">
                                    <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="partial">Balance</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="process_status">Delivery Status</label>
                                        <select name="delivery_status" id="delivery_status" class="form-control select2" style="width:100%">
                                                <option value="">All Status</option>
                                                <option value="9">Delivery Orders</option>
                                                <option value="99">Without Delivery</option>
                                        </select>
                                    </div>
                                </div>
                                
                                
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="sells">Sale Type</label>
                                        <select name="sells" id="sells" class="form-control select2" style="width:100%">
                                                <option value="">All Type</option>
                                                <option value="1">Sales</option>
                                                <option value="2">Trails</option>
                                                <option value="3">Trail Ready</option>
                                                <option value="4">Trail Completed</option>
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="start_date"><?= lang("start_date"); ?></label>
                                        <input type="date" name="start_date" class="form-control" id="start_date">
                                        <?//= form_input('start_date', set_value('start_date'), 'class="form-control" id="start_date"');?>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="end_date"><?= lang("end_date"); ?></label>
                                         <input type="date" name="end_date" class="form-control" id="end_date">
                                        <?//= form_input('end_date', set_value('end_date'), 'class="form-control" id="end_date"');?>
                                    </div>
                                </div>
                                
                                
                                
                                
                                <div class="col-sm-2">
                                    <label>Start DC Number</label>
                                    <input type="text" name="start_dc" class="form-control" id="start_dc">
                                </div>
                                
                                <div class="col-sm-2">
                                    <label>End DC Number</label>
                                    <input type="text" name="end_dc" class="form-control" id="end_dc">
                                </div>
                                
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="due_date">Due Date</label>
                                         <input type="date" name="due_date" class="form-control" id="due_dates">
                                    </div>
                                </div>
                                
                                
                                <div class="col-sm-2">
                                    <div class="form-group">
                                        <label class="control-label" for="ready_status">Ready Status</label>
                                        <select name="ready_status" id="ready_status" class="form-control select2" style="width:100%">
                                                <option value="">All Status</option>
                                                <option value="1">Not Ready</option>
                                                <option value="2">Unit Ready</option>
                                        </select>
                                    </div>
                                </div>
                                
                                
                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label class="control-label" for="hold_ref"><?= lang("dc_number"); ?></label>
                                        <select name="hold_ref[]" id="hold_ref"  class="form-control select2" multiple>
                                            <?php $f=1; foreach($dc_number as $dc){   {?>  
                                            <option value="<?=$dc->hold_ref?>" <?php if($_GET['sale_id']==$dc->hold_ref){echo "selected";}?>><?=$dc->hold_ref?></option>
                                            <?php } $f++;} ?>
                                        </select> 
                                    </div>
                                </div>
                                
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-primary"><?= lang("submit"); ?></button>
                                    <span class="btn btn-success" style="float: right;" id="btn_assign">Bulk Ready Items</span>
                                </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 display">
                            <thead>
                                <tr>
                                    <td colspan="18" 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 style="max-width:50px;">Order&nbsp;Date</th>
                                    <th style="max-width:100px;">&nbsp;<?= lang("customer"); ?>&nbsp;Details</th>
                                    <th>Phone&nbsp;Number</th>
                                    <th>P</th>
                                    <th>S</th>
                                    <th class="col-xs-1">Grand&nbsp;Total</th>
                                    <th class="col-xs-1"><?= lang("paid"); ?></th>
                                    <th class="col-xs-1">Balance</th>
                                    <th>Due&nbsp;Date</th>
                                    <th>C</th>
                                    <th>S</th>
                                    <th>Ready</th>
                                    <th class="col-xs-1">Unit Process Status</th>
                                    <th class="col-xs-1">View</th>
                                    <th class="col-xs-1">Sale&nbsp;Type</th>
                                    <th style="min-width:180px; max-width:180px; text-align:center;"><?= lang("actions"); ?></th>
                                    
                                    
                                    <!--<th class="col-xs-1">Discount</th>-->
                                    <!--<th>Total&nbsp;Shirt</th>-->
                                    <!--<th style="min-width:130px;" class="col-xs-2"><?= lang("date"); ?></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="18" 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-1" style="max-width:50px;">Order&nbsp;Date</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-1">P</th>
                                <th class="col-sm-1">S</th>
                                <th class="col-sm-1">Total</th>
                                <th class="col-sm-1">Paid</th>
                                <th class="col-sm-1">Balance</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">C</th>
                                <th class="col-sm-1">S</th>
                                
                                <th class="col-sm-1">Ready</th>
                                <th class="col-sm-1">Unit Process Status</th>
                                <th class="col-sm-1">View</th>
                                <th class="col-sm-1">Sale Type</th>
                                <th class="col-sm-1"><?= lang("actions"); ?></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">Discount</th>-->
                                <!--<th class="col-sm-1">Total Shirt</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>




<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()
        });
    });
</script>

<?php } ?>


<?php if ($Admin) { ?>
<!--************************************************************ START UNIT PROCESS STATUS ***********************************************************/ -->
<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 DC Status &nbsp;<b><span id="dc_number_id"></span></b>&nbsp;<b>Due Date (<span id=due_date></span>)</b> <span class="pull-right" style="padding-right: 16px;"><div id="payment_button"></div></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)</a></li>
                                <!--<li id="step3" class=""><a href="#cutting_fully" data-toggle="tab">Cutting Unit (Ready)</a></li>-->
                                <li id="step4" class=""><a href="#stitching_partial" data-toggle="tab">Stitching Unit (Partial)</a></li>
                                <li id="step5" class=""><a href="#stitching_fully" data-toggle="tab">Unit Ready</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" data-toggle="tab">Order Delivered</a></li>
                                <li id="step10" class=""><a href="#bill_cancelled" data-toggle="tab">Bill Cancelled</a></li>
                                <li id="step11" class=""><a href="#history" data-toggle="tab">Unit History List</a></li>
                              </ul>
                            </div>
                    
                            <div class="col-md-9">
                              <div class="tab-content">
                                  <!-- Content Starts Here -->
                                    <div class="tab-pane" id="measurement">Measurement Collected</div>
                                    
                                    
                                    <div class="tab-pane" id="cutting_partial">
                                        <!--<form action="" enctype="multipart/form-data" id="cutting_form" method="post" accept-charset="utf-8">-->
                                        <?php echo form_open('sales/up_status_new', array('id' => 'cuttingForm')) ?>
                                        <?//= form_open('sales/up_status_new'); ?>
                                            <div id="cutting_assigned_section"></div>
                                        <?//= form_close(); ?>
                                        <?php echo form_close() ?>
                                        <!--</form>-->
                                    </div>
                                    
                                    <div class="tab-pane" id="cutting_fully">Cutting Unit (Ready)</div>
                                    
                                    <div class="tab-pane" id="stitching_partial">
                                        <?=form_open('sales/stitching_new', array('id' => 'stitchingForm')) ?>
                                            <div id="stitching_assigned_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    <div class="tab-pane" id="stitching_fully">All Units Are Ready</div>
                                    
                                    
                                    <div class="tab-pane" id="ready_delivery_partial">
                                        <?=form_open('sales/ready_to_delivery_new', array('id' => 'readytoDeliveryForm')) ?>
                                            <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/delivery_date_new', array('id' => 'deliveryDateForm')) ?>
                                            <div id="delivery_items_section"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    
                                    <div class="tab-pane" id="order_delivery">
                                        <?= form_open('sales/overall_delivery_date', array('id' => 'overAlldeliveryDateForm')) ?>
                                            <input type="hidden" name="delivery_date_sale_id" value="" id="delivery_date_sale_id" />
                                            <input type="hidden" name="full_delivery_date_status" value="9" id="full_delivery_date_status" />
                                            <div id="deliver_date_section">
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <label>Delivery Date</label>
                                                    <input type="date" name="full_delivery_date" value="" id="full_delivery_date" class="form-control today_date" />
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div style="float: right; padding-top: 30px;"><input type="submit" id="delivery" class="btn btn-success" value="Submit"></div>
                                                </div>
                                            </div>
                                            
                                            
                                        <?= form_close(); ?>
                                        </div>
                                    </div>
                                    
                                    <div class="tab-pane" id="bill_cancelled">
                                        <?= form_open('sales/bill_cancel_new'); ?>
                                            <input type="hidden" name="bill_cancel_sale_id" value="" id="bill_cancel_sale_id"  />
                                            <input type="hidden" name="bill_cancel_status" value="10" id="bill_cancel_status"  />
                                            <label>Bill Cancel Status</label>
                                            <select name="bill_cancell_done" id="bill_cancell_done" class="form-control">
                                                <option value="Cancelled">Bill Cancelled</option>
                                                <option value="Sales">Sale Bill</option>
                                            </select>
                                            <div style="float: right; padding-top: 30px;"><input type="submit" id="bill_cancel" class="btn btn-success" value="Submit"></div>
                                        <?= form_close(); ?>
                                    </div>
                                    
                                    <div class="tab-pane" id="history">
                                        <div id="history_section"></div>
                                    </div>
                                <!-- Content Ends Here -->
                                
                              </div>
                            </div> 
                            
                            <div class="clearfix"></div>
                            
                        </div>
                </div>
             </div>
            <div class="modal-footer" style="margin-top:0;">
                <button type="button" class="btn btn-danger pull-right" data-dismiss="modal"> <i class="fa fa-times"></i> <?=lang('close')?> </button>
            </div>
        </div>
    </div>
</div>
<!--************************************************************ END UNIT PROCESS STATUS *********************************************************** -->

                
                
<!--************************************************************ START MENU***********************************************************-->
<div class="modal fade" id="historymodal" 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 DC Status &nbsp;<b><span id="dc_number_id_hs"></span></b>&nbsp;<b>Due Date (<span id=due_date_hs></span>)</b> <span class="pull-right" style="padding-right: 16px;"><b>Pant Count : <span id="pant_count_hs"></span> | Shirt Count : <span id="shirt_count_hs"></span> </span> </b></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="history-view" class="active"><a href="#history1" data-toggle="tab">Unit History List</a></li>
                              </ul>
                            </div>
                    
                            <div class="col-md-9">
                              <div class="tab-content">
                                  <!-- Content Starts Here -->
                                    <div class="tab-pane active" id="history1">
                                      
                                        <div id="history_section1"></div>
                                    </div>
                                <!-- Content Ends Here -->
                                
                              </div>
                            </div> 
                            
                            <div class="clearfix"></div>
                            
                        </div>
                </div>
            </div>
            <div class="modal-footer" style="margin-top:0;">
                <button type="button" class="btn btn-danger pull-right" data-dismiss="modal"> <i class="fa fa-times"></i> <?=lang('close')?> </button>
            </div>
        </div>
    </div>
  </div>
<!--/************************************************************ END MENU STATUS ***********************************************************/ -->
      </div>
            
          
        </div>
    </div>
</div>

<!-- SMS Details Starts Here -->
<div class="modal" data-easein="flipYIn" id="smsModal" tabindex="-1" role="dialog" aria-labelledby="cModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header modal-primary">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
                <h4 class="modal-title" id="cModalLabel">
                    SMS Information
                </h4>
            </div>
            <div class="modal-body">
                <div id="c-alert" class="alert alert-danger" style="display:none;"></div>
                <div class="row">
                    <div class="col-xs-12">
                        <div id="sms_details"></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6"></div>
                    <div class="col-xs-6"></div>
                </div>

            </div>
            <div class="modal-footer" style="margin-top:0;">
                <button type="button" class="btn btn-default pull-right" data-dismiss="modal"> <?=lang('close')?> </button>
            </div>
        </div>
    </div>
</div>
<!-- SMS Details Ends Here -->


<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() {
            
            $('#payment_button').empty();
            //$('.today_date').val(todaydate);
                
            var sale_id = $(this).closest('tr').attr('id');
            var shirt_count = $(this).closest('tr').attr('shirt_count');
            console.log('Sale ID  : '+sale_id);
            console.log('Shirt Count  : '+shirt_count);
            
           /*$('.select2').select2();*/
            
            
		    /* ----- Get Sale Details Here ----- */
            $.ajax({
			type: "get",
			url: base_url + "sales/customerInfo",
			data : {sale_id:sale_id},
			dataType: "json",
			success: function(t) {
			  console.log('Due Date Unit:'+t['due_date']);
			 console.log('Total:'+t['total']);
			 console.log('Grand Total:'+t['grand_total']);
			 console.log('Unit Process Status:'+t['unit_process_status']);
			 console.log('Delivery Date:'+t['deliver_date']);
			 console.log('Get DC Number:'+t['hold_ref']);
			 
			 var delivery_date = "date="+t['deliver_date'];
			 var delivery_datee = t['deliver_date'];
			 console.log("delivery Date IS "+delivery_date);
			 $('#bill_cancell_done').val(t['bill_status']);
			 $('#full_delivery_date').val(t['deliver_date']);
			 $("#upstatus").val(t['unit_process_status']).trigger('change');
			 $('#dc_number_id').text("( DC Number:  "+t['hold_ref']+" )");
			 $('#due_date').text(t['due_date']);
			 console.log("Shirt Count"+t['shirt_count']);
			 if(t['shirt_count']==null){
			     var shirt_c='0';
			 }else{
			     var shirt_c=t['shirt_count'];
			 }
			 if(t['pant_count']==null){
			     var pant_c='0';
			 }else{
			     var pant_c=t['pant_count'];
			 }
			 $('#shirt_count').text(shirt_c);
			 $('#pant_count').text(pant_c);
			 
			 $('#dc_number').text(t['hold_ref']);
			 
			 var payment = '<a href="sales/add_payment/'+sale_id+'" data-toggle="ajax" id="pay"><span class="btn btn-info"><i class="fa fa-inr"></i> Add Payment</span></a> <a href="sales/add_payment/'+sale_id+'/'+delivery_datee+'" data-toggle="ajax" id="pay_delivery" style="display: none;"><span class="btn btn-info"><i class="fa fa-inr"></i> Add Payment</span></a>&nbsp;<b>Pant Count : <span id="pant_count">'+pant_c+'</span> | Shirt Count : <span id="shirt_count">'+shirt_c+'</span></span> </b>';
             // $('#payment_button').append('<a href="sales/add_payment/'+sale_id+'" data-toggle="ajax"><span class="btn btn-info"><i class="fa fa-inr"></i> Add Payment</span></a>');
            $('#payment_button').append(payment);
            
            
			}
            });	
            
            
            
            
            /* ----- 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,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 --- */
            

            
            /* ----- 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();
            
            /* ----- Get Sale All Delivery Items Here ----- */
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_unit_status_history');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#history_section').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#history_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);
            $('#delivery_date_sale_id').val(sale_id);
            $('#bill_cancel_sale_id').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)'){
                s=2;
                $("#step2").attr('class', 'active');
                $("#cutting_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Stitching Unit (Partial)'){
                s=3;
                /*$("#step3").attr('class', 'active');
                $("#cutting_fully").attr('class', 'tab-pane active');*/
                $("#step4").attr('class', 'active');
                $("#stitching_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='Stitching Unit (Partial)'){
                s=4;
                $("#step4").attr('class', 'active');
                $("#stitching_partial").attr('class', 'tab-pane active');
            }
            else if(upstatus=='All Units Are Ready'){
                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');
            }
            else if(upstatus=='Bill Cancelled'){
                s=10;
                $("#step10").attr('class', 'active');
                $("#bill_cancelled").attr('class', 'tab-pane active');
            }
			
			
            
            
            
            $(document).on('change','#upstatus', function() {
                
                $("#cutting_unit_com_date_div").hide();
                $("#stiching_unit_com_date_div").hide();
                
                
                var status = 0;
                user_name = $("#user_name").val();
                
                status=$('#upstatus').val();
                
                if(isEven(status))
                {
                    
                }
                else
                {
                    
                }
                
                
                
            });
            
           
            
            $('#stModal1').modal();
        });
        
    /*******************************starts history **************************************************/ 
     $(document).on('click', '.view-history', function() {
            
            console.log("history");
             var sale_id = $(this).attr('id');
            console.log("saleid"+sale_id);
            //$('.today_date').val(todaydate);
           // var sale_id = $(this).closest('tr').attr('id');
            var shirt_count_hs = $(this).closest('tr').attr('shirt_count_hs');
            console.log('Sale ID  : '+sale_id);
            console.log('Shirt Count  : '+shirt_count_hs);
            
            
		    /* ----- 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']);
			 
			 
			 $('#bill_cancell_done').val(t['bill_status']);
			 $('#full_delivery_date').val(t['deliver_date']);
			 $("#upstatus").val(t['unit_process_status']).trigger('change');
			 $('#dc_number_id_hs').text("( DC Number:  "+t['hold_ref']+" )");
			 $('#due_date_hs').text(t['due_date']);
			 console.log(t['shirt_count']);
			 if(t['shirt_count']==null){
			     var shirt_c='0';
			 }else{
			     var shirt_c=t['shirt_count'];
			 }
			 if(t['pant_count']==null){
			     var pant_c='0';
			 }else{
			     var pant_c=t['pant_count'];
			 }
			 $('#shirt_count_hs').text(shirt_c);
			 $('#pant_count_hs').text(pant_c);
			 
			 $('#dc_number').text(t['hold_ref']);
			}
            });	
            
            
           
            
            /* ----- Get Sale All Delivery Items Here ----- */
            $.ajax({
			type: "get",
			url: '<?=site_url('sales/get_all_unit_status_history');?>',
			data : {sale_id:sale_id},
			dataType: "text",
			success: function(t) {
			    $('#history_section1').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
            $('#history_section1').empty();
            
            
            
           
            
            $('#historymodal').modal()
        });
    /*******************************ends history **************************************************/ 
    });
    
    
</script>
<script>
        function deleteAssignedID(id,product_id){
                        
                var result = confirm("Confirm Want to delete this Assigned List?");
                if (result) {
                        $.ajax({
            			type: "get",
            			url: "<?=site_url("sales/deleteAssign");?>",
            			data : {id:id},
            			dataType: "text",
            			success: function(t) {
            			    $("#xyz_"+id).empty();
            			     var tot=0;
                      console.log("Ganesan #total_product_quantity_product_id_"+product_id);
                      console.log("Ganesan #total_product_quantity_id_"+id);
                      $(".qqty_"+product_id).each(function(){
                        tot+=Number($(this).val());
                        console.log(".qqty_"+product_id);
                      });
                      
                    
                        var total = $("#total_product_quantity_"+product_id).val();
                        console.log("loop:"+total);
                        console.log("Total Gane:"+total);
                        grand_balance=total-tot;
                        console.log("Grand Balance:"+grand_balance);
                        console.log("Total Assigned:"+tot);
                        $("#balance_qty_"+product_id).text(grand_balance);
                        
                        $("#qtty_"+product_id).val(grand_balance);
                        if($("#balance_qty_"+product_id).text() < 0){
                             $("#bal_total_qty_"+product_id).css({"color":"#FF0000"});
                             $("#cutting_update").prop("disabled", true);
                        }else{
                            $("#bal_total_qty_"+product_id).css({"color":"black"});
                            $("#cutting_update").prop("disabled", false);
                        }
            			    
            			    
            			},
            			error:function(err){
            			    alert(err);
            			}
            		    });
                
                
                     
                }
        }
        function deleteStitchingAssignedID(id,product_id){
                        
                var result = confirm("Confirm Want to delete this Assigned List?");
                if (result) {
                        $.ajax({
            			type: "get",
            			url: "<?=site_url("sales/deleteAssign");?>",
            			data : {id:id},
            			dataType: "text",
            			success: function(t) {
            			    $("#xyz_"+id).empty();
            			     var tot=0;
                      console.log("Ganesan #total_product_quantity_product_id_"+product_id);
                      console.log("Ganesan #total_product_quantity_id_"+id);
                      $(".s_qqty_"+product_id).each(function(){
                        tot+=Number($(this).val());
                        console.log(".s_qqty_"+product_id);
                      });
                      
                    
                        var total = $("#s_total_product_quantity_"+product_id).val();
                        console.log("loop:"+total);
                        console.log("Total Gane:"+total);
                        grand_balance=total-tot;
                        console.log("Grand Balance:"+grand_balance);
                        console.log("Total Assigned:"+tot);
                        $("#s_balance_qty_"+product_id).text(grand_balance);
                        
                        $("#s_qtty_"+product_id).val(grand_balance);
                        if($("#s_balance_qty_"+product_id).text() < 0){
                             $("#s_bal_total_qty_"+product_id).css({"color":"#FF0000"});
                             $("#stitching_update").prop("disabled", true);
                        }else{
                            $("#s_bal_total_qty_"+product_id).css({"color":"black"});
                            $("#stitching_update").prop("disabled", false);
                        }
            			    
            			    
            			},
            			error:function(err){
            			    alert(err);
            			}
            		    });
                
                
                     
                }
        }
        function deleteReadytAssoDeliveryAssignedID(id,product_id){
                        
                var result = confirm("Confirm Want to delete this Assigned List?");
                if (result) {
                        $.ajax({
            			type: "get",
            			url: "<?=site_url("sales/deleteAssign");?>",
            			data : {id:id},
            			dataType: "text",
            			success: function(t) {
            			    $("#xyz_"+id).empty();
            			     var tot=0;
                      console.log("Ganesan #total_product_quantity_product_id_"+product_id);
                      console.log("Ganesan #total_product_quantity_id_"+id);
                      
                      $(".r_qqty_"+product_id).each(function(){
                        tot+=Number($(this).val());
                      });
                      
                    
                         var total = $("#r_total_product_quantity_"+product_id).val();
                        console.log("Total Now Quantity:"+tot);
                        console.log("Total:"+tot);
                        grand_balance=total-tot;
                        console.log(grand_balance);
                        
                        $("#r_balance_qty_"+product_id).text(grand_balance);
                        $("#r_assigned_product_quantity_"+product_id).val(tot);
                        
                       if($("#r_balance_qty_"+product_id).text() < 0){
                             $("#r_bal_total_qty_"+product_id).css({"color":"#FF0000"});
                             $("#ready_to_delivery_update").prop("disabled", true);
                        }else{
                            $("#r_bal_total_qty_"+product_id).css({"color":"black"});
                            $("#ready_to_delivery_update").prop("disabled", false);
                        }
            			    
            			    
            			},
            			error:function(err){
            			    alert(err);
            			}
            		    });
                
                
                     
                }
        }
        function deleteDeliveryAssignedID(id,product_id){
                        
                var result = confirm("Confirm Want to delete this Assigned List?");
                if (result) {
                        $.ajax({
            			type: "get",
            			url: "<?=site_url("sales/deleteAssign");?>",
            			data : {id:id},
            			dataType: "text",
            			success: function(t) {
            			    $("#xyz_"+id).empty();
            			     var tot=0;
                      console.log("Ganesan #total_product_quantity_product_id_"+product_id);
                      console.log("Ganesan #total_product_quantity_id_"+id);
                      
                       $(".d_qqty_"+product_id).each(function(){
                        tot+=Number($(this).val());
                      });
                      
                    
                       var total = $("#d_total_product_quantity_"+product_id).val();
                        console.log("Total Now Quantity:"+tot);
                        grand_balance=total-tot;
                        
                        console.log(grand_balance);
                        $("#d_balance_qty_"+product_id).text(grand_balance);
                        $("#d_assigned_product_quantity_"+product_id).val(tot);
                        
                        $("#d_qtty_"+product_id).val(grand_balance);
                        if($("#d_balance_qty_"+product_id).text() < 0){
                             $("#d_bal_total_qty_"+product_id).css({"color":"#FF0000"});
                             $("#d_delivery_update").prop("disabled", true);
                        }else{
                            $("#d_bal_total_qty_"+product_id).css({"color":"black"});
                            $("#d_delivery_update").prop("disabled", false);
                        }
            			    
            			    
            			},
            			error:function(err){
            			    alert(err);
            			}
            		    });
                
                
                     
                }
        }
        
</script>
<script>
$(document).ready(function(){
  $("#measurement_status").click(function(){
        for(var c=1;c<=11;c++)
        {
            $('#step'+c).attr('class', '');
        }
        $("#measurement").attr('class', 'tab-pane');
        $("#cutting_partial").attr('class', 'tab-pane');
        $("#cutting_fully").attr('class', 'tab-pane');
        $("#stitching_partial").attr('class', 'tab-pane');
        $("#stitching_fully").attr('class', 'tab-pane');
        $("#ready_delivery_partial").attr('class', 'tab-pane');
        $("#ready_delivery").attr('class', 'tab-pane');
        $("#order_delivery_partial").attr('class', 'tab-pane');
        $("#order_delivery").attr('class', 'tab-pane');
        $("#bill_cancelled").attr('class', 'tab-pane');
        $("#history").attr('class', 'tab-pane');
        

  });
  $(".content").click(function(){
      
        for(var c=1;c<=11;c++)
        {
            $('#step'+c).attr('class', '');
        }
        $("#measurement").attr('class', 'tab-pane');
        $("#cutting_partial").attr('class', 'tab-pane');
        $("#cutting_fully").attr('class', 'tab-pane');
        $("#stitching_partial").attr('class', 'tab-pane');
        $("#stitching_fully").attr('class', 'tab-pane');
        $("#ready_delivery_partial").attr('class', 'tab-pane');
        $("#ready_delivery").attr('class', 'tab-pane');
        $("#order_delivery_partial").attr('class', 'tab-pane');
        $("#order_delivery").attr('class', 'tab-pane');
        $("#bill_cancelled").attr('class', 'tab-pane');
        $("#history").attr('class', 'tab-pane');
        
  });
});
</script>




<script type="text/javascript">
    $(document).ready(function() {
        $(document).on('click', '.sms', function() {
            console.log('SMS Inside Function Working:');
            var sms_sale_id = $(this).attr('id');
            console.log(sms_sale_id);

		    $.ajax({
			type: "get",
			url: '<?=site_url('sales/send_sms_form');?>',
			data : {sms_sale_id:sms_sale_id},
			dataType: "text",
			success: function(t) {
			    $("#smsModal").modal("show");
			    $('#sms_details').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#sms_details').empty();
        });
    });
</script>

<script>
    $(function() {
        $("#cuttingForm").on('submit', function(e) {
            e.preventDefault();
            var contactForm = $(this);

            $.ajax({
                url: contactForm.attr('action'),
                type: 'post',
                dataType: 'json',
                data: contactForm.serialize(),
                success: function(response){
                    console.log(response);
                    if(response.status == 'success') {
                        alert("Cutting Unit Assigned Completed");
                        /*$('#stModal1').modal().hide();*/
                        $('#stModal1').modal('toggle');
                        /*$('#stModal1').modal('toggle');*/
                        
                        
                        /*$('#stModal1').modal('hide');
                            $('#stModal1').modal();*/
                    }else
                    {
                        alert("Cutting Unit Assigned Error");
                    }

                }
            });
        });
        
        $("#stitchingForm").on('submit', function(e) {
            e.preventDefault();
            var contactForm = $(this);

            $.ajax({
                url: contactForm.attr('action'),
                type: 'post',
                dataType: 'json',
                data: contactForm.serialize(),
                success: function(response){
                    console.log(response);
                    if(response.status == 'success') {
                        alert("Stitching Unit Assigned Completed");
                        
                        $('#stModal1').modal('toggle');
                        
                        /*$('#stModal1').modal('hide');
                            $('#stModal1').modal();*/
                    }else
                    {
                        alert("Stitching Unit Assigned Error");
                    }

                }
            });
        });
        
        $("#readytoDeliveryForm").on('submit', function(e) {
            e.preventDefault();
            var contactForm = $(this);

            $.ajax({
                url: contactForm.attr('action'),
                type: 'post',
                dataType: 'json',
                data: contactForm.serialize(),
                success: function(response){
                    console.log(response);
                    if(response.status == 'success') {
                        alert("Ready to Delivery Completed");
                        
                        $('#stModal1').modal('toggle');
                        
                        /*$('#stModal1').modal('hide');
                            $('#stModal1').modal();*/
                    }else
                    {
                        alert("Ready to Delivery Error");
                    }

                }
            });
        });
        
        $("#deliveryDateForm").on('submit', function(e) {
            e.preventDefault();
            var contactForm = $(this);

            $.ajax({
                url: contactForm.attr('action'),
                type: 'post',
                dataType: 'json',
                data: contactForm.serialize(),
                success: function(response){
                    console.log(response);
                    if(response.status == 'success') {
                        alert("Delivery Date Product Assigned Completed");
                        
                        $('#pay').click();
                        
                        /*$('#stModal1').modal('hide');
                            $('#stModal1').modal();*/
                    }else
                    {
                        alert("Delivery Date Error");
                    }

                }
            });
        });
        
        $("#overAlldeliveryDateForm").on('submit', function(e) {
            e.preventDefault();
            var contactForm = $(this);

            $.ajax({
                url: contactForm.attr('action'),
                type: 'post',
                dataType: 'json',
                data: contactForm.serialize(),
                success: function(response){
                    console.log(response);
                    if(response.status == 'success') {
                        alert("Fully Delivery Date Assigned");
                        /*<a href="sales/add_payment/'+sale_id+'" data-toggle="ajax" id="pay"><span class="btn btn-info"><i class="fa fa-inr"></i> Add Payment</span></a>*/
                        $('#pay').click();
                        /*$('#stModal1').modal('hide');
                            $('#stModal1').modal();*/
                    }else
                    {
                        alert("Fully Delivery Date Error");
                    }

                }
            });
        });
        
        
        
        
    });
    
    /*function readyAllproductsClick(id,cutting_count,stitching_count){
        
        if(cutting_count==0 && stitching_count==0){
            alert("All Items are Zero");
            xyz();
            
        }*/
        
        /*var result = confirm("Confirm Want to Ready All Products !!! Id is"+id+"?");
        if (result) {
                $.ajax({
    			type: "get",
    			url: "<?=site_url("sales/readyAllProducts");?>",
    			data : {id:id},
    			dataType: "text",
    			success: function(t) {
    			    alert("Success - All Products are Ready to Delivery");
    			    $('#spn_'+id).text();
    			   },
    			error:function(err){
    			    alert(err);
    			}
    		    });
                }*/
   /* }*/
</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>
    /*table.display tbody tr:active td {
    background-color: #abe2eb !important;
    }*/
</style>
<!-- Working Script Here -->
<script>
$(document).on('click', 'table.display tbody tr', function () {
        $('table tr').css('background','#ffffff');
         $(this).css('background','#abe2eb');  
});
</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