function inward_sublist_validation()
{
   var in_jobcard_no = document.getElementById("in_jobcard_no").value;
	if(in_jobcard_no=='')
	{
		document.getElementById("in_jobcard_no_validation_div").innerHTML="* This field is Required.";
		document.getElementById("in_jobcard_no").focus();
		return false;
	}
	
	var inward_particular = document.getElementById("inward_particular").value;
	if(inward_particular=='')
	{
		document.getElementById("inward_particular_validation_div").innerHTML="* This field is Required.";
		document.getElementById("inward_particular").focus();
		return false;
	}
	var roll_width = document.getElementById("roll_width").value;
	if(roll_width=='')
	{
		document.getElementById("roll_width_validation_div").innerHTML="* This field is Required.";
		document.getElementById("roll_width").focus();
		return false;
	}
	var kg_height = document.getElementById("kg_height").value;
	if(kg_height=='')
	{
		document.getElementById("kg_height_validation_div").innerHTML="* This field is Required.";
		document.getElementById("kg_height").focus();
		return false;
	}
	var inward_qty = document.getElementById("inward_qty").value;
	if(inward_qty=='')
	{
		document.getElementById("inward_qty_validation_div").innerHTML="* This field is Required.";
		document.getElementById("inward_qty").focus();
		return false;
	}
	else
	{
		document.getElementById("inward_qty_validation_div").innerHTML="Please check Order Qty.";
		document.getElementById("inward_qty").focus();
		return false;
	}
	
}

function inward_sub_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("in_jobcard_no_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("inward_particular_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("roll_width_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("kg_height_validation_div").innerHTML="";
	}
	
	if(str!='')
	{
		document.getElementById("inward_qty_validation_div").innerHTML="";
	}
}




function inward_main_validation()
{
   var in_jobcard_no = document.getElementById("in_jobcard_no").value;
	if(in_jobcard_no=='')
	{
		document.getElementById("in_jobcard_no_validation_div").innerHTML="* This field is Required.";
		document.getElementById("in_jobcard_no").focus();
		return false;
	}
	 var delivery_through = document.getElementById("delivery_through").value;
	if(delivery_through=='')
	{
		document.getElementById("delivery_through_inward_validation_div").innerHTML="* This field is Required.";
		document.getElementById("delivery_through").focus();
		return false;
	}
	 var vehicle_no = document.getElementById("vehicle_no").value;
	if(vehicle_no=='')
	{
		document.getElementById("vehicleno_inward_validation_div").innerHTML="* This field is Required.";
		document.getElementById("vehicle_no").focus();
		return false;
	}
}


function inward_main_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("in_jobcard_no_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("delivery_through_inward_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("vehicleno_inward_validation_div").innerHTML="";
	}
}
/***********************************   Sublist Add  ***********************************/
function inward_sublist(jobcard_no,in_cust_name,inward_date,inward_particular,roll_width,kg_height,inward_qty,inward_qty1,fabric_type,created_by,job_types,entrydates,total_piece,customer_dc_no,receipt,overall_qty,invoice_no,edit_id,action)
{ 

 if((jobcard_no!='')&&(inward_particular!='')&&(roll_width!='')&&(kg_height!='')&&(inward_qty!='')&&(Number(inward_qty)<=Number(inward_qty1))) 
{
	
 jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_entry_db.php",
		data: "jobcard_no="+jobcard_no+"&in_cust_name="+in_cust_name+"&inward_date="+inward_date+"&inward_particular="+inward_particular+"&roll_width="+roll_width+"&kg_height="+kg_height+"&inward_qty="+inward_qty+"&inward_qty1="+inward_qty1+"&fabric_type="+fabric_type+"&created_by="+created_by+"&job_types="+job_types+"&entrydates="+entrydates+"&total_piece="+total_piece+"&customer_dc_no="+customer_dc_no+"&receipt="+receipt+"&overall_qty="+overall_qty+"&invoice_no="+invoice_no+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#inward_sub_list_div").html(msg);
		document.getElementById("roll_width").value='';
		document.getElementById("kg_height").value='';
		document.getElementById("inward_qty").value='';
		document.getElementById("add").value='ADD';
		document.getElementById("in_jobcard_no").focus();	
 }
		});
}
else
{
	inward_sublist_validation();
}
}
/******************************************** SUB EDIT*****************************************************************/
function edit_sublist_inward(edit_id,jobcard_no)
{ 
  jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_sublist.php",
		data: "edit_id="+edit_id+"&jobcard_no="+jobcard_no,
		success: function(msg){jQuery("#inward_sub_list_div").html(msg);

 }
		});
}
/******************************************** SUB DELETE*****************************************************************/
function delete_sublist_inward(id,jobcard_no)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_entry_db.php",
		data: "id="+id+"&jobcard_no="+jobcard_no+"&action=del_inward_sublist",
		success: function(msg){jQuery("#inward_sub_list_div").html(msg);
		document.getElementById("in_jobcard_no").focus();	
	}
	});
    }
}
/*************************main list********************************************/
function inward_main_list(jobcard_no,entry_time,customer_name,style_no,created_by,style_name,cust_po_no,combo,jobtype,fabric_type,overal_tot,total_piece,customer_dc_no,receipt,invoice_no,delivery_through,vehicle_no,edit_id,action)
{ 
  if((jobcard_no!='')&&(delivery_through!='')&&(vehicle_no!='')) 
{ 
  	if(confirm('Are You Sure! You Want To Conform The Inward..'))
	{
   jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_entry_db.php",
		data: "jobcard_no="+jobcard_no+"&entry_time="+entry_time+"&customer_name="+customer_name+"&style_no="+style_no+"&created_by="+created_by+"&style_name="+style_name +"&cust_po_no="+cust_po_no+"&combo="+combo+"&jobtype="+jobtype+"&fabric_type="+fabric_type +"&overal_tot="+overal_tot+"&total_piece="+total_piece+"&customer_dc_no="+customer_dc_no+"&receipt="+receipt+"&invoice_no="+invoice_no+"&delivery_through="+delivery_through+"&vehicle_no="+vehicle_no+"&main_edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#inward_main_list_div").html(msg);	
			if(edit_id!='')
			{
			window.location.href="main_fram.php?file=inward_entry";
			}
			else
			{
			window.location.reload(true);
		    }
     }
		});
		}
		}
