<script>

	function user_master()
	{
		
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/user_master.php",
			success:function(data)
			{
				
				$(".content").html(data);
				
			}
		});
	}
	function form_demo()
	{
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/new_user.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function change_pass()
	{
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/change_password/change_password.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
		function newuser()
	{
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/new_user_password.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	
	function new_role()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/new_role.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}

	
	

		function invoice()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/inwards/invoice_creation.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function scrab()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/scrab.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
		function after_repair()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/afterrepair.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function create_status()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_status.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function role_master()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/role_master.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function branchmap(v)
	{
		var user=$("#user").val();
		$.ajax({
			type:"GET",
			url:"/asset_temp/master/branchmapping_script.php",
			data:"role_code="+v+"&user_id="+user,
			success:function(data)
			{
				$("#branch_form").html(data);
			}
		});
	}
	function edituser(p)
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_user.php",
			data:"user_id="+p,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editemp(b)
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_employee.php",
			data:"id="+b,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
		function createvendor(b)
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_vendor.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function createinward()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/inwards/create_inward.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function editrole(v)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_role.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editvendor(v)
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_vendor.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function user_log()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/user_log_report.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
		function user_error()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/user_log_error.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function rolemap(u)
	{
		//alert(u);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/role_mapping.php",
			data:"id="+u,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function old(pass,s)
{
	alert(pass);
	$.ajax
	({
		
		type: "POST",
		url: "change_password/check_pass.php",
		data: "old_pass=" + pass,		 
		success: function(data)
		{
			if(/^\s*no\s*$/.test(data))
			{
				alert("Old Password Is incorrect");
				$("#"+s).val("");
			}
		}
	});
}


function pass(pass,s)
{
 var password_regex1=/([A-Z].*[a-z])|([A-Z].*[a-z])([0-9])+([!,%,&,@,#,$,^,*,?,_,~])/;
 var password_regex2=/([0-9])/;
 var password_regex3=/([!,%,&,@,#,$,^,*,?,_,~])/;

 if(pass.length<8 || password_regex1.test(pass)==false || password_regex2.test(pass)==false || password_regex3.test(pass)==false)
 {
  alert("Please Enter Strong Password");
  $("#"+s).val("");
  return false;
 }
 else
 {
  return true;
 }
}

		function checkpass(x)
		{
			var newpass=$("#new_password").val();
			//alert(newpass);
			if(newpass!=x)
			{
				$("#password1").val("");
				alert("Passwords Not Match");
			}
		}
function reset_password(r)
	{
		//alert(r);
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/change_password/reset_password.php",
			data:"user_id="+r,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_user(d)
	{
		//alert(v);
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_user.php",
			data:"user_id="+d,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_user(a)
	{
		//alert(v);
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_user.php",
			data:"user_id="+a,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function branch()
	{
		//alert(v);
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/branchmaster.php",
			
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function branchcreation()
	{
		//$('.content').html('<br><div style="text-align: center;"><img src="/asset_template/images/loader/loader.gif"></div>');
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/branch_creation.php",
			
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editbranch(i)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_branch.php",
			data:"id="+i,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function delete_branch(di)
	{
		var confirm_branch= confirm("Are you sure to delete this Item....");
		  if(confirm_branch!='')
		  {
			$.ajax({
				type:"POST",
				url:"/asset_temp/master/delete_branch.php",
				data:"id="+di,
				success:function(data)
				{
					
					$(".content").html(data);
				}
			});
		  }
	}
	function user(x)
		{
			//alert(x);
			var user=$('#username').val();
            var email=$('#email').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "user_val.php",
			data :"id="+user+"&email="+email,
			success: function(data) {
			if(/^\s*USER ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#username').val("");
				$('#email').val("");
			}
				
			}
			});
			}
			function vendor_val(x)
		{
			//alert(x);
			var vcode=$('#vendor_code').val();
            var vname=$('#vendor_name').val();
			           
			$.ajax({
			type: "POST",
			url: "vendor_val.php",
			data :"id="+vcode+"&vname="+vname,
			success: function(data) {
			if(/^\s*VENDOR ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#vendor_code').val("");
				$('#vendor_name').val("");
			}
				
			}
			});
			}
			
			function branchval(x)
		{
			//alert(x);
			var branchname=$('#branch_name').val();
            var branchaddress=$('#branch_addr').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "branch_val.php",
			data :"id="+branchname+"&branchaddress="+branchaddress,
			success: function(data) {
			if(/^\s*BRANCH ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#branch_name').val("");
				$('#branch_addr').val("");
			}
				
			}
			});
			}
			
	function typeval(x)
		{
			//alert(x);
			var type=$('#type').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "type_val.php",
			data :"id="+type,
			success: function(data) {
			if(/^\s*TYPE ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#type').val("");
			}
				
			}
			});
			}
		function delete_type(ti)
		{
			var confirm_type= confirm("Are you sure to delete this type ....");
		  if(confirm_type!='')
		  {
			$.ajax({
				type:"POST",
				url:"/asset_temp/master/delete_type.php",
				data:"id="+ti,
				success:function(data)
				{
					$(".content").html(data);
				}
			});
		  }
		}
		function bloodval(bl)
		{
			alert(bl);
	      	var blood_group=$('#blood_group').val();
			           
			alert(blood_group);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "blood_val.php",
			data :"id="+blood_group,
			success: function(data) {
			if(/^\s*BLOOD ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#blood_group').val("");
			}
				
			}
			});
			}
			
			function locval(x)
		{
			//alert(x);
			var loc=$('#location').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "location_val.php",
			data :"id="+loc,
			success: function(data) {
			if(/^\s*LOCATION ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#location').val("");
			}
				
			}
			});
			}
			
			
			function configval(x)
		{
			//alert(x);
			var config=$('#config').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "config_val.php",
			data :"id="+config,
			success: function(data) {
			if(/^\s*CONFIGURATION ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#config').val("");
			}
				
			}
			});
			}
			function delete_config(ti)
			{
			var confirm_config= confirm("Are you sure to delete this config ....");
			  if(confirm_config!='')
			  {
				$.ajax({
					type:"POST",
					url:"/asset_temp/master/delete_config.php",
					data:"id="+ti,
					success:function(data)
					{
						
						$(".content").html(data);
					}
				});
			  }
			}
			function catgval(x)
		{
			//alert(x);
			var catg=$('#category').val();
			           
			//alert(user);
			//alert(email);
		
			$.ajax({
			type: "POST",
			url: "category_val.php",
			data :"id="+catg,
			success: function(data) {
			if(/^\s*CATEGORY ALREADY EXISTS\s*$/.test(data))
			{	alert(data);
				$('#category').val("");
			}
				
			}
			});
			}
