/***********************sheeba******************************/
//----------------------------------------common section start-----------------//

var serviceURLHR =localStorage['serviceURLHR'];
var hosturl    =localStorage['basicURL'];
//var url= window.location.pathname;
//urlBase = url.substring(0, url.lastIndexOf('/')+4);
var url= $(location).attr('pathname');
//var id = getUrlVars()["tid"];
/*$(window).load(function() {
if(localStorage.getItem('username')===null || localStorage.getItem('userid')===null || localStorage['username'] =='' || localStorage['userid']=='' || localStorage['activation']===null){
	window.location = "login.html";	
}
	
});*/

//$(document).ready(function() {var style1;
			//   if(window.location==hosturl+'/cash/InventoryView.html'){style1="background-color:#ccc"; }else{style1="background-color:#fff"; }
//	if(location.href="InventoryView.html")					   
//});

//setInterval( getTableList, 10000 ); // refresh every 10000 milliseconds


$(document).ajaxError(function(event, request, settings) {
	$('#busy').hide();
	//alert("Error accessing the server");
});
//----------------------------------------common section end-----------------//
var limit=50;
function showheading(page){
var links;
links=  '<ul>'+
			'<li class="notification">55</li>'+
			'<li><a href="../notification.html" title="Notifications"><img src="images/icon-notifications.png" alt="" border="0" />'+
			'</a></li>'+
			'<li><a href="../report.html" title="Report"><img src="images/icon-report.png" border="0" />'+
		   ' </a></li>'+
			'<li><a href="../settings.html" title="Settings"><img src="images/icon-settings.png" border="0" />'+
			'</a></li>'+
			'<li><a href="../sale.html"><img src="images/icon-sale.png" alt="" border="0" /></a></li>'+
			 
			 ' <li><a href="../inv/index.html#manageVendore"><img src="images/inventory-ico.png" alt="" border="0" /></a></li>'+
			' <li><a href="../inv/chef.html#manageIngredients"><img src="images/chef.png" alt="" border="0" /></a></li>'+
			' <li><a href="../inv/accountant.html#manageVendore"><img src="images/accountant.png" alt="" width="47" height="46" border="0" /></a></li>'+
			
			  '<li><a href="employee-lists.html"><img src="images/icon-hr.png" alt="" width="49" height="48" border="0" /></a></li>'+
		  '</ul>';

$('#headlinks').html(links);
}

