<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GST 03 Summary</title>
<link rel="stylesheet" href="<?php echo base_url()?>css/stylesheets.css" type="text/css" />
<?php //echo put_headers(); ?>
<style>
	.thPrint tr{
		height: 41px;
	}
	.table thead th{
		  vertical-align: middle;
	}
</style>
<style media="print" type="text/css">
	/*body{FONT-SIZE: 14px;FONT-FAMILY: Arial;COLOR: #000000}*/
	.printButton { display: none; }
	
	@media print {
                .td-print,.td-print*{display:none !important;}
				.printTbl hr{
					margin:0 !important;
				}
				.thPrint th{
					/*background:url(<?php echo base_url() ?>img/rptPaymentAdvice.png) !important;*/
                	/*-webkit-print-color-adjust: exact;*/
					
				}
                /*body{overflow:visible !important;}*/
                @page{ 
                    size: auto;   /* auto is the initial value */ 

                    /* this affects the margin in the printer settings */ 
                    margin: 10px 10px 10px 10px;  
                } 
                .compLogo{
                    width: 150px;
                }

            }
</style>
<script language="javascript" type="text/javascript">	
	$(document).ready(function(){
		//$('.image').height($('.thPrint').height());
		//$('.image').width($('.thPrint').width());
	});
	function do_print(){
		window.print();
	}
	function do_printexcel(){
		var url = "<?php echo base_url()?>gst03/gst03SummaryPrint_excel/<?php echo $periodFromID?>/<?php echo $periodToID?>";
		window.location.href = url;
	}
</script>
</head>

<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
    
    <!--<tr>
        <td align="center" colspan="2">
            <div class="printButton" align="center">
        	<?php 
			/*$js = 'onClick="do_print()" class="btn-icon btn-success-form Print" title="Print"';
			echo form_button('Print','<span class="i-printer">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="do_printexcel()" class="btn-icon btn-warning-form EXCEL" title="Download"';
			echo form_button('EXCEL','<span class="i-download">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="javascript:window.close();" class="btn-icon btn-danger-form Close" title="Close"';
			echo form_button('Close','<span class="i-switch">',$js);*/?>
            </div>
        </td>
    </tr>-->
    <tr>
                            <td colspan="2" >
                            	<img class="compLogo" src="<?php echo base_url(). 'images/'.element('logo', $this->session->userdata('logged_in'));?>" style="max-width:150px; max-height:150px; position:absolute; left:20px;top:20px;" />
                                <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 echo $this->lang->line('module');?>
                                </p>
                                        <p style="text-align:center; font-size:16px;"> 
                                            <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="text-align:center; font-size:10px; line-height:1.4; padding:0 0 5px; margin:0; border-bottom:1px solid #eeeeee;">

                                            <?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>