function deactivate_branch(d)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_branch.php",
			data:"user_id="+d,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function activate_branch(a)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_branch.php",
			data:"user_id="+a,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function newemp()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/new_employee.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	
	function empupload()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/upload_employee.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deleterow(i)
	{
		//alert(i);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/delete_employee.php",
			data:"id="+i,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function deactivate_blood(o)
	{
		//alert(0);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_blood.php",
			data:"id="+o,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_blood(m)
	{
		//alert(m);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_blood.php",
			data:"id="+m,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function createblood()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_bloodgrp.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editblood(s)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_bloodgrp.php",
			data:"id="+s,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_role(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_role.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_role(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_role.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function createtype()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_type.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function createconfig()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_config.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
		function createcategory()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_category.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}

function creatematerial()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_material.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function uploadexcel()
	{
		
		$.ajax({
			url:"/asset_temp/master/category_upload.php",
			type:"POST",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function uploadinward()
	{
		
		$.ajax({
			url:"/asset_temp/inwards/inward_upload.php",
			type:"POST",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function createlocation()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/create_location.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function edittype(s)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_type.php",
			data:"id="+s,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editstatus(id)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_status.php",
			data:"id="+id,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editlocation(s)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_location.php",
			data:"id="+s,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editconfig(s)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_config.php",
			data:"id="+s,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function editcategory(s)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/edit_category.php",
			data:"id="+s,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function delete_category(cti)
	{
		var confirm_category= confirm("Are you sure to delete this category ....");
		  if(confirm_category!='')
		  {
			$.ajax({
				type:"POST",
				url:"/asset_temp/master/delete_category.php",
				data:"id="+cti,
				success:function(data)
				{
					
					$(".content").html(data);
				}
			});
		  }
	}
		function deactivate_type(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_type.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_status(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_status.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_status(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_status.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_type(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_type.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_config(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_config.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_config(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_config.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_category(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_category.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	
	function activate_category(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_category.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_loct(v)
	{
		//alert(v);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_location.php",
			data:"id="+v,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_loct(x)
	{
		//alert(x);
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_location.php",
			data:"id="+x,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function deactivate_vendor(d)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/deactivate_vendor.php",
			data:"id="+d,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function activate_vendor(a)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/master/activate_vendor.php",
			data:"id="+a,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	

function deleteRow(btn) {
	  var row = btn.parentNode.parentNode;
	  row.parentNode.removeChild(row);
	}

	
	
function showhide() {
  var x = document.getElementById("password");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}

function stock()
	{
	//alert(gdfh);
		$.ajax({
			type:"POST",
			url:"/asset_temp/stocktransfer/stock_transfer.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}

function get_podate(r)
{
	//alert(r);
	var po_number= r;
	var branch=$("#branch").val();
	
	$.ajax
		({
			type: "POST",
			url: "get_po_number.php",
			data: "po_number=" + po_number,
			success: function(data)
			{
				var arr = $.parseJSON(data);
				var date=arr.result['po'];
				var invoice_no=arr.result['invoice_no'];
				var invoice_date=arr.result['in_date'];
				var warranty=arr.result['warranty'];
				var exp_date=arr.result['ex_date'];
				var vendor=arr.result['vendor'];
				var remark=arr.result['remark'];
				
				$("#po_date").val(date);
				$("#invoice_no").val(invoice_no);
				$("#invoice_date").val(invoice_date);
				$("#warranty").val(warranty);
				$("#exp_date").val(exp_date);
				$("#vendor").val(vendor);
				$("#remark").val(remark);
				
			}
		});
		$.ajax
		({
			type: "POST",
			url: "get_po_category.php",
			data: "po_number=" + po_number+"&branch="+branch,
			success: function(data)
			{
				$('#table_view').html(data);
			}
		});
}
	function get_pono(r)
{
	$.ajax
		({
			type: "POST",
			url: "get_po_list.php",
			data: "branch=" + r,
			success: function(data)
			{
				$('#po_num_select').html(data);
			}
			});
}

function inward_valid(v,i)
{
	//alert(v);
	var val_inward= parseInt(v,10);
	var click=i.split("_");
	var c=click[2];
	var avl=parseInt($("#available_qty_"+c).val(),10);
	var cat=$("#cat_"+c).val();
	var cat_id=$("#cat_id_"+c).val();
	var inward_qty=$("#inward_qty_"+c).val();
	if(val_inward<=avl)
	{
		$.ajax
		({
			type: "POST",
			url: "get_inward_validation.php",
			data: "category=" + cat+"&qty="+inward_qty+"&data="+cat_id,
			success: function(data)
			{
			$('#s_'+c).html(data);
			}
			});
	}
	else
	{
		alert("Available Quantity is "+avl);
		$('#inward_qty_'+c).val("");
		$('#s_'+c).html("");
		
	}
	
}
function check_list(l)
{
	//alert(v);
	/* var list=l.split("_");
	var c=list[1];
	var cat=$("#cat_"+c).val();
	var inward_qty=$("#inward_qty_"+c).val();
	$.ajax
		({
			type: "GET",
			url: "get_inward_validation.php",
			data: "category=" + cat+"&qty="+inward_qty,
			success: function(data)
			{
				$('#s').html(data);
			}
			}); */
}


function cat_id(d)

	{
	   // alert(d);
			var branch=$('#branch').val();
            var category=$('#category').val();
	$.ajax({
			type: "POST",
			url: "config_item.php",
			data :"id="+branch+"&category="+category,
		success: function(data)
			{
				$('#confg').html(data);
			}
			});
}


function barcode(d)

	{
	   // alert(d);
            var cate=$('#check').val();
	$.ajax({
			type: "POST",
			url: "config_print.php",
			data :"id="+cate,
		success: function(data)
			{
				$('#bar').html(data);
			}
			});
}

function scan_asset(d)

	{
	   // alert(d);
            var scn=$('#scan').val();
	$.ajax({
			type: "POST",
			url: "config_scan.php",
			data :"id="+scn,
		success: function(data)
			{
				$('#scanng').html(data);
			}
			});
}
function warranty_cal(war)

	{
	    //alert(war);
		var get_val=war.split(" ");
		var war_val=get_val[0];
        var inv_date=$('#invoice_date').val();
	
		var get_val=inv_date.split("-");
		var year=get_val[0];
		var month=get_val[1];
		var day=get_val[2];
		var kk=+year + +war_val;
		var fi=kk+"-"+month+"-"+day
		
	$("#ex_date").val(fi);

	
}
function invoice_ch()
	{
		$("#warranty").val("");
		$("#ex_date").val("");
	}
function receive_stock(b)
	{
		//alert(b);
		$.ajax({
			type:"POST",
			url:"/asset_temp/stocktransfer/stock_inward.php",
			data:"id="+b,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function asse_code(a)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/get_config.php",
			data:"id="+a,
			success:function(data)
			{
				
				$("#configuration").html(data);
			}
		});
	}
function get_asset_id(id)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/get_assetid.php",
			data:"id="+id,
			success:function(data)
			{
				
				$("#asset_val").html(data);
			}
		});
	}	
function scrab_asset_id(scrab_id)
{
	$.ajax({
			type:"POST",
			url:"scrab_item_check.php",
			data:"scrab_id="+scrab_id,
			success:function(data)
			{
				$("#replace_id").html(data);
			}
		});
	}
function return_repair(id)
	{
		//alert(id);
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/return_stock.php",
			data:"id="+id,
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function create_scrab()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/repair/create_scrab.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function item_issue()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/create_item_issue.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
function emp_share()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/emp_share.php",
			success:function(data)
			{
				
				$("#emp_sh").html(data);
				$("#sh1").html("");
			}
		});
	}
function loc()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/location_share.php",
			success:function(data)
			{
				
				$("#sh1").html(data);
				$("#emp_sh").html("");
			}
		});
	}
	function delete_location(ctis)
	{
		var confirm_location= confirm("Are you sure to delete this Location ....");
		  if(confirm_location!='')
		  {
			$.ajax({
				type:"POST",
				url:"/asset_temp/master/delete_location.php",
				data:"id="+ctis,
				success:function(data)
				{
					$(".content").html(data);
				}
			});
		  }
	}
function sharing(e)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/emp_details.php",
			data:"share="+e,
			success:function(data)
			{
				$("#sh1").html(data);
			}
		});
	
	}
	function get_emp_code(v)
	{
		
		$.ajax({
			type:"GET",
			url:"/asset_temp/issue/get_emp_code.php",
			data:"emp_id="+v,
			success:function(data)
			{
				
				var arw = $.parseJSON(data);
				var code=arw.result['emp_no'];
				var dept=arw.result['department'];
				$("#emp_code").val(code);
				$("#emp_dept").val(dept);
			}
		});
	}
	function get_semp_code(v)
	{
		
		$.ajax({
			type:"GET",
			url:"/asset_temp/issue/get_emp_code.php",
			data:"emp_id="+v,
			success:function(data)
			{
				
				var arw = $.parseJSON(data);
				var code=arw.result['emp_no'];
				var dept=arw.result['department'];
				$("#s_emp_code").val(code);
				$("#s_emp_dept").val(dept);
			}
		});
	}
function type_permanent(v)
	{
if(v=="Temporary")
{	
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/get_expire.php",
			success:function(data)
			{
				$("#expire").html(data);
			}
		});
}
else {
	$("#expire").html("");
}
	
	}
function get_itemcode(v,i)
{
	var id_no=i.split("_");
	var id=id_no[1];
	
	$.ajax({
	type:"GET",
	url:"/asset_temp/issue/get_assetcode.php",
	data:"val="+v+"&no="+id,
	success:function(data)
	{
	$("#code_"+id).html(data);
	}
	});
}
function cat_get(v,i)
{
	var id_no=i.split("_");
	var id=id_no[1];
	
	$.ajax({
	type:"GET",
	url:"/asset_temp/stocktransfer/get_category.php",
	data:"val="+v+"&no="+id,
	success:function(data)
	{
	$("#code_"+id).html(data);
	}
	});
}
function non_consumable_issue()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/non_consumable_item_issue.php",
			success:function(data)
			{
				
				$(".content").html(data);
			}
		});
	}
	function emp_detail(e)
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/emp_detail_nc.php",
			data:"share="+e,
			success:function(data)
			{
				$("#sh1").html(data);
			}
		});
	
	}
	function loc_nc()
	{
		
		$.ajax({
			type:"POST",
			url:"/asset_temp/issue/location_nc.php",
			success:function(data)
			{
				
				$("#sh1").html(data);
			}
		});
	}
		
function rs1()
 {
 var search = document.getElementById('search1').value; 			
			$.ajax
			({
				type: "GET",
				url: "search.php",
				data: "employee_name=" + search,		 
				success: function(data)
				{
					$('.box-body').html(data);
   				}
			});	
	}
	function rs1_non()
 {
 var search = document.getElementById('search1').value; 			
			$.ajax
			({
				type: "GET",
				url: "non_cos_search.php",
				data: "employee_name=" + search,		 
				success: function(data)
				{
					$('.box-body').html(data);
   				}
			});	
	}
 function clicked(e) 
 {
	//alert(e);
	var rr="invoice"+e;
	var r=document.getElementById(rr).value;
	//alert(r);
		$.ajax
			({
				type: "GET",
				url: "issue.php",
				data: "issue_id=" + r,		 
				success: function(data)
				{
					$('#rs').html(data);
   				}
			});	
	
}
function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}
$("[id$=myButtonControlID]").click(function(e) {
		window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('div[id$=rs]').html()));
			e.preventDefault();
		});
	function stock_branch()
	{
		var branchid=$('#branch').val();
		//alert(branchid);
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/branch_wise_stock.php",
			data:'branchid='+branchid,
			success:function(data)
			{
				
				$("#stock_report").html(data);
			}
		});
	}	
		
	 function clic(e) 
 {
	//alert(e);
	var rr="invoice"+e;
	var r=document.getElementById(rr).value;
	//alert(r);
		$.ajax
			({
				type: "GET",
				url: "non_cos_issue.php",
				data: "issue_id=" + r,		 
				success: function(data)
				{
					$('#rs').html(data);
   				}
			});	
	
}
function cat_report()
	{
		var catgryid=$('#category').val();
	//	alert(catgryid);
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/cat_wise_table.php",
			data:'catgryid='+catgryid,
			success:function(data)
			{
				
				$("#category_wise").html(data);
			}
		});
	}		