function ingredients(){location.href="ingredients.html"}
function vendor(){location.href="vendors.html"}
function receipe(){location.href="receipes.html"}
function purchase(){location.href="purchase.html"}
function menucosst(){location.href="menucost.html"}
function menusalecosst(){location.href="menusalecost.html"}
function inventory(){location.href="InventoryView.html"}
function saleslist1(){location.href="Saleslist.html"}
function menuexpensereport(){location.href="menuextra.html"}
function menuexpensereport1(){location.href="menuexpensereport.html"}
function stocktake(){location.href="stocktaking.html";}
function cutlary(){location.href="cutlary.html";}
function inventoryreportlist(){location.href="InventoryReportView.html";}
function extramenuexp(){location.href="menuextra.html";}
function stockwastage(){location.href="stockwastge.html";}
function reveiws(){location.href="reviews.html";}
function storereportlist1(){location.href="storereportlist.html";}
function cutlerystocktake(){location.href="cutlarystocktaking.html";}
function showleft()
{
	document.getElementById('leftmenuid').innerHTML='<h3 onclick="ingredients();" style="cursor:hand; cursor:pointer;">Ingredients</h3><h3 onclick="vendor();" style="cursor:hand; cursor:pointer;">Vendors</h3><h3 onclick="receipe();" style="cursor:hand; cursor:pointer;">Recipes</h3><h3 onclick="purchase();" style="cursor:hand; cursor:pointer;">Purchase</h3><h3 onclick="extramenuexp();" style="cursor:hand; cursor:pointer;">Store Usage</h3><h3 onclick="cutlary();" style="cursor:hand; cursor:pointer;">Cutlery</h3><h3 onclick="stocktake();" style="cursor:hand; cursor:pointer;">StockTaking</h3><h3 onclick="cutlerystocktake();" style="cursor:hand; cursor:pointer;">Cutlery StockTaking</h3><h3 onclick="stockwastage();" style="cursor:hand; cursor:pointer;">Add To Damage</h3><h3 onclick="storereportlist1();" style="cursor:hand; cursor:pointer;">Store Reports</h3><h3 onclick="inventoryreportlist();" style="cursor:hand; cursor:pointer;">Cost Reports</h3><h3 onclick="reveiws();" style="cursor:hand; cursor:pointer;">Reviews</h3>';
}
function topview()
{
	//if(window.location=='"'+hosturl+'/cash/InventoryView.html"')
//	{<li><a style="cursor:hand; cursor:pointer;" class="dinein"  onclick="saleslist1()"  >SalesList</a></li>
	document.getElementById('topviewspace').innerHTML='<div class="sub-menu-nav"><ul><li ><a style="cursor:hand; cursor:pointer;" class="dinein" id="inventoryreportlist"  onclick="inventoryreportlist()"  >Inventory Report View</a></li><li><a style="cursor:hand; cursor:pointer;" class="dinein" id="vendorlist"  onclick="inventory()"  >Inventory Level</a></li><li><a style="cursor:hand; cursor:pointer;" class="dinein" id="addnewvendor"  onclick="menucosst()" >Food Cost</a></li><li><a style="cursor:hand; cursor:pointer;" class="dinein" id="vendorlist"  onclick="menusalecosst()"  >Menu V/s Receipe Cost</a></li><li><a style="cursor:hand; cursor:pointer;" class="dinein"  onclick="menuexpensereport1()"  >Food expense  Lists</a></li><li><a style="cursor:hand; cursor:pointer;" class="dinein"  onclick="ingredients()"  >Home</a></li> </ul></div>';
//	}
}
function currentdate()
{
        var today = new Date();
		var dd = today.getDate();
        var mm = today.getMonth()+1; //January is 0!
        var yyyy = today.getFullYear();
        var today = mm+'/'+dd+'/'+yyyy;	
         return today;
}
function closediv(id)
{
	document.getElementById('costviewspan'+id).innerHTML='';
}
function closedivview(id)
{
	document.getElementById('invviewspan'+id).innerHTML='';
}
function closedivviewdetail(id)
{
	document.getElementById('costsaleviewspan'+id).innerHTML='';
}
function storereportlist()
{
//var idval=$("#idval").val();alert(idval);
var path='http://192.168.1.25:8081'+url;
//	alert(hosturl+'storereportlist.html');alert(path);
var lilink='<li><a style="cursor:hand; cursor:pointer;" class="dinein" id="vendorlist"  onclick="listAllPurchase(1)"  >Purchase Reports</a></li>';
if(path==hosturl+'storereportlist.html')
{
	
	lilink='<li><a style="cursor:hand; cursor:pointer; background-color:#ff2972;color:#fff" class="autoclass" id="purchlist"  onclick="listAllPurchase(1)"  >Purchase Reports</a></li>';
}
 lilink+='<li><a style="cursor:hand; cursor:pointer; " class="dinein" id="extralist"  onclick="extracostreport(1)"  >Extra Cost Reports</a></li>';
//if(/kotz/cash/inventory/storereportlist.html)http://192.168.1.25:8081/kotz/cash/inventory/
document.getElementById('storediv').innerHTML=' <ul><li><a style="cursor:hand; cursor:pointer; background-color:#ff2972;color:#fff" class="autoclass" id="purchlist"  onclick="listAllPurchase(1)"  >Purchase Reports</a></li><li><a style="cursor:hand; cursor:pointer; " class="dinein" id="extralist"  onclick="extracostreport(1)"  >Extra Cost Reports</a></li></ul>';
 }
 function findgrandtotal(table,div,field1,field2,pagenum,searchdate,searchdateto,searchvalue,searchvend,searchordernum)
  {
		   $.ajax({
		   url: serviceURLHR+"grandtotal.php?table="+table+"&field1="+field1+"&field2="+field2+"&page="+pagenum+"&searchdate="+searchdate+"&searchdateto="+searchdateto+"&searchvalue="+searchvalue+"&searchvend="+searchvend+"&searchordernum="+searchordernum,
		   success: function(data){
		   $("#"+div).html(data);
		   }
           });	 
  }
/***********************sheeba******************************/
