时间:2018-06-22 13:52:25

标签: javascript ajax codeigniter datatable

我是使用Codeigniter的数据表的新手,我需要有关如何汇总该列的帮助,这样我才能获得报告的总销售额。

这是我的查看代码:

<div id="container" class="container">
    <h1>REPORTS</h1>
        <input id="dailySale" type="date" class="btn btn-default btn-sm" value="<?= date('Y-m-d'); ?>">
    <br>
        <td>Minimum age:</td>
        <td><input type="text" id="min" name="min"></td>
    </tr>
    <tr>
        <td>Maximum age:</td>
        <td><input type="text" id="max" name="max"></td>
    </tr>

<div class="table table-responsive">
    <table class="table table-bordered table-hover table-striped" id="datatable">
        <tbody>
            <thead>
                <tr>
                    <td>Sale ID</td>
                    <td>Customer Name</td>
                    <td>Laundry Type</td>
                    <td>Date Paid</td>
                    <td>Date Received</td>
                    <td>Amount</td>
                </tr>
            </thead>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td align="right">
                        <strong>TOTAL:</strong>
                    </td>
                    <td align="center">
                        <strong> <?= '₱ '?></strong>
                    </td>
                </tr>
        </tbody>

这是我的jscript代码

<script type="text/javascript">
    $(document).ready(function() {
    $('#datatable').DataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": {
            "url": "<?= base_url(); ?>index.php/reports_s/get_reports",
            "type": "POST"
        },
        "columns": [
            { "data": "sale_id" },
            { "data": "sale_customer_name" },
            { "data": "sale_type_desc" },
            { "data": "sale_date_paid" },
            { "data": "sale_laundry_received" },
            { "data": "sale_amount" }

        ]
    });
});
</script>

我还有一个问题,如何在数据表上过滤日期。

0 个答案:

没有答案