<?
ob_start();
session_start();
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}


$veh_num='';
$sdate_12 ='';
$page='1';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();
$msg = '';
$client_namek ='';

if(isset($_REQUEST['del']) && $_REQUEST['del']=='delete')
{
	$id = $_REQUEST['sales_del'];
	
	$sqlsale = mysql_query("select * from cf_sales_sub where sale_id ='$id' ");
	while($rwsale = mysql_fetch_array($sqlsale))
	{
		$packsale_box = $rwsale['sale_box'];
		$packsale_no_tin_kg = $rwsale['sale_no_tin_kg'];
		$branchid = $rwpack['branch_id'];
		$literid = $rwpack['liter_id'];
		
		$sqlsku = mysql_query("select * from cf_sku_stock where brnd_id = '$branchid' and ltre_id = '$literid'");
		$rwsku = mysql_fetch_array($sqlsku);
		
		$skupackqty = $rwsku['packqty'];
		$skupackbox = $rwsku['packbox'];
		$updtpackqty = $skupackqty - $packqty;
		$updtpackbox = $skupackbox - $packbox;
		mysql_query("update cf_sku_stock set packqty = '$updtpackqty',packbox='$updtpackbox' where brnd_id = '$branchid' and ltre_id = '$literid'");
		
		//echo "update cf_sku_stock set packqty = '$updtpackqty',packbox='$updtpackbox' where brnd_id = '$branchid' and ltre_id = '$literid'";
		//echo "<br/>";
	
	}
	
	$sql=mysql_query("delete from cf_sales where sales_id='$id'");
	header("location:sales-list.php?msg=You Have Successfully Deleted");
}
?>

<!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 href="css/menu.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />

<script type="text/javascript" src="scripts_date/jquery-calendar-1.7.2.js"></script>



<script src="js/popup_sales.js" type="text/javascript"></script>
<script>

$(document).ready(function(){
$('#from_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#to_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

</script>
<script language="javascript">
function getXMLHTTP()
	 { //fuction to return the xml http object
	var xmlhttp=false;	
		try
		{
		xmlhttp=new XMLHttpRequest();
		}
		catch(e)	
		{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch(e)
			{
				try
				{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1)
				{
				xmlhttp=false;
				}
			}
		}
	return xmlhttp;
	}   


function Searchdate(page,val)
{ 
 	
	 var page=page;	
	 var saletype='';
	 var fromdate='';
	 var todate='';
	 
	 if(document.sales_frm.saletype){
	 saletype= document.sales_frm.saletype.value;
	 } 
	 
	 if(document.sales_frm.from_date){
	 fromdate= document.sales_frm.from_date.value;
	 }
	 
	 if(document.sales_frm.to_date){
	 todate= document.sales_frm.to_date.value;
	 }
	 
	 
	var strURL="ajax/sales_list_data.php?&page="+page;
		
		if(saletype!=''){
		strURL+="&saletype="+saletype;
		}
			
		if(fromdate!=''){
		strURL+="&fromdate="+fromdate;
		}
			
		if(todate!=''){
		strURL+="&todate="+todate;
		}
	var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
		 
			if ((req.readyState == 0)||(req.readyState == 1)||(req.readyState == 2)||(req.readyState == 3))
      		{
			//document.getElementById('order').innerHTML='<div align="center"><img src="'+path+'images/ajax_loader.gif"/></div>';
			//document.getElementById('Cakeorder').innerHTML='<div align="center"><img src="'+path+'images/ajax_loader.gif"/></div>';
			}
		 
		 
      if (req.readyState == 4)
      {
	 // only if "OK"
	 	if (req.status == 200)
	 	{ 
	   document.getElementById('list').innerHTML=req.responseText;
	//	document.getElementById('Cakeorder').innerHTML=req.responseText;
	 	}
	  else 
	 	{
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);

	 }
     }
     }
   req.open("GET", strURL, true);
   req.send(null);
   }
 
   
}
function showClientcodedropdown(str){
var xmlhttp;    
if (str=="")
  {
  document.getElementById("txtcodeshow").innerHTML="";
  Searchdate(1,str);
  return;
  }
  
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	   document.getElementById("txtcodeshow").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","clientajax_code_dropdown.php?str="+str,true);
xmlhttp.send();
}
</script>
</head>

<body>
<!------------------popup area (view, edit)--------------->

<div class="viewEmployeePopup login-popup"  id="login-box" style="width:800px;height:400px;">
<a href="#" class="close"><img src="images/close.png" class="btn_close" title="Close Window" alt="Close" /></a>
   <div id="popupid"></div>
   
     
    </div>

<!---------------popup area ends------------------>
<div class="wrapper" >
   <div>
<?php 
	include("header.php");
