<table width="98%" border="0" align="center" cellpadding="1" cellspacing="0">
    
    
    					<tr>
                            <td colspan="2"  style="overflow:hidden;border-bottom:1px solid #eeeeee; padding-bottom:10px;">
                                <p style="text-align: right; margin:0; padding-right: 10px; font-weight: 500; line-height: 2; padding-bottom: 0px; padding-top: 0px; color: black; font-size: 25px;">
                                    <?php if(isset($rptTitle)) echo $rptTitle; ?>
                                </p>
                                        
                                        <p style="text-align:center; font-size:16px; width:355px;margin:0 auto;">
                                            <span style=" font-weight:800;"><?php echo $companyInfo->companyName; ?></span> <span style="font-size:10px;"><?php echo "(".$companyInfo->companyNo.")";?></span><br />
                                            <span style="font-size:10px;"><?php echo "GST Registration No : ".$companyInfo->gstRegisteredNo; ?></span><br />
                                        </p>
                                        <p style="width: 355px; text-align:center; font-size:10px; line-height:1.4; padding:0 0 5px; margin:0 auto; ">

                                            <?php if(!empty($companyInfo->line1)): ?><span><?php echo $companyInfo->line1; ?></span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->line2) || !empty($companyInfo->line3)): ?><span><?php echo $companyInfo->line2.", ".$companyInfo->line3; ?></span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->companyPostCode) || !empty($companyInfo->city)): ?><span><?php echo $companyInfo->companyPostCode . '  ' . $companyInfo->city; ?> </span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->fldname) || !empty($companyInfo->fldcountry)): ?><span><?php echo $companyInfo->fldname . '  ' . $companyInfo->fldcountry; ?> </span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->phoneNo) || !empty($companyInfo->faxNo)): ?><span><?php echo 'Phone : ' . $companyInfo->phoneNo . '  Fax : ' . $companyInfo->faxNo; ?> </span><?php endif; ?>
                                        </p>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php
                                if (isset($leftContentHeader)){
                                    echo "<p style='padding-left:10px; margin:0; font-size:11px; '>"
                                    . "<strong>".$leftContentHeader."</strong></p>";
                                }
                                 
                                 if (isset($leftContent)){
                                   echo '<p style="padding-left:10px; margin:0; line-height:1.4;">';
                                    foreach ($leftContent as $value) {
                                         echo $value != ''?"<span>".$value."</span><br />":'';
                                     }
                                  echo '</p>';
                                 }
                                
                                ?>
                            </td>
                                
                                <td style="float:right;" valign="top">
                                    <p style="line-height:1.4; text-align:left;">
                                        <?php
	                                        if (isset($rightContentHeader)){
	                                        	echo "<p style='padding-right:10px; margin:0; font-size:11px; '>"
	                                        			. "<strong>".$rightContentHeader."</strong></p>";
	                                        } 
                                            if (isset($rightContent)){
                                                 foreach ($rightContent as $value) {
                                                    echo $value != ''?"<span>".$value."</span><br />":'';
                                                }
                                            }
                                        ?>
                                    </p>
                                  </td>
                            </tr>
