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 : 18.217.228.195
<?php
class commmon_data
{
public $internal_code;
function __construct($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->aobj_context=$aobj_context;
$this->user_id = $_SESSION['user_id'];
$this->user_type= $_SESSION['user_type'];
$this->real_name= $_SESSION['real_name'];
$this->loc_internal_code = $aobj_context->mobj_data["internal_code"];
}
function GetOrganizationForLocation()
{
$get_data="select o.internal_code as internal_code,o.name as organization from locations loc
inner join organization o on o.internal_code=loc.organization
where loc.internal_code='{$this->loc_internal_code}'
";
$lobj_get_data= $this->aobj_context->mobj_db->GetRow($get_data);
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success");
}
function AssignLocationDetails()
{
$get_data="select count(*) as loc_cnt
from user_master u
inner join user_master_location_mapping_group ug on ug.ref_s_ref_data_code=u.internal_code
where u.internal_code='{$this->user_id}'
";
$lobj_get_data= $this->aobj_context->mobj_db->GetRow($get_data);
$loc_cnt=$lobj_get_data[loc_cnt];
if($loc_cnt==1)
{
$get_loc_data="select l.internal_code as loc_internal_code,l.name as loc_name
from user_master u
inner join user_master_location_mapping_group ug on ug.ref_s_ref_data_code=u.internal_code
inner join locations l on l.internal_code=ug.location
where u.internal_code='{$this->user_id}'
";
$lobj_get_loc_data= $this->aobj_context->mobj_db->GetRow($get_loc_data);
if($lobj_get_loc_data)
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_loc_data,0,"success");
else
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_loc_data,-1,"failure");
}
else
{
echo $this->aobj_context->mobj_output->ToJSONEnvelope($loc_cnt,-1,"failure");
}
}
function GetCurrencyCode()
{
$get_cur="select internal_code,code as currency
from currency
where code='INR'
";
$lobj_get_cur= $this->aobj_context->mobj_db->GetRow($get_cur);
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_cur,0,"success");
}
function AssignDefaultStoreNames()
{
$get_st_cnt = "SELECT count(s.internal_code) as ref_st_codes
FROM stores_employee_group se
INNER JOIN stores s ON s.internal_code = se.ref_s_ref_data_code
WHERE se.employee = {$this->user_id}
";
$lobj_get_st_cnt = $this->aobj_context->mobj_db->GetRow($get_st_cnt);
if($lobj_get_st_cnt[ref_st_codes] == 1)
{
$get_data="select s.internal_code,store_name
from stores s
inner join stores_employee_group seg on seg.ref_s_ref_data_code=s.internal_code
where seg.employee={$this->user_id}
";
$lobj_get_data= $this->aobj_context->mobj_db->GetRow($get_data);
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success");
}
else
{
echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,1,"success");
}
}
}
function GetOrganizationForLocation($aobj_context)
{
$change_obj=new commmon_data($aobj_context);
$change_obj->GetOrganizationForLocation();
}
function AssignLocationDetails($aobj_context)
{
$change_obj=new commmon_data($aobj_context);
$change_obj->AssignLocationDetails();
}
function GetCurrencyCode($aobj_context)
{
$change_obj=new commmon_data($aobj_context);
$change_obj->GetCurrencyCode();
}
function AssignDefaultStoreNames($aobj_context)
{
$change_obj=new commmon_data($aobj_context);
$change_obj->AssignDefaultStoreNames();
}
?>
|