Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function() {
- function format_date(oObj) {
- //var sValue = oObj.aData[oObj.iDataColumn];
- var aDate = oObj.split('-');
- <?php if(JS_DATE == 'dd-mm-yyyy') { ?>
- return aDate[2] + "-" + aDate[1] + "-" + aDate[0];
- <?php } elseif(JS_DATE == 'dd/mm/yyyy') { ?>
- return aDate[2] + "/" + aDate[1] + "/" + aDate[0];
- <?php } elseif(JS_DATE == 'mm/dd/yyyy') { ?>
- return aDate[1] + "/" + aDate[2] + "/" + aDate[0];
- <?php } elseif(JS_DATE == 'mm-dd-yyyy') { ?>
- return aDate[1] + "-" + aDate[2] + "-" + aDate[0];
- <?php } else { ?>
- return sValue;
- <?php } ?>
- }
- function currencyFormate(x) {
- var parts = x.toString().split(".");
- return parts[0].replace(/B(?=(d{3})+(?!d))/g, ".")+(parts[1] ? "," + parts[1] : ".00");
- }
- $('#fileData').dataTable( {
- "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
- "aaSorting": [[ 1, "desc" ]],
- "iDisplayLength": <?php echo ROWS_PER_PAGE; ?>,
- 'bProcessing' : true,
- 'bServerSide' : true,
- 'sAjaxSource' : '<?php echo base_url(); ?>index.php?module=entradaesaida&view=getdatatableajax',
- 'fnServerData': function(sSource, aoData, fnCallback, fnFooterCallback)
- {
- aoData.push( { "name": "<?php echo $this->security->get_csrf_token_name(); ?>", "value": "<?php echo $this->security->get_csrf_hash() ?>" } );
- $.ajax
- ({
- 'dataType': 'json',
- 'type' : 'POST',
- 'url' : sSource,
- 'data' : aoData,
- 'success' : fnCallback
- });
- },
- "oTableTools": {
- "sSwfPath": "assets/media/swf/copy_csv_xls_pdf.swf",
- "aButtons": [
- ]
- },
- "aoColumns": [
- { "mRender": format_date }, null, null, null, null,
- { "mRender": currencyFormate },
- ],
- "fnFooterCallback": function ( nRow, Entradas, iStart, iEnd, aiDisplay ) {
- var row_total = 0;
- for ( var i=0; i<Entradas.length; i++ )
- {
- row_total += parseFloat(Entradas[ aiDisplay[i] ][3]);
- }
- var nCells = nRow.getElementsByTagName('th');
- nCells[3].innerHTML = currencyFormate(parseFloat(row_total).toFixed(3));
- }
- } ).columnFilter({ aoColumns: [
- { type: "text", bRegex:true },
- { type: "text", bRegex:true },
- { type: "text", bRegex:true },
- { type: "text", bRegex:true },
- null, null, null, null
- ]});
- } );
- </script>
- <?php if($message) { echo "<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>" . $message . "</div>"; } ?>
- <?php if($success_message) { echo "<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>" . $success_message . "</div>"; } ?>
- <h3 class="title"><?php echo $page_title; ?></h3>
- <table id="fileData" class="table table-bordered table-hover table-striped table-condensed" style="margin-bottom: 5px;">
- <thead>
- <tr>
- <th><?php echo $this->lang->line("data"); ?></th>
- <th><?php echo $this->lang->line("clientes"); ?></th>
- <th><?php echo $this->lang->line("products"); ?></th>
- <th><?php echo $this->lang->line("entradas"); ?></th>
- <th><?php echo $this->lang->line("saidas"); ?></th>
- <th><?php echo $this->lang->line("saldoanterior"); ?></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td colspan="8" class="dataTables_empty"><?php echo $this->lang->line("loading_data"); ?></td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <th>[<?php echo $this->lang->line("data"); ?>]</th>
- <th>[<?php echo $this->lang->line("clientes"); ?>]</th>
- <th>[<?php echo $this->lang->line("products"); ?>]</th>
- <th>[<?php echo $this->lang->line("entradas"); ?>]</th>
- <th><?php echo $this->lang->line("saidas"); ?></th>
- <th><?php echo $this->lang->line("saldoanterior"); ?></th>
- </tr>
- </tfoot>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement