<?php
/*
* To change this template, choose Tools | Templates
* this code is MIL Modules
* author Santosh Singh
* updated date 10-08-2015
* and open the template in the editor.
*/
?>
<?php
class docreporting_AnalyticesController extends Infr_Controller_BaseController {
public function init() {
parent::init();
$sessionVar = $this->getSessVar('userinfo');
$this->_hierarchy_id=$sessionVar['user']->hierarchy_id;
$this->_empSessionId = $sessionVar['user']->employee_id;
$this->_dbuser = $sessionVar['db']['username'];
$this->_host = $sessionVar['db']['host'];
$this->_password = $sessionVar['db']['password'];
$this->_dbname = $sessionVar['db']['dbname'];
$this->_geography_Id = $sessionVar['geography'][0]['list_id'];
}
public function indexAction() {
$now = new DateTime('now');
$month = $now->format('m');
$year = $now->format('Y');
$check_mtp_submission = "select count(*) as count from gst_calendar where date_format(submit_time,'%Y-%m')='$year-$month'";
//var_dump($check_mtp_submission);die;
//$stp_dr_data="call get_stp_data_v1(1,8,8)";
$check_mtp_submission_data = MainDbTable::selectProcStatic($check_mtp_submission);
$this->view->check_for_existing_count=$check_mtp_submission_data;
$activity_master="select gc.working_id,date_format(gct.start_time,'%e') as day,gc.activity_type,gc.activity_id ,gam.activity_type as activity_type_name from gst_calendar gc join gst_calendar_time gct on gc.calendar_id=gct.calendar_id join gst_activity_master gam on gam.activity_id = gc.activity_id where gc.activity_id<>1 and gc.employee_id =$this->_empSessionId and date_format(gct.start_time,'%m-%Y')='$month-$year'";
//var_dump($activity_master);die;
$activity_master_array = MainDbTable::selectProcStatic($activity_master);
$this->view->activity_master_array=$activity_master_array;
$stp_data = "call get_stp_data ($this->_empSessionId,'$year-$month-01')";
//var_dump($stp_data);die;
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $stp_data");
$emp_detail = $this->_clientresultset['emp_detail'];
$emp_history = $this->_clientresultset['emp_history'];
$current_month_holiday = $this->_clientresultset['current_month_holiday'];
$this->view->emp_detail = $emp_detail;
$this->view->emp_history = $emp_history;
$this->view->current_month_holiday = $current_month_holiday;
//@@@@@@@@@@@@@@@@@@@@@ this is the stage master query
$stage_query=" select * from gst_stage_master";
$stage_result= MainDbTable::selectProcStatic($stage_query);
$this->view->stage=$stage_result;
//@@@@@@@@@@@@@@@@@@@@ end of query
$query="call get_employee_reporting_details($this->_empSessionId)";
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['employee_reporting'];
$result1 = $this->_clientresultset['employee_detail'];
$this->view->reporting=$result;
$this->view->employee_details=$result1;
//@@@@@@@@@@@@@@@@@ scheduled AND unscheduled id display here
$query1="select * from gst_pharmaclient_activity";
$result1= MainDbTable::selectProcStatic($query1);
$this->view->schedule=$result1;
//@@@@@@@@@@@@@@@@@ gst_pharmaclient_type as like doctors,MICROBIOLOGIST e.t.c///
$query_joint=" call get_employee_managers_details($this->_empSessionId)";
$joint_result= MainDbTable::selectProcStatic($query_joint);
$this->view->jointwork=$joint_result;
//@@@@@@@@@@@@@@@@@@@@@@@@@ end of codes@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
//@@@@@@@@@@@@@@@@ this is display gst_pharmaclient_type as Doctor,Microbiologist
$query_pharama=" select * from gst_pharmaclient_type";
$res_pharama= MainDbTable::selectProcStatic($query_pharama);
$this->view->department=$res_pharama;
//@@@@@@@@@@@@@@@@ end of codes @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$query="select * from gst_activity_master";
// var_dump($query);die;
$reuslt= MainDbTable::selectProcStatic($query);
$this->view->activitymaster=$reuslt;
}
public function submitotheractivityAction(){
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$act_id=$_POST['act_id'];
$date=$_POST['date'];
$remark=$_POST['remark'];
$query="insert into gst_dr_report(employee_id,meeting_date,submit_date,activity_id,description) values($this->_empSessionId,'$date',now(),$act_id,'$remark')";
// var_dump($query);die;
if(MainDbTable::insertProcStatic($query)){
$this->sendJsonResponse("success");
}
exit;
}
public function doctspecAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$spec_query="select gsm.speciality_id,gsm.speciality from gst_speciality_master as gsm join gst_pharmaclient_speciality_relation as gpsr on(gsm.speciality_id=gpsr.speciality_id) where gpsr.pharmaclient_id in(select gpm.pharmaclient_id from gst_pharmaclient_relation as gpr join gst_pharmaclient_master as gpm on(gpm.pharmaclient_id=gpr.pharmaclient_id) where gpm.type_id=1 and meet_place_id=$hosp_id) group by gsm.speciality_id";
$spec_result= MainDbTable::selectProcStatic($spec_query);
$this->sendJsonResponse($spec_result);
exit;
//####################### end of codes############################
}
public function schedulehospitalAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$date=$_POST['date'];
$query5="call get_employee_reporting_schudle_details($this->_empSessionId,1,'$date')";
// var_dump($query5);die;
$result5= MainDbTable::selectProcStatic($query5);
//var_dump($result5);
$this->sendJsonResponse($result5);
exit;
}
public function territoryviewAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$query="call get_manager_employee_area($this->_empSessionId)";
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function clusterviewAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$query="select list_id,name from gst_geography_list where parent_place=".$_REQUEST['list_id'];
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function savestockistAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$date=$_POST['date'];
$comment=$_POST['remark'];
$stockist_id=$_POST['stockist_id'];
$query="insert into gst_stockiest_report (employee_id,stockiest_id,information,meeting_date,submit_date,flag) values($this->_empSessionId,$stockist_id,'$comment','$date',now(),2)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function viewdetailsAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$stockist_id=$_POST['list_id'];
$query="select gpm.pharmaclient_name,gpm.pharmaclient_id from gst_pharmaclient_master gpm join gst_pharmaclient_geography_list_reln gpglr on (gpglr.pharmaclient_id=gpm.pharmaclient_id) where gpglr.list_id=148 and gpm.type_id=1";
//var_dump($query);die;
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function savechemistAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$date=$_POST['date'];
$comment=$_POST['remark'];
$chemist_id=$_POST['chem_id'];
$query="insert into gst_chemist_report (employee_id,chemist_id,remarks,meeting_date,submit_date,flag) values($this->_empSessionId,$chemist_id,'$comment','$date',now(),2)";
// var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function viewchemistAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$chemist_id=$_POST['list_id'];
$query="select gcr.chemist_report_id,gcr.chemist_id,gpm.pharmaclient_name,gcr.remarks,date(gcr.meeting_date) as date from gst_chemist_report as gcr join gst_pharmaclient_master as gpm on(gcr.chemist_id=gpm.pharmaclient_id) where gcr.employee_id=$this->_empSessionId and gcr.chemist_id=$chemist_id";
// var_dump($query);die;
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function deleteviewAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$chemist_id=$_POST['chemist_id'];
$query="delete from gst_chemist_report where chemist_report_id=$chemist_id";
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function chemviewAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$list_id=$_POST['list_id'];
$query="select gpm.pharmaclient_id,gpm.pharmaclient_name from gst_pharmaclient_master as gpm join gst_pharmaclient_geography_list_reln as gpglr on(gpm.pharmaclient_id=gpglr.pharmaclient_id) where gpglr.list_id=$list_id and gpm.type_id=2";
//var_dump($query);die;
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function stockistviewAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$list_id=$_POST['list_id'];
$query="select gpm.pharmaclient_id,gpm.pharmaclient_name from gst_pharmaclient_master as gpm join gst_pharmaclient_geography_list_reln as gpglr on(gpm.pharmaclient_id=gpglr.pharmaclient_id) where gpglr.list_id=$list_id and gpm.type_id=3;";
//var_dump($query);die;
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function unschedulehospitalAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
//var_dump($unsechudle_id);die;
$date=$_POST['date'];
if($this->_hierarchy_id != '7'){
$query5="select pharmaclient_id,pharmaclient_name from gst_pharmaclient_master where type_id=4 order by pharmaclient_name";
}else{
$query5="call get_employee_reporting_unscheduled_details($this->_empSessionId,2,'$date');";
}
// var_dump($query5);die;
$result5= MainDbTable::selectProcStatic($query5);
//var_dump($result5);
$this->sendJsonResponse($result5);
exit;
}
public function hospitaldetailsAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$query="call get_emp_reporting_schudle_hospital_details($this->_empSessionId,$hosp_id,$date)";
//var_dump($query);die;
//var_dump($query);die;
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
//var_dump($query);die;
$result = $this->_clientresultset['Hospital_detail'];
$result1 = $this->_clientresultset['last_visit_detail'];
$result2 = $this->_clientresultset['today plan'];
$result3 = $this->_clientresultset['focus_product'];
$value=array($result,$result1,$result2,$result3);
// $result= MainDbTable::selectProcStatic($value);
$this->sendJsonResponse($value);
exit;
}
public function currbussprodAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];// 2 is hospital id
$curr_prd="select * from gst_product_master order by product_name";
$result= MainDbTable::selectProcStatic($curr_prd);
$this->sendJsonResponse($result);
exit;
}
public function viewdoctorAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$spec_id=$_POST['speciality_id'];
$query="call get_emp_repoting_doctor_lists($hosp_id,$spec_id)"; //2 ,4
// var_dump($query);die;
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['doctor_detail'];
// var_dump($result);die;
$this->sendJsonResponse($result);
exit;
}
public function viewmicroAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$pharamclient_id=$_POST['hosp_id'];
//first parameter is the pharamclient_id and second parameter id the specility-id
$query="call get_emp_repoting_doctor_lists($pharamclient_id,0)";
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['microbiologist'];
// var_dump($result);die;
$this->sendJsonResponse($result);
exit;
}
public function purchasehospAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$query="call get_emp_repoting_doctor_lists($hosp_id,0)"; //2,0
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['purchase_officer'];
// var_dump($result);die;
$this->sendJsonResponse($result);
exit;
}
public function nursestaffAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout(); //2 is hospital id
$hosp_id=$_POST['hosp_id'];
$query="call get_emp_repoting_doctor_lists($hosp_id,0)";
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['nursing_staff'];
// var_dump($result);die;
$this->sendJsonResponse($result);
exit;
}
public function otstaffAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout(); //2 is hospital id
$hosp_id=$_POST['hosp_id'];
$query="call get_emp_repoting_doctor_lists($hosp_id,0)"; //2,0
$obj = new Infr_Model_BaseModel();
$this->_clientresultset = $obj->callMySQLi("$this->_host", "$this->_dbuser", "$this->_password", "$this->_dbname", " $query");
$result = $this->_clientresultset['ot_staff'];
// var_dump($result);die;
$this->sendJsonResponse($result);
exit;
}
public function prddoctorAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout(); //2 is hospital id
// $prddoct_id=$_POST['prddoct_id'];
$query="select product_id,product_name from gst_product_master";
$result= MainDbTable::selectProcStatic($query);
// $quer1="select speciality from gst_speciality_master where speciality_id in(select speciality_id from gst_pharmaclient_speciality_relation where pharmaclient_id=$prddoct_id)";
// $result1= MainDbTable::selectProcStatic($quer1);
// $value=array($result,$result1);
$this->sendJsonResponse($result);
exit;
}
public function viewmicroprdAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout(); //2 is hospital id
$query="select product_id,product_name from gst_product_master where product_type=2";
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function viewpurchaseprdAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout(); //2 is hospital id
$query="select product_id,product_name from gst_product_master where product_type=1";
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function savedoctorAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['doctor_id'];
$stage_id=$_POST['stage_id'];
$buss_potentials=$_POST['buss_potential'];
$date=$_POST['date'];
$current_pots=$_POST['prd_amt'];
$query1=" select type_id from gst_pharmaclient_master where pharmaclient_id=".$doct_id;
$resultdepartment= MainDbTable::selectProcStatic($query1);
$department_tab_id=$resultdepartment[0]['type_id'];
$quntity_amoumnt=$_POST['quntity_amt'];
$quntity_amoumnt=implode("~",$quntity_amoumnt);
$joint_works=$_POST['joint_work'];
$query="call set_dr_report_for_web(1,$hosp_id,$doct_id,$stage_id,'$buss_potentials','$current_pots',$this->_empSessionId,$department_tab_id,'$date','$quntity_amoumnt','$joint_works',4,@st,@id)";
// var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$query1="select @id";
$result1= MainDbTable::selectProcStatic($query1);
$value = $result1[0]['@id'];
//var_dump($result1);die;
// var_dump($result);
if($result)
{
$this->sendJsonResponse($value);
}
else {
$this->sendJsonResponse(false);
}
exit;
// var_dump($query);die;
}
public function savedoctormeetAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
// var_dump($hosp_id);die;
$stage_id=$_POST['stage_id'];
$buss_potential=$_POST['buss_potential'];
$prd_amt=$_POST['prd_amt']; //current bussiness amount
$current_pot=implode("~", $prd_amt);
// var_dump(implode("~", $prd_amt));die;
// var_dump($prd_amt)
$department_tab_id=$_POST['department_tab_id'];
$quntity_amt=$_POST['quntity_amt'];
$quntity_amoumnt=implode("~", $quntity_amt);
//var_dump($quntity_amoumnt);die;
$date=$_POST['date'];
$query="insert into gst_dr_report(account_id,doctor_id,employee_id,department_id,meeting_date,submit_date,stage_id,submit_status,flag) values($hosp_id, 0,$this->_empSessionId,$department_tab_id,'$date',now(),$stage_id,2,2);";
//var_dump($query);die;
if(MainDbTable::insertProcStatic($query)){
$this->sendJsonResponse("success");
}
exit;
}
public function savemicroAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['doctor_id'];
$stage_id=$_POST['stage_id'];
$buss_potential=$_POST['buss_potential'];
$prd_amt=$_POST['prd_amt']; //current bussiness amount
//var_dump($prd_amt);die;
$current_pot=implode("~", $prd_amt);
$current_pots='';
if($current_pot==NULL)
{
$current_pots='NULL';
//var_dump("santosh");
}
else
{
$current_pots=$current_pot;
}
$joint_work=$_POST['joint_work'];
$joint_works='';
if($joint_work==NULL)
{
$joint_works='NULL';
}
else
{
$joint_works=$joint_work;
}
//var_dump($current_pots);die;
// var_dump(implode("~", $prd_amt));die;
// var_dump($prd_amt)
$department_tab_id=$_POST['micro_type'];
$date=$_POST['date'];
$quntity_amt=$_POST['quntity_amt'];
// var_dump($quntity_amt);
$quntity_amoumnt=implode("~", $quntity_amt);
//var_dump($quntity_amoumnt);die;
$remark_array=$_POST['remark_array'];
$j=0;
for($i=0;$i<count($quntity_amt);$i++)
{
$j++;
$microbiofinalstrinh[$i]=$quntity_amt[$i].'^'.$remark_array[$i];
}
$micro_qun= implode("~", $microbiofinalstrinh);
//var_dump($micro_qun);die;
$query="call set_dr_report_for_web(1,$hosp_id,$doct_id,$stage_id,'$buss_potential','$current_pots',$this->_empSessionId,$department_tab_id,'$date','$micro_qun',$joint_works,4,@st,@id)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$query1="select @id";
$result1= MainDbTable::selectProcStatic($query1);
$value = $result1[0]['@id'];
if($result)
{
$this->sendJsonResponse($value);
}
else {
$this->sendJsonResponse(false);
}
exit;
}
public function micronotmeetAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['not_meet_id'];
$stage_id=$_POST['stage_id'];
$department_tab_id=$_POST['micro_type'];
$date=$_POST['date'];
$query="insert into gst_dr_report(account_id,doctor_id,employee_id,department_id,meeting_date,submit_date,stage_id,submit_status,flag) values( $hosp_id,0,$this->_empSessionId, $department_tab_id,'$date',now(),$stage_id,2,2)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function nursenotmeetAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['not_meet_id'];
$stage_id=$_POST['stage_id'];
$department_tab_id=$_POST['nurse_type'];
$date=$_POST['date'];
$query="insert into gst_dr_report(account_id,doctor_id,employee_id,department_id,meeting_date,submit_date,stage_id,submit_status,flag) values( $hosp_id,0,$this->_empSessionId, $department_tab_id,'$date',now(),$stage_id,2,2)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function otstaffnotmeetAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['not_meet_id'];
$stage_id=$_POST['stage_id'];
$department_tab_id=$_POST['ot_type'];
$date=$_POST['date'];
$query="insert into gst_dr_report(account_id,doctor_id,employee_id,department_id,meeting_date,submit_date,stage_id,submit_status,flag) values( $hosp_id,0,$this->_empSessionId, $department_tab_id,'$date',now(),$stage_id,2,2)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function purchasenotmeetAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['not_meet_id'];
$stage_id=$_POST['stage_id'];
$department_tab_id=$_POST['purchase_type'];
$date=$_POST['date'];
$query="insert into gst_dr_report(account_id,doctor_id,employee_id,department_id,meeting_date,submit_date,stage_id,submit_status,flag) values( $hosp_id,0,$this->_empSessionId, $department_tab_id,'$date',now(),$stage_id,2,2)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function savepurchaseAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$doct_id=$_POST['doctor_id'];
$stage_id=$_POST['stage_id'];
$buss_potential=$_POST['buss_potential'];
$prd_amt=$_POST['prd_amt']; //current bussiness amount
$date=$_POST['date'];
$joint_work=$_POST['joint_works'];
$joint_works='';
if($joint_work==NULL)
{
$joint_works='NULL';
}
else
{
$joint_works=$joint_work;
}
$current_pot=implode("~", $prd_amt);
$current_pots='';
if($current_pot==NULL)
{
$current_pots='NULL';
//var_dump("santosh");
}
else
{
$current_pots=$current_pot;
}
$department_tab_id=$_POST['purchase_tab_ids'];
$quntity_amt=$_POST['quntity_amt'];
// var_dump($quntity_amt);
$quntity_amoumnt=implode("~", $quntity_amt);
$remark_array=$_POST['remark_array'];
// var_dump($remark_array);
$j=0;
for($i=0;$i<count($quntity_amt);$i++)
{
// var_dump($remark_array[$i]);
$j++;
$microbiofinalstrinh[$i]=$quntity_amt[$i].'^'.$remark_array[$i];
}
$micro_qun= implode("~", $microbiofinalstrinh);
//var_dump($micro_qun);
$query="call set_dr_report_for_web(1,$hosp_id,$doct_id,$stage_id,'$buss_potential','$current_pots',$this->_empSessionId,$department_tab_id,'$date','$micro_qun',$joint_works,4,@id,@st)";
//var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$query1="select @id";
$result1= MainDbTable::selectProcStatic($query1);
$value = $result1[0]['@id'];
if($result)
{
$this->sendJsonResponse($value);
}
else {
$this->sendJsonResponse(false);
}
exit;
}
public function viewbusspotAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$query="select business_potential_amount from gst_dr_report where dr_report_id =(select max(dr_report_id) from gst_dr_report where account_id=$hosp_id and business_potential_amount is not NULL)";
//$query="select business_potential_amount from gst_dr_report where account_id=$hosp_id";
// var_dump($query);die;
$reuslt= MainDbTable::selectProcStatic($query);
if($reuslt)
{
$this->sendJsonResponse($reuslt);
}
else {
$this->sendJsonResponse(false);
}
exit;
}
public function activitymasterAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$query="select * from gst_activity_master";
// var_dump($query);die;
$reuslt= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($reuslt);
exit;
}
public function submitdcrAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$submit_id=$_POST['submit_id'];
//var_dump($submit_id);die;
$submit_ids= implode(",", $submit_id);
$query="update gst_dr_report set submit_status=6 where dr_report_id in($submit_ids)";
//var_dump($query);die;
$reuslt= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function submitotherAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$stage_id=$_POST['stage_id'];
$buss_pote=$_POST['buss_potential'];
$prd_amt=$_POST['prd_amt'];
$date=$_POST['date'];
$curen_buss=$prd_amt;
$oter_tab_id=$_POST['other_tab_id'];
$new_person=$_POST['new_person'];
$other_qty=$_POST['other_qty'];
$other_remark=$_POST['other_remark'];
$other_prd=explode(',',$_POST['prd_amt_other']);
$other_prd_quns=$other_prd[0];
$approvearray= explode('~',$other_prd_quns);
$approvearray1= explode('^',$approvearray[0]);
$approve=$approvearray1[1];
// var_dump($other_prd[1]);die;
$acom=$other_prd[1];
if(!$acom || $acom=='' || $acom==NULL){
$acom=NULL;
}
//var_dump($acom);die;
$query="call set_dr_report_for_web1(1,$hosp_id,$stage_id,'$buss_pote','$curen_buss',$this->_empSessionId,$oter_tab_id,'$date','$other_prd_quns',2,'$new_person',$approve,'$other_remark',NULL,@st,@id)";
// var_dump( $query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
exit();
}
public function otherproductAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$query=" select product_id,product_name from gst_product_master where product_type=1";
$reuslt= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($reuslt);
exit;
}
function mtptocalAction(){
$datetime=$_POST['datetime'];
$select_mtp="select date_format(submit_time,'%e') as submit_time, working_id,calendar_approval_status,cluster_name,cluster_id,IF(cluster_id=0,0,count(working_id)) as total_no_of_hospital from gst_calendar where employee_id=".$this->_empSessionId." and date_format(submit_time,'%Y-%m')='".$datetime."' group by submit_time";
//var_dump($select_mtp);die;
$select_mtp_result = MainDbTable::selectProcStatic($select_mtp);
$select_joint_work="select date_format(joint_date,'%e') as joint_date from gst_calendar_joint_work where date_format(joint_date,'%Y-%m')='".$datetime."' and employee_id=".$this->_empSessionId;
//var_dump($select_joint_work);die;
$select_joint_work_array = MainDbTable::selectProcStatic($select_joint_work);
$select_report_date="select dr_report_id ,submit_status,date_format(meeting_date,'%e') as meeting_date from gst_dr_report where date_format(meeting_date,'%Y-%m')='".$datetime."' and employee_id=".$this->_empSessionId." group by meeting_date" ;
//var_dump($select_report_date);die;
$select_report_date_array = MainDbTable::selectProcStatic($select_report_date);
$this->sendJsonResponse(array($select_mtp_result,$select_joint_work_array,$select_report_date_array));
exit;
}
public function jointworkAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$query_joint=" call get_employee_managers_details($this->_empSessionId)";
$joint_result= MainDbTable::selectProcStatic($query_joint);
$this->sendJsonResponse($joint_result);
exit;
}
//@@@@@@@@@@@@@@@@@ view dcr @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
public function viewdcrAction()
{
}
public function pobproductAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$query=" call get_personal_order_product_details($this->_empSessionId,$hosp_id)";
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function submitpobAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$pob_qun=$_POST['prd_amt_other'];
//var_dump($pob_qun);die;
$prd_qun= implode("~", $pob_qun);
if($prd_qun!='')
{
$query="call set_personal_order_booking($this->_empSessionId,$hosp_id,'$prd_qun')";
// var_dump($query);die;
$result= MainDbTable::insertProcStatic($query);
$this->sendJsonResponse($result);
}
else
{
$this->sendJsonResponse(false);
}
exit;
}
public function viewpobAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$newdate= strtotime($date);
$dates= date("Y-m",$newdate);
// var_dump($dates);die;
//var_dump($date);die;
$query="select gpob.product_id,gpm.product_name,gpob.quantity from gst_personal_order_booking as gpob join gst_product_master as gpm on(gpm.product_id=gpob.product_id) where gpob.employee_id=$this->_empSessionId and pharmaclient_id=$hosp_id and date_format(gpob.date,'%Y-%m')='$dates'";
// var_dump($query);die;
$result= MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
//var_dump($hosp_id);die;
exit;
}
public function doctortabAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(department_id) as department_id from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date' and doctor_id <> 0 ";
//var_dump($query);die;
//$query=" select count(department_id) as department_id from gst_dr_report where account_id=1 and department_id=12 and employee_id=8 and date(meeting_date)='2015-12-03' and doctor_id <> 0 ;";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function microtabAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(department_id) as department_id from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date' and doctor_id <> 0 ";
//var_dump($query);die;
//$query=" select count(department_id) as department_id from gst_dr_report where account_id=1 and department_id=12 and employee_id=8 and date(meeting_date)='2015-12-03' and doctor_id <> 0 ;";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function nursetabAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(department_id) as department_id from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date' and doctor_id <> 0 ";
//var_dump($query);die;
//$query=" select count(department_id) as department_id from gst_dr_report where account_id=1 and department_id=12 and employee_id=8 and date(meeting_date)='2015-12-03' and doctor_id <> 0 ;";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function ottabAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(department_id) as department_id from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date' and doctor_id <> 0 ";
//var_dump($query);die;
//$query=" select count(department_id) as department_id from gst_dr_report where account_id=1 and department_id=12 and employee_id=8 and date(meeting_date)='2015-12-03' and doctor_id <> 0 ;";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function checkforreportAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(*) as count from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date'";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
public function purchasetabAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$hosp_id=$_POST['hosp_id'];
$date=$_POST['date'];
$department_id=$_POST['department_id'];
$query="select count(department_id) as department_id from gst_dr_report where account_id=$hosp_id and department_id=$department_id and employee_id=$this->_empSessionId and date(meeting_date)='$date' and doctor_id <> 0 ";
//var_dump($query);die;
//$query=" select count(department_id) as department_id from gst_dr_report where account_id=1 and department_id=12 and employee_id=8 and date(meeting_date)='2015-12-03' and doctor_id <> 0 ;";
$result=MainDbTable::selectProcStatic($query);
$this->sendJsonResponse($result);
exit;
}
}