function return_item(i)
	{
		//alert(i);
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/return_form.php",
			data:"id="+i,
			success:function(data)
			{
			$(".content").html(data);
			}
		});
	}	
	function extend_item(i)
	{
	//	alert(i);
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/extend_form.php",
			data:"id="+i,
			success:function(data)
			{
			$(".content").html(data);
			}
		});
	}	
function exp_report(d)

	{
	   // alert(d);
			var fdate=$('#from_date').val();
            var tdate=$('#to_date').val();
            var pono=$('#po_number').val();
	$.ajax({
			type: "POST",
			url: "exp_wise_report.php",
			data :"fdate="+fdate+"&tdate="+tdate+"&pono="+pono,
		success: function(data)
		{
		$('#exp_report').html(data);
		}
			});
}	
function division_level(d)

	{
	   // alert(d);
            var divin=$('#branch').val();
	$.ajax({
			type: "POST",
			url: "division_get.php",
			data :"divin="+divin,
		success: function(data)
		{
		$('#division_report').html(data);
		}
			});
}	
function department_level(d)

	{
	   // alert(d);
            var deprt=$('#dept').val();
	$.ajax({
			type: "POST",
			url: "depart_get.php",
			data :"deprt="+deprt,
		success: function(data)
		{
		$('#department_report').html(data);
		}
			});
}	
function branc_level(d)

	{
	   // alert(d);
            var brch=$('#branc').val();
	$.ajax({
			type: "POST",
			url: "branch_get.php",
			data :"brch="+brch,
		success: function(data)
		{
		$('#branc_report').html(data);
		}
			});
}	
function category_level(d)
{
    var grp=$('#cate').val();
	$.ajax({
			type: "POST",
			url: "categy_get.php",
			data :"grp="+grp,
		success: function(data)
		{
		$('#categry_report').html(data);
		}
			});
}	
function his_report(d)
{
	$.ajax({
		type: "GET",
		url: "history_search.php",
		data :"code="+d,
		success: function(data)
		{ $('#asset_his').html(data); }
	});
}	
function get_field(f)
{
	$.ajax({
		type: "POST",
		url: "field_search.php",
		data :"field="+f,
		success: function(data)
		{ $('#category_wise').html(data); }
	});
}	
function get_cat_report(v)
	{
		//var catgryid=$('#category').val();
	//	alert(catgryid);
		$.ajax({
			type:"POST",
			url:"/asset_temp/reports/asset_cat_get.php",
			data:'catgryid='+v,
			success:function(data)
			{
				
				$("#get_cat_asset").html(data);
			}
		});
	}		
	function createmail()
	{
		$.ajax({
			type:"POST",
			url:"/asset_temp/mail/create_mail.php",
			success:function(data)
			{
				$(".content").html(data);
			}
		});
	}
	function editmail(mid)  // New coded By bala
	{
		$.ajax({
			type: "POST",
			url: "/asset_temp/mail/edit_mail.php",
			data :"ids="+mid,
			success: function(data)
			{ $('.content').html(data); }
		});
	}
	function deactivate_mail(vd)  // New coded By bala
		{
			$.ajax({
				type:"POST",
				url:"/asset_temp/mail/deactivate_mail.php",
				data:"idd="+vd,
				success:function(data)
				{
					$(".content").html(data);
				}
			});
		}
	function delete_mail(cde)
		{
			$.ajax({
				type:"POST",
				url:"/asset_temp/mail/delete_mail.php",
				data:"ids="+cde,
				success:function(data)
				{
					
					$(".content").html(data);
				}
			});
		}
	function activate_mail(ids)
		{
			$.ajax({
				type:"POST",
				url:"/asset_temp/mail/activate_mail.php",
				data:"id="+ids,
				success:function(data)
				{
					
					$(".content").html(data);
				}
			});
		}
		function item_descriptionss(asset_id) // Repair menu fetch location division department in item_master table 
		{ var location=$('#location').val();
		 var branch=$('#branch').val();
			$.ajax({
				type:"POST",
				url:"/asset_temp/repair/item_descriptions.php",
				data:"id="+asset_id+"&location="+location+"&branch="+branch,
				success:function(data)
				{
					var splitData=data.split("-");			
						$("#division").val(splitData[0]);
						$("#department").val(splitData[2]);
				}
			});
		}
		
		function item_descriptions(asset_id) // Repair menu fetch location division department in item_master table 
		{ var location=$('#location').val();
		 var branch=$('#branch').val();
			$.ajax({
				type:"POST",
				url:"/asset_temp/repair/item_descriptions.php",
				data:"id="+asset_id+"&location="+location+"&branch="+branch,
				success:function(data)
				{
					var splitData=data.split("-");			
						$("#division").val(splitData[0]);
						$("#location").val(splitData[1]);
						$("#department").val(splitData[2]);
				}
			});
		}