</table>
<br />
<br />
<div>

							<table class="editable" cellpadding="0" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th><?php echo $this->lang->line('description') ?></th>
                                            <?php foreach($months as $month): ?>
                                            <th class="tar"><?php echo $this->lang->line('month'.date('n',strtotime($month->startDate)))." ".$selyear; ?>&nbsp;&nbsp;</th>
                                          <?php endforeach; ?>
                                            <th class="dn">&nbsp;</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        if (isset($accountGroup) && !empty($accountdetails)) {
                                            foreach ($accountGroup as $datatbl):
                                                foreach($monthly as $key=>$month):
                                                    $total_thisyear[$key] = 0;
                                                    $thisyear_amount[$key] = 0;
                                                    $tyear_amount[$key] = 0;
                                                endforeach;
                                                ?>
                                                <?php if ($datatbl->title == 1) { ?>
                                                    <tr>
                                                        <td colspan="<?php echo count($months)+1; ?>"><h5><?php echo $this->lang->line($datatbl->acctGroupName) ?></h5></td>
                                                    </tr>
                                                <?php } ?>
                                                <?php
                                                foreach ($groupdetails as $rowdet):
                                                    foreach($monthly as $key=>$month):
                                                        $rowdet_thisyeartotal[$key] = 0;
                                                    endforeach;
                                                    if ($rowdet->parentID == $datatbl->ID) {
                                                        ?>
                                                    <?php if ($rowdet->title == 1) { ?>
                                                            <tr>
                                                                <td colspan="<?php echo count($months)+1; ?>">&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet->acctGroupName) ?></strong></td>
                                                            </tr>
                                                        <?php } ?>
                                                        <?php
                                                        foreach ($groupdetails as $rowdet1):
                                                            foreach($monthly as $key=>$month):
                                                                $rowdet1_thisyeartotal[$key] = 0;
                                                            endforeach;
                                                            if ($rowdet1->parentID == $rowdet->ID) {
                                                                ?>
                                                                <?php if ($rowdet1->title == 1) { ?>
                                                                    <tr>
                                                                        <td colspan="<?php echo count($months)+1; ?>">&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet1->acctGroupName) ?></strong></td>
                                                                    </tr>
                                                                <?php } ?>
                                                                <?php if ($monthly) { ?>
                                                                    <?php foreach ($monthly[$start] as $key=>$row):
                                                                        if ($row->acctGroupID == $rowdet1->ID) {
                                                                            ?>
                                                                            <?php if(true) { ?>
                                                                                <tr>
                                                                                    <td style="display:none" ></td>
                                                                                    <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 foreach($monthly as $index=>$month): $zeroChkr = 0; ?>
                                                                                    <?php $tyear_amount[$index] = ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); 
                                                                                        $zeroChkr += $tyear_amount[$index];
                                                                                    ?>
                                                                                    
                                                                                    <?php if ($rowdet1->status == 1) { ?>
                                                                                            <td class="tar"><?php echo ($tyear_amount[$index] <= 0 ) ? number_format($tyear_amount[$index] * -1, 2) : '(' . number_format($tyear_amount[$index], 2) . ')' ?></td>
                                                                                    <?php } else { ?>
                                                                                            <td class="tar"><?php echo ($tyear_amount[$index] >= 0 ) ? number_format($tyear_amount[$index], 2) : '(' . number_format($tyear_amount[$index] * -1, 2) . ')' ?></td>
                                                                                    <?php } ?>

                                                                                        <?php $rowdet1_thisyeartotal[$index] = $rowdet1_thisyeartotal[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>                                        
                                                                                        <?php $rowdet_thisyeartotal[$index] = $rowdet_thisyeartotal[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>                                        
                                                                                        <?php $total_thisyear[$index] = $total_thisyear[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>

                                                                                    <?php endforeach;
                                                                                    if($zeroChkr == 0): echo "<td class='dn hideMe'>Display None</td>";
                                                                                    else:               echo "<td class='dn'>Display Block</td>";
                                                                                    endif;
                                                                                    ?>
                                                                                </tr>
                                        
                                    <?php } ?>        
                                <?php }
                            endforeach;
                            ?>
                        <?php } ?>
                                                                <tr>
                                                                    <td>&nbsp;&nbsp;&nbsp;<?php echo $this->lang->line('subtotal') ?> <?php echo $this->lang->line($rowdet1->acctGroupName) ?> </td>

                                                                    <?php foreach($monthly as $index=>$month): ?>
                                                                    <?php if ($rowdet1->status == 1) { ?>
                                                                            <td class="tar sep"><?php echo ($rowdet1_thisyeartotal[$index] <= 0 ) ? number_format($rowdet1_thisyeartotal[$index] * -1, 2) : '(' . number_format($rowdet1_thisyeartotal[$index], 2) . ')' ?></td>
                                                                    <?php } else { ?>
                                                                            <td class="tar sep"><?php echo ($rowdet1_thisyeartotal[$index] >= 0 ) ? number_format($rowdet1_thisyeartotal[$index], 2) : '(' . number_format($rowdet1_thisyeartotal[$index] * -1, 2) . ')' ?></td>
                                                                    <?php } ?>
                                                                    <?php endforeach;?>
                                                                </tr>
                                                                <tr><td colspan="<?php echo count($months)+1; ?>">&nbsp;</td></tr>
                    <?php }
                endforeach;
                ?>
                    <?php if ($accountdetails) { ?>
                    <?php
                    foreach ($monthly[$start] as $key=>$row):

                        //print_r($row);
                        if ($row->acctGroupID == $rowdet->ID) {
                            ?>
                                                                        <?php if ($row->acctCode == '130000000') { ?>
                                                                            
                                                                        <tr>
                                                                            <td style="display:none" ></td>
                                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 foreach($monthly as $index=>$month): $zeroChkr = 0?>
                                                                        
                                                                            <?php $thisyear_amount[$index] = $currentretained[$index]; ?>
                                                                            <?php $zeroChkr += $thisyear_amount[$index]; ?>

                                                                            <?php if ($rowdet->status == 1) { ?>
                                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] <= 0 ) ? number_format($thisyear_amount[$index] * -1, 2) : '(' . number_format($thisyear_amount[$index], 2) . ')' ?></td>
                                                                            <?php } else { ?>
                                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] >= 0 ) ? number_format($thisyear_amount[$index], 2) : '(' . number_format($thisyear_amount[$index] * -1, 2) . ')' ?></td>
                                                                            <?php } ?>
                                                                            <?php $total_thisyear[$index] = $total_thisyear[$index] + $thisyear_amount[$index]; ?>
                                                                            <?php $rowdet_thisyeartotal[$index] = $rowdet_thisyeartotal[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + $thisyear_amount[$index]; ?>

                                                                        <?php endforeach; 
                                                                        if($zeroChkr == 0): echo "<td class='dn hideMe'>Display None</td>";
                                                                        else:               echo "<td class='dn'>Display Block</td>";
                                                                        endif;
                                                                        ?>
                                                                        </tr>
                                                                            
                                                                        
                                                                        <?php } elseif ($row->acctCode == '120000000') { ?>
                                                                        
                                                                        <tr>
                                                                            <td style="display:none" ></td>
                                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 foreach($monthly as $index=>$month): $zeroChkr = 0; ?>
                                                                            <?php $lastyear_amount[$index] = $lastRetained; ?>
                                                                            <?php
                                                                                $thisyear_amount[$index] = $currRetain; //$currentretained * -1;                                        
                                                                                $zeroChkr += $thisyear_amount[$index];
                                                                            ?>    

                                                                            <?php if ($rowdet->status == 1) { ?>
                                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] <= 0 ) ? number_format($thisyear_amount[$index] * -1, 2) : '(' . number_format($thisyear_amount[$index], 2) . ')' ?></td>
                                                                            <?php } else { ?>
                                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] >= 0 ) ? number_format($thisyear_amount[$index], 2) : '(' . number_format($thisyear_amount[$index] * -1, 2) . ')' ?></td>
                                                                            <?php } ?>
                                                                            <?php $total_thisyear[$index] = $total_thisyear[$index] + $thisyear_amount[$index]; ?>
                                                                            <?php $rowdet_thisyeartotal[$index] = $rowdet_thisyeartotal[$index] + $thisyear_amount[$index]; //+ ($row->lastyeardebit-$row->lastyearcredit)+$thisyear_amount; ?>
                                                                        <?php endforeach; 
                                                                        if($zeroChkr == 0): echo "<td class='dn hideMe'>Display None</td>";
                                                                        else:               echo "<td class='dn'>Display Block</td>";
                                                                        endif;

                                                                        ?>
                                                                        </tr>
                                                                            
                                                                        <?php } ?>
                                                                    <?php if ($row->lastyeardebit == 0 && $row->lastyearcredit == 0 && $row->currentyeardebit == 0 && $row->currentyearcredit == 0) {
                                                                        
                                                                    } elseif ($row->acctCode != '130000000' && $row->acctCode != '120000000') {
                                                                        ?>
                                                                        
                                                                        <tr>
                                                                            <td style="display:none" ></td>
                                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 
                                                                            $zeroChkr = 0;
                                                                            foreach($monthly as $index=>$month): ?>

                                                                                <?php $tyear_amount[$index] = ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>
                                                                                <?php $zeroChkr += $tyear_amount[$index]; ?>

                                                                                <?php if ($rowdet->status == 1) { ?>
                                                                                    <td class="tar"><?php echo ($tyear_amount[$index] <= 0 ) ? number_format($tyear_amount[$index] * -1, 2) : '(' . number_format($tyear_amount[$index], 2) . ')' ?></td>
                                                                                <?php } else { ?>
                                                                                    <td class="tar"><?php echo ($tyear_amount[$index] >= 0 ) ? number_format($tyear_amount[$index], 2) : '(' . number_format($tyear_amount[$index] * -1, 2) . ')' ?></td>
                                                                                <?php } ?>
                                                                                
                                                                                <?php $total_thisyear[$index] = $total_thisyear[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>
                                                                                <?php $rowdet_thisyeartotal[$index] = $rowdet_thisyeartotal[$index] + ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit); ?>
                                                                                <?php
                                                                                if($zeroChkr == 0): echo "<td class='dn hideMe'>Display None</td>";
                                                                                else:               echo "<td class='dn'>Display Block</td>";
                                                                                endif;
                                                                                ?>

                                                                            <?php endforeach;?>
                                                                        </tr>
                                
                                                                    <?php } ?>
                                                                <?php }
                                                            endforeach;
                                                            ?>
                                                        <?php } ?>        
                                                        <tr>
                                                        <?php if ($rowdet->ID == '39') { ?>
                                                                <td>&nbsp;&nbsp;&nbsp;<strong><?php echo $this->lang->line($rowdet->acctGroupName) ?></strong></td>
                                                        <?php } else { ?>
                                                                <td>&nbsp;&nbsp;&nbsp;<?php echo $this->lang->line('subtotal') ?> <?php echo $this->lang->line($rowdet->acctGroupName) ?> </td>
                                                        <?php } ?>

                                                        <?php foreach($monthly as $index=>$month): ?>
                                                            <?php if ($rowdet->status == 1) { ?>
                                                                <td class="tar sep"><?php echo ($rowdet_thisyeartotal[$index] <= 0 ) ? number_format($rowdet_thisyeartotal[$index] * -1, 2) : '(' . number_format($rowdet_thisyeartotal[$index], 2) . ')' ?></td>
                                                            <?php } else { ?>
                                                                <td class="tar sep"><?php echo ($rowdet_thisyeartotal[$index] >= 0 ) ? number_format($rowdet_thisyeartotal[$index], 2) : '(' . number_format($rowdet_thisyeartotal[$index] * -1, 2) . ')' ?></td>
                                                            <?php } ?>
                                                        <?php endforeach;?>
                                                        </tr>
                                                        <tr><td colspan="<?php echo count($months)+1; ?>">&nbsp;</td></tr>
                                                        <?php }
                                                    endforeach;
                                                    ?>
                                                <?php foreach ($monthly[$start] as $key => $row):
                                                    if ($row->acctGroupID == $datatbl->ID) {
                                                        ?>
                                                            
                                                        <tr>
                                                            <td style="display:none" ></td>
                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 foreach($monthly as $index=>$month): 

                                                                $zeroChkr = 0;
                                                            ?>

                                                                <?php if ($row->acctCode == '130000000') { ?>
                                                                    <?php $thisyear_amount[$index] = $currentretained[$index] * -1; ?>
                                                                <?php } else { ?>
                                                                    <?php $thisyear_amount[$index] = ($monthly[$index][$key]->lastyeardebit - $monthly[$index][$key]->lastyearcredit) + ($monthly[$index][$key]->currentyeardebit - $monthly[$index][$key]->currentyearcredit) ?>
                                                                <?php
                                                                }
                                                                $zeroChkr += $thisyear_amount[$index];
                                                                ?>


                                                                <?php if ($datatbl->status == 1) { ?>
                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] <= 0 ) ? number_format($thisyear_amount[$index] * -1, 2) : '(' . number_format($thisyear_amount[$index], 2) . ')' ?></td>
                                                                <?php } else { ?>
                                                                    <td class="tar"><?php echo ($thisyear_amount[$index] >= 0 ) ? number_format($thisyear_amount[$index], 2) : '(' . number_format($thisyear_amount[$index] * -1, 2) . ')' ?></td>
                                                                <?php } ?>
                                                                                                        </tr>
                                                                <?php $total_thisyear[$index] = $total_thisyear[$index] + $thisyear_amount[$index]; ?>
                                                            <?php endforeach;
                                                            if($zeroChkr == 0): echo "<td class='dn hideMe'>Display None</td>";
                                                            else:               echo "<td class='dn'>Display Block</td>";
                                                            endif;

                                                            ?>
                                                        <?php }
                                                    endforeach;
                                                    ?>
                                                <tr>
                                                    <td><h4><?php echo $this->lang->line('total') ?> <?php echo $this->lang->line($datatbl->acctGroupName) ?> </h4></td>
                                                <?php foreach($monthly as $index=>$month): ?>
                                                    <?php if ($datatbl->status == 1) { ?>
                                                            <td class="tar tots"><?php echo ($total_thisyear[$index] <= 0 ) ? number_format($total_thisyear[$index] * -1, 2) : '(' . number_format($total_thisyear[$index], 2) . ')' ?></td>
                                                    <?php } else { ?>
                                                            <td class="tar tots"><?php echo ($total_thisyear[$index] >= 0 ) ? number_format($total_thisyear[$index], 2) : '(' . number_format($total_thisyear[$index] * -1, 2) . ')' ?></td>
                                                    <?php } ?>
                                                <?php endforeach;?>                                                
                                                </tr>
                                                <tr><td colspan="<?php echo count($months)+1; ?>">&nbsp;</td></tr>
    <?php endforeach;
} ?>
                                    </tbody>
                                </table>