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.149.29.209


Current Path : /var/www/oasis/js_old/base_file/
Upload File :
Current File : /var/www/oasis/js_old/base_file/ajax_queue

/**************************************************************************************************
*	FILE NAME��.......: MainPage.js
*	DATE..............: 26/05/2009
* 	PROGRAMMER........: Natesh 
* 	MODIFIED PROGRAMMER........: Jijo.P,Beemaraj.V 
* 	DESCRIPTION�......: This Script file is used for maintaining Cookie,Golabal Variable,Display Menu
*	
*	FUNCTION�.........: saveRecords()
*	PARAMETERS........: NO ARGUMENTS
* 	DESCRIPTION.......: The function is used to call the save function for corresponding modules.

*	FUNCTION�.........: Clearfields()
*	PARAMETERS........: NO ARGUMENTS
* 	DESCRIPTION.......: The function is used to call the Clear Fields function for corresponding modules.
*
*	FUNCTION�.........: view_records()()
*	PARAMETERS........: NO ARGUMENTS
* 	DESCRIPTION.......: The function is used to Display Grid for corresponding modules.
*
*
*
***************************************************************************************************/
function GenerateFiles()
{ 
   switch(document.getElementById('module_name_for_save').value)
	{
 			case 'SaveReportFormDetails':
			var cond= validateReportForm();
			if(cond)  
			{
				if( $g_report_form_elements.error_code=='0')
				{
					$ele_data=$g_report_form_elements.data[1];//data  Id
					$report_id=$g_report_form_elements.data[0];//report Id
					$schema_name=$g_report_form_elements.data[2];//report Id
					$lstr_data='';
					for($i=0;$i<$ele_data.length;$i++)
					{		
					$lstr_data+="&"+$ele_data[$i].ele_field_name+"="+document.getElementById('details_'+$ele_data[$i].internal_code).value;
					}
					$data="report_id="+$report_id+"&schema_name="+$schema_name+$lstr_data;
				}
				else 
				{
				$report_id=$g_report_form_elements.data[0];//report Id
				$schema_name=$g_report_form_elements.data[2];//report Id
				$data="report_id="+$report_id+"&schema_name="+$schema_name;
				}
				//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'>Down Loading  ... <img src='../images/spinner.gif' border='0'></h1>" }); 
				window.location.href=$host_url+"getDownloadReportFile&"+$data;
			}
		break;	
	}
}

function saveRecords()
{
	$('#dialog').dialog('close');
 	switch(document.getElementById('module_name_for_save').value)
	{
	
		case 'savegeneralmasterDetails':
			savegeneralmasterDetails();
			//$geditinternalcode=0;
		break;
		
		case 'saveuserschemagroupDetails':
			saveuserschemagroupDetails();
			//$geditinternalcode=0;
		break;
		
		case 'saveuserschemaelementDetails':
		 
			saveuserschemaelementDetails();
		break;
		
		case 'saveModuleDetails':
			 saveModuleDetails();
			 
		break;
		
		case 'saveSchemaGroupTableDetails':
		 
			saveSchemaGroupDetails();
			//$geditinternalcode=0;
		break;
		 
		case 'saveUserSetUpDetails':
		 
			saveUserSetUpDetails();
			//$geditinternalcode=0;
		break;
		case 'saveUserRightsDetails':
			 
			saveUserRightsDetails();
			//$geditinternalcode=0;
		break;
		
		case 'saveTransactionSeries':
			 
			saveTransactionSeries();
			//$geditinternalcode=0;
		break;
		
		case 'saveReportSetup':
		     saveReportSetup();
		 break;
		 
		
		case 'SaveReportFormDetails_old':
			var cond= validateReportForm();
			if(cond)  
			{
				if( $g_report_form_elements.error_code=='0')
				{
					$ele_data=$g_report_form_elements.data[1];//data  Id
					$report_id=$g_report_form_elements.data[0];//report Id
					$schema_name=$g_report_form_elements.data[2];//report Id
					$lstr_data='';
					for($i=0;$i<$ele_data.length;$i++)
					{		
					$lstr_data+="&"+$ele_data[$i].ele_field_name+"="+document.getElementById('details_'+$ele_data[$i].internal_code).value;
					}
					$data="report_id="+$report_id+"&schema_name="+$schema_name+$lstr_data;
				}
				else 
				{
				$report_id=$g_report_form_elements.data[0];//report Id
				$schema_name=$g_report_form_elements.data[2];//report Id
				$data="report_id="+$report_id+"&schema_name="+$schema_name;
				}
				//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'>Down Loading  ... <img src='../images/spinner.gif' border='0'></h1>" }); 
				window.location.href=$host_url+"getDownloadReportFile&"+$data;
			}
		break;	
	}
}