?>
</div>
 
 <div class="tabbedArea" style="position:relative; margin-top:">

  
  <div class="tabBody">
   <h1>Sales List</h1>
   
   <div class="searchBox" style="width:93%; margin-right:0px;  padding:0px;">
     <table  border="0" cellspacing="0" cellpadding="0" align="center" style="width:90%;">
       <tr>
         <td width="200" align="center" valign="middle"></td>
         <td width="600" align="center" valign="top" style="border:#333333 0px solid;"><div id="salslipDiv">
             <table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-left: 8px;" class="tableListrec" id="psliptab">
               <tbody>
                 <tr>
                   <td colspan="7" align="center" valign="middle"><h1 align="center">Travancore Rural Development Producer Company Ltd.</h1></td>
                 </tr>
                 <tr>
                   <td colspan="4"><b>PAYSLIP NUMBER : </b>&nbsp;&nbsp;&nbsp;&nbsp;11</td>
                   <td colspan="3" align="center"><b>DATE : </b>&nbsp;&nbsp;&nbsp;&nbsp;02 / 08 / 2014</td>
                 </tr>
                 <tr>
                 <tr>
                   <td colspan="7"><b>EMPLOYEE NAME : </b>&nbsp;&nbsp;&nbsp;&nbsp;Madhu G G</td>
                 </tr>
                 <tr>
                   <td colspan="7"><b>DESIGNATION : </b>&nbsp;&nbsp;&nbsp;&nbsp;Office Assistant (O A)</td>
                 </tr>
                 <tr>
                   <td colspan="7"><b>PAY PERIOD : </b>&nbsp;&nbsp;&nbsp;&nbsp;01 / 08 / 2014&nbsp;&nbsp;-&nbsp;&nbsp;31/ 08 / 2014</td>
                 </tr>
                 <tr>
                   <td colspan="7" align="center" style="height:30px">&nbsp;</td>
                 </tr>
                 <tr>
                   <td colspan="3" width="50%"><b><u>DESCRIPTION </u></b></td>
                   <td colspan="2" width="25%" align="center"><b><u>EARNINGS</u></b></td>
                   <td colspan="2" width="25%" align="center"><b><u>DEDUCTIONS</u></b></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Basic</span></td>
                   <td colspan="2"><span style="float:right">4,000.00</span></td>
                   <td colspan="2"></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Travel Allowance</span></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                   <td colspan="2"></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Dearness Allowance</span></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                   <td colspan="2"></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Bonus</span></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                   <td colspan="2"></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Others</span></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                   <td colspan="2"></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span>Tax</span></td>
                   <td colspan="2"></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span>Providend Fund (P.F)</span></td>
                   <td colspan="2"></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left">Leave Deduction (0 days)</span></td>
                   <td colspan="2"></td>
                   <td colspan="2"><span style="float:right">0.00</span></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left"><b>TOTAL</b></span></td>
                   <td colspan="2" style="border-top: 1px solid #949494;"><span style="float:right">4,000.00</span></td>
                   <td colspan="2" style="border-top: 1px solid #949494;"><span style="float:right">0.00</span></td>
                 </tr>
                 <tr>
                   <td colspan="3"><span style="float:left"><b>NET SALARY PAYABLE</b></span></td>
                   <td colspan="4" align="center"><b>4,000.00</b></td>
                 </tr>
                 <tr>
                   <td colspan="3"><b>SALARY FOR CURRENT MONTH : </b></td>
                   <td colspan="4" align="center"><b>Rs. Four Thousand</b></td>
                 </tr>
                 <tr>
                   <td colspan="7" align="center" style="height:30px">&nbsp;</td>
                 </tr>
                 <tr>
                   <td colspan="7" style="height:25px" align="center"><b>SALARY STATEMENT RECEIVED</b></td>
                 </tr>
                 <tr>
                   <td colspan="7" valign="bottom" style="height:65px"><span style="float:left"><b>A.O</b></span>&nbsp;&nbsp; <span style="margin-left: 200px;"><b>CASHIER</b></span>&nbsp;&nbsp; <span style="float:right"><b>SIGNATURE OF EMPLOYEE</b></span> </td>
                 </tr>
               </tbody>
             </table>
         </div></td>
         <td width="52" align="center" valign="middle" style="padding-left:80px;"><br />
             <br />
             <div class="input submit">
               <label for="Print Salary Slip"></label>
               <div class="submit">
                 <input  name="Printsalslip" class="input1" alt="Print Salary Slip" onClick="if(confirm(&#039;Do you want to print this salary slip?&#039;)){printDiv(&#039;salslipDiv&#039;);}" type="submit" value="Print Salary Slip"/>
               </div>
             </div>
           <div class="input submit">
             <label for="Pay By Cash"></label>
             <div class="submit">
               <input  name="Paybycash" class="input1" alt="Pay By Cash" onClick="if(confirm(&#039;Do you want to pay this salary by cash?&#039;)){location.href=&#039;http://www.travanco.com/TravancoFinance/SaveVoucher/cash?employee_id=003&amp;payslip_id=11&#039;}" type="submit" value="Pay By Cash"/>
             </div>
           </div>
           <div class="input submit">
             <label for="Pay By Cheque"></label>
             <div class="submit">
               <input  name="Paybycheque" class="input1" alt="Pay By Cheque" onClick="if(confirm(&#039;Do you want to pay this salary by cheque?&#039;)){location.href=&#039;http://www.travanco.com/TravancoFinance/SaveVoucher/cheque?employee_id=003&amp;payslip_id=11&#039;}" type="submit" value="Pay By Cheque"/>
             </div>
           </div>
           <br />
             <input type="hidden" name="save" />
             <br />
             <input name="reset" type="reset" class="input1" style="margin: 20px 0px 0px 0px" onClick="javascript:location.href='http://www.travanco.com/TravancoAdmin/employees/salary/';" value="Back" />
         </td>
         <td width="148" align="left" valign="middle">&nbsp;</td>
       </tr>
     </table>
   </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>
