0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.12.163.120


Current Path : /proc/thread-self/root/var/www/html/jssm/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/jssm/js/services.js

function callenableservices()
{
	$("#page_main_div").load('html_modules/services.html',function()
	{ 
		$("#input_form").hide();
		document.getElementById('display_module_name').innerHTML = 'Services';
		document.getElementById('module_name_for_save').value = 'Services';
		getDefaultHeadFooterLinks("Services");
		document.getElementById('is_add_edit').value = 'view';
		var TFields = ['FSERVCODE','FSERVNAME','FPROC','FMAXDAYS'];
		var TColwidth = ['40','50','200','630','100'];
		var THeader = ['Sl.No.','Service Code','Service Name','Service procedure','Max. service days'];
		var TWhere = "AND ifnull(FDELETED,'')<>'T'";
		srchHeaderGrid('servtype',TFields,TWhere,1070,TColwidth,THeader,5);
		$('#header_save').css('color', '#717171');
		$('#header_save').css('cursor','default');	
		$('#header_cancel').css('color', '#717171');
		$('#header_cancel').css('cursor','default');
		$('#header_delete').css('color', '#717171');
		$('#header_delete').css('cursor','default');
		$("#grid_view").show();
	});
}

function addServices()
{
	var typeEdit = document.getElementById('is_add_edit').value;
	if(typeEdit == 'view')
	{	
		$("#page_main_div").load('html_modules/services.html',function()
		{ 
			fldorder = 'T1,T2,T3,T4,T5,T6,T7,T8,T18,T9,T10,T11,T12,T13,T14,T17,T15,T16';
			mandfields = 'T1,T2,T3,T4,T8,T10,T12,T13,T14,T17,T15,T16';
			$("#grid_view").hide();
			document.getElementById('display_module_name').innerHTML = 'Services';
			document.getElementById('module_name_for_save').value = 'Services';
			getDefaultHeadFooterLinks("Services");
			$geditinternalcode='';
			document.getElementById('is_add_edit').value = 'Add';
			$("#input_form").show();
			$('#header_add').css('color', '#717171');
			$('#header_add').css('cursor','default');
			$('#header_report').css('color', '#717171');
			$('#header_report').css('cursor','default');
			$('#header_delete').css('color', '#717171');
			$('#header_delete').css('cursor','default');
			document.getElementById('T1').focus();
		});	
	}
}

function editServicesMaster(supcode)
{
	$("#page_main_div").load('html_modules/services.html',function()
	{ 
		fldorder = 'T1,T2,T3,T4,T5';
		mandfields = 'T1,T2,T3,T4,T5';
		window.enable_proper_module="Supplier";	   
		document.getElementById('display_module_name').innerHTML = 'Services';
		document.getElementById('module_name_for_save').value = 'Services';
		getDefaultHeadFooterLinks("Services");
		document.getElementById('is_add_edit').value = 'Edit';
		$("#input_form").show();
		editSupplierDetailsForUpdate(supcode);
		$('#header_add').css('color', '#717171');
		$('#header_add').css('cursor','default');
		$('#header_report').css('color', '#717171');
		$('#header_report').css('cursor','default');
		document.getElementById('T2').focus();
		return;	
	});
}

function deleteServices()
{
	var typeEdit = document.getElementById('is_add_edit').value;
	if(typeEdit == 'Edit')
	{	
		var r = confirm("Do you want to delete this record ?");
		if (r == true) 
		{
			var delete_arr = new Object();
			delete_arr[0]= new Object();
			var supplierCode = document.getElementById('T1').value;
			delete_arr[0]['supplierCode']=supplierCode;	
			$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });
			var myJSONText = encodeURIComponent(JSON.stringify(delete_arr));
			$.ajax({
			type: "POST",
			//async:false,
			url: $host_url+"disableServicesRecord", 
			data:"&delete_arr="+myJSONText,
			success: function($responce)
			{  $.unblockUI();
				$responce = eval('(' + $responce + ')'); 
				if($responce.error_code==0)
				{		 
					alert("Record deleted successfully");		
					$('#view_supplier_entry').trigger("reloadGrid"); 
					callenableservices();
				}	
			}
			});	
		}
	}
}

function cancelSupplier()
{
	var typeEdit = document.getElementById('is_add_edit').value;
	if(typeEdit == 'Edit' || typeEdit == 'Add')
	{
		var s = confirm("Confirm Cancel?");
		if (s == true)
		{
			callenableservices();
		}
	}	
}

function exitSupplier()
{
	home();
}