function Clearfields()
{
$('#dialog').dialog('close');
$g_group_edit_internalcode=0;
$g_group_edit_parent_internalcode=0;
	switch(document.getElementById('module_name_for_save').value)
	{
		
		case 'savegeneralmasterDetails':
			enablegeneralmaster();
			$geditinternalcode=0;
		break;
	
		case 'saveuserschemagroupDetails':
			enable_user_schema_group();
			$geditinternalcode=0;
		break;
		
		case 'saveuserschemaelementDetails':
			enable_user_schema_elements();
			$geditinternalcode=0;
		break;
		
		case 'saveModuleDetails':
			getModulesDetails($g_str_module_name,$g_str_module_id,'Add');
			$geditinternalcode=0;
			$geditParentGroupinternalcode=0;
		break;
		case 'SaveReportFormDetails':
			getReportFormDetails($g_str_module_name,$g_str_module_id,'Add');
			$geditinternalcode=0;
		break;
		
		 
		case 'saveUserSetUpDetails':
			$gedituserinternalcode=1;
			enableUserSetUp();
		break;
		
		case 'saveTransactionSeries':
			$geditinternalcode=0;
			enableTransactionSeries();
		break;
		 
				
	}
}	

function view_records()
{
$('#dialog').dialog('close');
$geditinternalcode=0;
$geditParentGroupinternalcode=0;
$g_group_edit_internalcode=0;
$g_group_edit_parent_internalcode=0;
HideHeaderFooterValues('View');

	if(1)
	{
		switch(document.getElementById('module_name_for_save').value)
		{
			case 'savegeneralmasterDetails':
				displayUserSchemaMaster_grid();
			break;
			
			case 'saveuserschemagroupDetails':
				display_user_schema_group_master_grid();			
			break;
			
			case 'saveuserschemaelementDetails':
				display_user_schema_element_master_grid();			
			break;
			
			case 'saveModuleDetails':
				$.ajax({
				type: "POST",
				async: false,
				url: $host_url+"getModuleColumnName.demo",
				data:"module_name="+encodeURIComponent($g_str_module_name),
				success: getModuleColumnResponse
				}); 
				
			break;
			
			case 'saveuserschemaelementDetails':
				display_user_schema_element_master_grid();
				document.getElementById('edit_row').style.display='';
				document.getElementById("finish_row").setAttribute("class", "tarkabutton-disabled");
			break;
			
			//same as saveModuleDetails, since we will store different save value
			case 'saveSchemaGroupTableDetails':
				$.ajax({
				type: "POST",
				async: false,
				url: $host_url+"getModuleColumnName.demo",
				data:"module_name="+$g_str_module_name,
				success: getModuleColumnResponse
				}); 
			break;
			 
			
			case 'SaveReportFormDetails':
				var cond= validateReportForm();
				if(cond)  
				{
					if( $g_report_form_elements.error_code=='0' )
					{ 
						$ele_data=$g_report_form_elements.data[1];//data  Id
						$report_id=$g_report_form_elements.data[0];//report Id
						$schema_name=$g_report_form_elements.data[2];//report Id
						$lstr_data='';
						for($i=0;$i<$ele_data.length;$i++)
						{		
						$lstr_data+="&"+$ele_data[$i].ele_field_name+"="+document.getElementById('details_'+$ele_data[$i].internal_code).value;
						}
						//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'>Processing  ... <img src='../images/spinner.gif' border='0'></h1>" }); 
						$.ajax({
							 type: "POST",
							 async: false,
							 url: $host_url+"getReport",
							  data:$lstr_data+"&report_id="+$report_id+"&schema_name="+$schema_name,
							   success: getReportDataDetailsResponse
						}); 
					}
					else 
					{
						$report_id=$g_report_form_elements.data[0];//report Id
						$schema_name=$g_report_form_elements.data[2];//report Id
						//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'>Processing ... <img src='../images/spinner.gif' border='0'></h1>" }); 
						$.ajax({
							 type: "POST",
							 async: false,
							 url: $host_url+"getReport",
							  data:"report_id="+$report_id+"&schema_name="+$schema_name,
							   success: getReportDataDetailsResponse
						}); 
					}
				}	
			break;
			
			case 'saveUserSetUpDetails':
			if(document.getElementById("footer_view_row").className!='tarkabutton-disabled')
			{
				if(getCookie('user_type')=='Admin' || getCookie('user_type')=='Super Wiser')
				{
					displayUserSetUpDetails();
					document.getElementById("footer_finish_row").setAttribute("class", "tarkabutton-disabled");
				}
				//if(getCookie('user_type')=='Admin')		
				//document.getElementById('edit_row').style.display='';
			}	
			break;
			
			case 'saveTransactionSeries':
				displayTransactionSeriesGrid();				
			break;												 
		}
	}	
}

