JezK
Edit File: dashboard.php
<?php // include("./app/checkSession.php"); session_start(); // if(!isset($_SESSION['name']) || (isset($_SESSION['name']) && $_SESSION['name']=="")){ // echo "<script>window.location.href='index.php'</script>"; // } include("header.php"); $warehouses=$adminObj->getAllWarehouesesWithStatus(); $closedQuotations=$adminObj->getClosedQuotations(); $acceptedQuotations=$adminObj->getAcceptedQuotations(); $getallQuotations=$adminObj->getAllQuotations(); $getInvoicesCount=$adminObj->getcustoInvoices(); $getCountOfMtransactions=$adminObj->getCountOfMtransactions(); $acceptedQuotationCount=$acceptedQuotations ?count($acceptedQuotations):0; // $acceptedQuotationCount= 3; $closedQuotationsCount =$closedQuotations ?count($closedQuotations):0; $getallQuotationsCount=$getallQuotations ?count($getallQuotations):0; // print_r($acceptedQuotations); // exit; // $acceptedQuotationCount=$acceptedQuotations ?count($acceptedQuotations):0; //~ echo "<pre>"; //~ print_r($res2); $activeWarehouses=0; $pendingWarehouses=0; $rejecetedWarehouses=0; foreach($warehouses as $warehouse) { if($warehouse['warehouse_status']==0) { $pendingWarehouses++; } else if($warehouse['warehouse_status']==1) { $activeWarehouses++; } else if($warehouse['warehouse_status']==2) { $rejecetedWarehouses++; } } $mondayqid=0; $tuesdayqid=0; $wednesdayqid=0; $thursdayqid=0; $fridayqid=0; $saturdayqid=0; $sundayqid=0; $closedIds=$closedQuotations ? $closedQuotations:[]; foreach($closedIds as $closed){ $closed['modify_dt']; $day=date('l', strtotime($closed['modify_dt'])); if($day=='Monday'){ $mondayqid++; } if($day=='Tuesday'){ $tuesdayqid++; } if($day=='Wednesday'){ $wednesdayqid++; } if($day=='Thursday'){ $thursdayqid++; } if($day=='Friday'){ $fridayqid++; } if($day=='Saturday'){ $saturdayqid++; } if($day=='Sunday'){ $sundayqid++; } } $mondayAcpQid=0; $tuesdayAcpQid=0; $wednesdayAcpQid=0; $thursdayAcpQid=0; $fridayAcpQid=0; $saturdayAcpQid=0; $sundayAcpQid=0; $mondayCldQid=0; $closedIds=$acceptedQuotations ? $acceptedQuotations:[]; foreach($closedIds as $closed){ $closed['modify_dt']; $day=date('l', strtotime($closed['modify_dt'])); if($day=='Monday'){ $mondayAcpQid++; } if($day=='Tuesday'){ $tuesdayAcpQid++; } if($day=='Wednesday'){ $wednesdayAcpQid++; } if($day=='Thursday'){ $thursdayAcpQid++; } if($day=='Friday'){ $fridayAcpQid++; } if($day=='Saturday'){ $saturdayAcpQid++; } if($day=='Sunday'){ $sundayAcpQid++; } } $mondayQid=0; $tuesdayQid=0; $wednesdayQid=0; $thursdayQid=0; $fridayQid=0; $saturdayQid=0; $sundayQid=0; $closedIds=$getallQuotations ? $getallQuotations:[]; foreach($closedIds as $closed){ $closed['modify_dt']; $day=date('l', strtotime($closed['modify_dt'])); if($day=='Monday'){ $mondayQid++; } if($day=='Tuesday'){ $tuesdayQid++; } if($day=='Wednesday'){ $wednesdayQid++; } if($day=='Thursday'){ $thursdayQid++; } if($day=='Friday'){ $fridayQid++; } if($day=='Saturday'){ $saturdayQid++; } if($day=='Sunday'){ $sundayQid++; } } ?> <h1 class="font-small px-4"><?php echo $lang['DASHBOARD']; ?></h1> <div class="row m-0 mt-5 d-flex h-auto px-3"> <a href="materialtransactionhome.php" class="col-lg-4 col-md-6 col-sm-12 resBox"> <div class="content h-100 d-flex flex-column justify-content-center pl-4 pr-4"> <div class="row"> <div class="col-sm-5 pt-3 pb-3"> <img src="images/dashboardMateriatransactions.png" class="img-top"> </div> <div class="col-sm-7 d-flex flex-column text-right justify-content-center position-rightBlock"> <h2 class="text-dark heading-h2"><?php echo $lang['MATERIAL_TRANSACTION']; ?></h2> <h2 class="orange-text"><?php echo $getCountOfMtransactions; ?></h2> <small class="text-dark"><?php echo $lang['ALL_TRANSACTION'];?></small> </div> </div> <div class="border-top"> <p class="text-blue font-weight-bold"><?php echo $lang['VIEW']; ?></p> </div> </div> </a> <a href="adminInvoice.php" class="col-lg-4 col-md-6 col-sm-12 resBox"> <div class="content h-100 d-flex flex-column justify-content-center pl-4 pr-4"> <div class="row"> <div class="col-sm-5 pt-3 pb-3"> <img src="images/dashboardInvoices.png" class="img-top"> </div> <div class="col-sm-7 d-flex flex-column text-right justify-content-center position-rightBlock"> <h2 class="text-dark heading-h2"><?php echo $lang['INVOICES'] ?></h2> <h2 class="orange-text"><?php echo $getInvoicesCount; ?></h2> <small class="text-dark"><?php echo $lang['TOTAL_INVOICE'] ?></small> </div> </div> <div class="border-top"> <p class="text-blue font-weight-bold"><?php echo $lang['VIEW']; ?></p> </div> </div> </a> <a href="onhandstockwarehouseview.php" class="col-lg-4 col-md-6 col-sm-12 mt-lg-0 mt-md-3 resBox"> <div class="content h-100 d-flex flex-column justify-content-center pl-4 pr-4"> <div class="row"> <div class="col-sm-7 d-flex justify-content-center align-items-center"> <h2 class="text-dark heading-h2"><?php echo $lang['ON_HAND_STOCK']?></h2> </div> <div class="col-sm-5 pt-3 pb-3"> <img src="images/dashboardOnhandStock.png"> </div> </div> <div class="border-top"> <p class="text-blue font-weight-bold"><?php echo $lang['VIEW']; ?></p> </div> </div> </a> </div> <div class="row m-0 mt-3 mb-5 px-3"> <div class="col-sm-8"> <div class="content"> <div class="row d-mf-flex justify-content-between p-3"> <h2 class="font-small font-weight-bold"><?php echo $lang['QUOTATIONS'];?></h2> <div class="customMargin"> <a href="quotations.php?type=2"><button id="bg-green" class="font-weight-bold"><img src="images/dashboardlist1.png"> <?php echo $lang['ACCEPTED_LIST'] ?></button></a> <a href="quotations.php?type=1"><button id="bg-blue" class="font-weight-bold"><img src="images/dashboardlist1.png"> <?php echo $lang['SUBMITTED_LIST'] ?></button></a> <a href="quotations.php?type=3"><button id="bg-grey" class="font-weight-bold customMargin"><img src="images/dashboardlist1.png"> <?php echo $lang['QUOTATIONS_LIST']; ?></button></a> </div> </div> <div id="chartContainer" style="height: 400px; width: 100%;"></div> <div class="d-md-flex justify-content-end mb-2"> <span class="gray-text"><?php echo $lang['TOTAL_ACCEPTED'] ?> : <?php echo $acceptedQuotationCount; ?></span> <span class="gray-text"><?php echo $lang['TOTAL_SUBMITTED'];?> : <?php echo $closedQuotationsCount; ?></span> <span class="gray-text"><?php echo $lang['TOTAL_QUOTATIONS']?> : <?php echo $getallQuotationsCount; ?></span> </div> </div> </div> <a href="shipmentstatus.php" class="col-sm-4"> <div class="content d-flex flex-column justify-content-center pl-4 pr-4 mt-2"> <div class="row"> <div class="col-sm-7 d-flex justify-content-center align-items-center"> <h2 class="text-dark heading-h2 font-weight-bold"><?php echo $lang['SHIPMENT_STATUS'] ?></h2> </div> <div class="col-sm-5 pt-3 pb-3"> <img src="images/dashboardShipmentStatus.png"> </div> </div> <div class="border-top"> <p class="text-blue font-weight-bold"><?php echo $lang['VIEW']; ?></p> </div> </div> <div class="content mt-2 pb-4"> <div id="piechartContainer" style="height: 300px; width: 100%;"></div> </div> </a> </div> <!-- footer --> <?php include("footer.php"); ?> <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script> <!-- <script src="js/canvasjs.min.js"></script> --> <script> window.onload = function() { CanvasJS.addColorSet("customColors", [ //colorSet Array "#76db75", "#ff9d0b", "#ff574c", ]); var piechart = new CanvasJS.Chart("piechartContainer", { colorSet: "customColors", theme: "light1", animationEnabled: true, legend: { fontSize: 14, horizontalAlign: "right", verticalAlign: "bottom", }, data: [{ type: "pie", indexLabel: "{y}", startAngle: 120, indexLabelPlacement: "inside", indexLabelFontColor: "#fff", indexLabelFontSize: 14, indexLabelFontWeight: "bolder", showInLegend: true, legendMarkerType: "circle", legendText: "{label}", dataPoints: [{ label: "<?php echo $lang['ACTIVE_WAREHOUSE'] ?>", y: <?php echo $activeWarehouses; ?> }, { label: "<?php echo $lang['PENDING_WAREHOUSE'] ?>", y: <?php echo $pendingWarehouses; ?> }, { label: "<?php echo $lang['REJECTED_WAREHOUSE'] ?>", y: <?php echo $rejecetedWarehouses; ?> } ] }] }); piechart.render(); var chart = new CanvasJS.Chart("chartContainer", { animationEnabled: true, axisX: { gridColor: "#dedede", gridThickness: 1 }, axisY: { gridColor: "#dedede" }, toolTip: { shared: true, content:"{legendText}:{y}" }, legend: { fontSize: 14, horizontalAlign: "right", verticalAlign: "bottom" }, data: [{ type: "spline", legendText: "<?php echo $lang['ACCEPTED'] ?>", indexLabel: "{y}", indexLabelBackgroundColor: "#7bdc79", indexLabelFontColor: "#fff", indexLabelMaxWidth: 50, legendMarkerBorderColor: "#7bdc79", legendMarkerBorderThickness: 9, lineColor: "#7bdc79", markerColor: "#7bdc79", showInLegend: true, legendMarkerType: "circle", dataPoints: [{ label: "Mon", y: <?php echo $mondayAcpQid?> }, { label: "Tue", y: <?php echo $tuesdayAcpQid?> }, { label: "Wed", y: <?php echo $wednesdayAcpQid?> }, { label: "Thur", y: <?php echo $thursdayAcpQid?> }, { label: "Fri", y: <?php echo $fridayAcpQid?> }, { label: "Sat", y: <?php echo $saturdayAcpQid?> }, { label: "Sun", y: <?php echo $sundayAcpQid?> } ] }, { type: "spline", legendText: "<?php echo $lang['SUBMITTED'] ?>", indexLabel: "{y}", indexLabelBackgroundColor: "#1f58c9", indexLabelFontColor: "#fff", indexLabelMaxWidth: 50, legendMarkerBorderColor: "#1f58c9", legendMarkerBorderThickness: 9, showInLegend: true, lineColor: "#1f58c9", markerColor: "#1f58c9", legendMarkerType: "circle", dataPoints: [{ label: "Mon", y: <?php echo $mondayqid; ?> }, { label: "Tue", y: <?php echo $tuesdayqid; ?> }, { label: "Wed", y: <?php echo $wednesdayqid; ?> }, { label: "Thur", y: <?php echo $thursdayqid; ?> }, { label: "Fri", y: <?php echo $fridayqid; ?> }, { label: "Sat", y: <?php echo $saturdayqid; ?> }, { label: "Sun", y: <?php echo $sundayqid; ?> } ] }, { type: "spline", legendText: "<?php echo $lang['QUOTATIONS'] ?>", indexLabel: "{y}", indexLabelBackgroundColor: "#ff574c", indexLabelFontColor: "#fff", indexLabelMaxWidth: 50, legendMarkerBorderColor: "#ff574c", legendMarkerBorderThickness: 9, lineColor: "#ff574c", markerColor: "#ff574c", showInLegend: true, legendMarkerType: "circle", dataPoints: [{ label: "Mon", y: <?php echo $mondayQid; ?> }, { label: "Tue", y: <?php echo $tuesdayQid; ?> }, { label: "Wed", y: <?php echo $wednesdayQid; ?> }, { label: "Thur", y: <?php echo $thursdayQid; ?> }, { label: "Fri", y: <?php echo $fridayQid; ?> }, { label: "Sat", y: <?php echo $saturdayQid; ?> }, { label: "Sun", y: <?php echo $sundayQid; ?> } ] } ] }); chart.render(); } $('a.canvasjs-chart-credit').load(function(){ $(this).attr('id', 'canvas_id'); }) </script> <style> .canvasjs-chart-credit#canvas_id{ color:transparent !important; display: none !important; } @media(max-width:767px){ a.resBox { margin-bottom: 30px; margin-top: 10px; } .customMargin{ margin-top: 5px; } } </style>