var myobject;
function saveServices()
{
	var typeEdit = document.getElementById('is_add_edit').value;
	if(typeEdit == 'Edit' || typeEdit == 'Add')
	{			
		var sercode = document.getElementById('T1').value;
		$geditinternalcode = sercode;
		var sername = document.getElementById('T2').value;
		var procedure = document.getElementById('T3').value;
		var maxdays = document.getElementById('T4').value;	
		var seroder = document.getElementById('T5').value;
		var sertype = document.getElementById('S1').value;
		/* myobject = onsavevalidate.call(myobject, 999);
		if (myobject != 999)
		{
			document.getElementById(myobject).focus();
			return false;
		} */
		
		var datastring = "&sercode="+$geditinternalcode+"&sername="+sername+"&procedure="+procedure+"&maxdays="+maxdays+"&seroder="+seroder+"&add_edit="+typeEdit+"&sertype="+sertype;
		$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });

		$.ajax({
		type: "POST",
		url: $host_url+"saveServicesMaster",
		data:datastring,
		success:saveServicesMasterSuccess
		});  
	}
}

function saveServicesMasterSuccess($responce)
{
	$responce = eval('(' + $responce + ')');  
	$.unblockUI();
	if($responce.error_code == 0)
	{
		alert($responce.data);
		callenableservices();
	}
	else
	{
		alert($responce.data);
		document.getElementById('T1').focus();
	}	
}

function SelectSupplierRowId(id)
{ 	 
	var idlength = id.length;
	if(idlength == 4)
	{	
		$geditinternalcode=id; 
		CallenableSupplier('Edit');
	}	
}

function editSupplierDetailsForUpdate(id)
{
	$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });
	$.ajax({
	type: "POST",
	//async:false,
	url: $host_url+"getServiceCodeDetails", 
	data:"servicecode="+id,
	success: getServiceCodeDetailsResponse
	}); 
 }

function getServiceCodeDetailsResponse($responce)
{ 	
	$responce = eval('(' + $responce + ')'); 
	$.unblockUI();
	if($responce.error_code == 0 )
	{		
		if($responce.data['FDELETED'] =='T')
		{
			alert("This Supplier is already deleted!!");
			return false;
		}
		document.getElementById('T1').disabled=true;
		document.getElementById('T1').value = $responce.data['FSERVCODE'];
		document.getElementById('T2').value = $responce.data['FSERVNAME'];
		document.getElementById('T3').value = $responce.data['FPROC'];
		document.getElementById('T4').value = $responce.data['FMAXDAYS'];
		document.getElementById('T5').value = $responce.data['FORDER'];
		document.getElementById('S1').value = $responce.data['FMULTIPLE'];
	}	
	else
	{
		alert($responce.data);
	}		
}


//************* Validations *************//

function supplierfocus(e,id)
{
	if(e.keyCode == 13 || e.keyCode == 9 || e.keyCode == 38 || e.keyCode == 40)
	{
		var rtfocus = onfocusvalidate(e,999);
		if(rtfocus!=999)
		{	
			return false;
		}	
		
	}	
}

function reportSupplier()
{
	var typeEdit = document.getElementById('is_add_edit').value;
	if(typeEdit == 'view')
	{	
		var win_width = window.screen.width;
		$('#batch_dialog').dialog('open');	    
		$("#batch_dialog").data("width.dialog",400);   
		$("#batch_dialog").data("position.dialog",[(win_width-400)/2,90]);	
		$('#ui-dialog-title-batch_dialog').html('Supplier Report');	
		var path="html_modules/supplier_report_popup.html";				
		$('#batch_dialog').load(path,function()
		 {
			 document.getElementById('generate').focus();
		 });		 
	}	 
} 

function GenerateReportSupplierMasterDetails()
{ 
	florder = 'SR1,SR2';
	mandfields ='SR1,SR2';
	var rtfocus = onsavevalidate.call(myobject, 999);
	if (rtfocus != 999)
	{
		return false;
	} 
	from_supplier = trim($("#SR1").val());
	to_supplier = trim($("#SR2").val());
	var str ="&from_supplier="+from_supplier; 
	str+="&to_supplier="+to_supplier;		 	
	//window.location.href = $host_url+"generateReportSupplierMaster"+str;  
	$.ajax({
	type: "POST",
	//async:false,
	url: $host_url+"generateReportSupplierMaster", 
	data:str,
	success:function($responce)
	{
		$responce = eval('(' + $responce + ')');
		if($responce.error_code == 0)
		{
			viewReportToPrint($responce.data);
		}	
		else
		{
			alert($responce.data);
		}
	}
	}); 
}