KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Issue with select option with radio list #1968

Closed Abhishek opened this topic on on Mar 13, 2021 - 42 comments

Abhishek commented on Mar 13, 2021

Dear Team, I have implemented the radio list functionality in my report and when I am selecting the option only the single option is getting selected. What I mean is actually I have used 3 radio buttons and when i select the 2nd radio button I am getting the the value of the first radio button and if I select second radio button also the value of the first radio button is getting displayed.

So please consider my request because I am pending with 3 report which i need to submit to my client but unable to do because i am facing issue with this radio list functionality.

Please help me.

KoolReport commented on Mar 15, 2021

Could you please show details of your code for radiolist

Abhishek commented on Mar 15, 2021

Dear Team, Here is follow code of the view page and the below is the script code for the radio list. Please help me

<?php 
    use \koolreport\inputs\DateTimePicker;
    use \koolreport\widgets\koolphp\Table;
	use \koolreport\inputs\RadioList;
?>
<style>
    .calendar.left .daterangepicker_input,
    .calendar.right .daterangepicker_input {
        display: none;
    }
</style>

<div class="report-content">
    <div class="text-center">
        <h1>Not Visited List</h1>
        <p class="lead">
            
        </p>
    </div>
	
    <form method="post">
	<div class="col-md-6 form-group" style="margin:auto 25%">
		<?php
                RadioList::create(array(
                    "name"=>"radioList",
					"display"=>"horizontal",
					//"dataStore"=>$this->dataStore("result"),
                    "data"=>array(
					  "CallingDate"=>"CallingDate",
					  "NextCallingDate"=>"NextCallingDate",
					  "LastCallingDate"=>"LastCallingDate",
					),  
					
                ));
                ?>
		</div>
        <div class="row" style="text-align:center;">
		
            <div class="col-md-3 form-group" style="margin:auto 37%">
                <strong>Select Date</strong>
                <?php
                        DateTimePicker::create(array(
                            "name"=>"startDatePicker",
                            "maxDate"=>"@endDatePicker",
                            "format"=>"DD/MM/YYYY"
                        ));
                        ?>
            </div>                                   
        </div>
        <div class="form-group" style="margin-top:30px;text-align:center;">
            <button class="btn btn-lg btn-primary" name="submit">Submit</button>
        </div>  <!--- value="Get Selected Values" -->                
        <!-- <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre> -->
    </form>

	<?php

    if($this->dataStore("result")->countData()>0)
    {
        Table::create(array(
            "dataStore"=>$this->dataStore("result"),
            "cssClass"=>array(
                "table"=>"table table-bordered"
            ),
            "columns"=>array(
                "custEnquiryId"=>array(
                    "label"=>"#EID",
                ),
                "custName"=>array(
                    "label"=>"Patitent Name",
					"formatValue"=>function($value,$row){
						$custPhoneNumber = $row['custPhoneNumber'];

						   if($row)
						   {
							   return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
                
                ),
				"custPlace"=>array(
				    "label"=>"City",
				),
		   //"custPhoneNumber"=>array(
				   // "label"=>"Number",
				//),
				"custServiceFor"=>array(
				    "label"=>"Treatment For",
				),
				"custAppointmentDateIND"=>array(
				      "label"=>"Appointment Date"
				),
				"custStatusDateIND"=>array(
				      "label"=>"CallBack Date"
				),
				"custAge"=>array(
				   "label"=>"Age"
				),
				"custVistId"=>array(
				   "label"=>"VisitID",
				   "formatValue"=>function($VisitID){
					   if($VisitID=='0')
					   {
						   return "null";
					   }
					   return $VisitID;
				   }
				),
				"custRemarks"=>array(
				   "label"=>"Remarks"
				),
				"callType"=>array(
				    "label"=>"CallType",
						"formatValue"=>function($CallType){

						   if($CallType=='1')
						   {
							   return"Incoming Call";
						   }elseif($CallType=='2'){
							   return"Outgoing Call";
						   }elseif($CallType=='3'){
							   return"Walkin";
						   }
						   return $CallType;
					   }
				),
				
				"replyName"=>array(
				   "label"=>"Reply"
				),
				"statusName"=>array(
				   "label"=>"Status"
				),
				
				
            ),
			 "paging"=>array(
            "pageSize"=>10
			),		
        ));
    }
    else
    {
    ?>
      <!--  <div class="alert alert-warning">
            <i class="glyphicon glyphicon-info-sign"></i> Sorry, we found no data
        </div> -->
    <?php    
    }
    ?>
	<?php
	/*
	DataTables::create(array(
	"dataSource"=>$this->dataStore("tblcustomerenquiries"),
        "options"=>array(
            "searching"=>true,
        ),
        "searchOnEnter" => true,
        "searchMode" => "or",
	));*/
	?>
</div>
<script>
<?php
if(isset($_POST['submit'])){
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
?>
//<script>
//alert('ddd');
//</script>
<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate"){
	echo '1';
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->$query=("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='12-03-2021'")
));
}
elseif($selected_val=="NextCallingDate"){
	echo '2';
/*$query="SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,
DATE_FORMAT(ce.custCallBackDate, '%d-%m-%Y') AS custCallBackDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCallBackDate, '%d-%m-%Y')='". $start ."'";*/
}
elseif($selected_val=="LastCallingDate"){
	echo '3';
/*$query="SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='". $start ."'";*/
}
}
?>
</script>
Abhishek commented on Mar 15, 2021

