<?php include 'header.php' ?>

<style>

.card-body {
/*background-image: url(shubh-labh.jpg);
background-repeat: no-repeat;
background-position:center;*/

}


</style> 


 <!-- Page wrapper  -->
        <div class="page-wrapper ">
            <!-- Bread crumb -->
            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-primary">Dashboard</h3> </div>
                <div class="col-md-7 align-self-center">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
                        <li class="breadcrumb-item active">Dashboard</li>
                    </ol>
                </div>
            </div>
            <!-- End Bread crumb -->
            <!-- Container fluid  -->
            <div class="container-fluid">
			
                <!-- Start Page Content -->
                <div class="row">
                    <!-- <div class="col-12"> -->
                        <div class="card">
                            <div class="card-body" style="height:1000px;  width: 1180px">Welcome To Admin Area.
                               
<?php
    $sql_purchase="SELECT sum(pur_qty) as pur_qty FROM tbl_purchase_details where session_login_id = '".$_SESSION['login_id']."'";
    $res_purchase=mysql_query($sql_purchase);
    $count=mysql_fetch_assoc($res_purchase);
    $pur_qty=$count["pur_qty"]; 
 
    $sql_acc="SELECT sum(Dr_Amt) as Dr_Amt from tbl_account where sales_type='Purchase' and session_login_id = '".$_SESSION['login_id']."'";
    $res_acc=mysql_query($sql_acc);
    $pur_amt=mysql_fetch_assoc($res_acc);
    $debit_amt=$pur_amt["Dr_Amt"];

?>
<?php
    $sql_purchase_r="SELECT sum(ret_qty) as ret_qty FROM tbl_purchase_return_details where session_login_id = '".$_SESSION['login_id']."'";
    $res_purchase_r=mysql_query($sql_purchase_r);
    $count_r=mysql_fetch_assoc($res_purchase_r);
    $ret_qty=$count_r["ret_qty"];

    $sql_acc_r="SELECT sum(Cr_Amt) as Cr_Amt from tbl_account where sales_type='Purchase Return' and session_login_id = '".$_SESSION['login_id']."'";
    $res_acc_r=mysql_query($sql_acc_r);
    $pur_r_amt=mysql_fetch_assoc($res_acc_r);
    $debit_amt_r=$pur_r_amt["Cr_Amt"]
  

?>
<?php
    $sql_sale="SELECT sum(qty) as qty FROM tbl_sales_detail where session_login_id = '".$_SESSION['login_id']."'";
    $res_sale=mysql_query($sql_sale);
    $count_s=mysql_fetch_assoc($res_sale);
    $sale_qty=$count_s["qty"]; 

  $sql_acc="SELECT sum(Cr_Amt) as Cr_Amt from tbl_account where sales_type='Sales' and session_login_id = '".$_SESSION['login_id']."'";
    $res_acc=mysql_query($sql_acc);
    $sal_amt=mysql_fetch_assoc($res_acc);
    $credit_amt=$sal_amt["Cr_Amt"];

  $sql_sale_r="SELECT sum(ret_qty) as ret_qty FROM tbl_sales_return_details where session_login_id = '".$_SESSION['login_id']."'";
    $res_sale_r=mysql_query($sql_sale_r);
    $count_s=mysql_fetch_assoc($res_sale_r);
    $sale_qty_r=$count_s["ret_qty"]; 

  $sql_acc1="SELECT sum(Dr_Amt) as Dr_Amt from tbl_account where sales_type='Sales Return' and session_login_id = '".$_SESSION['login_id']."'";
    $res_acc1=mysql_query($sql_acc1);
    $sal_amt1=mysql_fetch_assoc($res_acc1);
    $credit_amt1=$sal_amt1["Dr_Amt"];
?>
                                    <?php
 
$dataPointsas2 = array(
    array("label"=> "Purchase Qty", "y"=> $pur_qty),
    array("label"=> "Pur Total Amt", "y"=>  $debit_amt),
    array("label"=> "Sale Qty", "y"=> $sale_qty),
    array("label"=> "Sale Total Amt", "y"=> $credit_amt),
    array("label"=> "Pur Ret Qty", "y"=> $ret_qty),
    array("label"=> "Pur Ret Amt", "y"=> $debit_amt_r),
    array("label"=> "Sale Ret Qty", "y"=> $sale_qty_r),
    array("label"=> "Sale Ret Amt", "y"=> $credit_amt1),
);
    
?>
  
<div style="height: 570px; width: 80%; border: 1px solid black">
 Rakesh
    <br>
<div id="chartContainer2" >
   
</div>
</div>
<?php 
       $sql_supplier="SELECT * ,  count(supplier_id) , sum(pur_qty) as pur_qty from view_pur_masdet where session_login_id = '".$_SESSION['login_id']."' order by supplier_id";
       $res_supplier=mysql_query($sql_supplier);

?>

<?php
$abc=date('d-m-Y');
$curr_date  = $objIms->DateToInt($abc);

 $sql = "SELECT * FROM view_pur_masdet where stampdate = '$curr_date' and session_login_id = '".$_SESSION['login_id']."'  ORDER BY `item_id` ASC";
 $res=mysql_query($sql);
 while($row=mysql_fetch_assoc($res)){

 }
?>
<?php
 
$dataPoints1 = array( 
    array("label"=>"Industrial", "y"=>51.7),
    array("label"=>"Transportation", "y"=>26.6),
    array("label"=>"Residential", "y"=>13.9),
    array("label"=>"Commercial", "y"=>7.8)
)
 
?>
<div style="height: 370px; width: 80%; border: 1px solid black">
 Rakesh
 <br>
<div id="Container1" >
   
</div>
</div>
                                </div>
                            </div>
                    </div>
                </div>
                <!-- End PAge Content -->
            </div>
            <!-- End Container fluid  -->
<?php include 'footer.php' ?>
<script src="../js/canvasjs.min.js"></script>
<script>
window.onload = function () {
$(document).ready(function() {
    setTimeout(function() {
        $("#output").append(" one ");
            }, 1000);

var chart2 = new CanvasJS.Chart("chartContainer2", {
    animationEnabled: true,
    exportEnabled: true,
    title:{
        text: "Total Purchase And Sale With Return Summary"
    },
    subtitles: [{
        text: "Currency Used: (%)"
    }],
    data: [{
        type: "pie",
        showInLegend: "true",
        legendText: "{label}",
        indexLabelFontSize: 16,
        indexLabel: "{label} - #percent%",
        yValueFormatString: "Rs#,##0",
        dataPoints: <?php echo json_encode($dataPointsas2, JSON_NUMERIC_CHECK); ?>
    }]
});
chart2.render();
 });;
}
</script>
<script>
window.onload = function() {
$(document).ready(function() {
    setTimeout(function() {
        $("#output").append(" two ");
    }, 999);

 
var chart1 =  new CanvasJS.Chart("Container1", {
    theme: "theme2",
    animationEnabled: "true",
    title: {
        text: "World Energy Consumption by Sector - 2012"
    },
    data: [{
        type: "pie",
        indexLabel: "{label}",
        yValueFormatString: "#,##0.00\"%\"",
      //  indexLabelPlacement: "inside",
        indexLabelFontColor: "#36454F",
        indexLabelFontSize: 18,
        indexLabelFontWeight: "bolder",
        showInLegend: "true",
        // legendText: "{label}",
        dataPoints1: <?php echo json_encode($dataPoints1, JSON_NUMERIC_CHECK); ?>
    }]
});
chart1.render();
});​
}
</script>
