ok

Mini Shell

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

<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); ?>
<?php
$v = "?v=1";

if ($this->input->post('category')){
    $v .= "&category=".$this->input->post('category');
}
if ($this->input->post('sub_category')){
    $v .= "&sub_category=".$this->input->post('sub_category');
}
if ($this->input->post('start_date')){
    $v .= "&start_date=".$this->input->post('start_date');
}
if ($this->input->post('end_date')) {
    $v .= "&end_date=".$this->input->post('end_date');
}
?>
<script type="text/javascript">
    $(document).ready(function() {

        function attach(x) {
            if (x !== null) {
                return '<a href="<?=base_url();?>uploads/'+x+'" target="_blank" class="btn btn-primary btn-block"><i class="fa fa-chain"></i></a>';
            }
            return '';
        }

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

            'ajax' : { url: '<?=site_url('reports/get_incomes'.$v);?>', type: 'POST', "data": function ( d ) {
                d.<?=$this->security->get_csrf_token_name();?> = "<?=$this->security->get_csrf_hash()?>";
            }},
            "aaSorting": [[ 1, "desc" ]],
            "buttons": [
            { extend: 'copyHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ] } },
            { extend: 'excelHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ] } },
            { extend: 'csvHtml5', 'footer': true, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': true,
            exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ] } },
            { extend: 'colvis', text: 'Columns'},
            ],
            "columns": [
            { "data": "id", "visible": false },
            { "data": "date" },
            { "data": "amount", "className": "text-center", "render": currencyFormat },
            { "data": "category", "className": "text-center" },
            { "data": "sub_category", "className": "text-center"},
            
            /*{ "data": "reference" },*/
            /*{ "data": "note" },*/
            /*{ "data": "Actions", "searchable": false, "orderable": false }*/
            
            ],
            "footerCallback": function (  tfoot, data, start, end, display ) {
                var api = this.api(), data;
                $(api.column(2).footer()).html( cf(api.column(2).data().reduce( function (a, b) { return pf(a) + pf(b); }, 0)) );
            }

        });

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

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

    });
</script>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <a href="#" class="btn btn-default btn-sm toggle_form pull-right" style="margin-left: 6px;"><?= lang("show_hide"); ?></a>
                    <!--<a href="incomes/add_income" class="btn btn-success btn-sm pull-right">Add Income</a>-->
                    <!--<a href="mmcategories/sub_add" class="btn btn-info btn-sm pull-right" style="margin-right: 5px;">Add Categories</a>-->
                    <!--<span class="btn btn-info btn-sm pull-right" style="margin-right: 5px;" id="CategoryButton">Add Categories</span>-->
                    <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("incomes");?>

                            <div class="row">
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="category">Category</label>
                                        <select name="category" id="category" class="form-control select2" onchange="getsubCategory()" onkey="getsubCategory()" style="width:100%">
                                                <option value="">All Category</option>
                                                <?php $f=1; foreach($expense_category as $category){ ?>
                                                <option value="<?=$category->id?>"><?=$category->name?></option>
                                                <?php $f++; } ?>
                                        </select>
                                    </div>
                                </div>
                                
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="category">Sub Category</label>
                                        <select name="sub_category" id="sub_category" class="form-control" style="width:100%">
                                                <option value="0">All Sub Category</option>
                                        </select>
                                    </div>
                                </div>
                                
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="start_date"><?= lang("start_date"); ?></label>
                                        <?= form_input('start_date', set_value('start_date'), 'class="form-control datetimepicker" id="start_date"');?>
                                    </div>
                                </div>
                                
                                <div class="col-sm-3">
                                    <div class="form-group">
                                        <label class="control-label" for="end_date"><?= lang("end_date"); ?></label>
                                        <?= form_input('end_date', set_value('end_date'), 'class="form-control datetimepicker" id="end_date"');?>
                                    </div>
                                </div>
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-primary"><?= lang("submit"); ?></button>
                                </div>
                            </div>
                            <?= form_close();?>
                        </div>
                    </div>
                    <!-- Filter Section Ends Here -->
                    <div class="table-responsive">
                        <table id="expData" class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr class="active">
                                    <th style="max-width:30px;"><?= lang("id"); ?></th>
                                    <th class="col-xs-2"><?= lang("date"); ?></th>
                                    <th class="col-xs-1"><?= lang("amount"); ?></th>
                                    <th class="col-xs-4"><?= lang("accounts"); ?></th>
                                    <th class="col-xs-4"><?= lang("category"); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="9" 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"><span class="datepickercon"><input type="text" class="text_filter datepicker" placeholder="[<?= lang('date'); ?>]"></span></th>
                                    <th class="col-xs-1"><?= lang('amount'); ?></th>
                                    <th class="col-xs-1"><?= lang("accounts"); ?></th>
                                    <th class="col-xs-1"><?= lang('category'); ?></th>
                                </tr>
                                <tr>
                                    <td colspan="10" 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>
                            </tfoot>
                        </table>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>


<!-- Add Categories Starts Here -->
<div class="modal fade" id="AddCategories" 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">Add Categories</h4>
            </div>
            <?php echo form_open_multipart("mmcategories/sub_add", 'class="validation"'); ?>
            <div class="modal-body">
                <div class="form-group">
                    <?= lang('name', 'name'); ?>
                    <?= form_input('name', set_value('name'), 'class="form-control tip" id="name"  required="required"'); ?>
                </div>
                
                <div class="form-group">
                    <?= lang('Category', 'Category'); ?>
                    <br>
                    <select name="category_id" id="category_id" class="form-control select2" style="width: 100%;" required="required">
                        <?php $f=1; foreach($mm_category as $category){ ?>  
                            <option value="<?=$category->id?>"><?=$category->name?></option>
                        <?php $f++;} ?>
                    </select>
                </div>
                
                <div class="form-group">
                    <?= form_submit('add_mmsubcategories', lang('submit'), 'class="btn btn-primary"'); ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> <?= lang('close'); ?></button>
            </div>
            <?= form_close(); ?>
        </div>
    </div>
</div>
<script>
    $(document).on('click', '#CategoryButton', function() {
        $('#AddCategories').modal();
    });        
</script>
<!-- Add Categories Ends Here -->

<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')});
    });
    $(function () {
        $('.datetimepicker').datetimepicker({
            format: 'YYYY-MM-DD'
        });
    });
</script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#form').hide();
        $('.toggle_form').click(function(){
            $("#form").slideToggle();
            return false;
        });
    });
</script>

<script>
    function getsubCategory(){
          var category=$('#category').val();
          $.ajax({
			type: "get",
			url: '<?=site_url('purchases/get_filter_sub_category');?>',
			data : {category:category},
			dataType: "text",
			success: function(t) {
			    $('#sub_category').append(t);
			},
			error:function(err){
			    alert(err);
			}
		    });
		    $('#sub_category').empty();
    }
</script>

Zerion Mini Shell 1.0