function quan(a) //stock transfer checks quantity
{
	var quantity=$('#quantity').val();
	var from_location=$('#from_location').val(); //alert(from_location);
	var item_search=$('#item_search').val(); //alert(item_search);
	 $.ajax({ 
		type:'GET',
		data:"quantity="+quantity+"&from_location="+from_location+"&item_search="+item_search,
		url:'id_post.php',
		 success:function(data)
			{	//alert(data);
				if(data == 0)
				{
					//	$('#quantity').val("data");
				}
				else if(data == 1)
				{
					alert("Low Number Of Quantity");
					$('#quantity').val(" ");
				}
				else
				{
					alert("Branch Not Matched With Items...!!!");
					$('#item_search').val(" ");
					$('#quantity').val(" ");
				}
			}       
	});  
}
function replace_div(values)
{ 
	var fdivision=$('#fdivision').val();alert(fdivision);
	$.ajax({ 
		type:'GET',
		data:"from_division="+fdivision,
		url:'item_search_admin.php',
		 success:function(data)
			{
				$('#replaces_div').html(data);
			}       
	});  
}
function yes_quant(a) //stock transfer checks quantity admin level
{
	var quantity=$('#quantity').val();
	var from_location=$('#from_location').val(); //alert(from_location);
	var fdivision=$('#fdivision').val(); //alert(from_location);
	var item_search=$('#item_search').val(); //alert(item_search);
	 $.ajax({ 
		type:'GET',
		data:"quantity="+quantity+"&from_location="+from_location+"&item_search="+item_search+"&fdivision="+fdivision,
		url:'id_posts.php',
		 success:function(data)
			{	//alert(data);
				if(data == 0)
				{
					//	$('#quantity').val("data");
				}
				else if(data == 1)
				{
					alert("Low Number Of Quantity");
					$('#quantity').val(" ");
				}
				else
				{
					alert("Branch Not Matched With Items...!!!");
					$('#item_search').val(" ");
					$('#quantity').val(" ");
				}
			}       
	});  
}



