<?php
$cs = Yii::app()->getClientScript();
$cs->registerScript("loadGraphdetail", '
    $(document).ready(function() {
     var data_plot="";
        var table_id ="#tbl_graph_invoice_monthly";   
        var month=$("#invoice_month").val();
        var table = $(table_id).DataTable({
            //scrollY         : "380px",
           // scrollX         : "true",
           // scrollCollapse  : true,
            //pageLength      : 50,
            paging:   false,
            ordering: false,
            info:     false,
            processing: true,
            ajax: {
                url: "' . Yii::app()->createUrl('dashboard/GetMonthlyInvoice') . '",
                type: "POST",
                data:{month:month},
                cache : false,
                complete:function(response){
                    data_plot=JSON.parse(response.responseText).plot;                
               }                            
            },
            "columnDefs": [            
            {
                "targets": [ 4 ],
                "visible": false
            },
            ],
            
            serverSide:     true,
            bFilter: false,
            fixedColumns:   true,
			processing: true,
            fixedHeader: {
                headerOffset: $("header.main").outerHeight()
            },
//            rowCallback: function ( row, data){          
//                $("td", row).css("background-color",""+data[3]+"");
//              
//            },        
        });
    });', CClientScript::POS_HEAD);

$cs->registerScript("loadgraph", "    
    $(document).ready(function() {
    setTimeout(function() {
            var canvas1 =document.getElementById('current_month_invoice');
        Chart.defaults.global.responsive = true;
        var ctx = canvas1.getContext('2d');
        var pieChart = new Chart(ctx).Pie(".$plot.");
          }, 300);  
});", CClientScript::POS_HEAD); 

//print_r($plot);
?>
<div class="clearfix"></div>
<br>
<div class="clearfix">
    <div class="col-lg-4" data-initial-class="col-lg-4" id="pieChartParent">
        <section class="panel">
<!--            <header class="panel-heading">
                  Lead- Lead Owner
            </header>-->
            <div class="panel-body text-center">
                <div class="clearfix canvas-holder" id="lead_container_1">
                    <canvas id="current_month_invoice" width="400" height="400"></canvas>
                </div>
            </div>
        </section>
    </div>
    <div class="col-lg-8">
        <input type="hidden" id="invoice_mnth" name="invoice_mnth" value="<?php echo $currentmonth; ?>"/>
        <div class="table-responsive">
        <table class="table table-hover table-bordered personal-task" id="tbl_graph_invoice_monthly">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Invoice No</th>
                    <th>Invoice Date</th>
                    <th>Amount</th>
                    <th></th>
                </tr>
            </thead>
            
        </table>
    </div>
    </div>