function validateReportForm()
{
	$save_second_level=$g_report_form_elements.data[1];
	//to check the optional field value
	for($i = 0; $i < $save_second_level.length; $i++)
	{
		if($save_second_level[$i].Type!='Ref Display' && trim(document.getElementById('details_'+$save_second_level[$i].internal_code).value)=='' && $save_second_level[$i].optional=='0')
		{
			alert($save_second_level[$i].element_name+'  is mandatory');
			document.getElementById('details_'+$save_second_level[$i].internal_code).focus();
			return false;
						}
					}	
					
		 
//to check data Type Number		
for($i = 0; $i < $save_second_level.length; $i++)
					{
					
				 	if($save_second_level[$i].Type=='Number')
						{
						
						if( document.getElementById('details_'+$save_second_level[$i].internal_code).value!='' && !validDecimal(document.getElementById('details_'+$save_second_level[$i].internal_code).value,$save_second_level[$i].decimals ))
							{
							alert('Please Enter Number for '+$save_second_level[$i].element_name +'with max of '+$save_second_level[$i].decimals+' Decimals' );
						 
							document.getElementById('details_'+$save_second_level[$i].internal_code).focus();
							return false;
							}
						}					
					} 
//to check date					
				for($i = 0; $i < $save_second_level.length; $i++)
					{
					
				 	if($save_second_level[$i].Type=='Date')
						{
						if(trim(document.getElementById('details_'+$save_second_level[$i].internal_code).value)!='' && !isDate(document.getElementById('details_'+$save_second_level[$i].internal_code).value,'d/M/y'))
							{
							alert('Please Enter '+$save_second_level[$i].element_name+' Date format as dd/mm/yy');
							 
							document.getElementById('details_'+$save_second_level[$i].internal_code).focus();
								 
							return false;
							}
						}					
					} 
				return true;	
}
function getReportDataDetailsResponse($responce)
	{
		$responce = eval('(' + $responce + ')');
		   $.unblockUI();
		 if($responce.error_code=='0')
		 {
		 window.open("http://"+$responce.data);
		 }
		 else
		 alert($responce.data);

		 
	}	
 
 function editRecords($id)
{
$('#dialog').dialog('close');
$geditinternalcode=$id;
 	switch(document.getElementById('module_name_for_save').value)
	{
		
		case 'savegeneralmasterDetails':
			getGeneralMasterDetails($id);
		break;
			
		case 'saveDynamicMasters':
			getDynamicMasterDetails($id);
			break;
			case 'saveuserschemagroupDetails':
			getUserSchemaGroupDetails($id);
		break;
		case 'saveuserschemaelementDetails':
			getUserSchemaElementDetails($id);
		break;
			case 'saveModuleDetails': 
			getModulesDetails($g_str_module_name,$g_str_module_id,'Edit');
			//getUserSchemaModuleDetails($id,$g_user_schema_details_array.data[1][0].ref_s_user_schema_code);
			
		break;
			case 'saveSchemaGroupTableDetails':
			getModulesDetails($g_str_module_name,$g_str_module_id,'Edit');
			getUserSchemaModuleDetails($id,$g_user_schema_details_array.data[1][0].ref_s_user_schema_code);
			
		 
		case 'saveUserSetUpDetails':
		getUserSetUpDetails($id);
		break;
		case 'saveTransactionSeries':
		getTransactionSeries($id);
		break;
		 
		
	
	}
}
function show_field_text($value)
{
	switch(document.getElementById('module_name_for_save').value)
	{
	
		case 'savegeneralmasterDetails':
			get_help_text_field('s_ref_modules',$value);
		break;
		case 'SaveReportFormDetails':
			get_help_text_field('s_ref_modules',$value);
		break;
		case 'saveSchemaGroupTableDetails':
			get_help_text_field('s_ref_group',$value);
		break;
		
		case 'saveuserschemagroupDetails':
			get_help_text_field('s_user_schema_group',$value);
			
		break;
		case 'saveuserschemaelementDetails':
			get_help_text_field('s_user_schema_elements',$value);
		break;
		 
		case 'saveModuleDetails':
			get_help_text_field('module_master_details',$value);
		break;
		case 'saveTransactionSeries':
			get_help_text_field('saveTransactionSeries',$value);
		break;
		case 'saveEmployeeFormulaMapping':
			get_help_text_field('saveEmployeeFormulaMapping',$value);
		break;
		case 'saveEmployeeFormulaSalarySetup':
			get_help_text_field('saveEmployeeFormulaSalarySetup',$value);
		break;
		case 'saveIncomeTaxMaster':
			get_help_text_field('saveIncomeTaxMaster',$value);
		break;
		case 'saveprocessEmployeeSalary':
			get_help_text_field('saveprocessEmployeeSalary',$value);
		break;
		
	}
}



