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


Current Path : /proc/thread-self/root/var/www/misc/public_html/live100/src/
Upload File :
Current File : //proc/thread-self/root/var/www/misc/public_html/live100/src/datadictionary.php

<?php
function pupulateDataDictionary($aobj_context)
{
//echo $get_display_cols;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
 $report_id = $aobj_context->mobj_data["report_id"];
$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
$main_src=$main_src_obj[1];
$excel_writer=$_SERVER["DOCUMENT_ROOT"]."/".$main_src."/Excel_Writer/Writer.php";
include($excel_writer);	
 $root_xls_file_download=$_SERVER["DOCUMENT_ROOT"]."/".$main_src."/Report_details/output/dictionary.xls";
 echo $root_xls_file_download;
$workbook = new Spreadsheet_Excel_Writer($root_xls_file_download);

// sending HTTP headers
//$workbook->send('test.xls');

// Creating a worksheet
$worksheet =& $workbook->addWorksheet('Sheet1');
     $get_display_cols="select us.internal_code,us.module_name,sus.name as Element_Name,
						case when rt.value='Text' then 'VarChar'
						when rt.value='Number' then 'Decimal'
						when rt.value='Reference Data' then 'Integer'
						when rt.value='List Of Values' then 'Varchar'
						when rt.value='Large Text' then 'Text'
						 else rt.value end as type,
						if(rt.value='Reference Data',concat('FK, Referenced from the Module ',us1.module_name),if(rt.value='List Of Values',
						concat('Contains List Of Values \"',REPLACE(list_of_values,'|','\",\"'),'\"'),'')) as description 
						from s_user_schema us
						inner join  s_user_schema_elements sus on us.internal_code = sus.ref_s_user_schema_code
						inner join  s_ref_type rt on sus.data_type=rt.internal_code
						left outer join s_user_schema us1 on  us1.internal_code = sus.ref_module_code 
						order by us.internal_code,sus.sequence";
   
     $lobj_details = $aobj_context->mobj_db->GetAll($get_display_cols);
	  
   	 $module_id=0;
	
	$header_row_cell_indx=0;
	/* foreach($lobj_details as $key=> $value)
   {
	if($module_id!=$value[internal_code])
	{
    $worksheet->write(0,$header_row_cell_indx,$value);
	$header_row_cell_indx++;	 
	}
	 
	
   } */
      $xlsRow = 1;
     foreach($lobj_details as $key=> $value)
	{
		$xlscol=0;
	    foreach($value as $key1=> $value1)
	    {
		 $worksheet->write($xlsRow,$xlscol,$value1);
	     $xlscol++;
		}
		 $xlsRow++; 
	}	         
 $workbook->close();
 }
 function alterTable($aobj_context)
 {
 echo "<pre>";
 var_dump($aobj_context);
	$get_table_names="select concat('module_',s.internal_code) as  mod_tab,
				concat('module_',s.internal_code,'_details') as det_tab
				   from s_user_schema s inner join s_ref_type t
				on t.internal_code=module_type
				left join s_ref_type mm on mm.internal_code=main_menu
				where module_name is not null and t.value!='Reports'
				and s.active=1 and is_menu_only=0
				group by s.internal_code ";
	$lobj_get_table_names = $aobj_context->mobj_db->GetAll($get_table_names);
	
	foreach($lobj_get_table_names as $k=>$v)
	{
		$alt_mod_syn="alter table {$v[mod_tab]} add 
				created_by  int(11) default NULL ,add   
			   created_date  datetime default NULL, add
			  `modified_by` int(11) default NULL, add
			  `modified_date` datetime default NULL ";
		$lobj_alt_mod_syn = $aobj_context->mobj_db->Execute($alt_mod_syn);
		echo $alt_mod_syn;

		$alt_mod_details_syn="alter table {$v[det_tab]} add 
				created_by  int(11) default NULL ,add   
			   created_date  datetime default NULL, add
			  `modified_by` int(11) default NULL, add
			  `modified_date` datetime default NULL ";
		$lobj_alt_mod_details_syn = $aobj_context->mobj_db->Execute($alt_mod_details_syn);
	}
	
	$for_multiple_group="select concat('user_schema_',ref_s_user_schema_code,'_group_',internal_code) as group_table
	from s_user_schema_group where multiple=1";
 	$lobj_for_multiple_group = $aobj_context->mobj_db->GetAll($for_multiple_group);
	foreach($lobj_for_multiple_group as $k1=>$v1)
	{
	$alt_group_syn="alter table {$v1[group_table]} add 
				created_by  int(11) default NULL ,add   
			   created_date  datetime default NULL, add
			  `modified_by` int(11) default NULL, add
			  `modified_date` datetime default NULL ";
		$lobj_alt_group_syn = $aobj_context->mobj_db->Execute($alt_group_syn);
	}
 }
 ?>