logthis("uitype is ".$uitype,'info');
$fldname = '';
if($uitype == 1)
{
$fldname = 'Text';
}
elseif($uitype == 7)
{
$fldname = 'Number';
}
elseif($uitype == 9)
{
$fldname = 'Percent';
}
elseif($uitype == 3)
{
$fldname = 'Currency';
}
elseif($uitype == 5)
{
$fldname = 'Date';
}
elseif($uitype == 13)
{
$fldname = 'Email';
}
elseif($uitype == 11)
{
$fldname = 'Phone';
}
elseif($uitype == 15)
{
$fldname = 'Pick';
}
elseif($uitype == 17)
{
$fldname = 'Url';
}
elseif($uitype == 56)
{
$fldname = 'Checkbox';
}
return $fldname;
}
function CustomFieldEditView($id, $fldModule, $tableName, $colidName, $app_strings, $theme)
{
global $adb;
//Custom Field Addition
$dbquery = "select * from field where tablename='".$fldModule."'";
$result = $adb->query($dbquery);
if($adb->num_rows($result) != 0)
{
if(isset($id))
{
$custquery = 'select * from '.$tableName.' where '.$colidName."='".$id."'";
$cust_result = $adb->query($custquery);
}
$noofrows = $adb->num_rows($result);
$custfld = '
';
$custfld .= '
';
for($i=0; $i<$noofrows; $i++)
{
$colName=$adb->query_result($result,$i,"fieldlabel");
$setName=$adb->query_result($result,$i,"column_name");
$uitype=$adb->query_result($result,$i,"uitype");
if(isset($id) && $adb->num_rows($cust_result) != 0)
{
$value=$adb->query_result($cust_result,0,strtolower($setName));
}
else
{
$value='';
}
$custfld .= '
'.$colName.': | ';
if($uitype == 5)
{
$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
$custfld .= ' (yyyy-mm-dd) | ';
$custfld .= '';
}
elseif($uitype == 15)
{
$pick_query="select * from ".$fldModule."_".$setName;
$pickListResult = $adb->query($pick_query);
$noofpickrows = $adb->num_rows($pickListResult);
$custfld .= ' | ';
}
else
{
$custfld .= ' | ';
}
$i++;
if($i<$noofrows)
{
$colName=$adb->query_result($result,$i,"fieldlabel");
$setName=$adb->query_result($result,$i,"column_name");
$uitype=$adb->query_result($result,$i,"uitype");
if(isset($id) && $adb->num_rows($cust_result) != 0)
{
$value=$adb->query_result($cust_result,0,$setName);
}
else
{
$value='';
}
$custfld .= ''.$colName.': | ';
if($uitype == 5)
{
$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
$custfld .= ' (yyyy-mm-dd) | ';
$custfld .= '';
}
elseif($uitype == 15)
{
$pick_query="select * from ".$fldModule."_".$setName;
$pickListResult = $adb->query($pick_query);
$noofpickrows = $adb->num_rows($pickListResult);
$custfld .= ' | ';
}
else
{
$custfld .= ' | ';
}
}
$custfld .= '
';
}
$custfld .= '
';
return $custfld;
}
}
function CustomFieldDetailView($id, $fldModule, $tableName, $colidName)
{
global $adb;
//Assigning custom field values
$dbquery = "select * from field where tablename='".$fldModule."'";
$result = $adb->query($dbquery);
$adb->println($result);
if($adb->num_rows($result) != 0)
{
$custquery = 'select * from '.$tableName.' where '.$colidName."='".$id."'";
$cust_result = $adb->query($custquery);
$adb->println($cust_result);
$noofrows=$adb->num_rows($result);
$custfld = '';
for($i=0; $i<$noofrows; $i++)
{
$fldName=$adb->query_result($result,$i,"fieldlabel");
$colName=$adb->query_result($result,$i,"column_name");
$uitype=$adb->query_result($result,$i,"uitype");
if($adb->num_rows($cust_result) != 0)
{
$value=$adb->query_result($cust_result,0,strtolower($colName));
}
else
{
$value='';
$adb->println("emply value ");
}
$custfld .= '';
$custfld .= ''.$fldName.': | ';
if($uitype == 13)
{
$custfld .= ''.$value.' | ';
}
else
{
$custfld .= ''.$value.' | ';
}
$i++;
if($i<$noofrows)
{
$fldName=$adb->query_result($result,$i,"fieldlabel");
$colName=$adb->query_result($result,$i,"column_name");
$uitype=$adb->query_result($result,$i,"uitype");
if($adb->num_rows($cust_result) != 0)
{
$value=$adb->query_result($cust_result,0,strtolower($colName));
}
else
{
$value='';
}
$custfld .= ''.$fldName.': | ';
if($uitype == 13)
{
$custfld .= ''.$value.' | ';
}
else
{
$custfld .= ''.$value.' | ';
}
}
$custfld .= '
';
}
}
return $custfld;
}
function getCustomFieldArray($module)
{
global $adb;
$custquery = "select * from field where tablename='".$module."'";
$custresult = $adb->query($custquery);
$custFldArray = Array();
$noofrows = $adb->num_rows($custresult);
for($i=0; $i<$noofrows; $i++)
{
$colName=$adb->query_result($custresult,$i,"column_name");
$custFldArray[$colName] = $i;
}
return $custFldArray;
}
function getCustomFieldTrans($module, $trans_array)
{
global $adb;
$tab_id = getTabid($module);
$custquery = "select columnname,fieldlabel from field where generatedtype=2 and tabid=".$tab_id;
$custresult = $adb->query($custquery);
$custFldArray = Array();
$noofrows = $adb->num_rows($custresult);
for($i=0; $i<$noofrows; $i++)
{
$colName=$adb->query_result($custresult,$i,"columnname");
$fldLbl = $adb->query_result($custresult,$i,"fieldlabel");
$trans_array[$colName] = $fldLbl;
}
}
function CustomFieldSearch($customfieldarray, $fldModule, $tableName,$colidName,$app_strings,$theme,$fieldlabel,$column)
{
global $adb;
//for($i=0;$i Custom Field : '.$i.'...'.$customfieldarray[$i];}
//Custom Field Addition
$dbquery = "select * from field where tablename='".$fldModule."' order by fieldlabel";
$result = $adb->query($dbquery);
if($adb->num_rows($result) != 0)
{
$noofrows = $adb->num_rows($result);
$custfld = '';
return $custfld;
}
}
?>