<div>
	<table border="0" cellpadding="1" cellspacing="0" width="100%">
		<thead>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td class="tar"><b><?php echo $this->lang->line('as').":"." ".date('d-m-Y'); ?></b></td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td><b><?php echo $this->lang->line('taxablePeriod').":"." ".date('d-m-Y', strtotime($startDateFrom))." ".$this->lang->line('to')." ".date('t-m-Y', strtotime($startDateTo)) ?></b></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        </tbody>
        </table>
        <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-2.0.0.min.js"></script>
        <script type="text/javascript">
			$(window).load(function(){      
				$(window).resize();
			});
        	$(window).resize(function(){ 
				if($('.image').length){
					$('.image').width($('.image').parents('thead').width());
					$('.image').height($('.image').parents('thead').find('tr:nth-child(2)').height());
				}
			});
        </script>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="">
        				<img class="image" style="position:absolute;left:0;top:10;z-index: -1000;width:100%" alt="" src="<?php echo base_url() ?>img/rptPaymentAdvice.png" />
						<?php
						$count = 0;
                        echo "<div class='content np table-sorting'>
                            <table cellpadding='0' cellspacing='0' width='100%' id='test' class='editable' style='position:relative;'>
                                <thead  class=\"thPrint\">
								<tr style=\"height:0px;\">
									<th colspan='".$periodDiff."'>"; ?>
                						<img class="image" style="position:absolute;left:0;top:10;z-index: -1000;width:100%" alt="" src="<?php echo base_url() ?>img/rptPaymentAdvice.png" />
                					<?php echo "</th>
            					</tr>
                                <tr>
                                    <th class='tac'>No.</th>
                                    <th class='tac'>".$this->lang->line('itemDesc')."</th>";
									for($i=0; $i<$periodDiff; $i++){
										if($periodDiff > 1){
												if($i == 0){	
													if(date("M", strtotime($i." months", strtotime($startDateFrom))) == "Dec"){
														echo "<th class='tac'>".date("M", strtotime($i." months", strtotime($startDateFrom)))."'".date("y", strtotime($count." years", strtotime($startDateFrom)))."</th>";
														//$count = 0;
														$count ++;
													}
													else{
														echo "<th class='tac'>".date("M", strtotime($i." months", strtotime($startDateFrom)))."'".date("y", strtotime($count." years", strtotime($startDateFrom)))."</th>";
													}
												}
												else{
													if(date("M", strtotime($i." months", strtotime($startDateFrom))) == "Dec"){
														echo "<th class='tac'>".date("M", strtotime($i." months", strtotime($startDateFrom)))."'".date("y", strtotime($count." years", strtotime($startDateFrom)))."</th>";
														$count ++;
													}
													else{
														echo "<th class='tac'>".date("M", strtotime($i." months", strtotime($startDateFrom)))."'".date("y", strtotime($count." years", strtotime($startDateFrom)))."</th>";
													}
												}
										}
										else{
											echo "<th class='tac'>".date("M", strtotime($startDateFrom))."'".date("y", strtotime($count." years", strtotime($startDateFrom)))."</th>";
										}
									}
									echo "<th class='tac'>".$this->lang->line('total')."</th>";
                                "</tr>
                                </thead>
								<tbody>";
								foreach($datatbls as $datatbl):
                                echo"<tr style=\"height:20px;\">
									<td class='tac'>5</td>
									<td>".$this->lang->line('outputTax')."</td>";
									foreach ($datatbl as $col => $val) {
										if (strtoupper(substr($col,0,8))=='MONTHB5A'){
											echo '<td></td>';
										}
									}
									echo"<td></td>
								</tr>";
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'></td>
									<td>".$this->lang->line('5a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHB5A'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'></td>
									<td>".$this->lang->line('5b')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHB5B'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								foreach($datatbls as $datatbl):
								echo"<tr style=\"height:20px;\">
									<td class='tac' height='10'></td>
									<td></td>";
									foreach ($datatbl as $col => $val) {
										if (strtoupper(substr($col,0,8))=='MONTHB6A'){
											echo '<td></td>';
										}
									}
									echo"<td></td>
								</tr>";
								endforeach;
								
								foreach($datatbls as $datatbl):
								echo"<tr style=\"height:20px;\">
									<td class='tac'>6</td>
									<td>".$this->lang->line('inputTax')."</td>";
									foreach ($datatbl as $col => $val) {
										if (strtoupper(substr($col,0,8))=='MONTHB6A'){
											echo '<td></td>';
										}
									}
									echo"<td></td>
								</tr>";
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'></td>
									<td>".$this->lang->line('6a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHB6A'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'></td>
									<td>".$this->lang->line('6b')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHB6B'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								foreach($datatbls as $datatbl):
								echo"<tr style=\"height:20px;\">
									<td class='tac' height='10'></td>
									<td></td>";
									foreach ($datatbl as $col => $val) {
										if (strtoupper(substr($col,0,7))=='MONTHB7'){
											echo '<td></td>';
										}
									}
									echo"<td></td>
								</tr>";
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>7</td>
									<td>".$this->lang->line('7a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,7))=='MONTHB7'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>8</td>
									<td>".$this->lang->line('8a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,7))=='MONTHB8'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								foreach($datatbls as $datatbl):
								echo"<tr style=\"height:20px;\">
									<td class='tac' height='10'></td>
									<td></td>";
									foreach ($datatbl as $col => $val) {
										if (strtoupper(substr($col,0,8))=='MONTHC10'){
											echo '<td></td>';
										}
									}
									echo"<td></td>
								</tr>";
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>10</td>
									<td>".$this->lang->line('10a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC10'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>11</td>
									<td>".$this->lang->line('11a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC11'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>12</td>
									<td>".$this->lang->line('12a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC12'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>13</td>
									<td>".$this->lang->line('13a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC13'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>14</td>
									<td>".$this->lang->line('14a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC14'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>15</td>
									<td>".$this->lang->line('15a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC15'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>16</td>
									<td>".$this->lang->line('16a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC16'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>17</td>
									<td>".$this->lang->line('17a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC17'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								$bil = 0;
								$totCol = array();
								foreach($datatbls as $datatbl):
								$bil++;
								echo"<tr style=\"height:20px;\">
									<td class='tac'>18</td>
									<td>".$this->lang->line('18a')."</td>";
									$total = 0;
									$i = 0;
									foreach ($datatbl as $col => $val) {
												if (strtoupper(substr($col,0,8))=='MONTHC18'){
													echo '<td align="right">'.number_format($val, 2, '.', ',').'</td>';
													$total += $val;
													if($bil == 1)
														$totCol[] += $val;
													else
														$totCol[$i] += $val;	
													$i++;
												}
											}
									echo '<td align="right"><b>'.number_format($total, 2, '.', ',').'</b></td>
								</tr>';
								endforeach;
								
								echo"</tbody>";        
                            echo"</table>
                        </div><!-- content -->";  ?>
            
            
	</table>
    <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
        <tr>
            <td align="center" colspan="2">
            <br />
                <div class="printButton" align="left">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<?php 
                $js = 'onClick="do_print()" class="btn-icon btn-success-form Print" title="Print"';
                echo form_button('Print','<span class="icon-print">',$js);?> <?php
                $js = 'onClick="do_printexcel()" class="btn-icon btn-warning-form EXCEL" title="Download"';
                echo form_button('EXCEL','<span class="icon-download">',$js);?> <?php
                $js = 'onClick="javascript:window.close();" class="btn-icon btn-danger-form Close" title="Close"';
                echo form_button('Close','<span class="icon-off">',$js);?>
                </div>
            </td>
        </tr>
    </table>
    <br /><br /><br /><br />                                         
</div>
<div style="page-break-after:always"></div>
</html>
