diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 3e1bb695..0feda3cf 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -1171,6 +1171,7 @@ join ip_products on ip_products.product_id= T_FinalProduct_History.ProductCode where ProductCode=? and Transactiondate >= ? and Transactiondate <= ?'; $query = $this->db->query($subQuery,array($product_id,$starting_date,$end_date)); + //print_r($this->db->last_query()); return $query->result_array(); } diff --git a/application/views/Report_cumulative_year_inward.php b/application/views/Report_cumulative_year_inward.php index 3228b0b2..206fafb9 100755 --- a/application/views/Report_cumulative_year_inward.php +++ b/application/views/Report_cumulative_year_inward.php @@ -198,12 +198,42 @@ $(document).ready(function() { }, 'colvis' - ] + ], + "footerCallback": function ( row, data, start, end, display ) { + var api = this.api(), data; + + // Remove the formatting to get integer data for summation + var intVal = function ( i ) { + return typeof i === 'string' ? + parseFloat(i.replace(/[^0.00-9.00]+/g,"")*1) : + typeof i === 'number' ? + parseFloat(i) : 0; + }; + + TotalQTY = api + .column( 2, { search:'applied' } ) + .data() + .reduce( function (a, b) { + return intVal(a) + intVal(b); + }, 0 ); + + $( api.column( 2 ).footer() ).html( TotalQTY.toFixed().bold() ); + + TotalVALUE = api + .column( 3, { search:'applied' } ) + .data() + .reduce( function (a, b) { + return intVal(a) + intVal(b); + }, 0 ); + + $( api.column( 3 ).footer() ).html( TotalVALUE.toFixed(2).bold() ); + + } } ); } ); $('#mySelect').on('change',function(){ - table + table .column(4) .search(this.value) .draw(); @@ -211,6 +241,9 @@ $(document).ready(function() { + + +