Please help me

Abhishek commented on Mar 16, 2021

Dear Team Please help me how to make the table responsive.

Abhishek commented on Mar 16, 2021

View code of the above image

<?php 
    use \koolreport\inputs\DateTimePicker;
    use \koolreport\widgets\koolphp\Table;
	use \koolreport\inputs\RadioList;
?>
<style>
    .calendar.left .daterangepicker_input,
    .calendar.right .daterangepicker_input {
        display: none;
    }
</style>

<div class="report-content">
    <div class="text-center">
        <h1>Not Visited List</h1>
        <p class="lead">
            
        </p>
    </div>
	
    <form method="post">
	<div class="col-md-6 form-group" style="margin:auto 25%">
		<?php
                RadioList::create(array(
                    "name"=>"radioList",
					"display"=>"horizontal",
					//"dataStore"=>$this->dataStore("result"),
                    "data"=>array(
					  "CallingDate"=>"CallingDate",
					  "NextCallingDate"=>"NextCallingDate",
					  "LastCallingDate"=>"LastCallingDate",
					),  		
                ));
                ?>
		</div>
        <div class="row" style="text-align:center;">
		
            <div class="col-md-3 form-group" style="margin:auto 37%">
                <strong>Select Date</strong>
                <?php
                        DateTimePicker::create(array(
                            "name"=>"startDatePicker",
                            "maxDate"=>"@endDatePicker",
                            "format"=>"DD-MM-YYYY"
                        ));
                        ?>
            </div>                                   
        </div>
        <div class="form-group" style="margin-top:30px;text-align:center;">
            <button class="btn btn-lg btn-primary" name="submit">Submit</button>
        </div>  <!--- value="Get Selected Values" -->                
        <!-- <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre> -->
    </form>
	<?php
    if($this->dataStore("result")->countData()>0)
    {
        Table::create(array(
            "dataStore"=>$this->dataStore("result"),
            "cssClass"=>array(
                "table"=>"table table-bordered"
            ),
            "columns"=>array(
                "custEnquiryId"=>array(
                    "label"=>"#EID",
                ),
                "custName"=>array(
                    "label"=>"Patitent Name",
					"formatValue"=>function($value,$row){
						$custPhoneNumber = $row['custPhoneNumber'];

						   if($row)
						   {
							   return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
               
                ),
				"custPlace"=>array(
				    "label"=>"City",
				),
		   //"custPhoneNumber"=>array(
				   // "label"=>"Number",
				//),
				"custServiceFor"=>array(
				    "label"=>"Treatment For",
				),
				"custAppointmentDateIND"=>array(
				      "label"=>"Appointment Date"
				),
				"custStatusDateIND"=>array(
				      "label"=>"CallBack Date"
				),
				"custAge"=>array(
				   "label"=>"Age"
				),
				"custVistId"=>array(
				   "label"=>"VisitID",
				   "formatValue"=>function($VisitID){
					   if($VisitID=='0')
					   {
						   return "null";
					   }
					   return $VisitID;
				   }
				),
				"custRemarks"=>array(
				   "label"=>"Remarks"
				),
				"callType"=>array(
				    "label"=>"CallType",
						"formatValue"=>function($CallType){

						   if($CallType=='1')
						   {
							   return"Incoming Call";
						   }elseif($CallType=='2'){
							   return"Outgoing Call";
						   }elseif($CallType=='3'){
							   return"Walkin";
						   }
						   return $CallType;
					   }
				),
				
				"replyName"=>array(
				   "label"=>"Reply"
				),
				"statusName"=>array(
				   "label"=>"Status"
				),
				
				
            ),
			 "paging"=>array(
            "pageSize"=>10
			),		
        ));
    }
    else
    {
    ?>
      <!--  <div class="alert alert-warning">
            <i class="glyphicon glyphicon-info-sign"></i> Sorry, we found no data
        </div> -->
    <?php    
    }
    ?>
	<?php
	/*
	DataTables::create(array(
	"dataSource"=>$this->dataStore("tblcustomerenquiries"),
        "options"=>array(
            "searching"=>true,
        ),
        "searchOnEnter" => true,
        "searchMode" => "or",
	));*/
	?>
</div>
<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>
<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate"){
//	echo '1'.$startDatePickernew;
	
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="NextCallingDate"){
	//echo '2'.$startDatePickernew;
	echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,
DATE_FORMAT(ce.custCallBackDate, '%d-%m-%Y') AS custCallBackDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="LastCallingDate"){
//echo '3'.$startDatePickernew;
echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')<='$startDatePickernew'")
));
}
}
?>
</script>
Abhishek commented on Mar 16, 2021

