diff --git a/application/views/Report_cumulative.php b/application/views/Report_cumulative.php index 98acc2c5..3c3c932c 100755 --- a/application/views/Report_cumulative.php +++ b/application/views/Report_cumulative.php @@ -99,30 +99,32 @@ if(!empty($mms)) } $ab=$yearl; - foreach($cum as $rel) - { + foreach($cum as $index=>$rel) + { + ?> supplier_name;?> material_name;?> - tquantity); echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,round($rel->tquantity));?> - ttotal,2,'.',''); echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,number_format($rel->ttotal,2,'.',''));?> - mquantity); echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,round($rel->mquantity));?> - mtotal,2,'.',''); echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,number_format($rel->mtotal,2,'.',''));?> - quantity); echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,round($rel->quantity));?> - total,2,'.',''); echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,number_format($rel->total,2,'.',''));?> @@ -244,27 +246,115 @@ if(!empty($mms)) // Bootstrap datepicker // Set up your table $(document).ready(function() { - table = $('#cc').DataTable( { + var row= 1; + var col = 4; + //console.log($('table').find('tbody').find(tr:eq(1)).find(td:eq(4)).find(a).text()); + +console.log($('table tr:eq(' + row + ') td:eq(' + col + ')')); + $('#cc').DataTable( { + "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + "<'row'<'col-md-6'><'col-md-6'>>" + "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", +"search": { + "smart": false + }, + buttons: [ { - extend: 'excelHtml5', - footer: 'true', - //messageTop: $('h3').text(), - title: $('h3').text(), - exportOptions: { + extend: 'excelHtml5', + footer: 'true', + messageTop: $('h3').text(), + title: $('h3').text(), + exportOptions: { columns: ':visible' } }, - - 'colvis' - ] + + 'colvis' + ], + + "footerCallback": function ( row, data, start, end, display ) + { + + // console.log("start"+start); + // console.log("end"+end); + //console.log("display"+display); + //console.log(display); + + + var table = $('#cc').DataTable(); + var m_qsum =0; + var d_qsum= 0; + var d_valuesum= 0; + var m_valuesum= 0; + var y_quty=0; + var year_value = 0; + for(var j = 0;j<=display.length-1;j++) + { + // var data = table.row(display[j]).data(); + // var span = data[4]; + var count = display[j]; + var te= $('#m_quty'+count).text(); + var dte= $('#d_qty'+count).text(); + var dvte= $('#d_value'+count).text(); + var m_value= $('#m_value'+count).text(); + var y_qty= $('#y_qty'+count).text(); + var y_value = $('#y_value'+count).text(); + //console.log(te) + //sums(te); + m_qsum += +te; + d_qsum += +dte; + d_valuesum += +dvte; + m_valuesum += +m_value; + y_quty += +y_qty; + year_value += +y_value; + //console.log("inside"+sum); + } + //console.log(sum); + + + + + + + + + + + var api = this.api(), data; + var FinalTotal =parseInt(m_qsum); + var DailyFinalToatal=parseInt(d_qsum); + var DailyvalueFinalTotal=parseInt(d_valuesum); + var MonthlyValueFinal = parseInt(m_valuesum); + var yearlyFinalQty = parseInt(y_quty); + var yearlyValueFinal = parseInt(year_value); + + + $( api.column( 4 ).footer() ).html( FinalTotal.toFixed(2).bold() ); + $( api.column( 2 ).footer() ).html( DailyFinalToatal.toFixed(2).bold() ); + $( api.column( 3 ).footer() ).html( DailyvalueFinalTotal.toFixed(2).bold() ); + $( api.column( 5 ).footer() ).html( MonthlyValueFinal.toFixed(2).bold() ); + $( api.column( 6 ).footer() ).html( yearlyFinalQty.toFixed(2).bold() ); + $( api.column( 7 ).footer() ).html( yearlyValueFinal.toFixed(2).bold() ); + + } + + + } ); + + + + + + } ); + + + $('#mySelect').on('change',function(){ table