function get_help_text_field($table,$field_name)
{
window.field_help_text_table=$table;
window.field_help_text_field=$field_name;
	 $.ajax({
     type: "POST",
	 //async: false,
       url: $host_url+"help_text_field_value.demo",      
	   data:"table_name="+$table+"&field_name="+$field_name,
       success: populate_help_text_value
  });
 } 
function populate_help_text_value($responce)
{
	$responce = eval('(' + $responce + ')'); 
	 
	if ($responce.error_code == 0 && $responce.data.help_text_value!=undefined ) 
    {
	window.field_help_text=$responce.data.help_text_value;
	 
	document.getElementById('field_help_text').innerHTML=$responce.data.help_text_value;
	}	
	else
	{
		window.field_help_text='';
	//document.getElementById('field_help_text').innerHTML='';
	}	
}
function get_help_text($table)
{
//To Get Proper Table Names
window.left_navi_help_table=$table;
/* alert(window.left_navi_help_table);
alert(window.enable_proper_module); */
	 $.ajax({
     type: "POST",
       url: $host_url+"help_text_value.demo",      
	   data:"table_name="+$table,
       success: populate_help_text
  });
 } 
 
function populate_help_text($responce)
{
$responce = eval('(' + $responce + ')'); 
 
if ($responce.error_code == 0) 
    {
	if($responce.data.field_name==0)
	document.getElementById('table_help_text').innerHTML=$responce.data.help_text_value;
	//To Get Proper Table Name Text value
	window.left_navi_help_text=document.getElementById('table_help_text').innerHTML;
	}	
	else 
	{
	//document.getElementById('table_help_text').innerHTML='';
	//window.left_navi_help_text=document.getElementById('table_help_text').innerHTML
	}
}


function display_field_text	($value)
{
document.getElementById('field_help_text').innerHTML = $value;
}