Dear Team Please help me how to make the table responsive.

KoolReport commented on Mar 16, 2021

Hi, Please set like below to see how

Table::create([
    "responsive"=>true
    ...
])
Abhishek commented on Mar 16, 2021

Sorry the above one does not worked and when I using it a blank page is getting appeared

KoolReport commented on Mar 16, 2021

Please put your table code here please

Abhishek commented on Mar 16, 2021
<?php 
    use \koolreport\inputs\DateTimePicker;
    use \koolreport\widgets\koolphp\Table;
	//use \koolreport\datagrid\DataTables;
	use \koolreport\inputs\RadioList;
?>
<style>
    .calendar.left .daterangepicker_input,
    .calendar.right .daterangepicker_input {
        display: none;
    }
</style>

<div class="report-content">
    <div class="text-center">
        <h1>Not Visited List</h1>
        <p class="lead">
            
        </p>
    </div>
	
    <form method="post">
	<div class="col-md-6 form-group" style="margin:auto 25%">
		<?php
                RadioList::create(array(
                    "name"=>"radioList",
					"display"=>"horizontal",
					//"dataStore"=>$this->dataStore("result"),
                    "data"=>array(
					  "CallingDate"=>"CallingDate",
					  "NextCallingDate"=>"NextCallingDate",
					  "LastCallingDate"=>"LastCallingDate",
					),  
					
                ));
                ?>
		</div>
        <div class="row" style="text-align:center;">
		
            <div class="col-md-3 form-group" style="margin:auto 37%">
                <strong>Select Date</strong>
                <?php
                        DateTimePicker::create(array(
                            "name"=>"startDatePicker",
                            "maxDate"=>"@endDatePicker",
                            "format"=>"DD-MM-YYYY"
                        ));
                        ?>
            </div>                                   
        </div>
        <div class="form-group" style="margin-top:30px;text-align:center;">
            <button class="btn btn-lg btn-primary" name="submit">Submit</button>
        </div>  <!--- value="Get Selected Values" -->                
        <!-- <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre> -->
    </form>

	<?php

    if($this->dataStore("result")->countData()>0)
    {
        Table::create(array(
            "dataStore"=>$this->dataStore("result"),
            "cssClass"=>array(
                "table"=>"table table-bordered"
            ),
            "columns"=>array(
                "custEnquiryId"=>array(
                    "label"=>"#EID",
                ),
                "custName"=>array(
                    "label"=>"Patitent Name",
					"formatValue"=>function($value,$row){
						$custPhoneNumber = $row['custPhoneNumber'];

						   if($row)
						   {
							   return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
                
                ),
				"custPlace"=>array(
				    "label"=>"City",
				),
				"custServiceFor"=>array(
				    "label"=>"Treatment For",
				),
				"custAppointmentDateIND"=>array(
				      "label"=>"Appointment Date"
				),
				"custStatusDateIND"=>array(
				      "label"=>"CallBack Date"
				),
				"custAge"=>array(
				   "label"=>"Age"
				),
				"custVistId"=>array(
				   "label"=>"VisitID",
				   "formatValue"=>function($VisitID){
					   if($VisitID=='0')
					   {
						   return "null";
					   }
					   return $VisitID;
				   }
				),
				"custRemarks"=>array(
				   "label"=>"Remarks"
				),
				"callType"=>array(
				    "label"=>"CallType",
						"formatValue"=>function($CallType){

						   if($CallType=='1')
						   {
							   return"Incoming Call";
						   }elseif($CallType=='2'){
							   return"Outgoing Call";
						   }elseif($CallType=='3'){
							   return"Walkin";
						   }
						   return $CallType;
					   }
				),
				
				"replyName"=>array(
				   "label"=>"Reply"
				),
				"statusName"=>array(
				   "label"=>"Status"
				),
				
				
            ),
			 "paging"=>array(
            "pageSize"=>10
			),
			
			
			
			
        ));
    }
    else
    {
    ?>
      <!--  <div class="alert alert-warning">
            <i class="glyphicon glyphicon-info-sign"></i> Sorry, we found no data
        </div> -->
    <?php    
    }
    ?>
	<?php
	/*
	DataTables::create(array(
	"dataSource"=>$this->dataStore("tblcustomerenquiries"),
        "options"=>array(
            "searching"=>true,
        ),
        "searchOnEnter" => true,
        "searchMode" => "or",
	));*/
	?>
</div>
<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="NextCallingDate"){
	//echo '2'.$startDatePickernew;
	echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,
DATE_FORMAT(ce.custCallBackDate, '%d-%m-%Y') AS custCallBackDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="LastCallingDate"){
//echo '3'.$startDatePickernew;
echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')<='$startDatePickernew'")
));
}
}
?>
</script>
KoolReport commented on Mar 16, 2021

