<div class="row mt-1" style="margin-left:-30px">
    <div class="col-lg-12 col-md-12">
        <div class="card card-shadow-danger" >
            <h5 class="div-head" style="font-size:14px;padding-top:15px;padding-bottom:10px"><b style="font-weight:500">Action Plan Log</b>
                <button type="button" id="ActionLog" class="btn-transition btn btn-outline-primary btn-sm vocnot" onclick="exportExcel(this.id);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Export Excel" style="float:right;color:white !important;border-color:white ">
                    EXPORT
                </button>
            </h5>
            <table id="Alog_table" class="table table-striped table-bordered no-footer text-center display" style="font-size:12px">
                <thead style="background-color:#002a5c;color:#fff;width:100%">
                    <tr>
                        <td>Dealer Code</td>
                        <td>Dealer Name</td>
                        <td>User Type</td>
                        <td>login Date/Time</td>
						<td>Upload File</td>
						<td>Quarter</td>
					</tr>
                </thead>
                <tbody>
                    <?php
					include("config.php");
					$DC=trim($_REQUEST['dealer_code']);
					$user_type=trim($_REQUEST['user_type']);
					$action_log="action_log";
					
					if($user_type==1){
					$qL=mysqli_query($conn,"select * from $action_log where user_type>1");	
					}
					else if($user_type>=1 && $user_type<=6)
					{						
						$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q1 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q2 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q3 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q4 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q5 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q6 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q7 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q8 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q9 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q10 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q11 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q12 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q13 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q14 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q15 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q16 where Zone='$DC') or dealer_code LIKE  '%$DC%'");	
						}
						else{}
					}
					else if($user_type>=7 && $user_type<=24)
					{						
						$qL= mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q1 where Region='$DC') or dealer_code = '$DC'");	
						if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q2 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q3 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q4 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q5 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q6 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q7 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q8 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q9 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q10 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q11 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q12 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q13 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q14 where Region='$DC') or dealer_code = '$DC'");		
						}
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q15 where Region='$DC') or dealer_code = '$DC'");		
						}
						
						else if(mysqli_num_rows($qL)==0)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q16 where Region='$DC') or dealer_code = '$DC'");		
						}
						else{}
					}
					else if($user_type==999)
					{			
						$kaz = trim($_REQUEST['kaz']);
						if($kaz==1)
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q1 where Main_Dealer_Code='$DC') or dealer_code='$DC'");	
							if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q2 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q3 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q4 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q5 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q6 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q7 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q8 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q9 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q10 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q11 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q12 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q13 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q14 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q15 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Main_Dealer_Code from Q16 where Main_Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else{}
						}
						else
						{
							$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q1 where Dealer_Code='$DC') or dealer_code='$DC'");	
							//echo "select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q1 where Dealer_Code='$DC') or dealer_code='$DC'";
							if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q2 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q3 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q4 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q5 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q6 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q7 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q8 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q9 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q10 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q11 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q12 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q13 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q14 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q15 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else if(mysqli_num_rows($qL)==0)
							{
								$qL=mysqli_query($conn,"select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q16 where Dealer_Code='$DC') or dealer_code='$DC'");		
							}
							else{}
						}			
						
					}
					else{
					//$qL="select * from $action_log where  user_type>1 and dealer_code in (SELECT Dealer_Code from Q1 where Dealer_Code='$DC') or dealer_code='$DC'";	
					}
					//echo $qL;
					//$qL=mysqli_query($conn,$qL);
					if(mysqli_num_rows($qL)>0)
					{
						while($rL=mysqli_fetch_array($qL))
						{
							$x="";
							$DC2=$rL["dealer_code"];
							$ut=$rL["user_type"];
							$XcodeX = $rL["Xcode"];
							if($user_type==1)
							{
							    echo "<tr><td><a href='actionexport.php?dcode=".$DC2."&utype=".$ut."&xcode=".$XcodeX."' target='_blank'>".strtoupper($rL["dealer_code"])."</a></td>";
							}
							else
							{
							    echo  "<tr><td>".strtoupper($rL["dealer_code"])."</td>";
							}
							
							
							if($ut==1){
							$ut="Admin";
							}
							else if($ut>=1 && $ut<=6){
							$ut="zone";
							}
							else if($ut>=7 and $ut<=24)
							{
							$ut="Region";	
							}
							else if($ut==999)
							{
								if($XcodeX==1)
								{
									$ut="Main Dealer";	
									$x2=mysqli_query($conn,"select Main_dealer_name from Q1 where Main_Dealer_Code='$DC2'");
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q2 where Main_Dealer_Code='$DC2'");
										//echo "hii 17";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q3 where Main_Dealer_Code='$DC2'");
										//echo "hii 27";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q4 where Main_Dealer_Code='$DC2'");
										//echo "hii 37";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q5 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q6 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q7 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q8 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q9 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q10 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q11 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q12 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q13 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q14 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q15 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Main_dealer_name from Q16 where Main_Dealer_Code='$DC2'");
										//echo "hii 47";
									}
									else{}
									
								}
								else if($XcodeX==2)
								{
									$ut="Dealer";
									$x2=mysqli_query($conn,"select Dealer_name from Q1 where Dealer_Code='$DC2'");
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q2 where Dealer_Code='$DC2'");
										//echo "hii 4";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q3 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q4 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else{}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q5 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q6 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q7 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q8 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q9 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q10 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q11 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q12 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q13 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q14 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q15 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
									if(mysqli_num_rows($x2)==0)
									{
										$x2=mysqli_query($conn,"select Dealer_name from Q16 where Dealer_Code='$DC2'");
										//echo "hii 5";
									}
									else {}
								}
							}
							else{}
							while($r1=mysqli_fetch_array($x2)){
								$x=$r1[0];
								}
							echo  "<td>".$x."</td>";
							echo  "<td>".$ut."</td>";
							echo  "<td>".$rL["login_date"]."</td>";
							if($rL["uploadFrom"]==1)
							{
							    echo  "<td>Overall action plan</td>";
							}
							else if($rL["uploadFrom"]==2)
							{
							    echo  "<td>Key action plan</td>";
							}
							else
							{
							    echo '<td> </td>';
							}
							
							if($rL["quater"]==1)
							{
							    echo  "<td>Q2'22</td>";
							}
							else if($rL["quater"]==2)
							{
							    echo  "<td>Q3'22</td>";
							}
							else if($rL["quater"]==3)
							{
							    echo  "<td>Q4'22</td>";
							}
							else if($rL["quater"]==4)
							{
							    echo  "<td>Q1'23</td>";
							}
							else if($rL["quater"]==5)
							{
							    echo  "<td>Q2'23</td>";
							}
							else if($rL["quater"]==6)
							{
							    echo  "<td>Q3'23</td>";
							}
							else if($rL["quater"]==7)
							{
							    echo  "<td>Q4'23</td>";
							}
							else if($rL["quater"]==8)
							{
							    echo  "<td>Q1'24</td>";
							}
							else if($rL["quater"]==9)
							{
							    echo  "<td>Q2'24</td>";
							}
							else if($rL["quater"]==10)
							{
							    echo  "<td>Q3'24</td>";
							}
							else if($rL["quater"]==11)
							{
							    echo  "<td>Q4'24</td>";
							}
							else if($rL["quater"]==12)
							{
							    echo  "<td>Q1'25</td>";
							}
							else if($rL["quater"]==13)
							{
							    echo  "<td>Q2'25</td>";
							}
							else if($rL["quater"]==14)
							{
							    echo  "<td>Q3'25</td>";
							}
							else if($rL["quater"]==15)
							{
							    echo  "<td>Q4'25</td>";
							}
							else if($rL["quater"]==16)
							{
							    echo  "<td>Q1'26</td>";
							}
							else
							{}
							
							echo "</tr>";
						}
					}
					else
					{
						echo "<tr><td colspan=4>No records</td></tr>";
					}
					
					
					?>
					
					
                </tbody>

            </table>
			
        </div>
    </div>
</div>
