<?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 Resort 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=0,resizable=yes,width=500,height=350,left = 390,top = 312');");



}



// End -->



</script>

<style type="text/css">

<!--

.style2 {color: #DC147B;

	font-weight: bold;

}

.style3 {color: #000000}

-->

</style>

</head>







<body>



<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1">



  <tr>



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



  </tr>



  <tr>



    <td><?php include("cost_top.php");?></td>



  </tr>



  <tr>



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



      <tr>



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



          <form id="form1" name="form1" method="post" action="">



            <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#999999">



              <tr>



                <td width="23%"><strong>Search Income  </strong></td>



                <td width="77%">&nbsp;</td>



              </tr>



              <tr>



                <td bgcolor="#FFFFFF">Search on Income type: </td>



                <td bgcolor="#FFFFFF"><select name="cost_type" id="cost_type">



				 <option value="">Select Income Type</option>



                  <?php 



		  $result=mysql_query("select * from income_type order by id asc");



		  $row=mysql_fetch_array($result);



		  do{



		  ?>



                  <option value="<?php echo $row[id]; ?>"><?php echo $row[cost]; ?></option>



                  <?php 



		  }while($row=mysql_fetch_array($result));



		  ?>



                </select></td>



              </tr>

<?php 

if($_POST[ds]!=""){$ds=$_POST[ds];}

if($_POST[de]!=""){$de=$_POST[de];}



if($_GET[ds]!=""){$ds=$_GET[ds];}

if($_GET[de]!=""){$de=$_GET[de];}



if($ds == ""){



$dddez = strtotime("-60 day");

$ds=date('d-m-Y', $dddez);



}

if($de == ""){$de=date("d-m-Y");}



 ?>

              <tr>



                <td bgcolor="#FFFFFF">Search by date : 



                  <input name="p" type="hidden" id="p" value="y" /></td>



                <td bgcolor="#FFFFFF">From



                  <input name="ds" type="text" id="ds" value="<?php echo $ds;?>" />



                  To



                  <input name="de" type="text" id="de" value="<?php echo $de;?>" /></td>



              </tr>



              <tr>

                <td bgcolor="#FFFFFF">&nbsp;</td>

                <td bgcolor="#FFFFFF"><select name="status2" id="status2">

                  <option value="" selected="selected" <?php if($_POST[status2] == ""){echo 'selected="selected"';}?>>All</option> 

                  <option value="Receive F.C." <?php if($_POST[status2] == "Receive F.C."){echo 'selected="selected"';}?>>Receive F.C.</option>

                  <option value="OnProcess" <?php if($drow[status1] == "OnProcess"){echo 'selected="selected"';}?>>OnProcess</option>

                  <option value="Submitted" <?php if($_POST[status2] == "Submitted"){echo 'selected="selected"';}?>>Submitted</option>

                  <option value="Collect F.E." <?php if($_POST[status2] == "Collect F.E."){echo 'selected="selected"';}?>>Collect F.E.</option>

                  <option value="Delivery B.C." <?php if($_POST[status2] == "Delivery B.C."){echo 'selected="selected"';}?>>Delivery B.C.</option>

                  <option value="Completed" <?php if($_POST[status2] == "Completed"){echo 'selected="selected"';}?>>Completed</option>                

                </select></td>

              </tr>

              <tr>



                <td bgcolor="#FFFFFF">&nbsp;</td>



                <td bgcolor="#FFFFFF"><input type="submit" name="Submit" value="Search" /></td>



              </tr>



            </table>



            </form>



          </td>



      </tr>



      <tr>



        <td height="30"><span class="style2">M.Rec = Money Receipt <span class="style3">|</span> Ref = Reference <span class="style3">|</span> RSV = Reservation<span class="style3"> | </span>C = Conveyance <span class="style3">|</span> O = Others Cost </span></td>



      </tr>



      <tr>



        <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#999999">



          <tr>



            <td colspan="12" align="left" bgcolor="#999999"><strong>Search Result </strong></td>

          </tr>



          <tr>

            <td align="left" >M. Receipt/ Invoice No<br /></td>

            <td align="left" >Income Type </td>

            <td align="left" >Recieved From</td>

            <td align="left" >Total <br />

              Income</td>

            <td >Date</td>

            <td >Comments / <br />

              Bill No.</td>

            <td >P.Method </td>

            <td >Deposit To</td>

            <td align="center" >View </td>

            <td align="center" >Status</td>

            <td align="center" >Credited <br />

              Trx ID </td>

            <td align="center" >Approve ID</td>

          </tr>



          <?php 



		    



			if($_POST[cost_type]!=""){$c="and cost_type='$_POST[cost_type]'";}else{$c="";}



		  if($ds!=""){



		  $ds=dtformat($ds);



		  $de=dtformat($de);



		  $d="and cdate>='$ds' and cdate<='$de' ";}else{$d="";}

		  

		  if($_POST[status2]!=""){$status2="and status1='$_POST[status2]'";}else{$status2="";}

		  





		  



		  



		 



		  $dresult=mysql_query("select * from income WHERE amount!='0' $c $status2 $d order by id desc limit 100");

          $drow=mysql_fetch_array($dresult);



		  $total=0;



		  do{



		  ?>



          <tr>



            <td width="7%" align="left" bgcolor="#FFFFFF" class="link"><?php  echo $drow[voucher]; ?></td>



            <td width="9%" align="left" bgcolor="#FFFFFF" class="link"><?php 



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



		  $arow=mysql_fetch_array($aresult);



			



			echo $arow[cost]; ?></td>



            <td width="10%" align="left" bgcolor="#FFFFFF" class="link"><?php echo $drow[pt]; ?></td>



            <td width="8%" align="left" bgcolor="#FFFFFF" class="link"><?php 



			 /*$bresult=mysql_query("select SUM(amount) as amount from cost WHERE cost_type='$drow[cost_type]' and dt='$dt'");



		 	 $brow=mysql_fetch_array($bresult);*/



			 echo $drow[amount];



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



			?>            </td>



            <td width="8%" bgcolor="#FFFFFF" class="link"><?php 



			 echo dtformat($drow[cdate]);



			?></td>



            <td width="12%" bgcolor="#FFFFFF" class="link"><?php 



			 echo $drow[comments];



			?></td>



            <td width="8%" bgcolor="#FFFFFF" class="link"><?php  echo $drow[pay_methode];?></td>



            <td width="12%" bgcolor="#FFFFFF" class="link"><?php  echo $drow[acc_no];?></td>



            <td width="3%" align="center" bgcolor="#FFFFFF" class="link"><a href="javascript:popUp('pop_view_income.php?id=<?php echo $drow[id];?>')"> <img src="images/mag.jpg" width="20" height="20" border="0" /></a> </td>



            <td width="8%" align="center" bgcolor="#FFFFFF" class="link"><form id="form2" name="form2" method="post" action="update_status.php">



              <input name="id" type="hidden" value="<?php  echo $drow[id];?>" />



              <input name="db" type="hidden" value="income" />



              <input name="url" type="hidden" value="income_view_type.php" />

              <input name="ds" type="hidden" id="ds" value="<?php  echo dtformat($ds);?>" />

              <input name="de" type="hidden" id="de" value="<?php  echo dtformat($de);?>" />



              <select name="status1" id="status1" onchange="this.form.submit()">



                <option value="Receive F.C." selected="selected" <?php if($drow[status1] == "Receive F.C."){echo 'selected="selected"';}?>>Receive F.C.</option>

                <option value="In Hand" <?php if($drow[status1] == "In Hand"){echo 'selected="selected"';}?>>In Hand</option>

                <option value="Deposit To Bank" <?php if($drow[status1] == "Deposit To Bank"){echo 'selected="selected"';}?>>Deposit To Bank</option>

                <option value="Deposit To bkash" <?php if($drow[status1] == "Deposit To bkash"){echo 'selected="selected"';}?>>Deposit To bkash</option>

                <option value="Purchases" <?php if($drow[status1] == "Purchases"){echo 'selected="selected"';}?>>Purchases</option>

                <option value="Completed" <?php if($drow[status1] == "Completed"){echo 'selected="selected"';}?>>Completed</option>

              </select>



            </form></td>



            <td width="8%" align="center" bgcolor="#FFFFFF" class="link">C-<?php echo $drow[id];?></td>

            <td width="7%" align="center" bgcolor="#FFFFFF" class="link"><?php echo $drow[activecode];?></td>

          </tr>



          <?php 



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



		 



		  ?>



          <tr>



            <td colspan="3" align="right"  class="link"><strong>Total :</strong></td>



            <td align="left"  class="link"><strong><?php echo $total; ?></strong></td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>



            <td  class="link">&nbsp;</td>

            <td  class="link">&nbsp;</td>

          </tr>



        </table></td>



      </tr>



    </table></td>



  </tr>



  <tr>



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



  </tr>



</table>



</body>



</html>



<?php }?>