Dear Team, Thanks for the solutions and I do have any other query that is I have implemented a column chart in the dashboard but there are some of the conditions that need to satisfy.
Count of inquiries, appointments, visits, and consultations based on individual branches need to be shown in the chart.
I need to join data from different tables like branches from table branch, inquiries from table customer inquiries.
appointments, visits, and consultations from table consultations.
So, can you please help me with how to join the three tables(branch, customer inquiries, consultations) and need to show the count data of inquiries, appointments, visits, and consultations based on individual branches.
I have used only one table in my code but i need to join 3 tables as specified above please help me on how join them.
Branchdata.php
<?php
use \koolreport\dashboard\widgets\google\BarChart;
//use \koolreport\dashboard\fields\Date;
use \koolreport\dashboard\fields\Text;
use \koolreport\dashboard\fields\Number;
class branchdata extends BarChart
{
protected function onCreated()
{
$this
->title("Registrations by individual branch")
->options([
"isStacked"=>true
]);
//->colorScheme(["#000","#444","#888"])
//->height("320px");
}
protected function dataSource()
{
return AutoMaker::table("tblcustomerenquiries")
->groupBy("custBranchId")
->select("custBranchId")
->sum("custRegistrationId")->alias("registrations")
->sum("custEnquiryId")->alias("inquires");
}
protected function fields()
{
return [
Number::create("custBranchId"),
Number::create("registrations"),
Number::create("inquires"),
];
}
}