I did not see you adding "responsive"=>true to anywhere, please add to Table settings.

Abhishek commented on Mar 16, 2021

Actually the below code is the table code of my report.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="NextCallingDate"){
	//echo '2'.$startDatePickernew;
	echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,
DATE_FORMAT(ce.custCallBackDate, '%d-%m-%Y') AS custCallBackDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')='$startDatePickernew'")
));
}
elseif($selected_val=="LastCallingDate"){
//echo '3'.$startDatePickernew;
echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custEnquiryId,ce.custName,ce.custPlace,ce.custPhoneNumber,ce.custServiceFor,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS custCreatedDateIND,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As custAppointmentDateIND,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As custStatusDateIND,ce.custAge,ce.custVistId,ce.custCustomerStatus,ce.custRemarks,ce.callType,cr.replyName,cs.statusName
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')<='$startDatePickernew'")
));
}
}
?>
</script>
Abhishek commented on Mar 16, 2021

Dear Team, Please help me how to create a table for the following view code. I mean how can I customize the column names and provide link to one of the column value. So Please help me

<?php 
    use \koolreport\inputs\DateTimePicker;
    use \koolreport\widgets\koolphp\Table;
	//use \koolreport\datagrid\DataTables;
	use \koolreport\inputs\RadioList;
?>
<style>
    .calendar.left .daterangepicker_input,
    .calendar.right .daterangepicker_input {
        display: none;
    }
</style>

<div class="report-content">
    <div class="text-center">
        <h1>FollowUp Calling Report</h1>
        <p class="lead">
            
        </p>
    </div>
	
    <form method="post">
	<div class="col-md-6 form-group" style="margin:auto 25%">
		<?php
                RadioList::create(array(
                    "name"=>"radioList",
					"display"=>"horizontal",
					//"dataStore"=>$this->dataStore("result"),
                    "data"=>array(
					  "CallingDate"=>"CallingDate",
					  "NextCallingDate"=>"NextCallingDate",
					  "LastCallingDate"=>"LastCallingDate",
					),  	
                ));
                ?>
		</div>
        <div class="row" style="text-align:center;">
		
            <div class="col-md-3 form-group" style="margin:auto 37%">
                <strong>Select Date</strong>
                <?php
                        DateTimePicker::create(array(
                            "name"=>"startDatePicker",
                            "maxDate"=>"@endDatePicker",
                            "format"=>"DD-MM-YYYY"
                        ));
                        ?>
            </div>                                   
        </div>
        <div class="form-group" style="margin-top:30px;text-align:center;">
            <button class="btn btn-lg btn-primary" name="submit">Submit</button>
        </div>  <!--- value="Get Selected Values" -->                
        <!-- <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre> -->
    </form>