function UploadRecords()
{
	switch(document.getElementById('module_name_for_save').value)
	{
		
		case 'saveModuleDetails':
			//uploadModuleRecords($g_user_schema_details_array.data[1][0].ref_s_user_schema_code);
			$('#page_main_div').load("../../html_modules/upload_details.html");
            EnablePageHeaderFooter();
			HideHeaderFooterValues('Download');
			
	 
		
	}		
}	
function getManualUploadheader()
{
	switch(document.getElementById('module_name_for_save').value)
	{
		
			case 'enableMonthlyTransaction':
			 window.location.href=$host_url+"getMonthlyTransactionHeaders.demo";
			break;
		 
	}		
}
function uploadManualModuleDetailsIntoDB()
{
	switch(document.getElementById('module_name_for_save').value)
	{
		
			case 'enableMonthlyTransaction':
			 uploadMonthlytransactionsIntoDB();
			break;
			 	
	}		
}
function EnablePageHeaderFooter()
{
	FillDefaultHeaderFooterNames();
	module_name = document.getElementById('module_name_for_save').value;
	if(module_name=="savegeneralmasterDetails"||module_name=="saveuserschemaelementDetails"||module_name=="saveuserschemagroupDetails")
	{
		$("#page_header").show();
		$("#page_footer").show();
		$("#header_upload_row").hide();
		$("#footer_upload_row").hide();
	}
	else
	{	
		$("#page_header").show();
		$("#header_upload_row").show();
		$("#footer_upload_row").show();
		$("#page_footer").show();
	}
	
}
function FillDefaultHeaderFooterNames()
{
$("#header_finish_row").html("Save");
$("#footer_finish_row").html("Save");
$("#header_finish_row").show();
$("#footer_finish_row").show();

$("#footer_clear_row").html("Clear");
$("#header_clear_row").html("Clear");
$("#footer_clear_row").show();
$("#header_clear_row").show();

$("#footer_upload_row").html("Download");
$("#header_upload_row").html("Download");
$("#footer_upload_row").show();
$("#header_upload_row").show();

$("#header_view_row").html("View");
$("#footer_view_row").html("View");
$("#header_view_row").show();
$("#footer_view_row").show();
}
function HideHeaderFooterValues($type)
{
	switch($type)
	{		
			
			case 'View':
				$("#header_finish_row").hide();
				$("#footer_finish_row").hide();
				$("#footer_upload_row").show();
				$("#header_upload_row").show();
				$("#header_clear_row").html("New");
				$("#footer_clear_row").html("New");
				$("#header_view_row").hide();
				$("#footer_view_row").hide();
				HideCustomLinks();
				 $("#header_clear_row").focus()
			break;
			case 'Reports':
				$("#header_view_row").hide();
				$("#footer_view_row").hide();
				$("#header_upload_row").hide();
				$("#footer_upload_row").hide();
			break;
			case 'Download':
				$("#header_finish_row").hide();
				$("#footer_finish_row").hide();
				$("#header_upload_row").hide();
				$("#footer_upload_row").hide();
				$("#header_clear_row").html("New |");
				$("#footer_clear_row").html("New |");
				HideCustomLinks();
			break;		
	}	
}
function HideCustomLinks()
{
if($g_link_details_array!="")
	{
		$custom_links=$g_link_details_array.link_id.split(",");
		for($c=0;$c<$custom_links.length;$c++)
		{
		if($custom_links[$c]!="")
			{
			$id=$custom_links[$c];
			$("#header_"+$id).hide();
			$("#footer_"+$id).hide();
			}
		} 
	}
}
function ChangeHeaderFooterNames($type)
{
}

function DisablePageHeaderFooter()
{
$("#page_header").hide();
$("#page_footer").hide();
}

 function getDefaultHeadFooterLinks(module)
 {
  $.ajax({
		type: "POST",
		 async:false,
		url: $host_url+"getDefaultHeadFooterLinks.demo", 
		data:"module_name="+module,	
		success: getHeadFooterLinksResponce
	}); 
 }
 function getHeadFooterLinksResponce($responce)
{

 	$responce = eval('(' + $responce + ')');
	var g_link_details_array="";
	 g_link_details_array=$responce.data['links_data'];
	 $("#header_td_id").html(g_link_details_array['header_link']);
	$("#footer_td_id").html(g_link_details_array['footer_link']);
	$("#page_header").show();
	$("#page_footer").show();
}
 $upload_group_table_name="";
function  UploadGroupDetails(group_name)
{
$upload_group_table_name=group_name;
$('#dialog').dialog('open');

$path="../../html_modules/upload_group_details.html";
	$('#dialog').load($path);
 
}