You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
254 lines
5.7 KiB
254 lines
5.7 KiB
<?php
|
|
|
|
class Assign
|
|
{
|
|
public $form_key;
|
|
public $seq;
|
|
public $assigner;
|
|
public $assign_status;
|
|
public $assign_date;
|
|
public $assign_opinion;
|
|
public $flow_code;
|
|
public $flow_code_seq;
|
|
public $real_assigner;
|
|
|
|
/**
|
|
* @return null
|
|
*/
|
|
public function getFormKey()
|
|
{
|
|
return $this->form_key;
|
|
}
|
|
|
|
/**
|
|
* @param null $form_key
|
|
* @return Assign
|
|
*/
|
|
public function setFormKey($form_key)
|
|
{
|
|
$this->form_key = $form_key;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getSeq()
|
|
{
|
|
return $this->seq;
|
|
}
|
|
|
|
/**
|
|
* @param int $seq
|
|
* @return Assign
|
|
*/
|
|
public function setSeq($seq)
|
|
{
|
|
$this->seq = $seq;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getAssigner()
|
|
{
|
|
return $this->assigner;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $assigner
|
|
* @return Assign
|
|
*/
|
|
public function setAssigner($assigner)
|
|
{
|
|
$this->assigner = $assigner;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getAssignStatus()
|
|
{
|
|
return $this->assign_status;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $assign_status
|
|
* @return Assign
|
|
*/
|
|
public function setAssignStatus($assign_status)
|
|
{
|
|
$this->assign_status = $assign_status;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getAssignDate()
|
|
{
|
|
return $this->assign_date;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $assign_date
|
|
* @return Assign
|
|
*/
|
|
public function setAssignDate($assign_date)
|
|
{
|
|
$this->assign_date = $assign_date;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getAssignOpinion()
|
|
{
|
|
return $this->assign_opinion;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $assign_opinion
|
|
* @return Assign
|
|
*/
|
|
public function setAssignOpinion($assign_opinion)
|
|
{
|
|
$this->assign_opinion = $assign_opinion;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFlowCode()
|
|
{
|
|
return $this->flow_code;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $flow_code
|
|
* @return Assign
|
|
*/
|
|
public function setFlowCode($flow_code)
|
|
{
|
|
$this->flow_code = $flow_code;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFlowCodeSeq()
|
|
{
|
|
return $this->flow_code_seq;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $flow_code_seq
|
|
* @return Assign
|
|
*/
|
|
public function setFlowCodeSeq($flow_code_seq)
|
|
{
|
|
$this->flow_code_seq = $flow_code_seq;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getRealAssigner()
|
|
{
|
|
return $this->real_assigner;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $real_assigner
|
|
* @return Assign
|
|
*/
|
|
public function setRealAssigner($real_assigner)
|
|
{
|
|
$this->real_assigner = $real_assigner;
|
|
return $this;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param null $formKey
|
|
*/
|
|
public function __construct($formKey = null)
|
|
{
|
|
|
|
$this->form_key = $formKey;
|
|
|
|
list($seq) = DB::fields("SELECT max(seq) FROM assign
|
|
where form_key ='$formKey'");
|
|
$this->seq = empty($seq) ? 0 : $seq;
|
|
}
|
|
|
|
/**
|
|
* @param null $formKey
|
|
* @param string $as_array
|
|
* @param string $code
|
|
* @param string $assign_status
|
|
* @return array
|
|
*/
|
|
public static function get_records($formKey = null, $as_array = "true", $code = '%', $assign_status = '%')
|
|
{
|
|
try {
|
|
$sql = "select seq,assigner,assign_opinion, assign_date assign_date
|
|
,lead_code,f_return_content('lead_code',lead_code) position_name,assign_status,flow_code,
|
|
f_return_depart(assigner) assign_depart ,f_return_depart_name(f_return_depart(assigner)) assign_depart_name
|
|
from
|
|
assign a,employee b where
|
|
a.assigner =b.employee_no
|
|
and assign_status like '" . $assign_status . "%'
|
|
and form_key = '" . $formKey . "' and flow_code like '" . $code . "%' order by assign_date asc";
|
|
// echo $sql;
|
|
return DB::result($sql, $as_array);
|
|
|
|
} catch (Exception $e) {
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
public static function get_lastest_record($formKey, $code)
|
|
{
|
|
try {
|
|
$sql = "select seq,assigner,assign_opinion, assign_date assign_date,lead_code,
|
|
f_return_content('lead_code',lead_code) position_name,assign_status,flow_code,
|
|
f_return_depart(assigner) assign_depart ,f_return_depart_name(f_return_depart(assigner)) assign_depart_name
|
|
from
|
|
assign a,employee b where
|
|
a.assigner =b.employee_no
|
|
and form_key = '" . $formKey . "' and seq in(
|
|
select max(seq) from assign where form_key = '" . $formKey . "'
|
|
and flow_code like '" . $code . "%'
|
|
) ";
|
|
$result = DB::result($sql);
|
|
return $result[0];
|
|
|
|
} catch (Exception $e) {
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public function insert()
|
|
{
|
|
DB::insert_table("assign", array(
|
|
"form_key" => $this->form_key,
|
|
"seq" => $this->seq + 1,
|
|
"assigner" => $this->assigner,
|
|
"assign_status" => $this->assign_status,
|
|
"assign_opinion" => $this->assign_opinion,
|
|
"flow_code" => $this->flow_code,
|
|
"flow_code_seq" => $this->flow_code_seq,
|
|
"real_assigner" => $this->real_assigner
|
|
));
|
|
}
|
|
}
|