else
{
	inward_main_validation();
}
}

function get_customer_inward(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/customer_name.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#inward_customer").html(msg);
	}
	});
}


function get_created_by(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/created_by.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#created_by_div").html(msg);
	}
	});
}



function get_style_no(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/style_no.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#style_no_div").html(msg);
	}
	});
}



function get_style_name(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/style_name.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#style_name_div").html(msg);
	}
	});
}

function get_customer_po(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/cust_po_no.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#customer_po_div").html(msg);
	}
	});
}


function get_combo(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/combo.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#combo_type_div").html(msg);
	}
	});
}


function get_job_type(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/job_type.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#job_types_div").html(msg);
	}
	});
}


function get_fabric_types(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/fabric_type.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#fabric_type_div").html(msg);
	}
	});
}


function get_total_piece(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/total_piece.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#total_piece_div").html(msg);
	}
	});
}


function get_inward_jobcard(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_sublist.php",
		data: "jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#inward_sub_list_div").html(msg);
	}
	});
}



function get_particulars(in_jobcard_no)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/particulars.php",
		data: "in_jobcard_no="+in_jobcard_no,
		success: function(msg){jQuery("#inward_partic_divs").html(msg);
	}
	});
}


function get_rolls_sub(in_jobcard_no,inward_particular)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/rolls.php",
		data: "in_jobcard_no="+in_jobcard_no+"&inward_particular="+inward_particular,
		success: function(msg){jQuery("#rolls_div").html(msg);
	}
	});
}


function get_height_sub(in_jobcard_no,inward_particular)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/meters.php",
		data: "in_jobcard_no="+in_jobcard_no+"&inward_particular="+inward_particular,
		success: function(msg){jQuery("#kg_height_div").html(msg);
	}
	});
}


function get_qty_sub(in_jobcard_no,inward_particular)
{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/qty.php",
		data: "in_jobcard_no="+in_jobcard_no+"&inward_particular="+inward_particular,
		success: function(msg){
			jQuery("#qty_sub_div").html(msg);
			
			
	}
	});
	
	
	jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/qty1.php",
		data: "in_jobcard_no="+in_jobcard_no+"&inward_particular="+inward_particular,
		success: function(msg){
			jQuery("#qty_sub_div1").html(msg);
			
	}
	});
}


function delete_inward_main22(jobcard_no)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "jobcard/inward_entry/inward_entry_db.php",
		data: "jobcard_no="+jobcard_no+"&action=delete_inward",
		success: function(msg){jQuery("#inward_main_list_div").html(msg);
		window.location.reload(true);
	}
	});
    }
}