function quans(a) //stock transfer checks quantity
{
	var quantity=$('#no_of_items').val();
	var from_location=$('#location').val(); //alert(from_location);
	var item_search=$('#asset_code').val(); //alert(item_search);
	 $.ajax({ 
		type:'GET',
		data:"quantity="+quantity+"&from_location="+from_location+"&item_search="+item_search,
		url:'id_post.php',
		 success:function(data)
			{	//alert(data);
				if(data == 0)
				{
					//	$('#quantity').val("data");
				}
				else if(data == 1)
				{
					alert("Low Number Of Quantity");
					$('#no_of_items').val(" ");
				}
				else
				{
					alert("Branch Not Matched With Items...!!!");
					$('#asset_code').val(" ");
					$('#no_of_items').val(" ");
				}
			}       
	});  
}
function fa_serial_get(value)
{
	var from_location=$('#location').val();//alert(from_location);
	var division=$('#division').val();//alert(division);
	var department=$('#department').val();//alert(department);
	var category=$('#category').val();//alert(category);
	var qty=$('#qty').val();//alert(category);
	 $.ajax({ 
		type:'GET',
		data:"from_location="+from_location+"&division="+division+"&department="+department+"&category="+category+"&qty="+qty,
		url:'fa_serial_get.php',
		 success:function(data)
			{
				$('#fa').val(data);
			}       
	});  				
}









</script>


