<?php require_once('../auth/auth.php'); ?>
<section class="content">
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-3">
				<div class="card responsive-card card- card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #718575;">
					<div class="card-header" style="padding: 3px 8px;">
						<h3 class="card-title"> <i class="fa fa-chart-line pr-2 "></i><?php echo language(2);?></h3>
						<div class="card-tools">
							<button type="button" class="btn btn-tool" data-card-widget="remove">
							<i style="color:white;" class="fas fa-times"></i>
							</button>
						</div>
					</div>
					<div class="card-body cscroll" style="max-height: 450px;">
						<table class="table table-sm" style="overflow-x: auto;margin-bottom:0px !important;text-shadow: 0 0 black !important;
							">
						<center><fieldset style="background:#458b70;color:white;font-weight:500;"> <?php echo language(226);?>  </fieldset></center>
						<thead>
							<tr>
								<th class="text-center"><?php echo language(15); ?></th>
								<th class="text-center"><?php echo language(282); ?></th>
								<th class="text-center">#</th>
							</tr>
						</thead>
						<tbody>
							<?php
							$scat= mysqli_query($conn,"SELECT ac_s_cat_name,ac_g_catid,ac_g_cat_name,g_type FROM ac_sub_g_category LEFT JOIN ac_sub_category ON (ac_sub_category.ac_s_catid=ac_sub_g_category.ac_s_catid) WHERE ac_sub_category.ac_catid=1 AND ac_sub_g_category.coid='$coid' GROUP BY ac_g_catid") or die(mysqli_error($conn));
								$i=0;
								while($asat= mysqli_fetch_assoc($scat)){
								$ac_g_catid    = $asat['ac_g_catid'];
								$ac_g_cat_name = $asat['ac_g_cat_name'];
								$g_type        = $asat['g_type'];
								$ac_s_cat_name = $asat['ac_s_cat_name'];
								$cacc = mysqli_num_rows(mysqli_query($conn,"SELECT acid FROM accounts LEFT JOIN ac_sub_g_category ON (accounts.gcatid = ac_sub_g_category.ac_g_catid) WHERE g_type='$g_type' AND (g_type='prls' || g_type='sl-inc' || g_type='cs-gds' || g_type='pu-exp') AND accounts.coid='$coid' AND bid ='$bid' AND brid='$brid' LIMIT 1"));
							?>
							<tr>
								<th class="text-center"> <?php echo ++$i; ?>  </th>
								<th onclick="pagecall('../accounts/sub_acc_view.php?gcatid=<?php echo $ac_g_catid;?>','#subac_view<?php echo $ac_g_catid;?>');$(this).removeAttr('onclick');">
									<strong  class="btn opennn closes exploder btn-xs float-left" title="<?php echo $ac_s_cat_name;?>">
									<?php echo $ac_g_cat_name;?>  <?php if($cacc<1) { echo '<i class="fas fa-caret-down"></i>';?> <?php }else {} ?>
									</strong>
								</th>
								<th style="padding-right: 8px;padding-left:8px;" class="text-center"><?php if($cacc<1 && per('ac_add')==1) {?>
									<span>  <i style='float:center;margin-left:;font-size:20px ;color:white; background-color:green' class='fa fa-plus-square cshover'
										onclick="pagecall('../accounts/add_accounts.php?gcatid=<?php echo $ac_g_catid;?>','#ac_view');"></i>
									</span><?php }  ?>
								</th>
								<ss>
								<tr class=" hide" >
									<td colspan="5" style="background: #ececec; display: none;" id="subac_view<?php echo $ac_g_catid;?>">
									</td>
								</tr>
								</ss>
							</tr>
							<?php }  ?>
						</tbody>
					</table>
					<table class="table table-sm" style="overflow-x: auto;margin-bottom:0px !important;text-shadow: 0 0 black !important;
						">
					<center><fieldset class="bg-danger"> <?php echo language(227);?> </fieldset></center>
					<thead>
						<tr>
							<th class="text-center"><?php echo language(15);?></th>
							<th class="text-center"><?php echo language(282);?></th>
							<th class="text-center">#</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$scat= mysqli_query($conn,"SELECT ac_s_cat_name,ac_g_catid,ac_g_cat_name,g_type FROM ac_sub_g_category LEFT JOIN ac_sub_category ON (ac_sub_category.ac_s_catid=ac_sub_g_category.ac_s_catid) WHERE ac_sub_category.ac_catid=2 AND ac_sub_g_category.coid='$coid' GROUP BY ac_g_catid") or die(mysqli_error($conn));
							$i=0;
							while($asat= mysqli_fetch_assoc($scat)){
							$ac_g_catid    = $asat['ac_g_catid'];
							$ac_g_cat_name = $asat['ac_g_cat_name'];
							$g_type        = $asat['g_type'];
							$ac_s_cat_name = $asat['ac_s_cat_name'];
							$cacc = mysqli_num_rows(mysqli_query($conn,"SELECT acid FROM accounts LEFT JOIN ac_sub_g_category ON (accounts.gcatid = ac_sub_g_category.ac_g_catid) WHERE g_type='$g_type' AND (g_type='prls' || g_type='sl-inc' || g_type='cs-gds' || g_type='pu-exp') AND accounts.coid='$coid' AND bid ='$bid' AND brid='$brid' LIMIT 1"));
						?>
						<tr>
							<th class="text-center"> <?php echo ++$i; ?>  </th>
							<th onclick="pagecall('../accounts/sub_acc_view.php?gcatid=<?php echo $ac_g_catid;?>','#subac_view<?php echo $ac_g_catid;?>');$(this).removeAttr('onclick');">
								<strong  class="btn opennn closes exploder btn-xs float-left" title="<?php echo $ac_s_cat_name;?>">
								<?php echo $ac_g_cat_name;?>  <?php if($cacc<1) { echo '<i class="fas fa-caret-down"></i>';?> <?php }else {} ?>
								</strong>
							</th>
							<th style="padding-right: 8px;padding-left:8px;" class="text-center"><?php if($cacc<1 && per('ac_add')==1) {?>
								<span>  <i style='float:center;margin-left:;font-size:20px ;color:white; background-color:green' class='fa fa-plus-square cshover'
									onclick="pagecall('../accounts/add_accounts.php?gcatid=<?php echo $ac_g_catid;?>','#ac_view');"></i>
								</span><?php }  ?>
							</th>
							<ss>
							<tr class=" hide" >
								<td colspan="5" style="background: #ececec; display: none;" id="subac_view<?php echo $ac_g_catid;?>">
								</td>
							</tr>
							</ss>
						</tr>
						<?php }  ?>
					</tbody>
				</table>
				<table class="table table-sm" style="overflow-x: auto;margin-bottom:0px !important;text-shadow: 0 0 black !important;
					">
				<center><fieldset class="bg-navyblue text-white">  <?php echo language(228);?></fieldset></center>
				<thead>
					<tr>
						<th class="text-center"><?php echo language(15); ?></th>
						<th class="text-center"><?php echo language(282); ?></th>
						<th class="text-center">#</th>
					</tr>
				</thead>
				<tbody>
					<?php
					$scat= mysqli_query($conn,"SELECT ac_s_cat_name,ac_g_catid,ac_g_cat_name,g_type FROM ac_sub_g_category LEFT JOIN ac_sub_category ON (ac_sub_category.ac_s_catid=ac_sub_g_category.ac_s_catid) WHERE ac_sub_category.ac_catid=3 AND ac_sub_g_category.coid='$coid' GROUP BY ac_g_catid") or die(mysqli_error($conn));
						$i=0;
						while($asat= mysqli_fetch_assoc($scat)){
						$ac_g_catid    = $asat['ac_g_catid'];
						$ac_g_cat_name = $asat['ac_g_cat_name'];
						$g_type        = $asat['g_type'];
						$ac_s_cat_name = $asat['ac_s_cat_name'];
						$cacc = mysqli_num_rows(mysqli_query($conn,"SELECT acid FROM accounts LEFT JOIN ac_sub_g_category ON (accounts.gcatid = ac_sub_g_category.ac_g_catid) WHERE g_type='$g_type' AND (g_type='prls' || g_type='sl-inc' || g_type='cs-gds' || g_type='pu-exp') AND accounts.coid='$coid' AND bid ='$bid' AND brid='$brid' LIMIT 1"));
					?>
					<tr>
						<th class="text-center"> <?php echo ++$i; ?>  </th>
						<th onclick="pagecall('../accounts/sub_acc_view.php?gcatid=<?php echo $ac_g_catid;?>','#subac_view<?php echo $ac_g_catid;?>');$(this).removeAttr('onclick');">
							<strong  class="btn opennn closes exploder btn-xs float-left" title="<?php echo $ac_s_cat_name;?>">
							<?php echo $ac_g_cat_name;?>  <?php if($cacc<1) { echo '<i class="fas fa-caret-down"></i>';?> <?php }else {} ?>
							</strong>
						</th>
						<th style="padding-right: 8px;padding-left:8px;" class="text-center"><?php if($cacc<1 && per('ac_add')==1) {?>
							<span>  <i style='float:center;margin-left:;font-size:20px ;color:white; background-color:green' class='fa fa-plus-square cshover'
								onclick="pagecall('../accounts/add_accounts.php?gcatid=<?php echo $ac_g_catid;?>','#ac_view');"></i>
							</span><?php }  ?>
						</th>
						<ss>
						<tr class=" hide" >
							<td colspan="5" style="background: #ececec; display: none;" id="subac_view<?php echo $ac_g_catid;?>">
							</td>
						</tr>
						</ss>
					</tr>
					<?php }  ?>
				</tbody>
			</table>
			<table class="table table-sm" style="overflow-x: auto;margin-bottom:0px !important;text-shadow: 0 0 black !important;
				">
			<center><fieldset class="bg-black">  <?php echo language(229);?></fieldset></center>
			<thead>
				<tr>
					<th class="text-center"><?php echo language(15); ?></th>
					<th class="text-center"><?php echo language(282); ?></th>
					<th class="text-center">#</th>
				</tr>
			</thead>
			<tbody>
				<?php
				$scat= mysqli_query($conn,"SELECT ac_s_cat_name,ac_g_catid,ac_g_cat_name,g_type FROM ac_sub_g_category LEFT JOIN ac_sub_category ON (ac_sub_category.ac_s_catid=ac_sub_g_category.ac_s_catid) WHERE ac_sub_category.ac_catid=4 AND ac_sub_g_category.coid='$coid' GROUP BY ac_g_catid") or die(mysqli_error($conn));
					$i=0;
					while($asat= mysqli_fetch_assoc($scat)){
					$ac_g_catid    = $asat['ac_g_catid'];
					$ac_g_cat_name = $asat['ac_g_cat_name'];
					$g_type        = $asat['g_type'];
					$ac_s_cat_name = $asat['ac_s_cat_name'];
					$cacc = mysqli_num_rows(mysqli_query($conn,"SELECT acid FROM accounts LEFT JOIN ac_sub_g_category ON (accounts.gcatid = ac_sub_g_category.ac_g_catid) WHERE g_type='$g_type' AND (g_type='prls' || g_type='sl-inc' || g_type='cs-gds' || g_type='pu-exp') AND accounts.coid='$coid' AND bid ='$bid' AND brid='$brid' LIMIT 1"));
				?>
				<tr>
					<th class="text-center"> <?php echo ++$i; ?>  </th>
					<th onclick="pagecall('../accounts/sub_acc_view.php?gcatid=<?php echo $ac_g_catid;?>','#subac_view<?php echo $ac_g_catid;?>');$(this).removeAttr('onclick');">
						<strong  class="btn opennn closes exploder btn-xs float-left" title="<?php echo $ac_s_cat_name;?>">
						<?php echo $ac_g_cat_name;?>  <?php if($cacc<1) { echo '<i class="fas fa-caret-down"></i>';?> <?php }else {} ?>
						</strong>
					</th>
					<th style="padding-right: 8px;padding-left:8px;" class="text-center"><?php if($cacc<1 && per('ac_add')==1) {?>
						<span>  <i style='float:center;margin-left:;font-size:20px ;color:white; background-color:green' class='fa fa-plus-square cshover'
							onclick="pagecall('../accounts/add_accounts.php?gcatid=<?php echo $ac_g_catid;?>','#ac_view');"></i>
						</span><?php }  ?>
					</th>
					<ss>
					<tr class=" hide" >
						<td colspan="5" style="background: #ececec; display: none;" id="subac_view<?php echo $ac_g_catid;?>">
						</td>
					</tr>
					</ss>
				</tr>
				<?php }  ?>
			</tbody>
		</table>
		<table class="table table-sm" style="overflow-x: auto;margin-bottom:0px !important;text-shadow: 0 0 black !important;
			">
		<center><fieldset style="background: #74460c!important;color:white !important;">  <?php echo language(230);?></fieldset></center>
		<thead>
			<tr>
				<th class="text-center"><?php echo language(15); ?></th>
				<th class="text-center"><?php echo language(282); ?></th>
				<th class="text-center">#</th>
			</tr>
		</thead>
		<tbody>
			<?php
			$scat= mysqli_query($conn,"SELECT ac_s_cat_name,ac_g_catid,ac_g_cat_name,g_type FROM ac_sub_g_category LEFT JOIN ac_sub_category ON (ac_sub_category.ac_s_catid=ac_sub_g_category.ac_s_catid) WHERE ac_sub_category.ac_catid=5 AND ac_sub_g_category.coid='$coid' GROUP BY ac_g_catid") or die(mysqli_error($conn));
				$i=0;
				while($asat= mysqli_fetch_assoc($scat)){
				$ac_g_catid    = $asat['ac_g_catid'];
				$ac_g_cat_name = $asat['ac_g_cat_name'];
				$g_type        = $asat['g_type'];
				$ac_s_cat_name = $asat['ac_s_cat_name'];
				$cacc = mysqli_num_rows(mysqli_query($conn,"SELECT acid FROM accounts LEFT JOIN ac_sub_g_category ON (accounts.gcatid = ac_sub_g_category.ac_g_catid) WHERE g_type='$g_type' AND (g_type='prls' || g_type='sl-inc' || g_type='cs-gds' || g_type='pu-exp') AND accounts.coid='$coid' AND bid ='$bid' AND brid='$brid' LIMIT 1"));
			?>
			<tr>
				<th class="text-center"> <?php echo ++$i; ?>  </th>
				<th onclick="pagecall('../accounts/sub_acc_view.php?gcatid=<?php echo $ac_g_catid;?>','#subac_view<?php echo $ac_g_catid;?>');$(this).removeAttr('onclick');">
					<strong  class="btn opennn closes exploder btn-xs float-left" title="<?php echo $ac_s_cat_name;?>">
					<?php echo $ac_g_cat_name;?>  <?php if($cacc<1) { echo '<i class="fas fa-caret-down"></i>';?> <?php }else {} ?>
					</strong>
				</th>
				<th style="padding-right: 8px;padding-left:8px;" class="text-center"><?php if($cacc<1 && per('ac_add')==1) {?>
					<span>  <i style='float:center;margin-left:;font-size:20px ;color:white; background-color:green' class='fa fa-plus-square cshover'
						onclick="pagecall('../accounts/add_accounts.php?gcatid=<?php echo $ac_g_catid;?>','#ac_view');"></i>
					</span><?php }  ?>
				</th>
				<ss>
				<tr class=" hide" >
					<td colspan="5" style="background: #ececec; display: none;" id="subac_view<?php echo $ac_g_catid;?>">
					</td>
				</tr>
				</ss>
			</tr>
			<?php }  ?>
		</tbody>
	</table>
</div>
</div>
</div>
<div class="col-md-9" id="ac_view"></div>
</div>
</div>
</section>


<script>
	$(".exploder").click(function(){
$(this).toggleClass("opennn closes");
$(this).closest("tr").next("tr").toggleClass("hide");
if($(this).closest("tr").next("tr").hasClass("hide")){
$(this).closest("tr").next("tr").children("td").slideUp(1);
}
else{
$(this).closest("tr").next("tr").children("td").slideDown(1);
}
});
</script>