<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName As Name,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));
"custName"=>array(
                    
					"formatValue"=>function($value,$row){
						$custPhoneNumber = $row['custPhoneNumber'];

						   if($row)
						   {
							   return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
                
                ),
}
elseif($selected_val=="NextCallingDate"){
	//echo '2'.$startDatePickernew;
	echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS Name,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,
DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,
ce.custRemarks AS Remarks,ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')>='$startDatePickernew'")
));
}
elseif($selected_val=="LastCallingDate"){
//echo '3'.$startDatePickernew;
echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS Name,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y') AS AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,
ce.custRemarks AS Remarks,ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')<='$startDatePickernew'")
));
}
}
?>
</script>

Abhishek commented on Mar 16, 2021

Dear Team, In the above code I am directly executing the query by passing Table::create(array( "dataSource"=>$this->src("cloudkli_demo")->query(" query "). so please cloud you please me on how to customize the columns of the above code please help me.

Abhishek commented on Mar 16, 2021

Dear Team, Or else just help me with one thing that is when execute the query directly then how can I provide a hyperlink to one of a column. please at least help for me for this small query.

Abhishek commented on Mar 16, 2021

Dear Team, Or else just help me with one thing that is when executing the query directly then how can I provide a hyperlink to one of a column. please at least help me with this small query.

KoolReport commented on Mar 16, 2021

There are two solutions:

  1. You can make your query to load only the column that you needs. select columnA, columnB ....
  2. You can use "columns' property to list columns you want:
Table::create([
    "dataSource"=>....,
    "columns"=>["columnA","columnB"]
])

That 's all.

About the responsive, please add the "responsive"=>true to the Table settings

Abhishek commented on Mar 17, 2021

Dear Team, I have attached a image and the respective view code of the image and in that I have used some of the php code also and so just once please go through the code once and then provide me a solution please.

When I select a radio button and date then the respective data is getting display but the thing is that now I need to customize the column name and need to provide hyperlink for the column name.(This is my reequipment)

Thanking you in advance.

<?php 
    use \koolreport\inputs\DateTimePicker;
    use \koolreport\widgets\koolphp\Table;
	//use \koolreport\datagrid\DataTables;
	use \koolreport\inputs\RadioList;
?>
<style>
    .calendar.left .daterangepicker_input,
    .calendar.right .daterangepicker_input {
        display: none;
    }
</style>

<div class="report-content">
    <div class="text-center">
        <h1>FollowUp Calling Report</h1>
        <p class="lead">
            
        </p>
    </div>
	
    <form method="post">
	<div class="col-md-6 form-group" style="margin:auto 25%">
		<?php
                RadioList::create(array(
                    "name"=>"radioList",
					"display"=>"horizontal",
					//"dataStore"=>$this->dataStore("result"),
                    "data"=>array(
					  "CallingDate"=>"CallingDate",
					  "NextCallingDate"=>"NextCallingDate",
					  "LastCallingDate"=>"LastCallingDate",
					),  
					
                ));
                ?>
		</div>
        <div class="row" style="text-align:center;">
		
            <div class="col-md-3 form-group" style="margin:auto 37%">
                <strong>Select Date</strong>
                <?php
                        DateTimePicker::create(array(
                            "name"=>"startDatePicker",
                            "maxDate"=>"@endDatePicker",
                            "format"=>"DD-MM-YYYY"
                        ));
                        ?>
            </div>                                   
        </div>
        <div class="form-group" style="margin-top:30px;text-align:center;">
            <button class="btn btn-lg btn-primary" name="submit">Submit</button>
        </div>  <!--- value="Get Selected Values" -->                
        <!-- <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre> -->
    </form>

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));  
'.->pipe($this->dataStore("result")).';                         
}
elseif($selected_val=="NextCallingDate"){
	//echo '2'.$startDatePickernew;
	echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS Name,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,
DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,
ce.custRemarks AS Remarks,ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')>='$startDatePickernew'")
));
}
elseif($selected_val=="LastCallingDate"){
//echo '3'.$startDatePickernew;
echo
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS Name,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y') AS AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y')As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,
ce.custRemarks AS Remarks,ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')<='$startDatePickernew'")
));
}
}
?>
</script>

