ok

Mini Shell

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

<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); ?>
<style>
    tbody{
        font-size: 17px;
    }
</style>

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

        if (get('remove_spo')) {
            if (get('spoitems')) {
                remove('spoitems');
            }
            remove('remove_spo');
        }
        <?php
        if ($this->session->userdata('remove_spo')) {
            ?>
            if (get('spoitems')) {
                remove('spoitems');
            }
            <?php
            $this->tec->unset_data('remove_spo');
        }
        ?>
        function attach(x) {
            if (x !== null) {
                return '<a href="<?=base_url();?>uploads/'+x+'" target="_blank" class="btn btn-primary btn-block btn-xs"><i class="fa fa-chain"></i></a>';
            }
            return '';
        }
        
        function payment_status(ps) {
            if(ps == "Not Paid"){
                return "<div class='text-center'><span class='tip btn btn-danger btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'>"+ps+"</span></div>";
            }else if(ps == "Partial"){
                 return "<div class='text-center'><span class='tip btn btn-warning btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-spinner'></i> "+ps+"</span></div>";
            }else if(ps == "Fully Paid"){
                 return "<div class='text-center'><span class='tip btn btn-success btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-check'></i> "+ps+"</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 paid(p) {
            return "<div class='text-center'><span class='tip btn btn-success btn-sm' style='padding: 1px 10px 1px 10px;font-size: 14px;'><i class='fa fa-inr'></i> "+p+"</span></div>";
        }

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

            'ajax' : { url: '<?=site_url('purchases/get_purchases');?>', 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 ] } },
            { extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'csvHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': true,
            exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } },
            { extend: 'colvis', text: 'Columns'},
            ],
            "aaSorting": [[ 1, "desc" ]],
            "pageLength": 25,
            "columns": [
            { "data": "id", "visible": false },
            { "data": "date", "visible": false  },
            { "data": "purchase_date"},
            { "data": "supplier_name", "searchable": false, className: "text-center"},
            { "data": "reference", className: "text-center"},
            { "data": "total", "render": currencyFormat },
            { "data": "paid", "searchable": false, "render": paid },
            { "data": "balance", "searchable": false, "render": balance },
            { "data": "payment_status", className: "text-center", "searchable": false, "render": payment_status},
            { "data": "payment_done_dates", className: "text-center"},
            { "data": "Actions", "searchable": false, "orderable": false },
            { "data": "note" }
            /*{ "data": "attachment", "render": attach, "searchable": false, "orderable": false },*/
            ],
            "footerCallback": function (  tfoot, data, start, end, display ) {
                var api = this.api(), data;
                $(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)) );
            }

        });

        $('#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>

<style type="text/css">.table td:nth-child(3) { text-align: right; }</style>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <a href="purchases/add" class="btn btn-success btn-sm pull-right">Add Purchases</a>
                    <h3 class="box-title"><?= lang('list_results'); ?></h3>
                </div>
                <div class="box-body">
                    <div class="table-responsive">
                        <table id="purData" class="table table-striped table-bordered table-condensed table-hover" style="margin-bottom:5px;">
                            <thead>
                                <tr>
                                    <td colspan="12" 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 class="col-xs-2"><?= lang('date'); ?></th>
                                    <th class="col-xs-2"><?= lang('date'); ?></th>
                                    <th class="col-xs-2">Supplier&nbsp;Name</th>
                                    <th class="col-xs-1"><?= lang('reference'); ?></th>
                                    <th class="col-xs-1"><?= lang('total'); ?></th>
                                    <th class="col-xs-1">Paid</th>
                                    <th class="col-xs-1">Balance</th>
                                    <th class="col-xs-1">Payment Status</th>
                                    <th class="col-xs-1">Payment Date</th>
                                    <th style="width: 150px;">&nbsp;&nbsp;<?= lang('actions'); ?>&nbsp;&nbsp;</th>
                                    <th style="max-width:150px; width: 400px;" class="col-xs-9">
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?= lang('note'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </th>
                                    
                                    <!--<th style="width:25px; padding-right:5px;"><i class="fa fa-chain"></i></th>
                                    <th class="col-xs-1">Payment Type</th>-->
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="12" 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-2">Date</th>
                                    <th class="col-sm-2">Date</th>
                                    <th class="col-sm-3">Supplier</th>
                                    <th class="col-sm-1">Reference</th>
                                    <th class="col-xs-1"><?= lang('total'); ?></th>
                                    <th class="col-xs-1">Paid</th>
                                    <th class="col-xs-1">Balance</th>
                                    <th class="col-xs-1">Payment Status</th>
                                    <th class="col-xs-1">Payment Date</th>
                                    <th style="width:75px;"><?= lang('actions'); ?></th>
                                    <th style="max-width:150px; width: 400px;" class="col-xs-9"><input type="text" class="text_filter" placeholder="[<?= lang('note'); ?>]"></th>
                                    
                                    
                                    <!--<span class="datepickercon"><input type="text" class="text_filter datepicker" placeholder="[<?= lang('date'); ?>]"></span>
                                    <input type="text" class="text_filter" placeholder="[<?= lang('reference'); ?>]">
                                    <th class="col-xs-1">Payment Type</th>-->
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>

<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() {
        $('.datepicker').datetimepicker({format: 'YYYY-MM-DD', showClear: true, showClose: true, useCurrent: false, widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, widgetParent: $('.dataTable tfoot')});
    });
</script>

Zerion Mini Shell 1.0