<script src="chart/charts.js"></script>
<script src="chart/threed.js"></script>
<script src="chart/exporting.js"></script>
<script src="chart/export-data.js"></script>
<script src="chart/accessbility.js"></script>
<style>
    #saleschart {
  height: 400px; 
}

.highcharts-figure, .highcharts-data-table table {
  min-width: 310px; 
  max-width: 800px;
  margin: 1em auto;
}

.highcharts-data-table table {
  font-family: Verdana, sans-serif;
  border-collapse: collapse;
  border: 1px solid #EBEBEB;
  margin: 10px auto;
  text-align: center;
  width: 100%;
  max-width: 500px;
}
.highcharts-data-table caption {
  padding: 1em 0;
  font-size: 1.2em;
  color: #555;
}
.highcharts-data-table th {
  font-weight: 600;
  padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
  padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
  background: #f8f8f8;
}
.highcharts-data-table tr:hover {
  background: #f1f7ff;
}

</style>
<?php 
include "financial_year_calculation.php";
$accountyear    = $financialYearStart."-".$financialYearEnd;
$year=date('Y');
$month =date('m');
$last_month=date("m",strtotime("-1 month"));
$purchase_balance = mysqli_query($connect,"select ifnull(sum(netweight),0)as purchase from purchasedetails where status!='deleted' && date between '$year-$month-01' and '$year-$month-30' && financialyear='$accountyear'");
$dis_purchase = mysqli_fetch_assoc($purchase_balance);
$purchase_value = $dis_purchase['purchase'];
$sales_balance = mysqli_query($connect,"select ifnull(sum(netweight),0)as sales from second_transaction where status!='deleted' && date between '$year-$month-01' and '$year-$month-30' && financialyear='$accountyear'");
$dis_sales = mysqli_fetch_assoc($sales_balance);
$sales_value = $dis_sales['sales'];
?>
<input type="hidden" id="purchaseAmount" value="<?php echo $purchase_value ?>">
<input type="hidden" id="saleAmount" value="<?php echo $sales_value ?>">
<figure class="highcharts-figure">
    <div id="saleschart"></div>  
   
</figure>
<script>
var salesValue = document.getElementById("saleAmount").value;
var namea = "Sales";
var purchaseValue = document.getElementById("purchaseAmount").value;
var nameb = "Purchase";

Highcharts.chart('saleschart', {
  colors:["rgba(28, 101, 140,0.8)","rgba(238, 153, 160,0.7)","rgba(236, 179, 101,0.7)"],
    chart: {
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 45
        }
    },
    title: {
        text: 'Process-Flow '
    },
    subtitle: {
        text: 'In Tonn'
    },
    plotOptions: {
        pie: {
            innerSize: 100,
            depth: 45
        }
    },
    series: [{
        name: 'In Tonn',
        data: [
            [namea, Number(salesValue/1000)],
            [nameb, Number(purchaseValue/1000)]
                       
        ]
    }]
});
</script>