KoolReport commented on Mar 17, 2021

Please refer to this post to make link for a column

Abhishek commented on Mar 17, 2021

Dear Team, A small request that is I have previously implemented the links for the column and I have also customize the column names also. But now the issue is I have directly executed the query as below.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>
<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create(array(
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'")
));  
'.->pipe($this->dataStore("result")).';                         
}

So now how do I implement the table for the above code which I am executing directly. As I am presently customizing the columns names by providing the alias in the query but I need to construct a table to the above query which I have written in the php script.

KoolReport commented on Mar 17, 2021

I am not sure if I have understood your request. The code is like following:

Table::create([
    "dataSource"=>$this->src("cloudkli_demo")->query("...."),
    "columns"=>[
        ...
    ]
])

May I know what error you face? What do you expect but do not get?

Abhishek commented on Mar 17, 2021

Dear Team, Please help for me for this report with our support I have solved many issues of the other report.

So please kindly show me the solution for the above one please.

KoolReport commented on Mar 17, 2021

May I know what error you face? What do you expect but do not get?

Abhishek commented on Mar 17, 2021

Dear Team, I have implemented the the code as per your instruction but the output is as below.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
"columns"=>["custName"=>array(
		 "formatValue"=>function($value,$row){
	       $custPhoneNumber = $row['custPhoneNumber'];

		 if($row)
						   
                         {
							   
return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
                
                ),]
]);                     
}
KoolReport commented on Mar 17, 2021

Please check the "custPhoneNumber", it seems to me that you don't have this data in your query. That's why you get 0 (null) value.

Abhishek commented on Mar 17, 2021

Dear Team, First of all I am sorry for testing your patience but I need this report at cost. So please help me As you can see in the above code I have provided the column "custName" so for this column I have provided the link but I am unable to get the desire output.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
"columns"=>["custName"=>array(
                    "label"=>"Name",
					"formatValue"=>function($value,$row){
						$custPhoneNumber = $row['custPhoneNumber'];

						   if($row)
						   {
							   return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
						   }
						   return $value;
					   }
                
                ),]
]);                         
}
KoolReport commented on Mar 17, 2021

You can do:

    $custPhoneNumber = $row['custPhoneNumber'];
    $custName = $row['custName'];

    if($row)
    {
        return "<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blank'>$custName</a>";
    }
    return $value;
Abhishek commented on Mar 17, 2021

Dear Team, The above specified code is not working in my case. Actually what I want is.

As you can see in the above image I am able to display the table by using the below view code.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
?>
//<script>
//alert('ddd');
//</script>
<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,ce.custVistId AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
]);                       
}

So Now in the above code I have used "Table::create([ "dataSource"=>$this->src("cloudkli_demo")->query(" "),])"; to execute the query directly and I hope you have understand how am I able to display the table.

But the issue is that how can provide the links to the column named "custname" and how do it format other columns value.

KoolReport commented on Mar 17, 2021

You do:

    $custPhoneNumber = $row['PatientName'];
    $custName = $row['PhoneNumber'];
Abhishek commented on Mar 17, 2021

Dear Team, I have change the code the as you said but I am getting an error as Parse error: syntax error, unexpected ';', expecting ']' in C:\xampp\htdocs\test\ckr\Breport.view.php on line 182 And the code below

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,ce.custVistId AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
"columns"=>[
$custPhoneNumber = $row['PhoneNumber'];------> line 182
$custName = $row['PatientName'];
if($row)
{
return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blank'>$custName</a>";	
}
return $value;
]
]);                       
}
KoolReport commented on Mar 17, 2021

The last code I send you should be in the anynomous function of "formatValue"

KoolReport commented on Mar 17, 2021

The wrong point here is that you change the column name from "custName" to "PatientName" in your select query and then you use the old "custName" to refer to the column. You should use the new name "PatientName". The same mistake is for customer phone number.

KoolReport commented on Mar 17, 2021

Also your spell is wrong "PatitentName", it is not really an issue until you start use correct spell of "PatientName", it will cause trouble of "data not found"

