	<table cellpadding="0" cellspacing="0" width="100%" id="test" class="editable">
                	<thead>
                    <tr>
                        <th align="left">&nbsp;&nbsp;<?php echo $this->lang->line('description') ?></th>
                        <th class="tar tots"><?php echo $selyear+1;//$this->lang->line('thisyear') ?>&nbsp;&nbsp;</th>
                        <!-- th class="tar"><?php echo $this->lang->line('budget') ?>&nbsp;&nbsp;</th> -->
                        <?php if(isset($lastaccountdetails)): ?>
                        <th class="tar tots"><?php echo $selyear;//$this->lang->line('lastyear') ?>&nbsp;&nbsp;</th>
                    	<?php endif; ?>
            		</tr>
        			</thead>
       				 <tbody>
	<?php 
	$bil = 0; 
	$datatbl_total = 0;
	$lastdatatbl_total = 0;
	/* summary of looping
		//select * from _ref_acct_group where acctTypeID in (3,4) and parentID = 0 order by acctTypeID, parentID, orderNo
		foreach($accountGroup as $datatbl):
			//select sum(amount) as dr or cr from comp_acct_det 
			//select sum(amount) as dr or cr from comp_acct_det 
			foreach($accountdetails as $row):
				if($row->acctGroupID == $datatbl->ID)	
			//select * from _ref_acct_group where acctTypeID in (3,4) and parentID <> 0 order by acctTypeID, parentID, orderNo
			foreach($groupdetails as $rowdet):
				if($rowdet->parentID == $datatbl->ID){
				foreach($accountdetails as $row):
						if($row->acctGroupID == $rowdet->ID)
				foreach($groupdetails as $rowdet1): 
					if($rowdet1->parentID == $rowdet->ID){
					foreach($groupdetails as $rowdet2): 
						if($rowdet2->parentID == $rowdet1->ID){
						foreach($groupdetails as $rowdet3): 
							if($rowdet3->parentID == $rowdet2->ID){
							foreach($accountdetails as $row2):
								if($row2->acctGroupID == $rowdet3->ID){?>
						foreach($accountdetails as $row2):
							if($row2->acctGroupID == $rowdet2->ID){
				foreach($accountdetails as $row2):
					if($row2->acctGroupID == $rowdet1->ID){

	*/
	if($accountGroup && (!empty($accountdetails) || !empty($lastaccountdetails))){
		foreach($accountGroup as $datatbl):
			$bil++?>
 			<?php if ($datatbl->title == 1) {?>
            		<tr>
                		<td colspan="3">&nbsp;<strong><?php echo $this->lang->line($datatbl->acctGroupName) ?></strong></td>
                	</tr>
            <?php }?>
      <?php foreach($accountdetails as $key=>$row):
				if($row->acctGroupID == $datatbl->ID){?>
      	<?php 
					if(true) { ?>
                <?php 
                 		$totalamount =  ($row->currentyeardebit+$row->openingBalanceDr) - ($row->currentyearcredit+$row->openingBalanceCr);  
                 		$lasttotalamount =  ($lastaccountdetails[$key]->currentyeardebit+$lastaccountdetails[$key]->openingBalanceDr) - ($lastaccountdetails[$key]->currentyearcredit+$lastaccountdetails[$key]->openingBalanceCr);  
                		if(($totalamount+$lasttotalamount) != 0):
                ?>
            			<tr>
                			<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo substr($row->acctCode,0, 4).'-'.substr($row->acctCode,4, 3).'-'.substr($row->acctCode,7, 2).' [ '.$row->acctName.' ]'?></td>
                			<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($row->acctTypeID != $datatbl->acctTypeID )?number_format($totalamount,2):number_format($totalamount,2)?>&nbsp;&nbsp;</a></td>
                			<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lastaccountdetails[$key]->acctTypeID != $datatbl->acctTypeID )?number_format($totalamount,2):number_format($lasttotalamount,2)?>&nbsp;&nbsp;</a></td>
                		</tr>
         		<?php
							$datatbl_total = $datatbl_total + $totalamount;
							$lastdatatbl_total = $lastdatatbl_total + $lasttotalamount;
         				endif;
				?>
			<?php   } ?>
			<?php } ?>
		<?php endforeach;?>
      	<?php if($groupdetails){ 
				foreach($groupdetails as $rowdet):
							$rowdet_credit = 0;
							$lastrowdet_credit = 0;
					if($rowdet->parentID == $datatbl->ID){
						if ($rowdet->title == 1) {?>
            				<tr>
                				<td colspan="3">&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet->acctGroupName)?></strong></td>
                			</tr>
                	<?php } ?>
      				<?php foreach($accountdetails as $key=>$row):

							if($row->acctGroupID == $rowdet->ID){
								?>
      						<?php
								if(true ){ ?>
                 			<?php   
                 				$totalamount = $row->currentyeardebit - $row->currentyearcredit; 
                 				$lasttotalamount = $lastaccountdetails[$key]->currentyeardebit - $lastaccountdetails[$key]->currentyearcredit; 
                 				if(($totalamount+$lasttotalamount) != 0):
                 			?>
            						<tr>
                						<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo substr($row->acctCode,0, 4).'-'.substr($row->acctCode,4, 3).'-'.substr($row->acctCode,7, 2).' [ '.$row->acctName.' ]'?></td>
                                        <?php if($rowdet->status == 1){?>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount < 0 )?number_format($totalamount * -1,2):'('.number_format($totalamount,2).')'?>&nbsp;&nbsp;</a></td>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount < 0 )?number_format($lasttotalamount * -1,2):'('.number_format($lasttotalamount,2).')'?>&nbsp;&nbsp;</a></td>
        								<?php }elseif($rowdet->ID == 32){?>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount > 0 )?'('.number_format($totalamount,2).")":number_format($totalamount*-1,2)?>&nbsp;&nbsp;</a></td>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount > 0 )?'('.number_format($lasttotalamount,2).")":number_format($lasttotalamount*-1,2)?>&nbsp;&nbsp;</a></td>
        								<?php }else{?>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount > 0 )?number_format($totalamount,2):'('.number_format($totalamount * -1,2).')'?>&nbsp;&nbsp;</a></td>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount > 0 )?number_format($lasttotalamount,2):'('.number_format($lasttotalamount * -1,2).')'?>&nbsp;&nbsp;</a></td>
        								<?php }?>
                					</tr>
             	<?php
											$rowdet_credit = $rowdet_credit + $totalamount;
											$lastrowdet_credit = $lastrowdet_credit + $totalamount;

											$datatbl_total = $datatbl_total + $totalamount;
											$lastdatatbl_total = $lastdatatbl_total + $lasttotalamount;
								endif;
							?>

						<?php  } ?>
					<?php } ?>
				<?php endforeach;?>
				<?php foreach($groupdetails as $rowdet1): 
					$rowdet1_credit = 0; 
					$lastrowdet1_credit = 0; 					
					?>
				<?php	if($rowdet1->parentID == $rowdet->ID){
							if ($rowdet1->title == 1) {?>
            					<tr>
                					<td colspan="3">&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet1->acctGroupName)?></strong></td>
                				</tr>
                	<?php 	} ?>
				<?php   foreach($groupdetails as $rowdet2): 
					$rowdet2_credit = 0; 
					$lastrowdet2_credit = 0; 

					?>
				<?php		if($rowdet2->parentID == $rowdet1->ID){
								if ($rowdet2->title == 1) {?>
            						<tr>
                						<td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet2->acctGroupName)?></strong></td>
                					</tr>
                	<?php 		} ?>
 				<?php   foreach($groupdetails as $rowdet3): 
					$rowdet3_credit = 0; 
					$lastrowdet3_credit = 0; 
						if($rowdet3->parentID == $rowdet2->ID){
								if ($rowdet3->title == 1) {?>
            						<tr>
                						<td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet3->acctGroupName)?></strong></td>
                					</tr>
                	<?php 		} ?>
     				<?php 	  foreach($accountdetails as $key2=>$row2):
									if($row2->acctGroupID == $rowdet3->ID){?>
      	<?php 
										if(true){ ?>
                 			<?php   		  
                 				$totalamount =  ($row2->currentyeardebit+$row2->openingBalanceDr) - ($row2->currentyearcredit+$row2->openingBalanceCr); 
                 				$lasttotalamount =  ($lastaccountdetails[$key2]->currentyeardebit+$lastaccountdetails[$key2]->openingBalanceDr) - ($lastaccountdetails[$key2]->currentyearcredit+$lastaccountdetails[$key2]->openingBalanceCr); 
                 				if(($totalamount+$lasttotalamount) != 0):
                 			?>
            								<tr>
                								<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo substr($row2->acctCode,0, 4).'-'.substr($row2->acctCode,4, 3).'-'.substr($row2->acctCode,7, 2).' [ '.$row2->acctName.' ]'?></td>
                                                <?php if($rowdet3->status == 1){?>
                									<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount < 0 )?number_format($totalamount * -1,2):'('.number_format($totalamount,2).')'?>&nbsp;&nbsp;</a></td>
                									<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount < 0 )?number_format($lasttotalamount * -1,2):'('.number_format($lasttotalamount,2).')'?>&nbsp;&nbsp;</a></td>
                								<?php }else{?>
	                								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount > 0 )?number_format($totalamount,2):'('.number_format($totalamount * -1,2).')'?>&nbsp;&nbsp;</a></td>
	                								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount > 0 )?number_format($lasttotalamount,2):'('.number_format($lasttotalamount * -1,2).')'?>&nbsp;&nbsp;</a></td>
                								<?php }?>
                							</tr>
             	<?php
											$rowdet_credit = $rowdet_credit + $totalamount;
											$rowdet1_credit = $rowdet1_credit + $totalamount;
											$rowdet2_credit = $rowdet2_credit + $totalamount;
											$rowdet3_credit = $rowdet3_credit + $totalamount;

											$lastrowdet_credit = $lastrowdet_credit + $lasttotalamount;
											$lastrowdet1_credit = $lastrowdet1_credit + $lasttotalamount;
											$lastrowdet2_credit = $lastrowdet2_credit + $lasttotalamount;
											$lastrowdet3_credit = $lastrowdet3_credit + $lasttotalamount;


											$datatbl_total = $datatbl_total + $totalamount;
											$lastdatatbl_total = $lastdatatbl_total + $lasttotalamount;
								endif;				
							?>
						<?php  		} ?>
                	<?php   		  }	 ?>
				<?php   		  endforeach;?>
            						<tr>
                						<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<?php echo $this->lang->line($rowdet3->acctGroupName)?> <?php echo $this->lang->line('subtotal') ?></strong></td>
                                        <?php if($rowdet3->status == 1){?>
                						<td class="tar sep"><strong><?php echo ($rowdet3_credit < 0 )?number_format($rowdet3_credit * -1,2):number_format($rowdet3_credit,2) ?>&nbsp;&nbsp;</strong></td>
                						<td class="tar sep"><strong><?php echo ($lastrowdet3_credit < 0 )?number_format($lastrowdet3_credit * -1,2):number_format($lastrowdet3_credit,2) ?>&nbsp;&nbsp;</strong></td>
                 						<?php }else{?>
                						<td class="tar sep"><strong><?php echo ($rowdet3_credit > 0 )?number_format($rowdet3_credit,2):'('.number_format($rowdet3_credit * -1,2).')' ?>&nbsp;&nbsp;</strong></td>
                						<td class="tar sep"><strong><?php echo ($lastrowdet3_credit > 0 )?number_format($lastrowdet3_credit,2):'('.number_format($lastrowdet3_credit * -1,2).')' ?>&nbsp;&nbsp;</strong></td>
                						<?php }?>
                					</tr>
                	<?php 		} ?>
				<?php   		  endforeach;?>
     				<?php 	  foreach($accountdetails as $key2=>$row2):
									if($row2->acctGroupID == $rowdet2->ID){?>
      	<?php 
										if(true){ ?>
                 			<?php   		  
                 				$totalamount =  ($row2->currentyeardebit+$row2->openingBalanceDr) - ($row2->currentyearcredit+$row2->openingBalanceCr); 
                 				$lasttotalamount =  ($lastaccountdetails[$key2]->currentyeardebit+$lastaccountdetails[$key2]->openingBalanceDr) - ($lastaccountdetails[$key2]->currentyearcredit+$lastaccountdetails[$key2]->openingBalanceCr); 
                 				if(($totalamount+$lasttotalamount) != 0):
                 			?>
            								<tr>
                								<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo substr($row2->acctCode,0, 4).'-'.substr($row2->acctCode,4, 3).'-'.substr($row2->acctCode,7, 2).' [ '.$row2->acctName.' ]'?></td>
                								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" >
                								<?php if($row2->acctGroupID == '36'): ?>
                									<?php  echo ($totalamount* -1 < 0 )?"(".number_format($totalamount,2).")":number_format($totalamount* -1,2)?>
                								<?php elseif($row2->acctGroupID == '44'): ?>
                									<?php  echo ($totalamount < 0 )?"(".number_format($totalamount* -1,2).")":number_format($totalamount,2)?>
                								<?php else: ?>
                									<?php echo ($totalamount < 0 )?number_format($totalamount * -1,2):number_format($totalamount,2)?>
                								<?php endif; ?>
                								&nbsp;&nbsp;</a></td>
                								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" >
                								<?php if($lastaccountdetails[$key2]->acctGroupID == '36'): ?>
                									<?php  echo ($lasttotalamount* -1 < 0 )?"(".number_format($lasttotalamount,2).")":number_format($lasttotalamount* -1,2)?>
                								<?php elseif($lastaccountdetails[$key2]->acctGroupID == '44'): ?>
                									<?php  echo ($lasttotalamount < 0 )?"(".number_format($lasttotalamount* -1,2).")":number_format($lasttotalamount,2)?>
                								<?php else: ?>
                									<?php echo ($lasttotalamount < 0 )?number_format($lasttotalamount * -1,2):number_format($lasttotalamount,2)?>
                								<?php endif; ?>
                								&nbsp;&nbsp;</a></td>
                							</tr>
             				<?php
								$rowdet_credit = $rowdet_credit + $totalamount;
								$rowdet1_credit = $rowdet1_credit + $totalamount;
								$rowdet2_credit = $rowdet2_credit + $totalamount;
								
								$lastrowdet_credit = $lastrowdet_credit + $lasttotalamount;
								$lastrowdet1_credit = $lastrowdet1_credit + $lasttotalamount;
								$lastrowdet2_credit = $lastrowdet2_credit + $lasttotalamount;

								$datatbl_total = $datatbl_total + $totalamount;
								$lastdatatbl_total = $lastdatatbl_total + $lasttotalamount;
								endif;
							?>
						<?php  		} ?>
                	<?php   		  }	 ?>
				<?php   		  endforeach;?>
            						<tr>
                						<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<?php echo $this->lang->line($rowdet2->acctGroupName)?> <?php echo $this->lang->line('subtotal') ?></strong></td>
                                        <?php if($rowdet2->status == 1){?>
                						<td class="tar sep"><strong><?php echo ($rowdet2_credit >= 0 )?'('.number_format($rowdet2_credit,2).')':number_format($rowdet2_credit  * -1,2) ?>&nbsp;&nbsp;</strong></td>
                						<td class="tar sep"><strong><?php echo ($lastrowdet2_credit >= 0 )?'('.number_format($lastrowdet2_credit,2).')':number_format($lastrowdet2_credit  * -1,2) ?>&nbsp;&nbsp;</strong></td>
                 						<?php }else{?>
                						<td class="tar sep"><strong><?php echo ($rowdet2_credit < 0 )?number_format($rowdet2_credit,2):number_format($rowdet2_credit,2) ?>&nbsp;&nbsp;</strong></td>
                						<td class="tar sep"><strong><?php echo ($lastrowdet2_credit < 0 )?number_format($lastrowdet2_credit,2):number_format($lastrowdet2_credit,2) ?>&nbsp;&nbsp;</strong></td>
                						<?php }?>
                					</tr>
                	<?php   } ?>
				<?php   endforeach;?>
      			<?php   foreach($accountdetails as $key=>$row2):
							if($row2->acctGroupID == $rowdet1->ID){?>
      	<?php 
								if(true){ ?>
                 			<?php 	
                 				$totalamount = ($row2->currentyeardebit+$row2->openingBalanceDr) - ($row2->currentyearcredit+$row2->openingBalanceCr); 
                 				$lasttotalamount = ($lastaccountdetails[$key2]->currentyeardebit+$lastaccountdetails[$key2]->openingBalanceDr) - ($lastaccountdetails[$key2]->currentyearcredit+$lastaccountdetails[$key2]->openingBalanceCr); 
                 				if(($totalamount+$lasttotalamount) != 0):
                 			?>
    							<tr>
        							<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo substr($row2->acctCode,0, 4).'-'.substr($row2->acctCode,4, 3).'-'.substr($row2->acctCode,7, 2).' [ '.$row2->acctName.' ]'?></td>
                                    <?php if($rowdet1->status == 1){?>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount < 0 )?number_format($totalamount * -1,2):number_format($totalamount,2)?>&nbsp;&nbsp;</a></td>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount < 0 )?number_format($lasttotalamount * -1,2):number_format($lasttotalamount,2)?>&nbsp;&nbsp;</a></td>
         							<?php }else{?>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $add_year;?>/<?php echo $add_period;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($totalamount > 0 )?'('.number_format($totalamount,2).')':number_format($totalamount * -1,2)?>&nbsp;&nbsp;</a></td>
        								<td class="tar"><a href="<?php echo base_url(); ?>glreports/accountDetailsfc/<?php echo $row2->ID;?>/<?php echo $selyear;?>/<?php echo $selper;?>" title="<?php echo $this->lang->line('details');?>" ><?php echo ($lasttotalamount > 0 )?'('.number_format($lasttotalamount,2).')':number_format($lasttotalamount * -1,2)?>&nbsp;&nbsp;</a></td>
        							<?php }?>
        						</tr>
             	<?php
										$rowdet_credit = $rowdet_credit + $totalamount;
										$rowdet1_credit = $rowdet1_credit + $totalamount;

										$lastrowdet_credit = $lastrowdet_credit + $lasttotalamount;
										$lastrowdet1_credit = $lastrowdet1_credit + $lasttotalamount;

										$datatbl_total = $datatbl_total + $totalamount;
										$lastdatatbl_total = $lastdatatbl_total + $lasttotalamount;
								endif;
							?>
						<?php  	} ?>
                	<?php   	}	 ?>
				<?php 	endforeach;?>
            			  <tr>
                			<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;
								<?php echo $this->lang->line($rowdet1->acctGroupName)?> <?php echo $this->lang->line('subtotal') ?></strong></td>
                                <?php if($rowdet1->status == 1){?>
                					<td class="tar sep"><strong><?php echo ($rowdet1_credit < 0 )?'('.number_format($rowdet1_credit * -1,2).')':number_format($rowdet1_credit,2)?>&nbsp;&nbsp;<strong></td>
                					<td class="tar sep"><strong><?php echo ($lastrowdet1_credit < 0 )?'('.number_format($lastrowdet1_credit * -1,2).')':number_format($lastrowdet1_credit,2)?>&nbsp;&nbsp;<strong></td>
                 				<?php }else{?>
                					<td class="tar sep"><strong><?php echo ($rowdet1_credit > 0 )?'('.number_format($rowdet1_credit,2).')':number_format($rowdet1_credit * -1,2)?>&nbsp;&nbsp;<strong></td>
                					<td class="tar sep"><strong><?php echo ($lastrowdet1_credit > 0 )?'('.number_format($lastrowdet1_credit,2).')':number_format($lastrowdet1_credit * -1,2)?>&nbsp;&nbsp;<strong></td>
                				<?php }?>
                		  </tr>
                	<?php } ?>
				<?php endforeach;?>
            			  <tr>
                			<td><strong>
								<?php echo $this->lang->line($rowdet->acctGroupName)?> <?php echo $this->lang->line('subtotal') ?></strong></td>
                                <?php if($rowdet1->status == 1){?>
                					<td class="tar sep"><strong><?php echo ($rowdet_credit < 0 )?'('.number_format($rowdet_credit,2).')':number_format($rowdet_credit * -1,2)?>&nbsp;&nbsp;</strong></td>
                					<td class="tar sep"><strong><?php echo ($lastrowdet_credit < 0 )?'('.number_format($lastrowdet_credit,2).')':number_format($lastrowdet_credit * -1,2)?>&nbsp;&nbsp;</strong></td>
                 				<?php }elseif($rowdet->ID == 12){?>
                					<td class="tar sep"><strong><?php echo ($rowdet_credit > 0 )?number_format($rowdet_credit,2):"(".number_format($rowdet_credit * -1,2).")"?>&nbsp;&nbsp;</strong></td>
                					<td class="tar sep"><strong><?php echo ($lastrowdet_credit > 0 )?number_format($lastrowdet_credit,2):"(".number_format($lastrowdet_credit * -1,2).")"?>&nbsp;&nbsp;</strong></td>
                 				<?php }else{?>
                					<td class="tar sep"><strong><?php echo ($rowdet_credit > 0 )?'('.number_format($rowdet_credit,2).')':number_format($rowdet_credit * -1,2)?>&nbsp;&nbsp;</strong></td>
                					<td class="tar sep"><strong><?php echo ($lastrowdet_credit > 0 )?'('.number_format($lastrowdet_credit,2).')':number_format($lastrowdet_credit * -1,2)?>&nbsp;&nbsp;</strong></td>
                				<?php }?>
                		  </tr>
