<?php session_start();



if($_SESSION[invcox] == ""){



header("location:login.php?action=need");



}else{







include("config.php");?>



<!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=iso-8859-1" />



<title>Arnim Holidays Accounting Software</title>



<link href="style.css" rel="stylesheet" type="text/css" />



<SCRIPT LANGUAGE="JavaScript">







<!-- Begin


function popUp(URL) {

day = new Date();
id = day.getTime();



eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=yes,width=950,height=650,left = 100,top = 100');");



}



// End -->



</script>

<style type="text/css">

<!--

.style2 {color: #DC147B;

	font-weight: bold;

}

.style3 {color: #000000}

-->

</style>
<?php include("calendar.php"); ?>
</head>







<body>



<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">



  <tr>



    <td><?php include("top.php")?></td>



  </tr>



  <tr>



    <td>&nbsp;</td>



  </tr>



  <tr>



    <td class="center_page_white"><table width="100%" border="0" cellspacing="1" cellpadding="0">



      <tr>



        <td valign="top"><br /></td>



      </tr>



      <tr>



        <td height="30" align="center"><strong>Pending Payable &amp; Receivable</strong></td>



      </tr>



      <tr>



        <td class="round_box"><table width="100%" border="0" cellspacing="1" cellpadding="2">
          <tbody>
            <tr>
              <td width="49%" valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="list_table">
                <tr>
                  <td colspan="7" align="left"  ><strong>Payable  </strong></td>
                </tr>
                <tr>
                  <th align="left" >Date<br /></th>
                  <th align="left" >ID</th>
                  <th align="left" >Payable  Type </th>
                  <th align="left" >Pay to</th>
                  <th align="left" >Amount</th>
                  <th > Comments</th>
                  <th width="59" align="center" >Edit</th>
                </tr>
                <?php 

		   $m=date("m");

			$y=date("Y");

			  

		  $dt=$y.$m;

		  $date=date("Y-m-d");



		 

		 

	

		  $dresult=mysql_query("select * from pr where amount>'0' and cdate2='0000-00-00' order by cdate asc ");
		  $drow=mysql_fetch_array($dresult);

		  $total=0;
		  do{

		  ?>
                <tr>
                  <td width="47" align="left"  class="link"><?php 

			 echo dtformat($drow[cdate]);

			?></td>
                  <td width="48" align="left"  class="link"><a href="javascript:void(0);" onclick="popUp('show_pr.php?id=<?php echo $drow[id]; ?>')"><?php echo $drow[id]; ?></a></td>
                  <td width="111" align="left"  class="link"><?php 

		  $aresult=mysql_query("select * from pr_type WHERE id='$drow[cost_type]' limit 1");
		  $arow=mysql_fetch_array($aresult);

			

			echo $arow[cost]; ?></td>
                  <td width="159" align="left"  class="link"><?php echo $drow[pt]; ?></td>
                  <td width="99" align="left"  class="link"><?php 


			 echo $drow[amount];

			 $total=$total+$drow[amount];

			?></td>
                  <td  class="link"><?php 

			 echo $drow[comments];

			?></td>
                  <td width="59" align="center"  class="link"><?php 
if($drow[status] == '0'){ 

if($drow[cdate] == $date1ah){

//-----------------
if($_SESSION[invcox] == "$drow[suser]"){ ?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>">Edit</a>
                    <?php }else{
$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>">Edit</a>
                    <?php 	

}
}

//-----------------------

}else{

$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>">Edit</a>
                    <?php } }


}else{

	$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>">Edit</a>
                    <?php } }?></td>
                </tr>
                <?php 

		  }while($drow=mysql_fetch_array($dresult));

		  ?>
                <tr>
                  <td colspan="2" align="right"  class="link"><strong>Total : </strong></td>
                  <td align="right"  class="link">&nbsp;</td>
                  <td align="right"  class="link">&nbsp;</td>
                  <td align="left"  class="link"><strong><?php echo $total; ?></strong></td>
                  <td  class="link">&nbsp;</td>
                  <td  class="link">&nbsp;</td>
                </tr>
              </table></td>
              <td width="1%">&nbsp;</td>
              <td width="50%" valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="list_table">
                <tr>
                  <td colspan="7" align="left"  ><strong> Receivable</strong></td>
                </tr>
                <tr>
                  <th align="left" >Date<br /></th>
                  <th align="left" >ID</th>
                  <th width="96" align="left" >Receivable  Type </th>
                  <th width="122" align="left" > Receivable  from</th>
                  <th width="80" align="left" >Amount</th>
                  <th width="138" > Comments</th>
                  <th align="center" >Edit</th>
                </tr>
                <?php 

		   $m=date("m");

			$y=date("Y");

			  

		  $dt=$y.$m;

		  $date=date("Y-m-d");


 

		  $dresult=mysql_query("select * from pr where amount2>'0'   and cdate2='0000-00-00' order by cdate asc ");
		  $drow=mysql_fetch_array($dresult);

		  $total=0;
		  do{

		  ?>
                <tr>
                  <td width="91" align="left"  class="link"><?php 

			 echo dtformat($drow[cdate]);

			?></td>
                  <td width="45" align="left"  class="link"><a href="javascript:void(0);" onclick="popUp('show_pr.php?id=<?php echo $drow[id]; ?>')"><?php echo $drow[id]; ?></a></td>
                  <td width="96" align="left"  class="link"><?php 

		  $aresult=mysql_query("select * from pr_type WHERE id='$drow[cost_type]' limit 1");
		  $arow=mysql_fetch_array($aresult);

			

			echo $arow[cost]; ?></td>
                  <td width="122" align="left"  class="link"><?php echo $drow[pt]; ?></td>
                  <td width="80" align="left"  class="link"><?php 


			 echo $drow[amount2];

			 $total=$total+$drow[amount2];

			?></td>
                  <td  class="link"><?php 

			 echo $drow[comments];

			?></td>
                  <td width="103" align="center"  class="link"><?php 
if($drow[status] == '0'){ 

if($drow[cdate] == $date1ah){

//-----------------
if($_SESSION[invcox] == "$drow[suser]"){ ?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>&amp;t=2">Edit</a>
                    <?php }else{
$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>&amp;t=2">Edit</a>
                    <?php 	

}
}

//-----------------------

}else{

$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>&amp;t=2">Edit</a>
                    <?php } }


}else{

	$result=mysql_query("select * from user WHERE userid='$_SESSION[invcox]' and status='1'");
$row=mysql_fetch_array($result);

if($row[income_type] == '1'){
			?>
                    <a href="edit_pr.php?id=<?php echo $drow[id];?>&amp;t=2">Edit</a>
                    <?php } }?></td>
                </tr>
                <?php 

		  }while($drow=mysql_fetch_array($dresult));

		  ?>
                <tr>
                  <td colspan="2" align="right"  class="link"><strong>Total : </strong></td>
                  <td align="right"  class="link">&nbsp;</td>
                  <td align="right"  class="link">&nbsp;</td>
                  <td align="left"  class="link"><strong><?php echo $total; ?></strong></td>
                  <td  class="link">&nbsp;</td>
                  <td  class="link">&nbsp;</td>
                </tr>
              </table></td>
            </tr>
          </tbody>
        </table></td>



      </tr>



    </table></td>



  </tr>



  <tr>



    <td><?php include("bot.php")?></td>



  </tr>



</table>



</body>



</html>



<?php }?>