Abhishek commented on Mar 17, 2021
Warning: Illegal offset type in C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\widgets\koolphp\Table.tpl.php on line 93

Warning: Illegal offset type in C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\widgets\koolphp\Table.tpl.php on line 94

Fatal error: Uncaught Error: Object of class Closure could not be converted to string in C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\widgets\koolphp\Table.tpl.php:100 Stack trace: #0 C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\core\Widget.php(736): include() #1 C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\widgets\koolphp\Table.php(431): koolreport\core\Widget->template('Table', Array) #2 C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\core\Widget.php(676): koolreport\widgets\koolphp\Table->onRender() #3 C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\core\Widget.php(764): koolreport\core\Widget->render() #4 C:\xampp\htdocs\test\ckr\Breport.view.php(191): koolreport\core\Widget::create(Array) #5 C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\KoolReport.php(502): include('C:\\xampp\\htdocs...') #6 C:\xampp\htdocs\test\ckr\index.php(4): koolreport\KoolReport->render() #7 {main} thrown in C:\xampp\htdocs\test\vendor\koolreport_pro-5.0.4\koolreport\core\src\widgets\koolphp\Table.tpl.php on line 100

Abhishek commented on Mar 17, 2021

Dear Team, Here is the code

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatitentName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,ce.custVistId AS VisitID,ce.custRemarks AS Remarks,
ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
"columns"=>[
"formatValue"=>function($value,$row)
{
$custPhoneNumber = $row['custName'];
$custName = $row['custPhoneNumber'];
if($row)
{
return"<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blank'>$custName</a>";	
}
return $value;
}
]
]);                       
}
KoolReport commented on Mar 17, 2021

Man, I am thinking of writing the whole code for you to copy and paste

Abhishek commented on Mar 17, 2021

Sir/Madam, Sorry for making you frustrated but I need to complete these report at any cost and need to submit for the client today and since from 7 days I am working on this report. So please kindly be patience and help me please.

Once again I am really sorry but please help me

Abhishek commented on Mar 17, 2021

Sir/Madam, Sorry for making you frustrated but I need to complete these report at any cost and need to submit for the client today and since from 7 days I am working on this report. So please kindly be patience and help me please.

Once again I am really sorry but please help me

KoolReport commented on Mar 17, 2021

Here is the code for Table:

Table::create([
    "dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatientName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
    DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,CASE ce.custVistId WHEN 0 THEN 'NotVisited' else 'NotVisited' END AS VisitID,ce.custRemarks AS Remarks,
    ce.callType,CASE ce.callType when 1 THEN 'Incoming Call' when 2 THEN 'Outgoing Call' when 3 Then 'walkin' else 'null' END Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
    FROM tblcustomerenquiries ce
    LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
    LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
    WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew'"),
    "columns"=>[
        "PatientName"=>array(
            "label"=>"Name",
            "formatValue"=>function($value,$row){
                $custPhoneNumber = $row['PhoneNumber'];
                    if($row)
                    {
                        return "<a href='EnquiryForm.php?id=$custPhoneNumber' style='color:blue;' target='_blanck'>$value</a>";
                    }
                    return $value;
                }
        
            ),
        ],
    ]);

I am not frustrated at you but at your boss. You are not well prepared by him for this kind of tasks. I know you are frustrated too for the whole week working on a simple report but not getting it done. A experienced developer will take less than 30min to do. So after this, with my whole heart, I suggest that you tell your boss to prepare you with some courses of PHP and Javascript. It is not your fault, really. You are working hard and have good spirit, just that you have not been prepared enough.

Abhishek commented on Mar 17, 2021

Respected Sir/Madam, Really Thanks for your sweet heart but still I want to apologies you for this kind of disturbance created by me. And actually I am an java developer so that is the reason I am unable to execute the task in correct manner. I am really sorry again.

Abhishek commented on Mar 17, 2021

Respected Sir/Madam and Team, Really I am thankful for the help you have provide for me and the code you have gave is working fine and able to get the desire output by you help and really I am grateful for your co-operation and I am really sorry again. Thanks for the help, co-operation, support and gaudiness.
And you can close the ticket.

KoolReport commented on Mar 17, 2021

Awesome!

I am very happy to hear that the code is working :)

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Inputs