File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/MANCOM_VehicleSalesReport.php
Back
<link rel="stylesheet" type="text/css" href="./css/sidebarmain.css?v=<?php echo time(); ?>"/> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <?php include_once("../../../cfg/conn.php"); include ("../functions/users.php"); include_once("../functions/menuScript.php"); include ("../pages/loadergif.php"); //error_reporting(0); if(isset($_GET['hid'])){ $rtTotalTarget = 0; $flTotalTarget = 0; $opsTotalTarget = 0; $manTotalTarget = 0; $rtTotalActual = 0; $flTotalActual = 0; $opsTotalActual = 0; $manTotalActual = 0; $rtTotalRate = 0; $flTotalRate = 0; $opsTotalRate = 0; $manTotalRate = 0; $year = $_GET['y']; $dealCode = $_GET['d']; $userID = $_GET['uid']; $compCode = $_GET['c']; $manHeadercomID = $_GET['hid']; $dealerID = getDealerID($dealCode)[0]; $companyID = getCompanyID($compCode)[0]; //EDIT is for editing TARGET //ADD is for adding Actual //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== $roleID = userProfileID($userID); $moduleID = 38; $add =checkViewAccessM1024($roleID, $moduleID)[1]; $edit =checkViewAccessM1024($roleID, $moduleID)[2]; $delete =checkViewAccessM1024($roleID, $moduleID)[3]; $print =checkViewAccessM1024($roleID, $moduleID)[4]; $download =checkViewAccessM1024($roleID, $moduleID)[5]; echo "<input type='hidden' id='addAccess' value='$add'>"; echo "<input type='hidden' id='editAccess' value='$edit'>"; echo "<input type='hidden' id='deleteAccess' value='$delete'>"; echo "<input type='hidden' id='printAccess' value='$print'>"; echo "<input type='hidden' id='downloadAccess' value='$download'>"; echo "<input type='hidden' id='userID' value='$userID'>"; echo "<input type='hidden' id='companyID' value='$companyID'>"; if($add == 1){$addButton = '';}else{$addButton='Disabled';} if($edit == 1){$editButton = '';}else{$editButton='Disabled';} if($delete == 1){$deletButton = '';}else{$deletButton='Disabled';} if($print == 1){$printButton = '';}else{$printButton='Disabled';} if($download == 1){$downloadButton = '';}else{$downloadButton='Disabled';} if(checkViewAccessM1024($roleID, $moduleID)[0] == 0){ echo " <center><img src='./images/locked_out_icon.png' width='100' style='margin-top:100px'><img></center> "; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p>"; exit(); } //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== echo "<input type='hidden' id='userID' value='$userID'>"; echo "<input type='hidden' id='selectedRecord'>"; echo "<input type='hidden' id='companyID' value='$companyID'>"; echo "<input type='hidden' id='dealerID' value='$dealerID'>"; echo "<input type='hidden' id='manHeadercomID' value='$manHeadercomID'>"; ?><center> <div class='col text-left' style='width:90%'> <img src='../images/ahg_logo.png',10,5, 25,10></img> <h4 class='text-dark pb-3'>Vehicle Sales Report - <?php echo $_GET['c'];?></h4> </div> <table style="width:90%"> <tr> <td class='text-center bg-dark text-light p-4' rowspan="2" style='width:20%;border:1px solid gray'>MONTH.</td> <td class='text-center bg-dark text-light' colspan='3' style='width:20%;border:1px solid gray'>RETAIL</td> <td class='text-center bg-dark text-light' colspan='3' style='width:20%;border:1px solid gray'>FLEET</td> <td class='text-center bg-dark text-light' colspan='3' style='width:20%;border:1px solid gray'>TOTAL(OPSPLAN)</td> <td class='text-center bg-dark text-light' colspan='3' style='width:20%;border:1px solid gray'>PLANT TARGETS</td> </tr> <tr> <td class='bg-dark text-light text-center' style='border:1px solid gray'>TARGET</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>ACTUAL</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>RATE(%)</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>TARGET</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>ACTUAL</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>RATE(%)</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>TARGET</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>ACTUAL</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>RATE(%)</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>TARGET</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>ACTUAL</td> <td class='bg-dark text-light text-center' style='border:1px solid gray'>RATE(%)</td> </tr> <?php $months = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); foreach ($months as $value) { echo " <tr onclick=javascript:getData(this);'' style='width:100%'>"; $getD = "SELECT * FROM `mancom_data` WHERE `mancom_hdr_id`='$manHeadercomID' AND `month_id`='$value' AND `deleted`=0"; $qgetD = mysqli_query($conn,$getD); $gRow = mysqli_num_rows($qgetD); $rtJanTarget = "rtTarget".$value; $rtJanActual = "rtActual".$value; $rtJanRate = "rtRate".$value; $flJanTarget = "flTarget".$value; $flJanActual = "flActual".$value; $flJanRate = "flRate".$value; $opsJanTarget = "opsTarget".$value; $opsJanActual = "opsActual".$value; $opsJanRate = "opsRate".$value; $manJanTarget = "manTarget".$value; $manJanActual = "manActual".$value; $manJanRate = "manRate".$value; if($gRow > 0){ while($row=mysqli_fetch_array($qgetD)){ $rtTotalTarget = $rtTotalTarget + $row['retail_target_sales']; $flTotalTarget = $flTotalTarget + $row['fleet_target_sales']; $opsTotalTarget = $opsTotalTarget + $row['ops_total_target']; $manTotalTarget = $manTotalTarget + $row['plant_target_sales']; $manTotalActual = $manTotalActual + $row['plant_actual_sales']; $opsTotalActual = $opsTotalActual + $row['ops_total_sales']; $rtTotalActual = $rtTotalActual + $row['retail_actual_sales']; $flTotalActual = $flTotalActual + $row['fleet_actual_sales']; $temRate = 0; $temRate = str_replace("%","", $row['retail_target_vs_actual_rate']); if(is_numeric($temRate)){ }else{ $temRate = 0; } $rtTotalRate = ($rtTotalRate + $temRate); $temRate=0; $temRate = str_replace("%","", $row['fleet_target_vs_actual']); if(is_numeric($temRate)){ }else{ $temRate=0; } $flTotalRate = $flTotalRate + $temRate; $temRate=0; $temRate = str_replace("%","", $row['ops_target_vs_actual']); if(is_numeric($temRate)){ }else{ $temRate=0; } $opsTotalRate = $opsTotalRate + $temRate; $temRate=0; $temRate = str_replace("%","", $row['plant_target_vs_actual']); if(is_numeric($temRate)){ }else{ $temRate = 0; } $manTotalRate = $manTotalRate + $temRate; echo "<td class='border p-2'>".$row['month_id']."</td>"; echo "<td class='border p-2 text-center'>"; echo $row['retail_target_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['retail_actual_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['retail_target_vs_actual_rate']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['fleet_target_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['fleet_actual_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['fleet_target_vs_actual']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['ops_total_target']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['ops_total_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['ops_target_vs_actual']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['plant_target_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['plant_actual_sales']; echo "</td>"; echo "<td class='border p-2 text-center'>"; echo $row['plant_target_vs_actual']; echo "</td>"; } }else{ $sql="INSERT INTO mancom_data( `id`, `mancom_hdr_id`, `comp_id`, `deal_id`, `year`, `month_id`, `retail_actual_sales`, `retail_target_sales`, `retail_target_vs_actual_rate`, `fleet_actual_sales`, `fleet_target_sales`, `fleet_target_vs_actual`, `ops_total_sales`, `ops_total_target`, `ops_target_vs_actual`, `plant_target_sales`, `plant_actual_sales`, `plant_target_vs_actual`, `added_by` ) VALUES( '', '$manHeadercomID', '$companyID', '$dealerID', '$year', '$value', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '$userID' )"; if($conn->query($sql) === TRUE) { //echo "New record created successfully"; } else { //echo "Error: " . $sql . "<br>" . $conn->error; } } echo "</tr>"; } $rtTotalRate = number_format(($rtTotalRate / 12),2,'.','')."%"; $flTotalRate = number_format(($flTotalRate / 12),2,'.','')."%"; $opsTotalRate = number_format(($opsTotalRate / 12),2,'.','')."%"; $manTotalRate = number_format(($manTotalRate / 12),2,'.','')."%"; echo "<tr>"; echo "<td class='p-2 text-center text-right bg-dark text-light font-weight-bold'>TOTAL</td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $rtTotalTarget </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $rtTotalActual </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $rtTotalRate </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $flTotalTarget </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $flTotalActual </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $flTotalRate </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $opsTotalTarget </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $opsTotalActual </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $opsTotalRate </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $manTotalTarget </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $manTotalActual </td>"; echo "<td class='p-2 text-center text-left font-weight-bold bg-dark text-light'> $manTotalRate </td>"; echo "</tr>"; ?> </table> <!DOCTYPE HTML> <html> <head> <script> function reportLoader() { var div = document.getElementById("reportLoader"); if (div.style.display == 'none') { div.style.display = ''; } else { div.style.display = 'none' } } window.onload = function() { reportLoader(); CanvasJS.addColorSet("greenShades", [//colorSet Array "#067FA0", "#FC9543", "#FCAA48", "#051BFC", "#EF8E0A", "#D30798", "#FD93CB" ]); CanvasJS.addColorSet("greenShadesB", [//colorSet Array "#078515", "#D4A7F8", "#D30798", "#137A08", "#EF8E0A", "#FCAA48", "#70EEF9", "#FD93CB" ]); CanvasJS.addColorSet("greenShadesC", [//colorSet Array "#137A08", "#70EEF9", "#FD93CB", "#EF8E0A", "#70EEF9", "#051BFC", "#137A08" ]); CanvasJS.addColorSet("greenShadesD", [//colorSet Array "#EF8E0A", "#347CF1", "#D30798", "#F9A8D3", "#890C67", "#70EEF9", "#FD93CB" ]); var chart = new CanvasJS.Chart("chartContainer", { theme: "light2", // "light1", "light2", "dark1", "dark2" exportEnabled: true, animationEnabled: true, colorSet: "greenShades", title: { text: "RETAIL - Target Vs Actual" }, data: [{ type: "pie", startAngle: 25, toolTipContent: "<b>{label}</b>: {y}%", showInLegend: "true", legendText: "{label}", indexLabelFontSize: 16, indexLabel: "{label} {y}%", dataPoints: [ { y: <?php $myActual = ($rtTotalActual / $rtTotalTarget) * 100; echo number_format($myActual,2,'.',''); ?>, label: "ACTUAL" }, { y: <?php echo number_format((100 - $myActual),2,'.',''); ?>, label: "VARIANCE" } ] }] }); chart.render(); var chart = new CanvasJS.Chart("chartContainerB", { theme: "light2", // "light1", "light2", "dark1", "dark2" exportEnabled: true, animationEnabled: true, colorSet: "greenShadesB", title: { text: "FLEET - Target Vs Actual" }, data: [{ type: "pie", startAngle: 25, toolTipContent: "<b>{label}</b>: {y}%", showInLegend: "true", legendText: "{label}", indexLabelFontSize: 16, indexLabel: "{label} {y}%", dataPoints: [ { y: <?php $myActual = ($flTotalActual / $flTotalTarget) * 100; echo number_format($myActual,2,'.',''); ?>, label: "ACTUAL" }, { y: <?php echo number_format((100 - $myActual),2,'.',''); ?>, label: "VARIANCE" } ] }] }); chart.render(); var chart = new CanvasJS.Chart("chartContainerC", { theme: "light2", // "light1", "light2", "dark1", "dark2" exportEnabled: true, animationEnabled: true, colorSet: "greenShadesC", title: { text: "OPSPLAN - Target Vs Actual" }, data: [{ type: "pie", startAngle: 25, toolTipContent: "<b>{label}</b>: {y}%", showInLegend: "true", legendText: "{label}", indexLabelFontSize: 16, indexLabel: "{label} {y}%", dataPoints: [ { y: <?php $myActual = ($opsTotalActual / $opsTotalTarget) * 100; echo number_format($myActual,2,'.',''); ?>, label: "ACTUAL" }, { y: <?php echo number_format((100 - $myActual),2,'.',''); ?>, label: "VARIANCE" } ] }] }); chart.render(); var chart = new CanvasJS.Chart("chartContainerD", { theme: "light2", // "light1", "light2", "dark1", "dark2" exportEnabled: true, animationEnabled: true, colorSet: "greenShadesD", title: { text: "PLANT - Target Vs Actual" }, data: [{ type: "pie", startAngle: 25, toolTipContent: "<b>{label}</b>: {y}%", showInLegend: "true", legendText: "{label}", indexLabelFontSize: 16, indexLabel: "{label} {y}%", dataPoints: [ { y: <?php $myActual = ($manTotalActual / $manTotalTarget) * 100; echo number_format($myActual,2,'.',''); ?>, label: "ACTUAL" }, { y: <?php echo number_format((100 - $myActual),2,'.',''); ?>, label: "VARIANCE" } ] }] }); chart.render(); var chart = new CanvasJS.Chart("chartContainerE", { theme: "light2", // "light1", "light2", "dark1", "dark2" exportEnabled: true, animationEnabled: true, colorSet: "greenShadesD", title: { text: "Vehicle Sales - per Month" }, data: [{ type: "column", startAngle: 25, toolTipContent: "<b>{label}</b>: {y}", showInLegend: "true", legendText: "Monthly Sales", indexLabelFontSize: 16, indexLabel: "{y}", dataPoints: [ <?php $modelMonth = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); foreach ($modelMonth as $myMonth){ $tVal=0; $sq="SELECT SUM(`retail_actual_sales`) AS 'salesCount' FROM mancom_data WHERE `month_id`='$myMonth' AND `mancom_hdr_id`='$manHeadercomID'"; $qsQ = mysqli_query($conn,$sq); while($sq=mysqli_fetch_array($qsQ)){ $tVal = $sq['salesCount']; } if($tVal==''){ $tVal=0; } echo "{ y:$tVal, label: '$myMonth'},"; } ?> ] }] }); chart.render(); reportLoader(); } </script> </head> <body> <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script> </body> </html> <div style='width:90%;padding-top:50px;padding-bottom:50px'> <div class='float-left position-relative mb-5 p-5 col-xl-6 col-lg-6 col-md-12 col-sm-12' > <div id="chartContainer" style="position:relative;height: 370px; width: 100%;margin-bottom:100px"></div> </div> <div class='float-left position-relative mb-5 p-5 col-xl-6 col-lg-6 col-md-12 col-sm-12'> <div id="chartContainerB" style="position:relative;height: 370px; width: 100%;margin-bottom:100px"></div> </div> <div class='float-left position-relative mb-5 p-5 col-xl-6 col-lg-6 col-md-12 col-sm-12'> <div id="chartContainerC" style="position:relative;height: 370px; width: 100%;margin-bottom:100px"></div> </div> <div class='float-left position-relative mb-5 p-5 col-xl-6 col-lg-6 col-md-12 col-sm-12'> <div id="chartContainerD" style="position:relative;height: 370px; width: 100%;margin-bottom:100px"></div> </div> <div class='float-left position-relative mb-5 p-5 col-xl-12 col-lg-12 col-md-12 col-sm-12'> <div id="chartContainerE" style="position:relative;height: 370px; width: 100%;margin-bottom:100px"></div> </div> </div></center> <?php $conn->close(); } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings