<?php
use \koolreport\drilldown\LegacyDrillDown;
use \koolreport\processes\CopyColumn;
use \koolreport\processes\DateTimeFormat;
use \koolreport\widgets\google\ColumnChart;
use \koolreport\widgets\koolphp\Table;
?> <div class="report-content">
<div class="text-center">
<h1>Volume Sales from Dec'20 to as on date.</h1>
<p class="lead">
Please Single click on the column of chart/table to go further down on details.
</p>
</div>
<?php
LegacyDrillDown::create(array(
"name"=>"saleDrillDown",
"title"=>"Volume Sale Report",
"btnBack"=>true,
"themeBase"=>"bs4",
"dataSource"=>(
$this->src('automaker')
->query("select ZONE,LOCNM,NAME,SCNAME,DISTT,STATE,sum(isnull(MCRTOTCALLS,0)) MCRTOTCALLS,sum(isnull(TOTACTCALLS,0)) TOTACTCALLS,
sum(isnull(PLANVOL,0)) PLANVOL,sum(isnull(INVVOLFORTHEDAY,0)) INVVOLFORTHEDAY,sum(isnull(STKRTNDAY,0)) STKRTNDAY,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) NETVOLDAY,
sum(isnull(NETAPPRVOL,0)) NETAPPRVOL,sum(isnull(PDBVOL,0)) PDBVOL FROM volsale where not loc='13' group by ZONE,LOCNM,STATE,DISTT,NAME,SCNAME")
),
"calculate"=>array(
"sum"=>"MCRTOTCALLS,TOTACTCALLS,PLANVOL,INVVOLFORTHEDAY,STKRTNDAY,NETVOLDAY,NETAPPRVOL,PDBVOL"
),
"levels"=>array(
array(
"groupBy"=>"ZONE", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(ColumnChart::class,array(
"title"=>"Zone Wise Net Volume Sale",
"columns"=>array("ZONE","NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Qty",
)),
//"colorScheme"=>array("#3b9b00"),
)),
"title"=>"All Zone",
),
array(
"groupBy"=>"LOCNM", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(ColumnChart::class,array(
"title"=>"Office Wise Net Volume Sale",
"columns"=>array("LOCNM","NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Qty",
)),
"colorScheme"=>array("#3b9b00"),
)),
"title"=>function($params)
{
return "Zone - ".$params["ZONE"];
},
),
array(
"groupBy"=>"STATE", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(ColumnChart::class,array(
"title"=>"State Wise Net Volume Sale",
"columns"=>array("STATE","NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Qty",
)),
"colorScheme"=>array("#00ff40"),
)),
"title"=>function($params)
{
return "Office - ".$params["LOCNM"];
},
),
array(
"groupBy"=>"DISTT", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(ColumnChart::class,array(
"title"=>"District Wise Net Volume Sale",
"columns"=>array("DISTT","NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Qty",
)),
"colorScheme"=>array("#3b9b00"),
)),
"title"=>function($params)
{
return "State - ".$params["STATE"];
},
),
array(
"groupBy"=>"NAME", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(Table::class,array(
"responsive"=>true,
"showFooter"=>true,
"columns"=>array(
"NAME"=>array(
"label"=>"EXECUTIVE NAME",
"footerText"=>"<b>Total:</b>",
),
"MCRTOTCALLS"=>array(
"type"=>"number",
"label"=>"Calls Planned",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"TOTACTCALLS"=>array(
"type"=>"number",
"label"=>"Actual Visits",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"PLANVOL"=>array(
"type"=>"number",
"label"=>"Planned Volume",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"INVVOLFORTHEDAY"=>array(
"type"=>"number",
"label"=>"Invoice",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"STKRTNDAY"=>array(
"type"=>"number",
"label"=>"Stock Returns",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
/*"formatValue"=>function($value,$row)
{
if ($value > 0){
//$color = $value>20?"#718c00":"#e83e8c";
$color = "#e9ffe8";
return "<span style='background-color:$color'>".number_format($value)."</span>";
}
if ($row['INVVOLFORTHEDAY'] > 0){
$color = "#e9ffe8";
return "<span style='background-color:$color'>".number_format($value)."</span>";
}
} */
),
"NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Net Sale",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"NETAPPRVOL"=>array(
"type"=>"number",
"label"=>"Books Pending",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"PDBVOL"=>array(
"type"=>"number",
"label"=>"PDB",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
),
"cssClass"=>array(
"table"=>"table table-hover",
/*"td"=>function($value,$row)
{
if ($row['INVVOLFORTHEDAY'] > 0){
$color = "#e9ffe8";
return "<span style='background-color:$color'>".number_format($value)."</span>";
}
} */
)
//"colorScheme"=>array("#af17b5"),
)),
"title"=>function($params)
{
return "District - ".$params["DISTT"];
},
),
array(
"groupBy"=>"SCNAME", --------------- (need to sort this array on NETVOLDAY)---------------------------
"widget"=>array(Table::class,array(
"responsive"=>true,
"showFooter"=>true,
"columns"=>array(
"SCNAME"=>array(
"label"=>"SCHOOL NAME",
"footerText"=>"<b>Total:</b>",
),
"MCRTOTCALLS"=>array(
"type"=>"number",
"label"=>"Calls Planned",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"TOTACTCALLS"=>array(
"type"=>"number",
"label"=>"Actual Visits",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"PLANVOL"=>array(
"type"=>"number",
"label"=>"Planned Volume",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"INVVOLFORTHEDAY"=>array(
"type"=>"number",
"label"=>"Invoice",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"STKRTNDAY"=>array(
"type"=>"number",
"label"=>"Stock Returns",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"NETVOLDAY"=>array(
"type"=>"number",
"label"=>"Net Sale",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"NETAPPRVOL"=>array(
"type"=>"number",
"label"=>"Books Pending",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
"PDBVOL"=>array(
"type"=>"number",
"label"=>"PDB",
"cssStyle"=>"text-align:right",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
),
),
"cssClass"=>array(
"table"=>"table table-hover"
)
/*"paging"=>array(
"pageSize"=>10,
"pageIndex"=>0,
),*/
)),
"title"=>function($params)
{
return "Executive - ".$params["NAME"];
},
),
),
));
?>
</div>