<?
ob_start();
session_start();
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}
$rproduct_clientid='';
$tripclientid='';$rcnt='';$client_main='';
$tyrenum_veh='';$rclient_code='';$rrate='';$rclient_name='';$rclient_id='';$rtown_id='';$rpackname='';$billtype='';
$cclient_name='';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();

if(isset($_REQUEST['del']) && $_REQUEST['del']=='delete')
{
	$id = $_REQUEST['id'];
	$sql=mysql_query("delete from cf_agmark where agmark_id='$id'");
	header("location:add-agmark.php?msg=You Have Successfully Deleted");
}
	
	
            $tablename='profit_loss_adustment';
   			$sqlObj->tablename=$tablename;
		    $pdate=date("Y-m-d");
		    if(isset($_POST['save'])){			
			
				if(isset($_POST['profit_amount'])){
				$profit_amount=addslashes($_POST['profit_amount']);
				}
				
				if(isset($_POST['loss_amount'])){
				$loss_amount=addslashes($_POST['loss_amount']);
				}
				
				
				$updata="profit_amount='".$profit_amount."',loss_amount='".$loss_amount."'";
				$qry= "update ".$tablename." set ".$updata."";
				$CreateClient 	= mysql_query($qry);
				header("location:profit_loss_adjustment.php?msg=You Have Successfully Saved");
			}
			
			$profit_amount=0;
			$loss_amount=0;
			
			
			$rqry=mysql_query("SELECT *  FROM profit_loss_adustment ");
			
			if($rqry && mysql_num_rows($rqry)>0)
			{
				while($sobj=mysql_fetch_object($rqry))
				{
					$profit_amount=$sobj->profit_amount;
					$loss_amount=$sobj->loss_amount;
				}
			}
			

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL</title>
<link href="css/styles.css" rel="stylesheet"  />
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.js"></script>

<script type="text/javascript">

	 $(document).ready(function(){         
       
        $("#myForm").validate();
    });

</script>
<style>
.error{ color:red;}
.lableentrytext{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
}
.addimgs{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
cursor:hand;
cursor:pointer;
}
.addimgs a:hover{
color: #000;
}
.rimg{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
cursor:hand;
cursor:pointer;
}
.rimg a:hover{
color: #000;
}
.td-border-11 td{border:1px solid #ddd; padding:15px; font-size:13px;}

</style>
</head>

<body>
<div class="wrapper">
  <div>
<?php 
	include("header.php");
?>
 
</div>
 
 
 <div class="tabbedArea">
  
  <div class="tabBody">
   <h1>Opening-Closing Balance Profit/Loss</h1>
   <form name="prodfrmname" method="post" action="" id="myForm">
   <?php
	$div=1;
	?>
<input type="hidden" id="divcnt" value="<?=$div?>" name="cnt"/>
   <div class="addEmp" style="margin-bottom:0px; border-bottom:0px solid;width:1000px;">
        <table width="70%" border="0" cellspacing="0" cellpadding="10">
          <tr>
            <td valign="top">
            <!-- <div class="form1" style="min-width:600px;border-right:0px; "> -->
           <div class="form1">          

		   <div>
      			<p id="divshw" class="input1">Opening Balance<span style="color:#FF3300">*</span></p>
                <input name="profit_amount" id="profit_amount" class="input1 input3"  type="text" value="<?=$profit_amount?>"  required number="true">  
     	   </div>
		   
		   <div>
      			<p id="divshw" class="input1">Closing Balance<span style="color:#FF3300">*</span></p>
                <input name="loss_amount" id="loss_amount" class="input1 input3"  type="text" value="<?=$loss_amount?>" required number="true">  
     	   </div>

            
          <div><table width="70%" border="0" cellspacing="0" cellpadding="10">
       <tr>
         <td colspan="2"><div class="searchField1">
        
     <input name="save" type="submit" class="input1" value="Save" />
	 

        </div>
        </td>
          </tr>
        </table></div>
			
			</div>
        </td>
            <td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="td-border-11">
  <tr>
    <td>No</td>
    <td>Opening Balance</td>
	<td>Closing Balance</td>
	<!-- <td>Edit</td> -->
   </tr>
  <?php 
  $i=1;
  $rqry="SELECT *  FROM profit_loss_adustment ";
			$sqry=mysql_query($rqry);
			if($sqry && mysql_num_rows($sqry)>0)
			{
				while($sobj=mysql_fetch_object($sqry))
				{
					$id=$sobj->id;
					$profit_amount=$sobj->profit_amount;
					$loss_amount=$sobj->loss_amount;
					?>
					<tr>
                    <td><?=$i?></td>
					<td>Rs <?=$profit_amount?> /-</td>
					<td>Rs <?=$loss_amount?> /-</td>
					<!-- <td><a href="profit_loss_adjustment.php?id=<?php //echo $id; ?>" style="color:#FF9900">Edit</a></td> -->
				</tr>
				<?php 
					$i++;
					}
				}
			
  ?>
  
</table>
</td>
          </tr>
        </table>
	

<div class="mand"><p>Fields marked <span style="color:#FF3300">*</span> are Mandatory</p></div>
</div>
   </form>
   </div>
 </div>
 <div class="footer"><p>Powered by <a href="http://www.aadhocc.co.uk/" target="_blank">Aadhocc</a></p></div>
 
</div>
<div class="quicLInksCover">
  <?php 
	include("leftlink.php");
?>

</div>
</body>
</html>


		






