/********************************IMMIDIATE CHECK ITEM VALIDATION************************************/


/*************************************main validation********************************/
function party_validation()
{
    
	var party_name = document.getElementById("party_name").value;
	if(party_name=='')
	{
		document.getElementById("party_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("party_name").focus();
		return false;
	}
	
	var address = document.getElementById("address").value;
	if(address=='')
	{
		document.getElementById("address_validation_div").innerHTML="* This field is Required.";
		document.getElementById("address").focus();
		return false;
	}
	
	var city = document.getElementById("city").value;
	if(city=='')
	{
		document.getElementById("city_validation_div").innerHTML="* This field is Required.";
		document.getElementById("city").focus();
		return false;
	}
	
		var tin_no = document.getElementById("tin_no").value;
	if(tin_no=='')
	{
		document.getElementById("tin_no_validation_div").innerHTML="* This field is Required.";
		document.getElementById("tin_no").focus();
		return false;
	}
	
	var cst_no = document.getElementById("cst_no").value;
	if(cst_no=='')
	{
		document.getElementById("cst_no_validation_div").innerHTML="* This field is Required.";
		document.getElementById("cst_no").focus();
		return false;
	}
	
	var gst_no = document.getElementById("gst_no").value;
	if(gst_no=='')
	{
		document.getElementById("gst_no_validation_div").innerHTML="* This field is Required.";
		document.getElementById("gst_no").focus();
		return false;
	}
	

}



function party_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("party_name_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("address_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("city_validation_div").innerHTML="";
	}
		if(str!='')
	{
		document.getElementById("tin_no_validation_div").innerHTML="";
	}
		if(str!='')
	{
		document.getElementById("cst_no_validation_div").innerHTML="";
	}
		if(str!='')
	{
		document.getElementById("gst_no_validation_div").innerHTML="";
	}

}



function party_creation_add(party_type,status_type,party_no,party_name,mob_no,pho_no,email,address,city,cst_no,tin_no,source,edit_id,action,gst_no)
{ 
//alert(status_type); 
if((party_type!='')&&(party_name!='')&&(address!='')&&(city!='')&&(cst_no!='')&&(tin_no!='')&&(gst_no!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "party_creation_entry_db.php",
	    data: "party_type="+party_type+"&status_type="+status_type+"&party_no="+party_no+"&party_name="+party_name+"&mob_no="+mob_no+"&pho_no="+pho_no+"&email="+email+"&address="+address+"&city="+city+"&cst_no="+cst_no+"&tin_no="+tin_no+"&source="+source+"&edit_id="+edit_id+"&action="+action+"&gst_no="+gst_no,
		success: function(msg){jQuery("#item_list_div").html(msg);	
		alert(msg);	
		if(source=='Main')
		{
		  window.close();
		 window.opener.location.reload(true);
		}
		else 
		{
		window.close();
		}
 }
		});
 }
else
{
    party_validation();
}
}



function party_del_rows(id,party_no)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "party_creation/party_creation_entry_db.php",
		data: "id="+id+"&party_no="+party_no+"&action=del_party",
		success: function(msg){jQuery("#party_list_div").html(msg);
		window.location.reload(true);
	}
	});
    }
}
function party_approve_status(id,party_no)
{

		jQuery.ajax({
		type: "POST",
		url: "party_creation/party_creation_entry_db.php",
		data: "id="+id+"&party_no="+party_no+"&action=approve_party",
		success: function(msg){
		//	alert(msg);
			jQuery("#party_list_div").html(msg);
		window.location.reload(true);
	}
	});
    
}