<!-- row det -->
                <?php } ?>
		<?php  endforeach; ?>
            			  <tr>
                			<td><h4><?php echo $this->lang->line($datatbl->acctGroupName)?> <?php echo $this->lang->line('subtotal') ?></h4></td>
                                <?php if($datatbl->status == 1){?>
                					<td class="tar sep"><strong><?php echo ($datatbl_total < 0 )?'('.number_format($datatbl_total,2).')':number_format($datatbl_total * -1,2)?>&nbsp;&nbsp;</strong></td>
                					<td class="tar sep"><strong><?php echo ($lastdatatbl_total < 0 )?'('.number_format($lastdatatbl_total,2).')':number_format($lastdatatbl_total * -1,2)?>&nbsp;&nbsp;</strong></td>
                 				<?php }else{?>
                					<td class="tar sep"><strong><?php echo ($datatbl_total > 0 )?'('.number_format($datatbl_total,2).')':number_format($datatbl_total * -1,2)?>&nbsp;&nbsp;</strong></td>
                					<td class="tar sep"><strong><?php echo ($lastdatatbl_total > 0 )?'('.number_format($lastdatatbl_total,2).')':number_format($lastdatatbl_total * -1,2)?>&nbsp;&nbsp;</strong></td>
                				<?php }?>
                		  </tr>
        <?php } ?>
<?php  endforeach; ?>
	<?php } ?>

                     </tbody>
                     </table>
