PK

ADDRLIN : /home/anibklip/pcfcindia.com/2023-24/accounts/
FLL :
Current File : /home/anibklip/pcfcindia.com/2023-24/accounts/banks.php

<?php
	session_start();
	require_once '../common/common.php';
	require_once '../common/secure.php';
	include("connection.php");
	/*if($_GET['cty']=="Ludhiana"){
		include("connection2.php");//for ludhiana	
	}else{
		include("connection.php");
	}	*/
	
	if($_GET['action']=='tax')
	{
		include ("../head.php");
	}
	else
	{
		include ("../head_account.php");
	}	
?>
	<div align="left" style="float:left;"><!-- <a href="tax_report.php">Back</a> --></div> 
	 
	<div align='center'>
		<table width="100%" border="2px;" >
			<?php // image display for normal bank page.
				if($_GET['act']=='normal'){
					echo '<tr>
						<td align="right" >
							<img src="bank_report.gif" width="100%" height="150px"/>
						</td>
					</tr>';	
				}
			?>
			<tr>
				<td><div style='width:100%;font-size:large;' align='center'>Bank Reports</div></td>
			</tr>
			<?php
				if($_GET['act']=='amrt')//normal Amritsar
				{
					$type_bank="amritser";
					$bank_head="<strong>Amritsar</strong>&nbsp;&nbsp;&nbsp;HDFC</strong>";
				}
				elseif($_GET['act']=='ldh')//normal Ludhiana
				{
					$type_bank="Ludhiana";
					$bank_head="<strong>Ludhiana</strong>&nbsp;&nbsp;&nbsp;Punjab National Bank(PNB)</strong>";
				}elseif($_GET['act']=='normal'){
					$bank_head="Banks";
				}
				echo '<tr>
					<th>'.$bank_head.'</th>
				</tr>';
				
				if($_GET['type']=="bankReport")
				{
					echo '<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="100%" align="center" border="1px">
								<tr>
									<td><strong>Date</strong></td>
									<td><strong>Particulars</strong></td>
									<td><strong>Credit</strong></td>
									<td><strong>Debit</strong></td>
								</tr>';
								//start paid cert. income (credit)
								//$sql_inc="SELECT dtd,clnid,invid,certid,grandtotal FROM invoices WHERE invstatus='paid' AND branch='".$type_bank."' ORDER BY invid DESC";
								
								$sql_inc="SELECT inv.dtd,inv.clnid,inv.invid,inv.certid,inv.grandtotal FROM invoices inv,certificate ct WHERE inv.invstatus='paid' AND ct.certificateno=inv.certid AND ct.cancel_status<>1 AND inv.branch='".$type_bank."' ORDER BY inv.invid DESC";
								
								$result_inc=mysql_query($sql_inc);
								while($row_inc=mysql_fetch_array($result_inc))
								{
									$invAmt[]=$row_inc['grandtotal'];	
									$invAmt2=array_sum($invAmt);
									$dt=explode('-',$row_inc['dtd']);
									$crt_dt=$dt['2'].'-'.$dt['1'].'-'.$dt['0'];
									echo '<tr>
										<td>'.$crt_dt.'</td>
										
										<td>'.'<a href="../invoice_print.php?act=print&account=information&clnt_id='.$row_inc['clnid'].'&id='.$row_inc['invid'].'">Invoice No.&nbsp;'.$row_inc['invid'].'</a></td>
										
										<td>'.$row_inc['grandtotal'].'</td>
										<td align="center">&nbsp;&nbsp;&nbsp;--</td>
									</tr>';
								}
								//Ends paid cert.income (credit)
								
								//Start othre Extra Credit/debit
								$sql_inc2="SELECT * FROM bank_amount WHERE city_name='".$_GET['cty']."' order by amt_type";
								$result_inc2=mysql_query($sql_inc2);
								while($row_inc2=mysql_fetch_array($result_inc2))
								{
									$otherinvAmt[]=$row_inc2['amount'];	
									$otherinvAmt2=array_sum($otherinvAmt);
									
									$dt=explode('-',$row_inc2['idate']);
									$crt_dt2=$dt['2'].'-'.$dt['1'].'-'.$dt['0'];
									
									if($row_inc2['amt_type']=='credit')
									{
										$creditTotal[]=$row_inc2['amount'];
										$creditAmt=array_sum($creditTotal);
										$credit=$row_inc2['amount'];
										$debit='--';	
									}
									else
									{
										$debit=$row_inc2['amount'];
										$debit_amttotal1[]=$row_inc2['amount'];
										$debit_amttotal=array_sum($debit_amttotal1);
										$credit="--";
									}
									
									if($row_inc2['bank_name']=="Punjab National Bank(PNB)")
									{
										$detailsURL="banktype=pnb&cty=Ludhiana&detail=yes&bankamtID=".$row_inc2['id']."";
									}
									else
									{
										$detailsURL="banktype=hdfc&cty=Amritsar&detail=yes&bankamtID=".$row_inc2['id']."";
									}
									
									
									echo '<tr>
										<td>'.$row_inc2['tdate'].'</td>
										<td><a href="bank_credit.php?'.$detailsURL.'">'.$row_inc2['particular'].'</a></td>
										<td>'.$credit.'</td>
										<td align="center">'.$debit.'</td>
									</tr>';
								}
								//Ends Ohter Extra Credit/debit 
								$total=$invAmt2+$creditAmt;// total income
								$balance_amt=$total-$debit_amttotal;// Grand Balance Amount
								echo '<tr>
									<td colspan="2" align="right"><strong>Total</strong></td>
									<td><strong>'.number_format($total,2).'</strong></td>
									<td><strong>'.number_format($debit_amttotal,2).'</strong></td>
								</tr>
								<tr>
									<td colspan="3" align="right"><strong>Total Balance</strong></td>
									<td><strong>'.number_format($balance_amt,2).'</strong></td>
								</tr>
								<tr>
									<td colspan="4">&nbsp;<br />&nbsp;<br /><span style="padding-left:400px;"><a href="banks.php?act=normal" style="text-decoration:none;"><input type="button" value="&nbsp;&nbsp;&nbsp;Back&nbsp;&nbsp;&nbsp;"></a></span></td>
								</tr>
							</table>
						</td>
					</tr>';
				}
				elseif($_GET['act']=='normal')//normal display
				{
					$sql_inc="SELECT inv.grandtotal,inv.branch FROM invoices inv,certificate ct WHERE inv.invstatus='paid' AND ct.certificateno=inv.certid AND ct.cancel_status<>1";
					$result_inc=mysql_query($sql_inc);
					while($row_inc=mysql_fetch_array($result_inc))
					{
						if($row_inc['branch']=='amritser')
						{
							$invAmt[]=$row_inc['grandtotal'];	
						}
						elseif($row_inc['branch']=='ludhiana')
						{
							$invAmtldh[]=$row_inc['grandtotal'];	
						}
					}
					if($invAmt!=""){
						$invAmt2=array_sum($invAmt);	
					}
					if($invAmtldh!=""){
						$invAmtldh2=array_sum($invAmtldh);	
					}
					
					
					$sql_inc2="SELECT * FROM bank_amount";
					$result_inc2=mysql_query($sql_inc2);
					while($row_inc2=mysql_fetch_array($result_inc2))
					{
						if($row_inc2['city_name']=='Amritsar')
						{
							if($row_inc2['amt_type']=='credit')
							{
								$mainbalamrt[]=$row_inc2['amount'];
							}else{
								$mainballdh[]=$row_inc2['amount'];
							}
						}
						elseif($row_inc2['city_name']=='Ludhiana')
						{
							if($row_inc2['amt_type']=='credit')
							{
								$mainbalLDH[]=$row_inc2['amount'];
							}else{
								$mainbalLDH2[]=$row_inc2['amount'];
							}
							/*$creditTotalldh[]=$row_inc2['amount'];
							$creditAmtldh=array_sum($creditTotalldh);*/
						}
					}
					if($mainbalamrt!=""){
						$mainbalamrt1=array_sum($mainbalamrt);	
					}
					if($mainballdh!=""){
						$mainballdh2=array_sum($mainballdh);	
					}
					
					if($mainbalLDH!=""){
						$mainbalLDH1=array_sum($mainbalLDH);	
					}
					if($mainbalLDH2!=""){
						$mainbalLDH3=array_sum($mainbalLDH2);	
					}
					
					//---------Amritsar-------------
					$totalamritsar=$invAmt2+$mainbalamrt1;
					$finalamritsar=$totalamritsar-$mainballdh2;
					
					//---------Ludhiana-------------
					$totalludhiana=$invAmtldh2+$mainbalLDH1;
					$finalludhiana=$totalludhiana-$mainbalLDH3;
					
					//-----grand total-----------
					$grand_total=$finalamritsar+$finalludhiana;
					echo '<tr>
						<td>
							<table width="100%" border="0">
								<tr>
									<td width="15%"><strong>Amritsar</strong></td>
									<td  width="25%"><a href="banks.php?act=amrt&type=bankReport&cty=Amritsar">HDFC</a></td>
									<td width="14%" style="text-align: right;">Total Balance : </td>
									<td  width="14%" style="text-align: right;">'.number_format($finalamritsar,2).'</td>
									<td width="12%">(<a href="bank_credit.php?banktype=hdfc&cty=Amritsar">Add Entry</a>)</td>
								</tr>
								<tr>
									<td><strong>Ludhiana</strong></td>
									<td><a href="banks.php?act=ldh&type=bankReport&cty=Ludhiana">Punjab National Bank(PNB)</a></td>
									<td style="text-align: right;">Total Balance : </td>
									<td style="text-align: right;">'.number_format($finalludhiana,2).'</td>
									<td>(<a href="bank_credit.php?banktype=pnb&cty=Ludhiana">Add Entry</a>)</td>
								</tr>
								<tr>
									<td colspan="2"><strong>Grand Total</strong></td>
									<td style="text-align: right;"><strong>Total Balance : </strong></td>
									<td style="text-align: right;">'.number_format($grand_total,2).'</td>
									<td>&nbsp;</td>
								</tr>
							</table>
						</td>
					</tr>';
				}
			?>
		</table>
	</div>
<?php
	include ("../foot.php");
?>


PK 99