/********************************** Validation *******************************************************/
function payment_terms_validation()
{
    var payment_terms_name = document.getElementById("payment_terms_name").value;
	if(payment_terms_name=='')
	{
		document.getElementById("payment_terms_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("payment_terms_name").focus();
		return false;
	}
}

function payment_terms_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("payment_terms_name_validation_div").innerHTML="";
	}
}

/********************************** Mainlist Add *******************************************************/
function payment_terms_main_list_add(payment_terms_name,payment_terms_remarks,edit_id,action)
{

if((payment_terms_name!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "payment_terms_entry_db.php",
		data: "payment_terms_name="+payment_terms_name+"&payment_terms_remarks="+payment_terms_remarks+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#payment_terms_list_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
		
 }
		});
 }
else
{
    payment_terms_validation();
}
}

/********************************** Mainlist Delete *******************************************************/
function payment_terms_delete_row(id)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "master_entry/payment_terms/payment_terms_entry_db.php",
		data: "id="+id+"&action=delete_payments",
		success: function(msg){jQuery("#payment_terms_list_div").html(msg);
	}
	});
    }
}


