信呼OA版本v2.3.8
This commit is contained in:
71
webmain/model/flow/assetmModel.php
Normal file
71
webmain/model/flow/assetmModel.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
class flow_assetmClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = c('array')->strtoarray('blue|闲置,#ff6600|在用,red|维修,gray|报废,gray|丢失');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
if(isset($rs['typeid']))$rs['typeid'] = $this->db->getmou('[Q]option','name',"`id`='".$rs['typeid']."'");
|
||||
if(isset($rs['ckid']) && $rs['ckid']>0){
|
||||
$rs['ckid'] = $this->db->getmou('[Q]option','name',"`id`='".$rs['ckid']."'");
|
||||
if(isset($rs['address']) && isempt($rs['address'])){
|
||||
$rs['address'] = $rs['ckid'];
|
||||
$this->update("`address`='".$rs['address']."'", $rs['id']);
|
||||
}
|
||||
}
|
||||
if(isset($this->statearr[$rs['state']])){
|
||||
$b = $this->statearr[$rs['state']];
|
||||
$rs['state'] = '<font color="'.$b[0].'">'.$b[1].'</font>';
|
||||
}
|
||||
if(isset($rs['fengmian']) && !isempt($rs['fengmian']))$rs['fengmian'] = '<img src="'.$rs['fengmian'].'" height="100">';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$typeid = $this->rock->post('typeid','0');
|
||||
//$key = $this->rock->post('key');
|
||||
if($typeid!='0'){
|
||||
$alltpeid = m('option')->getalldownid($typeid);
|
||||
$where .= ' and `typeid` in('.$alltpeid.')';
|
||||
}
|
||||
//弃用这个,去到表单表示元素管理开启搜索
|
||||
//if($key != '')$where.=" and (`title` like '%$key%' or `num` like '%$key%' or `usename` like '%$key%')";
|
||||
return array(
|
||||
'where' => $where,
|
||||
'orlikefields'=>'title,num,usename',
|
||||
'order' => 'optdt desc',
|
||||
//'fields'=> 'id,title,num,brand,optdt,usename,state,ckid'
|
||||
);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'typeid' => '电脑/台式电脑',
|
||||
'title' => '这是一个电脑啊',
|
||||
'num' => 'ZiCAN-001',
|
||||
'brand' => '联想',
|
||||
'laiyuan' => '购买',
|
||||
'buydt' => '2017-01-17',
|
||||
'explain' => '简单说明一下',
|
||||
'address' => '放哪里了',
|
||||
);
|
||||
}
|
||||
|
||||
//导入之前
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['typeid'] = $this->option->gettypeid('assetstype',$rs['typeid']);
|
||||
$rows[$k]['adddt'] = $this->rock->now;
|
||||
$rows[$k]['optdt'] = $this->rock->now;
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
50
webmain/model/flow/bianjianModel.php
Normal file
50
webmain/model/flow/bianjianModel.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//便笺
|
||||
class flow_bianjianClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
public function flowrsreplace($rs,$isv=0)
|
||||
{
|
||||
$statestr = '';
|
||||
$zt = $rs['state'];
|
||||
$rs['stateval'] = $zt;
|
||||
if($zt>0){
|
||||
if($zt=='2')$rs['trstyle']='font-weight:bold';
|
||||
if($zt=='1')$rs['ishui']='1';
|
||||
$ztrs = $this->getststrsssa($zt);
|
||||
if($ztrs)$statestr = '<font color="'.$ztrs['color'].'">'.$ztrs['name'].'</font>';
|
||||
}
|
||||
$rs['state'] = $statestr;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function getststrsssa($zt)
|
||||
{
|
||||
$rs = false;
|
||||
$arrs = $this->statedatashow();
|
||||
foreach($arrs as $k1=>$rv1){
|
||||
if($rv1['value']==$zt){
|
||||
$rs = $rv1;
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function statedatashow()
|
||||
{
|
||||
$arr[] = array('name'=>'无状态','value'=>'0','color'=>'');
|
||||
$arr[] = array('name'=>'等待完成','value'=>'2','color'=>'red');
|
||||
$arr[] = array('name'=>'已完成','value'=>'1','color'=>'green');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowbillwhere($uid, $lx)
|
||||
{
|
||||
//排序
|
||||
return array(
|
||||
//'order' => '`state` desc, `id` desc'
|
||||
'order' => '`suodt` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
57
webmain/model/flow/bookModel.php
Normal file
57
webmain/model/flow/bookModel.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
class flow_bookClassModel extends flowModel
|
||||
{
|
||||
public function flowrsreplace($rs,$isv=0)
|
||||
{
|
||||
if(isset($rs['typeid']))$rs['typeid'] = $this->db->getmou('[Q]option','name',"`id`='".$rs['typeid']."'");
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$typeid = $this->rock->post('typeid','0');
|
||||
$key = $this->rock->post('key');
|
||||
if($typeid!='0'){
|
||||
$where .= ' and `typeid`='.$typeid.'';
|
||||
}
|
||||
//if($key != '')$where.=" and (`title` like '%$key%' or `author` like '%$key%')";
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => 'optdt desc'
|
||||
);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'typeid' => '计算机/编程',
|
||||
'title' => 'PHP从入门到放弃',
|
||||
'num' => 'TS-003',
|
||||
'author' => '磐石',
|
||||
'chuban' => '信呼开发团队',
|
||||
'cbdt' => '2017-01-17',
|
||||
'price' => '49.9',
|
||||
'shul' => '5',
|
||||
'weizhi' => '不知道',
|
||||
'isbn' => 'PANSHI-001',
|
||||
);
|
||||
}
|
||||
|
||||
//导入之前
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$num = 'booktype';
|
||||
if(ISMORECOM && $cnum=$this->adminmodel->getcompanynum())$num.='_'.$cnum.'';
|
||||
foreach($rows as $k=>$rs){
|
||||
$rs['typeid'] = $this->option->gettypeid($num,$rs['typeid']);
|
||||
$inarr[] = $rs;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
19
webmain/model/flow/bookborrowModel.php
Normal file
19
webmain/model/flow/bookborrowModel.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* 模块.图书借阅
|
||||
*/
|
||||
class flow_bookborrowClassModel extends flowModel
|
||||
{
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$fte = '<font color=red>否</font>';
|
||||
$isgh= 0;
|
||||
if(!isempt($rs['ghtime'])){
|
||||
$fte = '<font color=green>是</font>';
|
||||
$isgh= 1;
|
||||
}
|
||||
if($rs['isgh'] != $isgh)$this->update('`isgh`='.$isgh.'', $rs['id']);
|
||||
$rs['isgh'] = $fte;
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
56
webmain/model/flow/caigouModel.php
Normal file
56
webmain/model/flow/caigouModel.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
class flow_caigouClassModel extends flowModel
|
||||
{
|
||||
public $minwidth = 600;//子表最小宽
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
//审核完成处理,要通知仓库管理员出入库
|
||||
protected function flowcheckfinsh($zt){
|
||||
/*
|
||||
m('goodss')->update('status='.$zt.'',"`mid`='$this->id'");
|
||||
$aid = '0';
|
||||
$rows = m('goodss')->getall("`mid`='$this->id'",'aid');
|
||||
foreach($rows as $k=>$rs)$aid.=','.$rs['aid'].'';
|
||||
m('goods')->setstock($aid);
|
||||
*/
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
//删除入库详情的
|
||||
m('goodss')->delete("`mid`='$this->id'");
|
||||
}
|
||||
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
$db = m('goods');
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $db->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1)$rows[$k]['aid'] = $name; //1展示时
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state']);
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
26
webmain/model/flow/carmModel.php
Normal file
26
webmain/model/flow/carmModel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
//车辆管理模块接口
|
||||
class flow_carmClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = c('array')->strtoarray('blue|办理中,green|可用,red|维修中,gray|报废');
|
||||
$this->publiarr = c('array')->strtoarray('gray|否,green|是');
|
||||
|
||||
$this->carms = m('carms');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
if(isset($this->statearr[$rs['state']])){
|
||||
$b = $this->statearr[$rs['state']];
|
||||
$rs['state'] = '<font color="'.$b[0].'">'.$b[1].'</font>';
|
||||
}
|
||||
$b = $this->publiarr[$rs['ispublic']];
|
||||
$rs['ispublic'] = '<font color="'.$b[0].'">'.$b[1].'</font>';
|
||||
$rs['djshu'] = $this->carms->rows('carid='.$rs['id'].'');
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
41
webmain/model/flow/carmbyModel.php
Normal file
41
webmain/model/flow/carmbyModel.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
//车辆保养
|
||||
class flow_carmbyClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
if(isset($rs['carnum'])){
|
||||
$ors = $rs;
|
||||
}else{
|
||||
$ors = m('carm')->getone($rs['carid']);
|
||||
}
|
||||
if($ors)$rs['carid'] = ''.$ors['carbrand'].','.$ors['carmode'].'('.$ors['carnum'].')';
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
//多个连表查询
|
||||
public function flowbillwhere($uid, $lx)
|
||||
{
|
||||
return array(
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]carm` b on a.carid=b.id left join `[Q]flow_bill` c on c.`table`=\''.$this->mtable.'\' and c.mid=a.id',
|
||||
'fields' => 'a.*,b.carnum,b.carbrand,b.carmode,cartype,c.uname as base_name,c.udeptname as base_deptname',
|
||||
'orlikefields' => 'b.carnum,b.carbrand,b.carmode,b.`cartype`,c.`udeptname`,c.`uname`,c.`sericnum`@1',
|
||||
'asqom' => 'a.'
|
||||
);
|
||||
}
|
||||
|
||||
//自定义审核人读取
|
||||
protected function flowcheckname($num){
|
||||
$sid = '';
|
||||
$sna = '';
|
||||
//驾驶员审核读取
|
||||
if($num=='jia'){
|
||||
$sid = $this->rs['jiaid'];
|
||||
$sna = $this->rs['jianame'];
|
||||
}
|
||||
return array($sid, $sna);
|
||||
}
|
||||
}
|
||||
46
webmain/model/flow/carmreseModel.php
Normal file
46
webmain/model/flow/carmreseModel.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class flow_carmreseClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
//$key = $this->rock->post('key');
|
||||
//$dt = $this->rock->post('dt');
|
||||
//if($key != '')$where.=" and (`carnum`='$key' or `usename` like '%$key%' or `optname` like '%$key%')";
|
||||
//if($dt != '')$where.=" and (`applydt`='$dt' or `startdt` like '$dt%')";
|
||||
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => 'optdt desc'
|
||||
);
|
||||
}
|
||||
|
||||
//自定义审核人读取
|
||||
protected function flowcheckname($num){
|
||||
$sid = '';
|
||||
$sna = '';
|
||||
//驾驶员审核读取
|
||||
if($num=='jias'){
|
||||
$sid = $this->rs['jiaid'];
|
||||
$sna = $this->rs['jianame'];
|
||||
}
|
||||
return array($sid, $sna);
|
||||
}
|
||||
|
||||
//可预定的车辆
|
||||
public function getcardata()
|
||||
{
|
||||
$where= $this->adminmodel->getcompanywhere(1);
|
||||
$rows = m('carm')->getall("`ispublic`=1 and `state`=1 ".$where."",'carnum as name,id as value');
|
||||
$arrs = $this->db->getrows('[Q]carmrese','`status`=1 group by carid','max(kmend)kmend,carid');
|
||||
$arrsa= array();
|
||||
foreach($arrs as $k=>$rs)$arrsa[$rs['carid']]=$rs['kmend'];
|
||||
//读取车辆最后公里数
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['kmstart'] = $this->rock->arrvalue($arrsa, $rs['value']);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
85
webmain/model/flow/carmsModel.php
Normal file
85
webmain/model/flow/carmsModel.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
//车辆信息登记
|
||||
class flow_carmsClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$ztname = '';
|
||||
if(!isempt($rs['enddt'])){
|
||||
$jg = c('date')->datediff('d', $this->rock->date, $rs['enddt']);
|
||||
if($jg<0){
|
||||
$ztname='<font color="#888888">已到期</font>';
|
||||
$rs['ishui'] = 1;
|
||||
}
|
||||
if($jg==0)$ztname='<font color="blue">今日到期</font>';
|
||||
if($jg>0 && $jg<30)$ztname='<font color="#ff6600">'.$jg.'天后到期</font>';
|
||||
if($jg>=30)$ztname='<font color="green">生效中</font>';
|
||||
}
|
||||
if(isset($rs['carnum'])){
|
||||
$ors = $rs;
|
||||
}else{
|
||||
$ors = m('carm')->getone($rs['carid']);
|
||||
}
|
||||
if($ors)$rs['carid'] = ''.$ors['carbrand'].','.$ors['carmode'].'('.$ors['carnum'].')';
|
||||
$rs['ztname'] = $ztname;
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$carid = (int)$this->rock->get('carid',0);
|
||||
if($carid>0)$where='and a.`carid`='.$carid.'';
|
||||
|
||||
return array(
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]carm` b on a.`carid`=b.id',
|
||||
'fields' => 'a.*,b.carnum,b.carbrand,b.carmode,cartype',
|
||||
'orlikefields' => 'b.carnum,b.carbrand,b.carmode,b.`cartype`,a.`otype`@1',
|
||||
'asqom' => 'a.',
|
||||
'where' => $where,
|
||||
);
|
||||
}
|
||||
|
||||
//每天信息提醒
|
||||
public function todocarms($toid)
|
||||
{
|
||||
if(isempt($toid))return '没设置提醒人员';
|
||||
$dt = $this->rock->date;
|
||||
$dt30 = c('date')->adddate($dt,'d', 30);
|
||||
$rows = $this->db->getall('select a.`enddt`,a.`otype`,b.`carnum` from `[Q]carms` a left join `[Q]carm` b on a.carid=b.id where b.id is not null and a.`enddt` is not null and a.`enddt`>=\''.$dt.'\'');
|
||||
$txlist = m('option')->getval('cartodo','0,3,7,15,30');
|
||||
$txarr = explode(',', $txlist);
|
||||
$dtobj = c('date');
|
||||
$cars = array();
|
||||
$str = '';
|
||||
foreach($rows as $k=>$rs){
|
||||
$jg = $dtobj->datediff('d', $dt, $rs['enddt']);
|
||||
if(in_array($jg, $txarr)){
|
||||
$strs = ''.$jg.'天后('.$rs['enddt'].')';
|
||||
if($jg==1)$strs='明天';
|
||||
if($jg==0)$strs='今天';
|
||||
$str .= ''.$rs['carnum'].'的['.$rs['otype'].']将在'.$strs.'到期;';
|
||||
}
|
||||
}
|
||||
|
||||
//下次保养提醒
|
||||
$rows = $this->db->getall('select a.`nextdt`,b.`carnum`,a.`jiaid`,a.`uid` from `[Q]carmang` a left join `[Q]carm` b on a.carid=b.id where b.id is not null and a.`type`=1 and a.`status`=1 and a.`nextdt` is not null and a.`nextdt`>=\''.$dt.'\'');
|
||||
|
||||
foreach($rows as $k=>$rs){
|
||||
$jg = $dtobj->datediff('d', $dt, $rs['nextdt']);
|
||||
if(in_array($jg, $txarr)){
|
||||
$strs = ''.$jg.'后('.$rs['nextdt'].')';
|
||||
if($jg==1)$strs='明天';
|
||||
if($jg==0)$strs='今天';
|
||||
$str .= ''.$rs['carnum'].'在'.$strs.'后需保养了;';
|
||||
}
|
||||
}
|
||||
if($str!=''){
|
||||
$this->push($toid, '车辆', $str, '车辆信息提醒');
|
||||
}
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
30
webmain/model/flow/carmwxModel.php
Normal file
30
webmain/model/flow/carmwxModel.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
//车辆维修
|
||||
class flow_carmwxClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
if(isset($rs['carnum'])){
|
||||
$ors = $rs;
|
||||
}else{
|
||||
$ors = m('carm')->getone($rs['carid']);
|
||||
}
|
||||
if($ors)$rs['carid'] = ''.$ors['carbrand'].','.$ors['carmode'].'('.$ors['carnum'].')';
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//多个连表查询
|
||||
public function flowbillwhere($uid, $lx)
|
||||
{
|
||||
return array(
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]carm` b on a.carid=b.id left join `[Q]flow_bill` c on c.`table`=\''.$this->mtable.'\' and c.mid=a.id',
|
||||
'fields' => 'a.*,b.carnum,b.carbrand,b.carmode,cartype,c.uname as base_name,c.udeptname as base_deptname',
|
||||
'orlikefields' => 'b.carnum,b.carbrand,b.carmode,b.`cartype`,c.`udeptname`,c.`uname`,c.`sericnum`@1',
|
||||
'asqom' => 'a.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
43
webmain/model/flow/companyModel.php
Normal file
43
webmain/model/flow/companyModel.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 单位管理
|
||||
*/
|
||||
class flow_companyClassModel extends flowModel
|
||||
{
|
||||
public $flowcompanyidfieds = 'none';
|
||||
public $baseall = array();
|
||||
|
||||
public function flowdeletebillbefore()
|
||||
{
|
||||
if($this->rows('pid='.$this->id.'')>0)return '有下级不允许删除';
|
||||
}
|
||||
|
||||
|
||||
public function getallbase()
|
||||
{
|
||||
if($this->baseall)return $this->baseall;
|
||||
$rows = $this->db->getall('show DATABASES');
|
||||
foreach($rows as $k=>$rs){
|
||||
$this->baseall[] = $rs['Database'];
|
||||
}
|
||||
return $this->baseall;
|
||||
}
|
||||
|
||||
//替换
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$iscreate = 0;
|
||||
if(!isempt($rs['num'])){
|
||||
$base = ''.DB_BASE.'_company_'.$rs['num'].'';
|
||||
$arr = $this->getallbase();
|
||||
if(in_array($base, $arr))$iscreate = 1;
|
||||
}
|
||||
if(isset($rs['iscreate']) && $iscreate!=$rs['iscreate'])$this->update('`iscreate`='.$iscreate.'', $rs['id']);
|
||||
$rs['iscreate'] = $iscreate;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function testabc()
|
||||
{
|
||||
}
|
||||
}
|
||||
15
webmain/model/flow/custappyModel.php
Normal file
15
webmain/model/flow/custappyModel.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
//客户申请使用
|
||||
class flow_custappyClassModel extends flowModel
|
||||
{
|
||||
//流程全部完成后调用
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1){
|
||||
m('customer')->update(array(
|
||||
'isgh' => 0,
|
||||
'uid' => $this->uid
|
||||
),$this->rs['custid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
webmain/model/flow/custfinaModel.php
Normal file
49
webmain/model/flow/custfinaModel.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
//客户收付款单
|
||||
class flow_custfinaClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function initModel(){
|
||||
$this->statearrs = c('array')->strtoarray('未收款|red,已收款|green');
|
||||
$this->statearrf = c('array')->strtoarray('未付款|red,已付款|green');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$starrr = array('收','付');
|
||||
$rs['paystatus'] = $rs['ispay'];
|
||||
$ispay = '<font color=red>未'.$starrr[$rs['type']].'款</font>';
|
||||
if($rs['ispay']==1)$ispay = '<font color=green>已'.$starrr[$rs['type']].'款</font>';
|
||||
$rs['ispay'] = $ispay;
|
||||
$rs['type'] = ''.$starrr[$rs['type']].'款单';
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//操作菜单操作
|
||||
protected function flowoptmenu($ors, $arr)
|
||||
{
|
||||
//标识已付款处理
|
||||
if($ors['num']=='pay'){
|
||||
$ispay = 0;
|
||||
$paydt = arrvalue($arr,'fields_paydt', $this->rock->now);
|
||||
if(!isempt($paydt))$ispay = 1;
|
||||
$this->update("`ispay`='$ispay',`paydt`='$paydt'", $this->id);
|
||||
m('crm')->ractmoney($this->rs['htid']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `dt` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => '`optdt` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
49
webmain/model/flow/custfinbModel.php
Normal file
49
webmain/model/flow/custfinbModel.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
//客户收付款单
|
||||
class flow_custfinbClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function initModel(){
|
||||
$this->statearrs = c('array')->strtoarray('未收款|red,已收款|green');
|
||||
$this->statearrf = c('array')->strtoarray('未付款|red,已付款|green');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$starrr = array('收','付');
|
||||
$rs['paystatus'] = $rs['ispay'];
|
||||
$ispay = '<font color=red>未'.$starrr[$rs['type']].'款</font>';
|
||||
if($rs['ispay']==1)$ispay = '<font color=green>已'.$starrr[$rs['type']].'款</font>';
|
||||
$rs['ispay'] = $ispay;
|
||||
$rs['type'] = ''.$starrr[$rs['type']].'款单';
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//操作菜单操作
|
||||
protected function flowoptmenu($ors, $arr)
|
||||
{
|
||||
//标识已付款处理
|
||||
if($ors['num']=='pay'){
|
||||
$ispay = 0;
|
||||
$paydt = arrvalue($arr,'fields_paydt', $this->rock->now);
|
||||
if(!isempt($paydt))$ispay = 1;
|
||||
$this->update("`ispay`='$ispay',`paydt`='$paydt'", $this->id);
|
||||
m('crm')->ractmoney($this->rs['htid']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `dt` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => '`optdt` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
256
webmain/model/flow/customerModel.php
Normal file
256
webmain/model/flow/customerModel.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
class flow_customerClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = c('array')->strtoarray('停用|#888888,启用|green');
|
||||
$this->statarr = c('array')->strtoarray('否|#888888,是|#ff6600');
|
||||
}
|
||||
|
||||
//高级搜索下
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'所属人...','fields'=>'uid');
|
||||
$arr[] = array('name'=>'创建人...','fields'=>'createid');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if(isset($rs['status'])){
|
||||
if($rs['status']==0)$rs['ishui'] = 1;
|
||||
$zt = $this->statearr[$rs['status']];
|
||||
$rs['statuss'] = $rs['status'];
|
||||
$rs['status'] = '<font color="'.$zt[1].'">'.$zt[0].'</font>';
|
||||
}
|
||||
|
||||
if(isset($rs['isstat'])){
|
||||
$stat = $this->statarr[$rs['isstat']];
|
||||
$rs['isstat'] = '<font color="'.$stat[1].'">'.$stat[0].'</font>';
|
||||
}
|
||||
|
||||
if(isset($rs['isgys'])){
|
||||
$gys = $this->statarr[$rs['isgys']];
|
||||
$rs['isgys'] = '<font color="'.$gys[1].'">'.$gys[0].'</font>';
|
||||
}
|
||||
if($this->rock->arrvalue($rs,'htshu','0')==0)$rs['htshu']='';
|
||||
if($this->rock->arrvalue($rs,'moneyz','0')==0)$rs['moneyz']='';
|
||||
if($this->rock->arrvalue($rs,'moneyd','0')==0)$rs['moneyd']='';
|
||||
|
||||
if($lx==1){
|
||||
//$rs['suoname'] = $this->adminmodel->getmou('name','id='.$rs['uid'].'');
|
||||
|
||||
}
|
||||
|
||||
//详情时,移动端
|
||||
if($lx==1 && $this->rock->ismobile()){
|
||||
if(!isempt($rs['mobile']))$rs['mobile']='<a onclick="return callPhone(this)" href="tel:'.$rs['mobile'].'">'.$rs['mobile'].'</a>';
|
||||
if(!isempt($rs['tel']))$rs['tel']='<a onclick="return callPhone(this)" href="tel:'.$rs['tel'].'">'.$rs['tel'].'</a>';
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//是否有查看权限
|
||||
protected function flowisreadqx()
|
||||
{
|
||||
$bo = false;
|
||||
$shateid = ','.$this->rs['shateid'].',';
|
||||
if(contain($shateid,','.$this->adminid.','))$bo=true;
|
||||
return $bo;
|
||||
}
|
||||
|
||||
protected function flowgetfields_qiyong($lx)
|
||||
{
|
||||
$arr = array();
|
||||
if($this->uid==$this->adminid){
|
||||
$arr['mobile'] = '手机号';
|
||||
$arr['tel'] = '电话';
|
||||
$arr['email'] = '邮箱';
|
||||
$arr['routeline'] = '交通路线';
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
$zt = $ors['statusvalue'];
|
||||
$num = $ors['num'];
|
||||
if($num=='ztqh'){
|
||||
$this->update('`status`='.$zt.'', $this->id);
|
||||
}
|
||||
|
||||
//共享
|
||||
if($num=='shate'){
|
||||
$cname = $crs['cname'];
|
||||
$cnameid = $crs['cnameid'];
|
||||
$this->update(array(
|
||||
'shateid' => $cnameid,
|
||||
'shate' => $cname,
|
||||
), $this->id);
|
||||
$this->push($cnameid, '客户管理', ''.$this->adminname.'将一个客户【{name}】共享给你');
|
||||
}
|
||||
|
||||
//取消共享
|
||||
if($num=='unshate'){
|
||||
$this->update(array(
|
||||
'shateid' => '',
|
||||
'shate' => '',
|
||||
), $this->id);
|
||||
}
|
||||
|
||||
//放入公海
|
||||
if($num=='ghnoup'){
|
||||
$this->update(array(
|
||||
'isgh' => '1',
|
||||
'uid' => 0,
|
||||
'suoname'=>''
|
||||
), $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
return array(
|
||||
'order' => '`status` desc,`optdt` desc',
|
||||
//'table' => '`[Q]'.$this->mtable.'` a left join `[Q]admin` b on a.`uid`=b.id',
|
||||
//'asqom' => 'a.',
|
||||
//'fields'=> 'a.*,b.name as suoname'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr = array(
|
||||
'name' => '信呼',
|
||||
'type' => '软件',
|
||||
'laiyuan' => '网上开拓',
|
||||
'unitname' => '厦门信呼科技有限公司',
|
||||
'tel' => '0592-123456',
|
||||
'mobile' => '15800000000',
|
||||
'email' => 'admin@rockoa.com',
|
||||
'address' => '福建厦门思明区软件园',
|
||||
'linkname' => '磐石',
|
||||
'isgh' => '是',
|
||||
);
|
||||
$barr1 = array(
|
||||
'name' => '百度',
|
||||
'type' => '搜索计算',
|
||||
'laiyuan' => '电话联系',
|
||||
'unitname' => '百度在线网络技术(北京)有限公司',
|
||||
'tel' => '010-123456',
|
||||
'mobile' => '15800000001',
|
||||
'email' => 'admin@baidu.com',
|
||||
'address' => '北京软件园百度大厦',
|
||||
'linkname' => '李彦宏',
|
||||
'isgh' => '否',
|
||||
);
|
||||
$barr2 = array(
|
||||
'name' => '陈先生',
|
||||
'type' => '个人',
|
||||
'laiyuan' => '电话联系',
|
||||
'unitname' => '',
|
||||
'tel' => '010-123456',
|
||||
'mobile' => '15800000002',
|
||||
'email' => '1111@qq.com',
|
||||
'address' => '福建厦门火车站',
|
||||
'linkname' => '',
|
||||
'isgh' => '否',
|
||||
);
|
||||
return array($barr,$barr1,$barr2);
|
||||
}
|
||||
|
||||
public function flowdaorubefore($data)
|
||||
{
|
||||
$arr = array();
|
||||
$dbs = m('admin');
|
||||
foreach($data as $k=>$rs){
|
||||
$isgh = (arrvalue($rs,'isgh')=='是') ? 1: 0 ;
|
||||
$isstat = (arrvalue($rs,'isstat')=='是') ? 1: 0 ;
|
||||
if(isset($rs['status'])){
|
||||
$rs['status'] = (arrvalue($rs,'status')=='启用') ? 1: 0 ;
|
||||
}
|
||||
if(isset($rs['suoname'])){
|
||||
if($isgh==0){
|
||||
$urs = $dbs->geturs('name:'.$rs['suoname']);
|
||||
if($urs)$rs['uid'] = $urs['id'];
|
||||
}
|
||||
//unset($rs['suoname']);
|
||||
}
|
||||
$rs['isgh'] = $isgh;
|
||||
$rs['isstat'] = $isstat;
|
||||
if($isgh==1)$rs['uid'] = 0;
|
||||
|
||||
$arr[] = $rs;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自动放入公海
|
||||
*/
|
||||
public function addgonghai()
|
||||
{
|
||||
$tshu = (int)$this->option->getval('crmaddghai','0');
|
||||
if($tshu<=0)return;
|
||||
$sneuar = array();
|
||||
|
||||
$rows = $this->getall('`uid`>0 and `htshu`=0 and `isgys`=0 and `id` not in(select `custid` from `[Q]custsale` where `state` in(1)) and `id` not in(select `custid` from `[Q]goodm` where `type`=2 and `status` in(0,1))','lastdt,optdt,id,name,uid,unitname');
|
||||
$dtobj = c('date');
|
||||
$addghs = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$lastdt = $rs['lastdt'];
|
||||
if(isempt($lastdt))$lastdt = $rs['optdt'];
|
||||
$jg = $dtobj->datediff('d', $lastdt, $this->rock->now);
|
||||
|
||||
if($jg > $tshu){
|
||||
$sneuar[$rs['uid']][] = '['.$rs['name'].']超'.$jg.'天未跟进已放入公海库';
|
||||
$addghs[] = $rs['id'];
|
||||
}else{
|
||||
//要放入之前2天提醒
|
||||
$ts = $tshu - $jg;
|
||||
if($ts<3)$sneuar[$rs['uid']][] = '['.$rs['name'].']将'.$ts.'天后放入公海库';
|
||||
}
|
||||
}
|
||||
|
||||
//通知给对应人
|
||||
$maxlen = 5;
|
||||
foreach($sneuar as $uid=>$ursa){
|
||||
$str = '';
|
||||
foreach($ursa as $k1=>$s1){
|
||||
if($str!='')$str.="\n";
|
||||
if($k1>=$maxlen){
|
||||
$str.='还有'.(count($ursa)-$maxlen).'条,点击查看更多';
|
||||
break;
|
||||
}
|
||||
$str.="".$s1."";
|
||||
}
|
||||
$this->pushs($uid, $str, '客户未跟进提醒', array(
|
||||
'wxurl' => $this->getwxurl()
|
||||
));
|
||||
}
|
||||
if($addghs){
|
||||
$sid = join(',', $addghs);
|
||||
$this->update("`uid`=0,`isgh`=1", "`id` in($sid)");
|
||||
}
|
||||
}
|
||||
|
||||
//对外的详情页
|
||||
public function flowopenxiang($da, $xiangdata)
|
||||
{
|
||||
$zdarr = array('name','type','laiyuan','unitname','tel','mobile','sheng','shi','address','routeline','shibieid','openbank','cardid','explain','linkname');
|
||||
$slsts = array();
|
||||
foreach($xiangdata as $k=>$rs){
|
||||
if(in_array($rs['fields'], $zdarr)){
|
||||
$slsts[] = $rs;
|
||||
}
|
||||
}
|
||||
return array('xiangdata'=>$slsts,'modename'=>'客户详情');
|
||||
}
|
||||
}
|
||||
36
webmain/model/flow/custplanModel.php
Normal file
36
webmain/model/flow/custplanModel.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
class flow_custplanClassModel extends flowModel
|
||||
{
|
||||
|
||||
//替换
|
||||
public function flowrsreplace($rs, $slx=0){
|
||||
|
||||
$zts = $rs['status'];
|
||||
$str = $this->getstatus($rs,'','',1);
|
||||
|
||||
$rs['statusval']= $zts;
|
||||
$rs['status'] = $str;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
//计划跟进提醒(一条提醒一次)
|
||||
public function plantodo()
|
||||
{
|
||||
$date = $this->rock->date;
|
||||
$rows = $this->getall("`status`=0 and `plandt` like '".$date."%'");
|
||||
foreach($rows as $k=>$rs){
|
||||
$this->id = $rs['id'];
|
||||
$this->pushs($rs['uid'], '客户“'.$rs['custname'].'”需要在'.$rs['plandt'].'用“'.$rs['gentype'].'”跟进');
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
if($ors['num']=='bywc'){
|
||||
$findt = arrvalue($this->rs, 'findt', $this->rock->now);
|
||||
m('customer')->update("`lastdt`='{$findt}'", $this->rs['custid']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
162
webmain/model/flow/custractModel.php
Normal file
162
webmain/model/flow/custractModel.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
class flow_custractClassModel extends flowModel
|
||||
{
|
||||
public function initModel(){
|
||||
$this->typearr = array('收款合同','付款合同');
|
||||
$this->typesarr = array('收','付');
|
||||
$this->statearr = c('array')->strtoarray('待生效|blue,生效中|green,已过期|#888888');
|
||||
$this->dtobj = c('date');
|
||||
$this->crmobj = m('crm');
|
||||
$this->goodmobj = m('goodm');
|
||||
|
||||
$this->wherejoin['custfina'] = 'htid';
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
m('goodm')->update('`custractid`=0', "`custractid`='".$this->id."'");//销售单取消关联合同
|
||||
|
||||
|
||||
|
||||
$xiaoid = (int)arrvalue($this->rs,'xiaoid','0');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0){
|
||||
$type = $rs['type'];
|
||||
$rs['type'] = $this->typearr[$type];
|
||||
$statetext = '';
|
||||
$dt = $this->rock->date;
|
||||
$htstatus = 0;
|
||||
if($rs['startdt']>$dt){
|
||||
$statetext='待生效';
|
||||
}else if($rs['startdt']<=$dt && $rs['enddt']>=$dt){
|
||||
$jg = $this->dtobj->datediff('d', $dt, $rs['enddt']);
|
||||
$statetext='<font color=green>生效中</font><br><font color=#888888>'.$jg.'天过期</font>';
|
||||
if($jg==0)$statetext='<font color=green>今日到期</font>';
|
||||
$htstatus = 1;
|
||||
}else if($rs['enddt']<$dt){
|
||||
$statetext='<font color=#888888>已过期</font>';
|
||||
$rs['ishui'] = 1;
|
||||
$htstatus = 2;
|
||||
}
|
||||
$rs['statetext'] = $statetext;
|
||||
$nrss = $this->crmobj->ractmoney($rs);
|
||||
$ispay = $nrss[0];
|
||||
$moneys = $nrss[1];
|
||||
$dsmoney = '';
|
||||
$ts = $this->typesarr[$type];
|
||||
if($ispay==1){
|
||||
$dsmoney = '<font color=green>已全部'.$ts.'款</font>';
|
||||
}else{
|
||||
$dsmoney = '待'.$ts.'<font color=#ff6600>'.$moneys.'</font>';
|
||||
}
|
||||
if(isset($rs['xiaoid']) && $rs['xiaoid']>0){
|
||||
$xiaors = $this->goodmobj->getone("`id`='".$rs['xiaoid']."' and `status`<>5");
|
||||
if($xiaors){
|
||||
if($lx==1){
|
||||
$dsmoney.=',销售单:<a href="'.$this->getxiangurl('custxiao',$rs['xiaoid'],'auto').'">'.$xiaors['num'].'</a>';
|
||||
}else{
|
||||
$dsmoney.=',销售单:<br>'.$xiaors['num'].'';
|
||||
}
|
||||
}else{
|
||||
$this->update('`xiaoid`=0', $rs['id']);
|
||||
}
|
||||
}
|
||||
$rs['moneys'] = $dsmoney;
|
||||
$rs['htstatus'] = $htstatus;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
$month = $this->rock->post('dt');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where =" and `signdt` like '$month%'";
|
||||
}
|
||||
|
||||
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => '`optdt` desc',
|
||||
//'orlikefields' => 'custname'
|
||||
);
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $arrs)
|
||||
{
|
||||
//创建待收付款单
|
||||
if($ors['num']=='cjdaishou'){
|
||||
$moneys = m('crm')->getmoneys($this->rs['id']);
|
||||
$money = $this->rs['money'] - $moneys;
|
||||
if($money > 0){
|
||||
$arr['htid'] = $this->rs['id'];
|
||||
$arr['htnum'] = $this->rs['num'];
|
||||
$arr['uid'] = $this->rs['uid'];
|
||||
$arr['custid'] = $this->rs['custid'];
|
||||
$arr['custname']= $this->rs['custname'];
|
||||
$arr['dt'] = $this->rock->date;
|
||||
$arr['optdt'] = $this->rock->now;
|
||||
$arr['createdt']= $this->rock->now;
|
||||
$arr['optname'] = $this->adminname;
|
||||
$arr['createname']= $this->adminname;
|
||||
$arr['createid'] = $this->adminid;
|
||||
//$arr['optid'] = $this->adminid;
|
||||
$arr['type'] = $this->rs['type'];
|
||||
$arr['explain'] = $arrs['sm'];
|
||||
$arr['money'] = $money;
|
||||
m('custfina')->insert($arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户合同到期提醒
|
||||
*/
|
||||
public function custractdaoqi()
|
||||
{
|
||||
$dt = $this->rock->date;
|
||||
$rows = $this->getall("status=1 and `enddt` is not null and `enddt`>='$dt'",'uid,num,custname,enddt','`uid`');
|
||||
$txlist = m('option')->getval('crmtodo','0,3,7,15,30');//提醒的时间
|
||||
$txarr = explode(',', $txlist);
|
||||
$dtobj = c('date');
|
||||
$txrows = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$jg = $dtobj->datediff('d', $dt, $rs['enddt']);
|
||||
$uid= $rs['uid'];
|
||||
if(in_array($jg, $txarr)){
|
||||
$strs = ''.$jg.'天后('.$rs['enddt'].')';
|
||||
if($jg==1)$strs='明天';
|
||||
if($jg==0)$strs='今天';
|
||||
if(!isset($txrows[$uid]))$txrows[$uid]='';
|
||||
$txrows[$uid] .= '客户['.$rs['custname'].']的[合同:'.$rs['num'].']将在'.$strs.'到期;';
|
||||
}
|
||||
}
|
||||
foreach($txrows as $uid=>$cont){
|
||||
$this->push($uid, '客户,CRM', $cont, '客户合同到期提醒');
|
||||
}
|
||||
}
|
||||
|
||||
//对外的详情页
|
||||
public function flowopenxiang($da, $xiangdata)
|
||||
{
|
||||
$zdarr = array('num','custname','type','fenlei','signdt','money','startdt','enddt','explain');
|
||||
$slsts = array();
|
||||
foreach($xiangdata as $k=>$rs){
|
||||
if(in_array($rs['fields'], $zdarr)){
|
||||
$slsts[] = $rs;
|
||||
}
|
||||
}
|
||||
//相关文件
|
||||
$filedata = array();
|
||||
$htfileid = arrvalue($da,'htfileid');
|
||||
if($htfileid){
|
||||
$filedata = m('file')->getall('id in('.$htfileid.')','id,filename,filesizecn,fileext');
|
||||
}
|
||||
return array('xiangdata'=>$slsts,'filedata'=>$filedata);
|
||||
}
|
||||
}
|
||||
55
webmain/model/flow/custsaleModel.php
Normal file
55
webmain/model/flow/custsaleModel.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class flow_custsaleClassModel extends flowModel
|
||||
{
|
||||
public function initModel(){
|
||||
$this->statearr = c('array')->strtoarray('跟进中|blue,已成交|green,已丢失|#888888,暂缓|#ff6600');
|
||||
}
|
||||
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$zt = $this->statearr[$rs['state']];
|
||||
$rs['statess'] = $rs['state'];
|
||||
$rs['state'] = '<font color="'.$zt[1].'">'.$zt[0].'</font>';
|
||||
if($rs['htid']>0)$rs['state'].=',<font color=#888888>并建立合同</font>';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
m('crm')->update('`lastdt`=now()', $this->rs['custid']);
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
$zt = $ors['statusvalue'];
|
||||
$num = $ors['num'];
|
||||
if($num=='ztqh'){
|
||||
$sarr['state'] = $zt;
|
||||
if($zt==1)$sarr['dealdt'] = $this->rock->now;
|
||||
$this->update($sarr, $this->id);
|
||||
}
|
||||
|
||||
if($num=='zhuan'){
|
||||
$cname = $crs['cname'];
|
||||
$cnameid = $crs['cnameid'];
|
||||
$this->update(array(
|
||||
'uid' => $cnameid,
|
||||
'optname' => $cname
|
||||
), $this->id);
|
||||
$this->push($cnameid, '客户销售', ''.$this->adminname.'将一个客户【{custname}】的一个销售单转移给你');
|
||||
}
|
||||
|
||||
if($num=='genjin' || $num=='ztqh'){
|
||||
m('crm')->update('`lastdt`=now()', $this->rs['custid']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
return array(
|
||||
'order' => '`state`,`optdt` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
112
webmain/model/flow/custxiaoModel.php
Normal file
112
webmain/model/flow/custxiaoModel.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
class flow_custxiaoClassModel extends flowModel
|
||||
{
|
||||
public $minwidth = 600;//子表最小宽
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
$this->custractobj = m('custract');
|
||||
$this->crmobj = m('crm');
|
||||
}
|
||||
|
||||
public function flowxiangfields(&$fields)
|
||||
{
|
||||
$fields['base_name'] = '销售人';
|
||||
$fields['base_deptname'] = '销售人部门';
|
||||
$fields['base_sericnum'] = '销售单号';
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'销售人...','fields'=>'uid');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
$num = $this->sericnum;
|
||||
$this->update(array('num'=>$num),$this->id);
|
||||
m('custfina')->update("`htnum`='$num'", "`htid`='-".$this->id."'");
|
||||
}
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
$db = m('goods');
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $db->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1)$rows[$k]['aid'] = $name; //1展示时
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
$this->custractobj->update('`xiaoid`=0', "`xiaoid`='".$this->id."'");//合同取消关联销售单
|
||||
|
||||
$this->update('`custractid`=0', $this->id);//取消关联合同
|
||||
|
||||
//删除关联收付款单
|
||||
$this->deletebilljoin('custfina',"`htid`='-".$this->id."'", $sm);
|
||||
|
||||
//删除出库详情的
|
||||
m('goodss')->delete("`mid`='$this->id'");
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state'],1);
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
|
||||
$custractid = (int)$rs['custractid'];
|
||||
|
||||
//读取收款状态
|
||||
$dsmoney = '';
|
||||
if($custractid>0){
|
||||
|
||||
//从合同那读取
|
||||
$htrs = $this->custractobj->getone('`id`='.$custractid.' and `status`<>5');
|
||||
if($htrs){
|
||||
$custractid = $htrs['num'];//读取合同编号
|
||||
if($lx==1)$custractid = '<a href="'.$this->getxiangurl('custract',$rs['custractid'],'auto').'">'.$custractid.'</a>';
|
||||
|
||||
$nrss = $this->crmobj->ractmoney($htrs);
|
||||
$ispay = $nrss[0];
|
||||
$moneys = $nrss[1];
|
||||
|
||||
if($ispay==1){
|
||||
$dsmoney = '<font color=green>已全部收款</font>';
|
||||
}else{
|
||||
$dsmoney = '待收<font color=#ff6600>'.$moneys.'</font>';
|
||||
}
|
||||
|
||||
}else{
|
||||
$custractid = 0;//不存在
|
||||
$this->update('`custractid`='.$custractid.'', $rs['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($custractid===0){
|
||||
$custractid = '<font color=#aaaaaa>无关联</a>';
|
||||
$dsmoney = $this->crmobj->xiaozhuantai($rs);
|
||||
}
|
||||
$rs['custractid'] = $custractid;
|
||||
$rs['shoukuzt'] = $dsmoney;
|
||||
|
||||
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
32
webmain/model/flow/daibanModel.php
Normal file
32
webmain/model/flow/daibanModel.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
class flow_daibanClassModel extends flowModel
|
||||
{
|
||||
|
||||
/**
|
||||
* 每天流程待办提醒
|
||||
*/
|
||||
public function tododay()
|
||||
{
|
||||
$arr = array();
|
||||
$rows = $this->getrows('`status` not in(1,2) and `isturn`=1 and `isdel`=0 and `nowcheckid` is not null','`nowcheckid`,`modename`');
|
||||
foreach($rows as $k=>$rs){
|
||||
$dista = explode(',', $rs['nowcheckid']);
|
||||
foreach($dista as $distid){
|
||||
if(!isset($arr[$distid]))$arr[$distid] = array();
|
||||
if(!isset($arr[$distid][$rs['modename']]))$arr[$distid][$rs['modename']] = 0;
|
||||
$arr[$distid][$rs['modename']]++;
|
||||
}
|
||||
}
|
||||
foreach($arr as $uid => $strarr){
|
||||
$this->flowweixinarr['url'] = $this->getwxurl();//设置微信提醒的详情链接
|
||||
$str = '';
|
||||
$k = 0;
|
||||
foreach($strarr as $mod=>$sl){
|
||||
$k++;
|
||||
if($k>1)$str.="\n";
|
||||
$str.="".$k.".$mod(".$sl."条);";
|
||||
}
|
||||
if($str != '')$this->push($uid, '', $str, '流程待办处理');
|
||||
}
|
||||
}
|
||||
}
|
||||
297
webmain/model/flow/dailyModel.php
Normal file
297
webmain/model/flow/dailyModel.php
Normal file
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
class flow_dailyClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->typearr = explode(',','日报,周报,月报,年报');
|
||||
$this->logobj = m('log');
|
||||
}
|
||||
|
||||
protected function flowchangedata()
|
||||
{
|
||||
$this->rs['typess'] = $this->typearr[$this->rs['type']];
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($rs['mark']=='0')$rs['mark'] = '';
|
||||
$cfrom = $this->rock->get('cfrom');
|
||||
if($lx==2){
|
||||
if($cfrom!='mweb'){
|
||||
if(isset($rs['optdt']))$rs['optdt'] = str_replace(' ','<br>', $rs['optdt']);
|
||||
if(isset($rs['adddt']))$rs['adddt'] = str_replace(' ','<br>', $rs['adddt']);
|
||||
}
|
||||
|
||||
$zt = $this->logobj->isread('daily', $rs['id'], $this->adminid);
|
||||
|
||||
if($zt>0)$rs['ishui'] = 1;
|
||||
|
||||
|
||||
$dt = $rs['dt'];
|
||||
if($rs['type']!=0 && !isempt($rs['enddt']) && $cfrom!='mweb'){
|
||||
$dt.='<br><font color="#aaaaaa">'.$rs['enddt'].'</font>';
|
||||
}
|
||||
$rs['dt'] = $dt;
|
||||
}
|
||||
$this->replacepbr($rs, 'content');
|
||||
$rs['type'] = $this->typearr[$rs['type']];
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//提交保存完日报通知上级
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
$uparr = m('admin')->getsuperman($this->uid);
|
||||
$recid = arrvalue($uparr, 0);
|
||||
if(!$recid || $recid==0)return;
|
||||
$typea = $this->typearr[$this->rs['type']];
|
||||
$title = ''.$this->rs['optname'].'的'.$typea.'';
|
||||
$cont = c('html')->substrstr($this->rs['content'],0, 100);
|
||||
$this->push($recid, '', "".$typea."日期:{dt}\n".$cont, $title);
|
||||
}
|
||||
|
||||
protected function flowaddlog($a)
|
||||
{
|
||||
if($a['name'] == '日报评分'){
|
||||
$fenshu = (int)$this->rock->post('fenshu','0');
|
||||
$this->push($this->rs['uid'], '', ''.$this->adminname.'评分你[{dt}]的{typess},分数('.$fenshu.')',''.$this->modename.'评分');
|
||||
$this->update(array(
|
||||
'mark' => $fenshu
|
||||
), $this->id);
|
||||
}
|
||||
if($a['name'] == '点评'){
|
||||
$this->nexttodo($this->uid, 'pinglun', $a['explain'], '点评');
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$ispingfen = 0;
|
||||
$barr = m('admin')->getsuperman($this->uid); //获取我的上级主管
|
||||
if($barr){
|
||||
$hes = $barr[0];
|
||||
if(contain(','.$hes.',',','.$this->adminid.','))$ispingfen = 1; //是否可以评分
|
||||
}
|
||||
$arr['ispingfen'] = $ispingfen;
|
||||
$arr['mark'] = $this->rs['mark'];
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function flowgetoptmenu($opt)
|
||||
{
|
||||
//if($this->uid==$this->adminid)return false;
|
||||
$to = m('log')->isread($this->mtable, $this->id);
|
||||
return $to<=0;
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
$table = $this->mtable;
|
||||
$mid = $this->id;
|
||||
$uid = $this->adminid;
|
||||
$lx = $ors['num'];
|
||||
$log = m('log');
|
||||
if($lx=='yd'){
|
||||
$log->addread($table, $mid, $uid);
|
||||
}
|
||||
if($lx=='allyd'){
|
||||
$ydid = $log->getread($table, $uid);
|
||||
$where = m('view')->viewwhere($this->modeid, $uid);
|
||||
$where = "((1=1 $where) or (`uid`='$uid') )";
|
||||
$where = "`id` not in($ydid) and $where";
|
||||
|
||||
$rows = m($table)->getrows($where,'id');
|
||||
foreach($rows as $k=>$rs)$log->addread($table, $rs['id'], $uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function flowprintrows($rows)
|
||||
{
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['plan_style'] = 'text-align:left';
|
||||
$rows[$k]['content'] = str_replace("\n",'<br>', $rs['content']);
|
||||
$rows[$k]['plan'] = str_replace("\n",'<br>', $rs['plan']);
|
||||
$rows[$k]['type'] = $this->typearr[$rs['type']];
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//条件过滤已从流程模块条件下设置
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$type = $this->rock->post('type');
|
||||
$key = $this->rock->post('key');
|
||||
$dt = $this->rock->post('dt');
|
||||
$where = '';
|
||||
$keywhere = '';
|
||||
|
||||
|
||||
if(!isempt($type))$where.=" and a.`type`='$type'";
|
||||
if(!isempt($dt))$where.=" and a.`dt` like '$dt%'";
|
||||
|
||||
if(!isempt($key))$keywhere=m('admin')->getkeywhere($key, 'b.', "or a.`content` like '%$key%'");
|
||||
|
||||
return array(
|
||||
'table' => '`[Q]daily` a left join `[Q]admin` b on a.`uid`=b.`id`',
|
||||
'fields'=> 'a.*,b.`name`,b.`deptname`',
|
||||
'where' => $where,
|
||||
'keywhere' => $keywhere,
|
||||
'asqom' => 'a.', //主表别名
|
||||
'order' => 'a.`optdt` desc'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日报分析
|
||||
*/
|
||||
public function dailyanay($uid=0, $month='')
|
||||
{
|
||||
$dto = c('date');
|
||||
if($month=='')$month = $this->rock->date;
|
||||
$mon = substr($month,0, 7);
|
||||
$start = $mon.'-01';
|
||||
$enddt = $dto->getenddt($mon);
|
||||
$jg = $dto->getmaxdt($start);
|
||||
$dtarr = $dailydt = $leavedt = $zhoubdt = array();
|
||||
for($i=1; $i<=$jg; $i++){
|
||||
$oi = ''.$i.'';
|
||||
if($i<10)$oi= '0'.$i.'';
|
||||
$dt = $mon.'-'.$oi.'';
|
||||
if($dt>=$this->rock->date)break;
|
||||
$dtarr[] = array($dt, strtotime($dt));
|
||||
}
|
||||
$kql = m('kaoqin');
|
||||
$dbfx = m('dailyfx');
|
||||
$where = m('admin')->monthuwheres($start, $enddt);
|
||||
if($uid!=0)$where="and `id`='$uid'";
|
||||
$urows = m('userinfo')->getall("1=1 $where", 'id,name,workdate,quitdt,isdaily');
|
||||
|
||||
//日报
|
||||
$dailya = $this->getall("`type`=0 and `dt` like '$mon%' group by `uid`,`dt`",'`uid`,`dt`');
|
||||
foreach($dailya as $k=>$rs){
|
||||
$dailydt['a'.$rs['uid'].'_'.$rs['dt'].''] = 1;
|
||||
}
|
||||
|
||||
//周报
|
||||
$dailya = $this->getall("`type`=1 and `adddt` like '$mon%'",'`uid`,`adddt`');
|
||||
foreach($dailya as $k=>$rs){
|
||||
$zhoubdt['a'.$rs['uid'].'_'.substr($rs['adddt'],0,10).''] = 1;
|
||||
}
|
||||
|
||||
|
||||
//读取是不是全天请假(这种情况无法统计,全天请假写了2个上午和下午的请假条,下次改进)
|
||||
$qjarr = $this->db->getall("select `stime`,`etime`,`uid` from `[Q]kqinfo` where `status`=1 and `kind`='请假' and `etime`>='$start' and `stime`<='$enddt' ");
|
||||
if($qjarr){
|
||||
foreach($qjarr as $k=>$rs){
|
||||
$qjarr[$k]['stimes'] = strtotime($rs['stime']);
|
||||
$qjarr[$k]['etimes'] = strtotime($rs['etime']);
|
||||
}
|
||||
foreach($dtarr as $d1=>$dtss){
|
||||
$dt = $dtss[0];
|
||||
foreach($qjarr as $k=>$rs){
|
||||
$uid = $rs['uid'];
|
||||
$sbdt = $kql->getsbstr($uid, $dt);
|
||||
|
||||
if($rs['stimes']<=$sbdt['stimes'] && $rs['etimes']>=$sbdt['etimes']){
|
||||
$leavedt['a'.$uid.'_'.$dt.''] = 1; //全天请假
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($urows as $k=>$urs){
|
||||
$totaly = 0;//应写
|
||||
$totalx = 0;//已写次数
|
||||
$totalw = 0;//未写次数
|
||||
$dtjoin = '';
|
||||
$uid = $urs['id'];
|
||||
$dtarra = array();
|
||||
$ruzd = 0;$lzzt = 9999999999999;
|
||||
if(!isempt($urs['workdate']))$ruzd = strtotime($urs['workdate']);
|
||||
if(!isempt($urs['quitdt']))$lzzt = strtotime($urs['quitdt']);
|
||||
|
||||
$uarr = array(
|
||||
'uid' => $uid,
|
||||
'month' => $mon,
|
||||
'optdt' => $this->rock->now
|
||||
);
|
||||
foreach($dtarr as $d1=>$dtss){
|
||||
$dt = $dtss[0];
|
||||
$d = $d1+1;
|
||||
$zt = 0; //0未写,1已写,2请假,3休息日,4没入职或已离职,5不需要写日报,时间还没到,6写周报了
|
||||
|
||||
//入职离职判断
|
||||
if($dtss[1]<$ruzd || $dtss[1]>$lzzt){
|
||||
$uarr['day'.$d.''] = 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
$keys = 'a'.$uid.'_'.$dt.'';
|
||||
|
||||
$xbo = true;
|
||||
$iswork = $kql->isworkdt($uid, $dt);
|
||||
if($iswork==0){
|
||||
$zt = 3;
|
||||
if(isset($dailydt[$keys])){
|
||||
$zt = 1;
|
||||
}
|
||||
}else{
|
||||
|
||||
if(isset($leavedt[$keys])){
|
||||
$zt = 2;
|
||||
}else{
|
||||
$totaly++;
|
||||
}
|
||||
if(isset($dailydt[$keys])){
|
||||
$zt = 1;
|
||||
}
|
||||
if($zt==0 && isset($zhoubdt[$keys])){
|
||||
$zt = 6;//写周报了
|
||||
}
|
||||
if($zt==0){
|
||||
if($urs['isdaily']==0){
|
||||
$zt = 5;
|
||||
}else{
|
||||
$totalw++;//没写没请假
|
||||
}
|
||||
}
|
||||
}
|
||||
$uarr['day'.$d.''] = $zt;
|
||||
}
|
||||
|
||||
$totalx = $totaly - $totalw;
|
||||
$uarr['totaly'] = $totaly;
|
||||
$uarr['totalx'] = $totalx;
|
||||
$uarr['totalw'] = $totalw;
|
||||
|
||||
$where = "`uid`='$uid' and `month`='$mon'";
|
||||
if($dbfx->rows($where)==0)$where = '';
|
||||
|
||||
$dbfx->record($uarr, $where);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 未写日报通知
|
||||
* return 未写人员如:貂蝉(人事部),大乔(开发部)
|
||||
*/
|
||||
public function dailytodo($dt='')
|
||||
{
|
||||
if($dt=='')$dt = $this->rock->date;
|
||||
$dta = explode('-', $dt);
|
||||
$month = substr($dt, 0,7);
|
||||
$d = (int)$dta[2];
|
||||
$rows= $this->db->getall("select a.`id`,a.`name`,a.`deptname`,b.`day".$d."` from `[Q]admin` a left join `[Q]dailyfx` b on a.`id`=b.`uid` and b.`month`='$month' where a.`status`=1 and b.`day".$d."`=0");
|
||||
$w = c('date')->cnweek($dt);
|
||||
$cont= '你昨天['.$dt.',周'.$w.']的'.$this->modename.'未写,请及时补充填写。';
|
||||
$receid = '';
|
||||
foreach($rows as $k=>$rs){
|
||||
$receid.=','.$rs['id'].'';
|
||||
}
|
||||
$this->flowweixinarr = array(
|
||||
'url' => $this->getwxurl()
|
||||
);
|
||||
if($receid!='')$this->push(substr($receid, 1),'', $cont, ''.$this->modename.'未写提醒');
|
||||
}
|
||||
}
|
||||
19
webmain/model/flow/demoModel.php
Normal file
19
webmain/model/flow/demoModel.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
//演示模块的接口文件
|
||||
class flow_demoClassModel extends flowModel
|
||||
{
|
||||
protected function flowcoursejudge($num){
|
||||
|
||||
}
|
||||
|
||||
//默认返回就是前缀
|
||||
public function ABCYmd($num)
|
||||
{
|
||||
return 'QOM-';
|
||||
return array(
|
||||
'qom' => 'AExeeCC-',
|
||||
'wshu' => 5,
|
||||
'bom' => '-LLL'
|
||||
);
|
||||
}
|
||||
}
|
||||
11
webmain/model/flow/deptModel.php
Normal file
11
webmain/model/flow/deptModel.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
//部门的
|
||||
class flow_deptClassModel extends flowModel
|
||||
{
|
||||
//删除之前判断
|
||||
protected function flowdeletebillbefore()
|
||||
{
|
||||
if(m('admin')->rows($this->rock->dbinstr('deptpath',$this->id,'[',']'))>0)return '部门下有用户不允许删除';
|
||||
if($this->rows('pid='.$this->id.'')>0)return '有下级部门不允许删除';
|
||||
}
|
||||
}
|
||||
51
webmain/model/flow/diaoboModel.php
Normal file
51
webmain/model/flow/diaoboModel.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
//调拨单
|
||||
class flow_diaoboClassModel extends flowModel
|
||||
{
|
||||
public $minwidth = 600;//子表最小宽
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
$this->cangobj = m('godepot');
|
||||
}
|
||||
|
||||
//审核完成处理,要通知仓库管理员出入库
|
||||
protected function flowcheckfinsh($zt){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
$db = m('goods');
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $db->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1)$rows[$k]['aid'] = $name; //1展示时
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs,$lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state']);
|
||||
if(!isempt($rs['custname'])){
|
||||
$rs['custid'] = $rs['custname'];
|
||||
}else{
|
||||
$rs['custid']= $this->cangobj->getmou('depotname', $rs['custid']);
|
||||
}
|
||||
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
246
webmain/model/flow/emailmModel.php
Normal file
246
webmain/model/flow/emailmModel.php
Normal file
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
class flow_emailmClassModel extends flowModel
|
||||
{
|
||||
|
||||
private $readunarr = array();//未读人员
|
||||
|
||||
//判断是否有读取权限
|
||||
protected function flowisreadqx()
|
||||
{
|
||||
$to = m('emails')->rows('`mid`='.$this->id.' and `uid`='.$this->adminid.'');
|
||||
return $to>0;
|
||||
}
|
||||
|
||||
//删除时
|
||||
protected function flowdeletebill($sm)
|
||||
{
|
||||
m('emails')->delete('`mid`='.$this->id.'');
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
//撤回未读的
|
||||
if($ors['num']=='chemail'){
|
||||
$where = '`mid`='.$this->id.' and `type`<>2 and `zt`=0';
|
||||
$drows = m('emails')->getall($where);
|
||||
m('emails')->delete($where);
|
||||
$uids = '0';
|
||||
foreach($drows as $k1=>$rs1)$uids.=','.$rs1['uid'].'';
|
||||
m('todo')->deltodo($this->modenum, $this->id, $uids);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowgetoptmenu($opt)
|
||||
{
|
||||
if($opt=='chemail'){
|
||||
$to = $this->flogmodel->rows("".$this->mwhere." and `name`='撤回'");
|
||||
if($to>0)return false;
|
||||
}
|
||||
}
|
||||
|
||||
//立即发送提醒
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['isturn']==1 && $this->rs['type']==0){
|
||||
$h = c('html');
|
||||
$cont = $h->htmlremove($this->rs['content']);
|
||||
$cont = $h->substrstr($cont,0, 50);
|
||||
$receid = $this->rs['receid'];
|
||||
if(!isempt($this->rs['ccid']))$receid.=','.$this->rs['ccid'];
|
||||
$this->push($receid, '邮件', $cont.'...', $this->rs['title']);
|
||||
}
|
||||
}
|
||||
|
||||
//重写方法将邮件标识已读邮件了
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$where = '`mid`='.$this->id.' and `uid`='.$this->adminid.'';
|
||||
$dbs = m('emails');
|
||||
$dbs->update('`zt`=1', $where);
|
||||
//判断我是否可以回复
|
||||
$ishuifu = 0;
|
||||
$readunarr = array();
|
||||
if($this->rs['isturn']==1){
|
||||
$tos = $dbs->rows($where.' and `type` in(0,1)');
|
||||
if($tos>0)$ishuifu = 1;
|
||||
|
||||
//读取未读人员
|
||||
$uids = '';
|
||||
$uarrs = $dbs->getall('`mid`='.$this->id.' and `zt`=0 and `type` in(0,1) and `isdel`=0');
|
||||
foreach($uarrs as $k=>$rs)$uids.=','.$rs['uid'].'';
|
||||
if($uids!='')$readunarr = $this->adminmodel->getuserinfo(substr($uids,1));
|
||||
|
||||
}
|
||||
|
||||
$arr['ishuifu'] = $ishuifu;
|
||||
$arr['readunarr'] = $readunarr;
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
private function dtssss($dt)
|
||||
{
|
||||
$cnw = c('date')->cnweek($dt);
|
||||
return date('Y年m月d日(星期'.$cnw.')H:i:s',strtotime($dt));
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['senddt'] = $this->dtssss($rs['senddt']);
|
||||
if($lx == 1 && $rs['hid']>0){
|
||||
$rs['oldcontent'] = $this->getoldcont($rs['hid']);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取原来邮件内容
|
||||
*/
|
||||
public function getoldcont($hid, $bo=true)
|
||||
{
|
||||
$hid = (int)$hid;
|
||||
if($hid==0)return '';
|
||||
$hrs = $this->getone($hid);
|
||||
if(!$hrs)return '';
|
||||
$dts = $this->dtssss($hrs['senddt']);
|
||||
$fstr = m('file')->getstr($this->mtable, $hrs['id'], 1);
|
||||
$s = '<div style="color:#888888;font-size:12px;margin-top:20px">------------------ 原始邮件 ------------------</div>';
|
||||
$s.= '<div style="font-size: 12px;background:#efefef;padding:8px;line-height:18px;">发件人: '.$hrs['sendname'].'<br>
|
||||
发送时间: '.$dts.'<br>
|
||||
收件人: '.$hrs['recename'].'<br>
|
||||
主题: '.$hrs['title'].'</div>';
|
||||
$s.= '<div style="margin-top:10px">'.$hrs['content'].'<br>'.$fstr.'</div>';
|
||||
if($bo)$s.= $this->getoldcont($hrs['hid'], $bo);
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '1=2';
|
||||
$onwhere= '';
|
||||
$key = $this->rock->post('key');
|
||||
$dt = $this->rock->post('dt');
|
||||
$dbs = m('emailm');
|
||||
|
||||
//所有邮件
|
||||
if($lx=='' || $lx=='def' || $lx=='sjx'){
|
||||
$where = $dbs->gettowhere($uid, 0);
|
||||
}
|
||||
|
||||
//未读邮件
|
||||
if($lx=='wdyj'){
|
||||
$where = $dbs->gettowhere($uid, 1);
|
||||
}
|
||||
|
||||
//草稿箱
|
||||
if($lx == 'cgx'){
|
||||
$where = $dbs->gettowhere($uid, 2);
|
||||
}
|
||||
|
||||
//已发送
|
||||
if($lx == 'yfs'){
|
||||
$where = $dbs->gettowhere($uid, 3);
|
||||
}
|
||||
|
||||
//已删除
|
||||
if($lx == 'ysc'){
|
||||
$where = $dbs->gettowhere($uid, 4);
|
||||
}
|
||||
|
||||
if(!isempt($key))$where.=" and (a.`title` like '%$key%' or a.`recename` like '%$key%' or a.`sendname` like '%$key%')";
|
||||
if(!isempt($dt))$where.=" and a.`senddt` like '$dt%'";
|
||||
|
||||
return array(
|
||||
'where' => 'and '.$where,
|
||||
'fields'=> 'a.`id`,a.`title`,a.`sendname`,a.`recename`,a.`senddt`,a.`isfile`,b.`ishui`,b.`zt`,a.`outzt`,a.`type`',
|
||||
'order' => 'a.`senddt` desc',
|
||||
'table' => '`[Q]emailm` a left join `[Q]emails` b on a.`id`=b.`mid` '.$onwhere.''
|
||||
);
|
||||
}
|
||||
|
||||
private function getmid($uid, $type, $isdel=0)
|
||||
{
|
||||
$rows = m('emails')->getrows('`uid`='.$uid.' and `type` in('.$type.') and `isdel`='.$isdel.'','`mid`');
|
||||
$ids = '0';
|
||||
foreach($rows as $k=>$rs)$ids.=','.$rs['mid'].'';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
public function savesubmid($tuid, $mid, $type, $zt=0)
|
||||
{
|
||||
$now = $this->rock->now;
|
||||
if(is_numeric($tuid)){
|
||||
$uids = $tuid;
|
||||
}else{
|
||||
$uids = m('admin')->gjoin($tuid);
|
||||
}
|
||||
if($uids!=''){
|
||||
$this->db->insert('[Q]emails','mid,uid,email,personal,type,optdt,zt',"select '$mid',id,email,name,'$type','$now','$zt' from `[Q]admin` where id in($uids)", true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件回复
|
||||
* $cont 回复内容
|
||||
*/
|
||||
public function huifu($cont)
|
||||
{
|
||||
$rs = $this->rs;
|
||||
$rers = $this->gethuifuarr();
|
||||
if(!$rers)return '没有发送人';
|
||||
$cont = str_replace("\n", '<br>', $cont);
|
||||
$arr['title'] = '回复:'.$rs['title'].'';
|
||||
$arr['content'] = $cont;
|
||||
$arr['sendid'] = $this->adminid;
|
||||
$arr['uid'] = $this->adminid;
|
||||
$arr['sendname'] = $this->adminname;
|
||||
$arr['senddt'] = $this->rock->now;
|
||||
$arr['applydt'] = $this->rock->date;
|
||||
$arr['hid'] = $this->id;
|
||||
$arr['type'] = $rs['type'];
|
||||
$arr['receid'] = $rers['uid'];
|
||||
$arr['recename'] = $rers['personal'];
|
||||
$arr['isturn'] = 1;
|
||||
$arr['outzt'] = 0;
|
||||
$arr['toemail'] = ''.$rers['personal'].'('.$rers['email'].')';
|
||||
$arr['optdt'] = $this->rock->now;
|
||||
|
||||
|
||||
$id = $this->insert($arr);
|
||||
$sarr['mid'] = $id;
|
||||
$sarr['uid'] = $rers['uid'];
|
||||
$sarr['type'] = 0;
|
||||
$sarr['optdt'] = $this->rock->now;
|
||||
$sarr['email'] = $rers['email'];
|
||||
$sarr['personal'] = $rers['personal'];
|
||||
m('emails')->insert($sarr);
|
||||
$this->savesubmid($arr['sendid'], $id, 2,1);
|
||||
|
||||
m('emails')->update('ishui=1','`mid`='.$this->id.' and `uid`='.$this->adminid.' and `type`=0');//更新已回复
|
||||
//需要外发
|
||||
if($rs['type']==1 && !isempt($rers['email'])){
|
||||
$cont = $arr['content'];
|
||||
$cont .= $this->getoldcont($this->id, false);
|
||||
m('email')->sendemailout($this->adminid, array(
|
||||
'title' => $arr['title'],
|
||||
'body' => $cont,
|
||||
'receemail' => $rers['email'],
|
||||
'recename' => $arr['recename'],
|
||||
'mid' => $id,
|
||||
));
|
||||
}
|
||||
|
||||
$this->loaddata($id, false);
|
||||
$this->submit('回复');
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
|
||||
//获取要回复的接收人
|
||||
public function gethuifuarr()
|
||||
{
|
||||
$rs = m('emails')->getone('`mid`='.$this->id.' and `type`=2');
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
6
webmain/model/flow/finfybxModel.php
Normal file
6
webmain/model/flow/finfybxModel.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class flow_finfybxClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
87
webmain/model/flow/finpiaoModel.php
Normal file
87
webmain/model/flow/finpiaoModel.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
//发票管理
|
||||
class flow_finpiaoClassModel extends flowModel
|
||||
{
|
||||
|
||||
public $defaultorder = 'opendt,desc';
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `opendt` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr[] = array(
|
||||
'type' => '收到的发票',
|
||||
'ptype' => '增值税普通发票',
|
||||
'kainame' => '张三',
|
||||
'money' => '50',
|
||||
'custname' => '销售单位',
|
||||
'maicustname' => '购买单位',
|
||||
'daima' => '',
|
||||
'haoma' => '',
|
||||
'opendt' => '2017-01-17',
|
||||
'explain' => '说明',
|
||||
);
|
||||
|
||||
$barr[] = array(
|
||||
'type' => '开出去的发票',
|
||||
'ptype' => '增值税普通发票',
|
||||
'kainame' => '张三',
|
||||
'money' => '500',
|
||||
'custname' => '销售单位',
|
||||
'maicustname' => '购买单位',
|
||||
'daima' => '',
|
||||
'haoma' => '',
|
||||
'opendt' => '2017-01-17',
|
||||
'explain' => '说明客户买了啥给他开了发票',
|
||||
);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//导入之前处理,必须添加客户
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$crmdb = m('crm');
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$arr = $rs;
|
||||
$custname = $rs['custname'];
|
||||
$custrs = $crmdb->getcustomer($custname);
|
||||
if(!$custrs)return '行'.($k+1).'销售方名称【'.$custname.'】不存在,请先建客户档案';
|
||||
$arr['custid'] = $custrs['id'];
|
||||
|
||||
$maicustname = $rs['maicustname'];
|
||||
$custrs1 = $crmdb->getcustomer($maicustname);
|
||||
if(!$custrs1)return '行'.($k+1).'购买方名称【'.$maicustname.'】不存在,请先建客户档案';
|
||||
$arr['maicustid'] = $custrs1['id'];
|
||||
|
||||
|
||||
$type = 1; //收到的发票
|
||||
if(contain($rs['type'],'开出去'))$type=0;//开出去发票
|
||||
$arr['type'] = $type;
|
||||
$arr['status'] = 1;
|
||||
$inarr[] = $arr;
|
||||
}
|
||||
return $inarr;
|
||||
}
|
||||
}
|
||||
15
webmain/model/flow/flow.php
Normal file
15
webmain/model/flow/flow.php
Normal file
File diff suppressed because one or more lines are too long
257
webmain/model/flow/gongModel.php
Normal file
257
webmain/model/flow/gongModel.php
Normal file
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
class flow_gongClassModel extends flowModel
|
||||
{
|
||||
private $readunarr = array();//未读人员
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->logobj = m('log');
|
||||
}
|
||||
|
||||
protected function flowchangedata(){
|
||||
$cont = c('html')->replace($this->rs['content']);
|
||||
$fm = $this->rs['fengmian'];
|
||||
if(!isempt($fm)){
|
||||
$cont='<div align="center"><img style="max-width:100%" src="'.$this->rock->gethttppath($fm).'"></div>'.$cont.'';
|
||||
}
|
||||
$url = $this->rs['url'];
|
||||
if(!isempt($url))$cont.='<div><a href="'.$url.'">打开相应地址>></a></div>';
|
||||
$this->rs['content'] = $cont;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$mintou = (int)arrvalue($rs, 'mintou','0');
|
||||
if($lx==2){
|
||||
$zt = $this->logobj->isread($this->mtable, $rs['id'], $this->adminid);
|
||||
if($zt>0)$rs['ishui']=1;
|
||||
}
|
||||
if($lx==1){
|
||||
$receid = $rs['receid'];
|
||||
if(isempt($receid))$receid='all';
|
||||
$barr = m('log')->getreadshu($this->mtable, $rs['id'],$receid , $rs['optdt'], $this->adminmodel);
|
||||
foreach($barr as $k=>$v)$rs[$k]=$v;
|
||||
$this->readunarr = $barr['wduarr'];
|
||||
}
|
||||
if($mintou>0){
|
||||
$rs['title'] .='(投票)';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['status']==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
//移动端列表
|
||||
private $ydarr = false;
|
||||
public function flowrsreplace_we($row, $rs)
|
||||
{
|
||||
if(!isempt($rs['fengmian']))$row['picurl'] = $rs['fengmian'];
|
||||
if($this->ydarr===false)$this->ydarr = explode(',', m('log')->getread('infor', $this->adminid));
|
||||
|
||||
if(!in_array($rs['id'], $this->ydarr)){
|
||||
$row['statustext'] = '未读';
|
||||
$row['statuscolor'] = '#ED5A5A';
|
||||
}else{
|
||||
$row['ishui'] = 1;
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
public function flowwesearchdata($lx)
|
||||
{
|
||||
if($lx==1)return $this->option->getselectdata('gongtype', true);
|
||||
return array(
|
||||
'typename' => '所有通知',
|
||||
'searchmsg' => '通知标题/分类',
|
||||
);
|
||||
}
|
||||
|
||||
//审核完成后发通知
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
public function getreceids($receid, $whe='')
|
||||
{
|
||||
$receid = $this->adminmodel->gjoin($receid,'ud','where');
|
||||
if($receid=='' || $receid=='all'){
|
||||
$where = '';
|
||||
}else{
|
||||
$where = 'and id>0 and ('.$receid.')';
|
||||
}
|
||||
$ids = '';
|
||||
$rows = $this->adminmodel->getall('`status`=1 '.$where.' '.$whe.'','id');
|
||||
foreach($rows as $k=>$rs)$ids.=',u'.$rs['id'].'';
|
||||
if($ids!='')$ids = substr($ids, 1);
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
//发送推送通知
|
||||
private function tisongtodo()
|
||||
{
|
||||
//还没到展示时间就不发送提醒
|
||||
$zstart= arrvalue($this->rs, 'zstart');
|
||||
if(!isempt($zstart) && $zstart>$this->rock->date)return;
|
||||
|
||||
$h = c('html');
|
||||
$cont = $h->htmlremove($this->rs['content']);
|
||||
$cont = $h->substrstr($cont,0, 50);
|
||||
if(strlen($cont)>40)$cont.='...';
|
||||
if(isempt($cont))$cont = $this->rs['title']; //为空时
|
||||
$this->push($this->rs['receid'], '通知公告', $cont, $this->rs['title'],1);
|
||||
|
||||
//添加短信提醒,短信提醒
|
||||
if(arrvalue($this->rs,'issms')=='1'){
|
||||
$receid = $this->rs['receid'];//接收人ID,可以为部门合聚,如d2,u1(必须)
|
||||
if(isempt($receid))$receid = 'all'; //为空就是全部人
|
||||
$qiannum= ''; //【系统→短信管理→短信签名】下获取,如没有自己的签名默认【信呼OA】
|
||||
$tplnum = m('option')->getval('gongsmstpl', 'gongsms');//到【数据选项→行政选项】下设置通知短信模版编号
|
||||
$params = array(
|
||||
'title' => $this->rs['title'],
|
||||
'typename' => $this->rs['typename'],
|
||||
);
|
||||
$url = $this->getxiangurlx();//详情连接地址(选填),短信模版有url就需要填写
|
||||
c('xinhuapi')->sendsms($receid, $qiannum, $tplnum, $params, $url);
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowgetoptmenu($opt)
|
||||
{
|
||||
$to = m('log')->isread($this->mtable, $this->id);
|
||||
return $to<=0;
|
||||
}
|
||||
|
||||
protected function flowoptmenu($ors, $crs)
|
||||
{
|
||||
$table = $this->mtable;
|
||||
$mid = $this->id;
|
||||
$uid = $this->adminid;
|
||||
$lx = $ors['num'];
|
||||
$log = m('log');
|
||||
if($lx=='yd'){
|
||||
$log->addread($table, $mid, $uid);
|
||||
}
|
||||
if($lx=='allyd'){
|
||||
$ydid = $log->getread($table, $uid);
|
||||
$where = "id not in($ydid)";
|
||||
$meswh = m('admin')->getjoinstr('receid', $uid);
|
||||
$where .= $meswh;
|
||||
$rows = m($table)->getrows($where,'id');
|
||||
foreach($rows as $k=>$rs)$log->addread($table, $rs['id'], $uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$typeid = (int)$this->rock->post('typeid','0');
|
||||
$keywere= '';
|
||||
$whyere = '';
|
||||
if(!isempt($key))$keywere.=" and (`title` like '%$key%' or `typename`='$key')";
|
||||
//我和我未读
|
||||
if($lx=='my' || $lx=='wexx'){
|
||||
$whyere= "and (`zstart` is null or `zstart`<='{$this->rock->date}')";
|
||||
$whyere.= " and (`zsend` is null or `zsend`>='{$this->rock->date}')";
|
||||
}
|
||||
|
||||
if($typeid>0){
|
||||
$typename=$this->option->getmou('name', $typeid);
|
||||
$whyere.=" and `typename`='$typename'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'order' => '`istop` desc,`optdt` desc',
|
||||
'keywere' => $keywere,
|
||||
'where' => $whyere,
|
||||
'fields' => 'id,typename,optdt,title,optname,zuozhe,indate,recename,fengmian,mintou,`status`,`istop`,`appxs`'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//显示投票
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$istoupiao = 0;
|
||||
$mintou = (int)arrvalue($this->rs, 'mintou','0');
|
||||
$maxtou = (int)arrvalue($this->rs, 'maxtou','0');
|
||||
$status = (int)arrvalue($this->rs, 'status','0');
|
||||
$touarr = array();
|
||||
$logarr = array();
|
||||
if($mintou>0){
|
||||
$istoupiao = 4;
|
||||
$toutype = 0;//不需要投票,1已投票,2未投票
|
||||
$receid = $this->rs['receid'];
|
||||
if(isempt($receid)){
|
||||
$istoupiao = 1;
|
||||
}else{
|
||||
$bo = $this->adminmodel->containjoin($receid, $this->adminid);
|
||||
if($bo)$istoupiao = 1;
|
||||
}
|
||||
$zongps = 0;
|
||||
$touitems = m('infors')->getall('mid='.$this->id.'','*','`sort`');
|
||||
foreach($touitems as $k=>$rs){
|
||||
$zongps+=floatval($rs['touci']);
|
||||
$touitems[$k]['bili'] = 0;
|
||||
}
|
||||
if($zongps>0)foreach($touitems as $k=>$rs){
|
||||
$touitems[$k]['bili'] = $this->rock->number(floatval($rs['touci'])/$zongps * 100);
|
||||
}
|
||||
|
||||
|
||||
$touarr['touitems'] = $touitems;
|
||||
|
||||
if($istoupiao==1){
|
||||
if($this->rs['startdt']>$this->rock->now)$istoupiao = 2; //未开始
|
||||
if($this->rs['enddt']<$this->rock->now)$istoupiao = 3; //结束
|
||||
}
|
||||
|
||||
$touarr['type'] = ($mintou==1 && $maxtou==1)? 'radio': 'checkbox';
|
||||
|
||||
//判断我是否投票了
|
||||
if($istoupiao==1 && $status==1){
|
||||
$towheer = $this->mwhere." and `name`='投票' and `checkid`='$this->adminid'";
|
||||
if($this->flogmodel->rows($towheer)>0){
|
||||
$toutype = 1;
|
||||
$istoupiao = 5;
|
||||
}else{
|
||||
$toutype = 2; //未投票
|
||||
}
|
||||
}
|
||||
$touarr['toutype'] = $toutype;
|
||||
|
||||
//判断是否可以显示结果
|
||||
$showtou = 0;
|
||||
if($istoupiao!=2 && $status==1 && ($toutype==1 || $toutype==0))$showtou = 1;
|
||||
if($showtou==0){
|
||||
foreach($arr['logarr'] as $k1=>$rs1){
|
||||
if($rs1['actname']!='投票')$logarr[] = $rs1;
|
||||
}
|
||||
}
|
||||
|
||||
$touarr['showtou'] = $showtou;
|
||||
$touarr['mintou'] = $mintou;
|
||||
$touarr['maxtou'] = $maxtou;
|
||||
}
|
||||
|
||||
$toupiaoarrr = explode(',',',<font color=blue>投票进行中</font>,<font color=#ff6600>未开始</font>,<font color=#888888>已结束</font>,<font color=#888888>你不在投票对象中</font>,<font color=green>已投票过了</font>');
|
||||
|
||||
|
||||
$arr['istoupiao'] = $istoupiao; //投票状态0不能,1可以,2未开始,3结束 4你不需要投票
|
||||
$arr['toupiaostatus'] = $toupiaoarrr[$istoupiao];
|
||||
$arr['title'] = '';
|
||||
$arr['touarr'] = $touarr;
|
||||
if($logarr)$arr['logarr'] = $logarr;
|
||||
|
||||
|
||||
$arr['readunarr'] = $this->readunarr;//读取未查阅
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
60
webmain/model/flow/goodghModel.php
Normal file
60
webmain/model/flow/goodghModel.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
//物品归还
|
||||
class flow_goodghClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
//标识已完成了审核归还
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt!=1)return;
|
||||
$mid = $this->rs['custid'];
|
||||
m('goodn')->update('`lygh`=2','`mid`='.$mid.' and `lygh`=1');
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
//删除出库详情的
|
||||
m('goodss')->delete("`mid`='$this->id'");
|
||||
}
|
||||
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $this->goodsobj->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1){
|
||||
$rows[$k]['aid'] = $name;
|
||||
}
|
||||
$rows[$k]['unit'] = $one['unit'];
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state'],0);
|
||||
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
|
||||
if($lx==1){
|
||||
$url = $this->getxiangurl('goodly', $rs['custid'], 'auto');
|
||||
$rs['custname'] = '<a href="'.$url.'"><u>'.$rs['custname'].'</u></a>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
63
webmain/model/flow/goodlyModel.php
Normal file
63
webmain/model/flow/goodlyModel.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class flow_goodlyClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
//审核完成处理
|
||||
protected function flowcheckfinsh($zt){
|
||||
/*
|
||||
m('goodss')->update('status='.$zt.'',"`mid`='$this->id'");
|
||||
$aid = '0';
|
||||
$rows = m('goodss')->getall("`mid`='$this->id'",'aid');
|
||||
foreach($rows as $k=>$rs)$aid.=','.$rs['aid'].'';
|
||||
m('goods')->setstock($aid);*/
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
//删除出库详情的
|
||||
m('goodss')->delete("`mid`='$this->id'");
|
||||
}
|
||||
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
$db = m('goods');
|
||||
$lygya = array('','需要','已归还');
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $db->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1){
|
||||
$rows[$k]['aid'] = $name;
|
||||
$rows[$k]['count'] = 0-$rs['count']; //负数显示为正数
|
||||
if(isset($rs['lygh'])){
|
||||
$rows[$k]['lygh']=arrvalue($lygya, $rs['lygh']);
|
||||
|
||||
}
|
||||
}
|
||||
$rows[$k]['unit'] = $one['unit'];
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state'],1);
|
||||
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
87
webmain/model/flow/goodsModel.php
Normal file
87
webmain/model/flow/goodsModel.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class flow_goodsClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected function flowchangedata(){
|
||||
$this->rs['typeid'] = m('goods')->gettypename($this->rs['typeid']);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'typeid' => '办公耗材/笔',
|
||||
'name' => '红色粉笔',
|
||||
'num' => 'WP-829',
|
||||
'guige' => '红色',
|
||||
'xinghao' => '5厘米',
|
||||
'price' => '0.1',
|
||||
'unit' => '盒',
|
||||
'stockcs' => '20',
|
||||
);
|
||||
}
|
||||
|
||||
public function flowxiangfields(&$fields)
|
||||
{
|
||||
$fields['stock'] = '总库存';
|
||||
$where = '';
|
||||
if(ISMORECOM){
|
||||
$comid = arrvalue($this->rs,'comid','0');
|
||||
$where = ' and `comid`='.$comid.'';
|
||||
}
|
||||
$kcrow = m('godepot')->getall('1=1'.$where.'','*','`sort`');
|
||||
foreach($kcrow as $k1=>$rs1){
|
||||
$fields['stock_'.$rs1['id'].''] = $rs1['depotname'];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
//
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
//详情页下显示对应仓库库存
|
||||
if($lx==1){
|
||||
$drows = $this->db->getall("SELECT `depotid`,sum(count)count FROM `[Q]goodss` where aid=".$rs['id']." and `status`=1 GROUP BY `depotid`");
|
||||
foreach($drows as $k1=>$rs1)$rs['stock_'.$rs1['depotid'].''] = $rs1['count'];
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//导入之前
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$db = m('goods');
|
||||
$num = 'goodstype';
|
||||
if(ISMORECOM && $cnum=$this->adminmodel->getcompanynum())$num.='_'.$cnum.'';
|
||||
foreach($rows as $k=>$rs){
|
||||
$rs['typeid'] = $this->option->gettypeid($num,$rs['typeid']);
|
||||
|
||||
//判断是否存在
|
||||
$odi = $db->existsgoods($rs);
|
||||
if($odi)continue;
|
||||
|
||||
$rs['price'] = floatval($this->rock->repempt($rs['price'],'0')); //金额
|
||||
//$rs['stockcs'] = (int)$this->rock->repempt(arrvalue($rs,'stockcs','0')); //无用
|
||||
|
||||
$inarr[] = $rs;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
|
||||
//导入后处理(刷新库存)
|
||||
public function flowdaoruafter($ddoa=array())
|
||||
{
|
||||
//初始库存
|
||||
m('goods')->setstock();
|
||||
}
|
||||
|
||||
//删除时
|
||||
protected function flowdeletebill($sm)
|
||||
{
|
||||
m('goodss')->delete('`aid`='.$this->id.'');
|
||||
m('goods')->setstock();
|
||||
}
|
||||
}
|
||||
23
webmain/model/flow/groupModel.php
Normal file
23
webmain/model/flow/groupModel.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
class flow_groupClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected $flowcompanyidfieds = 'none';
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
//$carr = $this->adminmodel->getcompanyinfo();
|
||||
//$this->allid= $carr['companyallid'];
|
||||
//$companywhere = ' and `companyid` in('.join(',', $this->allid).')';
|
||||
$where = '';
|
||||
if(ISMORECOM && $this->adminid>1){
|
||||
$where = ' and `companyid`='.$this->companyid.'';
|
||||
}
|
||||
|
||||
return array(
|
||||
'companywhere' => '',
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
}
|
||||
414
webmain/model/flow/hrcheckModel.php
Normal file
414
webmain/model/flow/hrcheckModel.php
Normal file
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
//模块 hrcheck.考核评分
|
||||
class flow_hrcheckClassModel extends flowModel
|
||||
{
|
||||
//审核完成处理
|
||||
protected function flowcheckfinsh($zt){
|
||||
//最后得分计算,
|
||||
if($zt==1){
|
||||
$fenzp = floatval($this->rs['fenzp']);
|
||||
$fensj = floatval($this->rs['fensj']);
|
||||
$fenrs = floatval($this->rs['fenrs']);
|
||||
|
||||
//默认分数=自己评分*50% + 上级评分*25% + 人事评分*25%
|
||||
$fen = $fenzp*0.5 + $fensj*0.25 + $fenrs*0.25;
|
||||
|
||||
//3个平均分
|
||||
//$fen = ($fenzp+$fensj+$fenrs)/3;
|
||||
|
||||
|
||||
$this->update(array('fen' => $fen), $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
//需要评分就可以查看
|
||||
protected function flowisreadqx()
|
||||
{
|
||||
$boss = $this->getpfrows();
|
||||
if($boss)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getpfrows()
|
||||
{
|
||||
return m('hrcheckn')->getall('mid='.$this->id.' and `optid`='.$this->adminid.' and `optdt` is null','*', '`sort`');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if(isset($rs['abclex']))return $rs;
|
||||
$ztstr = '';
|
||||
if(isempt($rs['pfrens'])){
|
||||
$ztstr = '<font color=green>评分已完成</font>';
|
||||
}else{
|
||||
if($rs['uid']==$this->adminid){
|
||||
$ztstr = '待<font color=blue>'.$rs['pfrens'].'</font>评分';
|
||||
}else{
|
||||
$ztstr = '<font color=blue>待评分</font>';
|
||||
}
|
||||
}
|
||||
$rs['pfrenids'] = $ztstr;
|
||||
if($lx==1){
|
||||
$ckbo = $this->isreadqxs();//是否设置查看权限
|
||||
|
||||
|
||||
|
||||
$ispf = $this->getpfrows();
|
||||
if(!$ispf){
|
||||
if($ckbo){ //设置可查看
|
||||
$rs['subdatastr'] = $this->getsubdatastr($this->id);
|
||||
$this->moders['isgbcy'] = 0;
|
||||
$this->moders['isgbjl'] = 0;
|
||||
|
||||
}else{
|
||||
if($rs['uid']!=$this->adminid)$rs['fen'] = '-';
|
||||
}
|
||||
}else{
|
||||
$rs['fen'] = '-';
|
||||
}
|
||||
}
|
||||
if($rs['uid']!=$this->adminid && !contain($this->atype, 'all'))$rs['fen']='-';//自己只能看自己分
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function getsubdatastr($id, $glx=0)
|
||||
{
|
||||
$srows = m('hrchecks')->getrows('`mid`='.$id.'','*','`sort`');
|
||||
$nrows = m('hrcheckn')->getrows('`mid`='.$id.'','*','`sort`');
|
||||
$pars = array();
|
||||
$fsarr = array();
|
||||
foreach($nrows as $k2=>$rs2){
|
||||
$pars[$rs2['pfid']] = $rs2['pfname'].'<br>'.$rs2['optname'].'(权重'.$rs2['weight'].'%)';
|
||||
$fsarr['s'.$rs2['sid'].'_'.$rs2['pfid'].''] = $rs2['defen'];
|
||||
}
|
||||
$fenshu = 0;
|
||||
$toarr = array();
|
||||
foreach($srows as $k1=>&$rs1){
|
||||
$rs1['xuhaos'] = $k1+1;
|
||||
|
||||
foreach($pars as $k3=>$v3){
|
||||
$val = arrvalue($fsarr, 's'.$rs1['id'].'_'.$k3.'');
|
||||
if(!isset($toarr[$k3]))$toarr[$k3] = 0;
|
||||
$toarr[$k3]+=floatval($val);
|
||||
|
||||
if($val==0)$val= '';
|
||||
$rs1['pfzd'.$k3.''] = $val; //得分
|
||||
}
|
||||
|
||||
|
||||
$fenshu+=floatval($rs1['fenshu']);
|
||||
}
|
||||
|
||||
//统计的
|
||||
$tjarr = array();
|
||||
foreach($toarr as $k3=>$v1){
|
||||
if($v1==0)$v1='';
|
||||
$tjarr['pfzd'.$k3.''] = $v1;
|
||||
}
|
||||
$tjarr['itemname'] = '小计';
|
||||
$tjarr['fenshu'] = $fenshu;
|
||||
$srows[]= $tjarr;
|
||||
|
||||
if($glx==1){
|
||||
return array(
|
||||
'data'=>$srows,
|
||||
'colums'=> $pars
|
||||
);
|
||||
}
|
||||
|
||||
$herstr = 'xuhaos,,center@itemname,考核内容,left@fenshu,分值';
|
||||
foreach($pars as $k1=>$v1)$herstr.='@pfzd'.$k1.','.$v1.'';
|
||||
|
||||
$pfrowsstr = c('html')->createrows($srows, $herstr,'#dddddd');
|
||||
|
||||
return $pfrowsstr;
|
||||
}
|
||||
|
||||
|
||||
protected function flowinit()
|
||||
{
|
||||
$this->dtobj = c('date');
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if(!isempt($month)){
|
||||
$where="and a.`startdt` like '".$month."%'";
|
||||
}
|
||||
return array(
|
||||
'table' => '`[Q]hrcheck` a left join `[Q]userinfo` b on a.uid=b.id',
|
||||
'fields' => 'a.*,b.deptname',
|
||||
'asqom' => 'a.',
|
||||
'where' => $where,
|
||||
'orlikefields' => 'b.deptname'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//是否可评分
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$pfrows = $this->getpfrows();
|
||||
foreach($pfrows as $k=>&$rs){
|
||||
$rs['xuhaos'] = $k+1;
|
||||
$rs['defenstr'] = '<input type="number" min="0" max="'.$rs['fenshu'].'" class="inputs" onfocus="js.focusval=this.value" name="pingfen_'.$rs['id'].'" onblur="js.number(this)">';
|
||||
$rs['itemname'] = '<div style="max-width:200px">'.$rs['itemname'].'</div>';
|
||||
}
|
||||
$pfrowsstr = c('html')->createrows($pfrows, 'xuhaos,,center@itemname,考核内容,left@pfname,评分名称@fenshu,总分数@defenstr,评分分数','#dddddd');
|
||||
return array(
|
||||
'pfrows' => $pfrows,
|
||||
'pfrowsstr' => $pfrowsstr,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function hrkaohemrun()
|
||||
{
|
||||
$dt = $this->rock->date;
|
||||
$dbs = m('hrkaohes');
|
||||
$dbs1 = m('hrchecks');
|
||||
$dbn1 = m('hrcheckn');
|
||||
$dbn = m('hrkaohen');
|
||||
$rows = m('hrkaohem')->getall("`status`=1 and `startdt`<='$dt' and `enddt`>='$dt'");
|
||||
$keox = 0;
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$bo = $this->xuyuns($rs);
|
||||
if(!$bo)continue;
|
||||
|
||||
$keox++;
|
||||
$rowxm = $dbs->getall("`mid`='".$rs['id']."'",'*','`sort`');
|
||||
$rowpf = $dbn->getall("`mid`='".$rs['id']."'",'*','`sort`');
|
||||
|
||||
$inarr = array(
|
||||
'khid' => $rs['id'],
|
||||
'title' => $rs['title'],
|
||||
'startdt' => $this->rock->date,
|
||||
'applydt' => $this->rock->date,
|
||||
'optdt' => $this->rock->now,
|
||||
'createdt' => $this->rock->now,
|
||||
'optname' => $rs['optname'],
|
||||
'optid' => $rs['optid'],
|
||||
'isturn' => 1,
|
||||
'month' => date('Y-m'),
|
||||
'status' => 1,
|
||||
'enddt' => ''
|
||||
);
|
||||
if($rs['pfsj']>0)$inarr['enddt'] = $this->dtobj->adddate($inarr['startdt'],'d', $rs['pfsj']);
|
||||
$recwe = $this->adminmodel->gjoin($rs['receid'],'', 'where');
|
||||
$uarr = $this->adminmodel->getall("`status`=1 and ($recwe)",'id,name');
|
||||
foreach($uarr as $uk=>$urs){
|
||||
$inarr['uid'] = $urs['id'];
|
||||
$inarr['applyname'] = $urs['name'];
|
||||
$pfren = $pfrenid = $pfrenids = $pfrens = '';
|
||||
$mid = 0;
|
||||
$where1 = "`uid`='".$urs['id']."' and `startdt`='".$inarr['startdt']."' and `khid`='".$rs['id']."'";
|
||||
if($mrs = $this->getone($where1)){
|
||||
$mid= (int)$mrs['id'];
|
||||
}else{
|
||||
$where1= '';
|
||||
}
|
||||
//保存的hrcheck表
|
||||
$bo = $this->record($inarr, $where1);
|
||||
if($mid==0)$mid = $this->db->insert_id();
|
||||
|
||||
//在保存到hrchecks考核内容表
|
||||
$sids = '0';
|
||||
$sids1 = '0';
|
||||
foreach($rowxm as $k1=>$rs1){
|
||||
$where1 = "`mid`='$mid' and `itemname`='".$rs1['itemname']."'";
|
||||
$sid = (int)$dbs1->getmou('id',$where1);
|
||||
if($sid==0)$where1 = '';
|
||||
$fenshu = floatval($rs['maxfen']) * floatval($rs1['weight']) * 0.01;
|
||||
$dbs1->record(array(
|
||||
'mid' => $mid,
|
||||
'sort' => $k1,
|
||||
'itemname' => $rs1['itemname'],
|
||||
'weight' => $rs1['weight'],
|
||||
'fenshu' => $fenshu
|
||||
), $where1);
|
||||
if($sid==0)$sid = $this->db->insert_id();
|
||||
$sids.=','.$sid.'';
|
||||
|
||||
//添加到hrcheckn考核内容表
|
||||
|
||||
foreach($rowpf as $k2=>$rs2){
|
||||
$pfarr = $this->getpftype($urs, $rs2);
|
||||
$where2= "`mid`='$mid' and `pfid`='".$rs2['id']."' and `sid`='$sid'";
|
||||
$sid1 = 0;
|
||||
$srs = $dbn1->getone($where2);
|
||||
if($srs){
|
||||
$sid1 = (int)$srs['id'];
|
||||
}
|
||||
if($sid1==0)$where2 = '';
|
||||
|
||||
$dbn1->record(array(
|
||||
'mid' => $mid,
|
||||
'sort' => $k2,
|
||||
'itemname' => $rs1['itemname'],
|
||||
'weight' => $rs2['pfweight'],
|
||||
'pfid' => $rs2['id'],
|
||||
'pfname' => $rs2['pfname'],
|
||||
'sid' => $sid,
|
||||
'fenshu' => $fenshu,
|
||||
'optid' => $pfarr[0],
|
||||
'optname' => $pfarr[1],
|
||||
),$where2);
|
||||
if($sid1==0)$sid1 = $this->db->insert_id();
|
||||
$sids1.=','.$sid1.'';
|
||||
if(!isempt($pfarr[0]) && !contain(','.$pfrenid.',',','.$pfarr[0].',')){
|
||||
$pfren .= ','.$pfarr[1];
|
||||
$pfrenid .= ','.$pfarr[0];
|
||||
}
|
||||
//未评分人
|
||||
$ispf = false;
|
||||
if($srs && !isempt($srs['optdt']))$ispf=true;
|
||||
|
||||
if(!$ispf && !isempt($pfarr[0]) && !contain(','.$pfrenids.',',','.$pfarr[0].',')){
|
||||
$pfrenids .= ','.$pfarr[0];
|
||||
$pfrens .= ','.$pfarr[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$dbs1->delete("`mid`='$mid' and `id` not in($sids)");
|
||||
$dbn1->delete("`mid`='$mid' and `id` not in($sids1)");
|
||||
if($pfrenid!=''){
|
||||
$pfrenid = substr($pfrenid,1);
|
||||
$pfren = substr($pfren,1);
|
||||
}
|
||||
if($pfrenids!=''){
|
||||
$pfrenids = substr($pfrenids, 1);
|
||||
$pfrens = substr($pfrens, 1);
|
||||
}
|
||||
|
||||
|
||||
$this->update(array(
|
||||
'pfrenid' => $pfrenid,
|
||||
'pfren' => $pfren,
|
||||
'pfrenids' => $pfrenids,
|
||||
'pfrens' => $pfrens,
|
||||
), $mid);
|
||||
|
||||
//发给对应人通知
|
||||
$this->loaddata($mid, false);
|
||||
$this->numtodosend('pftodo','评分');
|
||||
}
|
||||
}
|
||||
return $keox;
|
||||
}
|
||||
private function xuyuns($rs){
|
||||
$pinlv = $rs['pinlv'];
|
||||
$sctime = $rs['sctime'];
|
||||
if(isempt($sctime))return false;
|
||||
if($pinlv=='d')return true; //每天
|
||||
if($pinlv=='m'){
|
||||
if(date('d')==date('d', strtotime($sctime)))return true;
|
||||
}
|
||||
//每季度
|
||||
if($pinlv=='j'){
|
||||
$m = (int)date('m');
|
||||
$jdr = array(1,4,7,10);
|
||||
if(in_array($m, $jdr)){
|
||||
if(date('d')==date('d', strtotime($sctime)))return true;
|
||||
}
|
||||
}
|
||||
//每年
|
||||
if($pinlv=='y'){
|
||||
if(date('m-d')==date('m-d', strtotime($sctime)))return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//获取评分人
|
||||
private function getpftype($urs, $rs2){
|
||||
$pftype = $rs2['pftype'];
|
||||
$sid = '';
|
||||
$sna = '';
|
||||
if(!isempt($rs2['pfren'])){
|
||||
$sid = $rs2['pfrenid'];
|
||||
$sna = $rs2['pfren'];
|
||||
}
|
||||
if($pftype=='my'){
|
||||
$sid = $urs['id'];
|
||||
$sna = $urs['name'];
|
||||
}
|
||||
//上级
|
||||
if($pftype=='super' && $sid==''){
|
||||
$sua = $this->adminmodel->getsuperman($urs['id']);
|
||||
if($sua){
|
||||
$sid = $sua[0];
|
||||
$sna = $sua[1];
|
||||
}
|
||||
}
|
||||
return array($sid, $sna);
|
||||
}
|
||||
|
||||
public function defen($mid)
|
||||
{
|
||||
$rows = m('hrcheckn')->getall('`mid`='.$mid.'');
|
||||
$fshu = 0;
|
||||
$pfren = $pfrenid = $pfrenids = $pfrens = '';
|
||||
foreach($rows as $k=>$rs){
|
||||
$fshu += floatval($rs['defen']) * floatval($rs['weight']) * 0.01;
|
||||
|
||||
if(!isempt($rs['optid']) && !contain(','.$pfrenid.',',','.$rs['optid'].',')){
|
||||
$pfren .= ','.$rs['optname'];
|
||||
$pfrenid .= ','.$rs['optid'];
|
||||
}
|
||||
|
||||
if(isempt($rs['optdt']) && !isempt($rs['optid']) && !contain(','.$pfrenids.',',','.$rs['optid'].',')){
|
||||
$pfrenids .= ','.$rs['optid'];
|
||||
$pfrens .= ','.$rs['optname'];
|
||||
}
|
||||
}
|
||||
|
||||
if($pfrenid!=''){
|
||||
$pfrenid = substr($pfrenid,1);
|
||||
$pfren = substr($pfren,1);
|
||||
}
|
||||
if($pfrenids!=''){
|
||||
$pfrenids = substr($pfrenids, 1);
|
||||
$pfrens = substr($pfrens, 1);
|
||||
}
|
||||
|
||||
$this->update(array(
|
||||
'pfrenid' => $pfrenid,
|
||||
'pfren' => $pfren,
|
||||
'pfrenids' => $pfrenids,
|
||||
'pfrens' => $pfrens,
|
||||
'fen' => $fshu,
|
||||
), $mid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交评分
|
||||
*/
|
||||
public function pingfen()
|
||||
{
|
||||
$str = $this->rock->post('str');
|
||||
$star= c('array')->strtoarray($str);
|
||||
$dbn = m('hrcheckn');
|
||||
foreach($star as $kv2){
|
||||
$sid = $kv2[0];
|
||||
$defen = $kv2[1];
|
||||
|
||||
$uarr = array(
|
||||
'defen' => $defen,
|
||||
'optdt' => $this->rock->now
|
||||
);
|
||||
|
||||
$dbn->update($uarr, $sid);
|
||||
}
|
||||
$this->defen($this->id);
|
||||
$sm = $this->rock->post('sm');
|
||||
|
||||
$this->addlog(array(
|
||||
'name' => '评分',
|
||||
'explain' => $sm
|
||||
));
|
||||
//$this->numtodosend('pftz','评分', $sm);
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
}
|
||||
45
webmain/model/flow/hrkaohemModel.php
Normal file
45
webmain/model/flow/hrkaohemModel.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
//考核项目
|
||||
class flow_hrkaohemClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->pinlva['d'] = '每天';
|
||||
$this->pinlva['w'] = '每周一';
|
||||
$this->pinlva['m'] = '每月';
|
||||
$this->pinlva['j'] = '每季度';
|
||||
$this->pinlva['y'] = '每年';
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$pinlv = $rs['pinlv'];
|
||||
|
||||
$rs['pinlv'] = arrvalue($this->pinlva, $pinlv);
|
||||
$sctime = $rs['sctime'];
|
||||
if($pinlv=='m'){
|
||||
$rs['sctime'] = $rs['pinlv'].date('d号H:i', strtotime($sctime));
|
||||
}
|
||||
if($pinlv=='j'){
|
||||
$rs['sctime'] = $rs['pinlv'].'首月的'.date('d号H:i', strtotime($sctime));
|
||||
}
|
||||
if($pinlv=='y'){
|
||||
$rs['sctime'] = $rs['pinlv'].date('m月d号H:i', strtotime($sctime));;
|
||||
}
|
||||
if($lx==2){
|
||||
$zbdata = $this->db->getall("select * from `[Q]hrkaohes` where `mid`='".$rs['id']."' order by `sort`");
|
||||
$str = '';
|
||||
foreach($zbdata as $k1=>$rs1)$str.=''.$rs1['itemname'].'('.$rs1['weight'].'%);';
|
||||
$rs['temp_zbcont'] = $str;
|
||||
|
||||
$zbdata = $this->db->getall("select * from `[Q]hrkaohen` where `mid`='".$rs['id']."' order by `sort`");
|
||||
$str = '';
|
||||
foreach($zbdata as $k1=>$rs1)$str.=''.$rs1['pfname'].'('.$rs1['pfweight'].'%);';
|
||||
$rs['temp_pfren'] = $str;
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
}
|
||||
23
webmain/model/flow/hrmanshiModel.php
Normal file
23
webmain/model/flow/hrmanshiModel.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* 人事模块.面试安排
|
||||
*/
|
||||
class flow_hrmanshiClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$statearr = array('待面试','录用','不适合');
|
||||
$rs['state'] = arrvalue($statearr, $rs['state']);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//面试处理,不时候
|
||||
protected function flowcheckbefore($zt=0, $ufied=null, $sm='')
|
||||
{
|
||||
$num = $this->nowcourse['num'];
|
||||
if($zt==2 && $num=='msque'){
|
||||
$this->update('state=2', $this->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
webmain/model/flow/hrpositiveModel.php
Normal file
22
webmain/model/flow/hrpositiveModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 人事模块.转正的
|
||||
*/
|
||||
class flow_hrpositiveClassModel extends flowModel
|
||||
{
|
||||
//审核完成处理
|
||||
protected function flowcheckfinsh($zt){
|
||||
m('hr')->hrrun();
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$where = '';
|
||||
if($key!='')$where.=" and (b.udeptname like '%$key%' or b.`uname` like '%$key%')";
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'leftbill' => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
22
webmain/model/flow/hrredundModel.php
Normal file
22
webmain/model/flow/hrredundModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 人事模块.离职的
|
||||
*/
|
||||
class flow_hrredundClassModel extends flowModel
|
||||
{
|
||||
//审核完成处理
|
||||
protected function flowcheckfinsh($zt){
|
||||
m('hr')->hrrun();
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$where = '';
|
||||
if($key!='')$where.=" and (b.udeptname like '%$key%' or b.`uname` like '%$key%')";
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'leftbill' => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
46
webmain/model/flow/hrsalarmModel.php
Normal file
46
webmain/model/flow/hrsalarmModel.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
//薪资模版
|
||||
class flow_hrsalarmClassModel extends flowModel
|
||||
{
|
||||
protected $flowcompanyidfieds = 'none'; //不要多单位判断,是共享的
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
return array(
|
||||
'order' => '`sort`,`id`'
|
||||
);
|
||||
}
|
||||
|
||||
//读取字段
|
||||
public function xinzifields()
|
||||
{
|
||||
$mid = m('flow_set')->getmou('id',"`num`='hrsalary'");
|
||||
$rows = m('flow_element')->getall("`mid`='$mid'",'*','iszb,sort');
|
||||
$barr = array();
|
||||
$nofar = explode(',','uname,udeptname,postjt,mones,money,ranking,month,ispay,explain,isturn,status');
|
||||
foreach($rows as $k=>$rs){
|
||||
if(in_array($rs['fields'], $nofar))continue;
|
||||
$barr[] = array(
|
||||
'name'=>$rs['name'],
|
||||
'value'=>$rs['fields'],
|
||||
'subname'=>$rs['fields']
|
||||
);
|
||||
}
|
||||
|
||||
return $barr;
|
||||
}
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$month = date('Y-m');
|
||||
if($rs['status']=='0' || $rs['enddt']<$month || $rs['startdt']>$month)$rs['ishui']=1;
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
398
webmain/model/flow/hrsalaryModel.php
Normal file
398
webmain/model/flow/hrsalaryModel.php
Normal file
@@ -0,0 +1,398 @@
|
||||
<?php
|
||||
class flow_hrsalaryClassModel extends flowModel
|
||||
{
|
||||
protected $flowviewufieds = 'xuid';
|
||||
|
||||
public $floweditother = true; //可编辑uid别人的单据
|
||||
|
||||
//薪资是个严格的模块,只能设置权限后才可以查看,不管是不是管理员
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$dt = $this->rock->post('dt');
|
||||
$ispay = $this->rock->post('ispay');
|
||||
$isturn = $this->rock->post('isturn');
|
||||
$where = '';
|
||||
$where = $this->viewmodel->viewwhere($this->moders, $this->adminid, $this->flowviewufieds, 1);
|
||||
if($lx=='faf'){
|
||||
$where.=' and a.`status`=1';
|
||||
}
|
||||
if($ispay!='')$where.=' and a.`ispay`='.$ispay.'';
|
||||
if($isturn!='')$where.=' and a.`isturn`='.$isturn.'';
|
||||
|
||||
//自己部门下的
|
||||
if($lx=='dept'){
|
||||
$uidall = $this->adminmodel->getdown($uid);
|
||||
if(isempt($uidall))$uidall='0';
|
||||
$where.=' and a.`xuid` in('.$uidall.')';
|
||||
}
|
||||
//echo $where;
|
||||
|
||||
//if($key!='')$where.=" and (c.deptallname like '%$key%' or a.uname like '%$key%' or a.ranking like '%$key%' )";
|
||||
if($dt!='')$where.=" and a.`month`='$dt'";
|
||||
return array(
|
||||
'where' => $where,
|
||||
'orlikefields' => 'c.`deptallname`,a.`uname`,a.`ranking`',
|
||||
'tableleft' => '`[Q]userinfo` c on a.`xuid`=c.`id`',
|
||||
'fieldsleft'=> 'c.`num`,c.deptallname,c.`bankname`,c.`banknum`',
|
||||
'order' => 'a.`month` desc,a.`id` asc',
|
||||
);
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0){
|
||||
$s = '<font color=red>待发放</font>';
|
||||
$rs['ispays'] = $rs['ispay'];
|
||||
if($rs['ispay']==1)$s = '<font color=green>已发放</font>';
|
||||
$rs['ispay'] = $s;
|
||||
|
||||
$s = '<font color=red>待核算</font>';
|
||||
if($rs['isturn']==1)$s = '<font color=green>已核算</font>';
|
||||
$rs['isturnss'] = $s;
|
||||
|
||||
//详情展示时
|
||||
if($lx==1){
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
private function fafang()
|
||||
{
|
||||
$this->addlog(array(
|
||||
'name' => '发放'
|
||||
));
|
||||
$this->update('ispay=1', $this->id);
|
||||
m('reim')->asynurl('asynrun','salaryff', array(
|
||||
'id' => $this->id
|
||||
));//异步通知给人员
|
||||
}
|
||||
|
||||
public function todouser()
|
||||
{
|
||||
$this->push($this->rs['xuid'],'工资条','您['.$this->rs['month'].']月份薪资已发放,请注意查看对账。','薪资发放通知');
|
||||
}
|
||||
|
||||
public function gongzifafang($sid)
|
||||
{
|
||||
$sarrid = explode(',',$sid);
|
||||
foreach($sarrid as $id){
|
||||
$this->loaddata($id, false);
|
||||
if($this->rs['status']==1 && $this->rs['ispay']==0)$this->fafang();
|
||||
}
|
||||
}
|
||||
|
||||
//一键生成薪资
|
||||
public function createdata($month)
|
||||
{
|
||||
$lmonth = c('date')->adddate($month.'-01','m',-1, 'Y-m');
|
||||
$swer = m('admin')->monthuwhere($month);
|
||||
$where = "`month`<'$month' and xuid in(select id from `[Q]userinfo` where 1=1 $swer) and `xuid` not in(select xuid from `[Q]".$this->mtable."` where `month`='$month')";
|
||||
$addfes = 'base,postjt';//基本工资跟岗位工资
|
||||
|
||||
$adees = explode(',', $addfes);
|
||||
$rows = $this->db->getall("select * from `[Q]hrsalary` where $where order by `month` desc");
|
||||
$count = 0;
|
||||
$xuarr = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
unset($rs['id']);
|
||||
$xuid = $rs['xuid'];
|
||||
if(isset($xuarr[$xuid]))continue;
|
||||
$count++;
|
||||
$xuarr[$xuid] = 1;
|
||||
$arr = array();
|
||||
$arr1 = array(
|
||||
'xuid' => $xuid,
|
||||
'uname' => $rs['uname'],
|
||||
'ranking' => $rs['ranking'],
|
||||
'udeptname' => $rs['udeptname'],
|
||||
'uid' => $this->adminid,
|
||||
'optid' => $this->adminid,
|
||||
'optname' => $this->adminname,
|
||||
'optdt' => $this->rock->now,
|
||||
'applydt' => $this->rock->date,
|
||||
'status' => 0,
|
||||
'isturn' => 0,
|
||||
'month' => $month,
|
||||
);
|
||||
foreach($adees as $adees1)$arr[$adees1]=$rs[$adees1];
|
||||
|
||||
foreach($arr1 as $k1=>$v1)$arr[$k1]=$v1;
|
||||
$arr['explain']='一键生成参考了'.$rs['month'].'月份的工资';
|
||||
|
||||
//读取固定值的
|
||||
$farrr = $this->getfiearrs($xuid, $month);
|
||||
foreach($farrr as $k1=>$rs1){
|
||||
foreach($rs1['fieldsarr'] as $k2=>$rs2){
|
||||
if($rs2['type']=='0')$arr[$rs2['fields']] = $rs2['devzhi'];
|
||||
|
||||
if($rs2['gongsi']=='last')$arr[$rs2['fields']] = $rs[$rs2['fields']]; //读取上月
|
||||
}
|
||||
}
|
||||
|
||||
$arr['jxdf'] = '0';
|
||||
$arr['jiansr'] = '0';
|
||||
$arr['otherzj'] = '0';
|
||||
$arr['otherjs'] = '0';
|
||||
|
||||
/*
|
||||
$money = 0;
|
||||
|
||||
|
||||
foreach($adees as $fid){
|
||||
$arr[$fid] = $rs[$fid];
|
||||
$money += floatval($rs[$fid]);
|
||||
}
|
||||
$money -= floatval($rs['socials']);
|
||||
$arr['money'] = $money;*/
|
||||
|
||||
$this->insert($arr);
|
||||
}
|
||||
return '成功生成'.$count.'条';
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr = array(
|
||||
'uname' => '貂蝉',
|
||||
'month' => '[2017-08]',
|
||||
'base' => '1700',
|
||||
'skilljt' => '3500',
|
||||
'telbt' => '0',
|
||||
'travelbt' => '0',
|
||||
'postjt' => '500',
|
||||
'reward' => '0',
|
||||
'jiabans' => '0',
|
||||
|
||||
'punish' => '0', //处罚
|
||||
'socials' => '0',
|
||||
'taxes' => '0',
|
||||
'money' => '5700',
|
||||
'explain' => '本月薪资',
|
||||
'isturn' => '是',
|
||||
'status' => '是',
|
||||
|
||||
);
|
||||
$barr1 = array(
|
||||
'uname' => '大乔',
|
||||
'month' => '[2017-08]',
|
||||
'base' => '1700',
|
||||
'skilljt' => '3000',
|
||||
'telbt' => '0',
|
||||
'travelbt' => '0',
|
||||
'postjt' => '500',
|
||||
'reward' => '0',
|
||||
'jiabans' => '0',
|
||||
|
||||
'explain' => '本月薪资',
|
||||
|
||||
'punish' => '0', //处罚
|
||||
'socials' => '0',
|
||||
'taxes' => '0',
|
||||
'money' => '5200',
|
||||
'isturn' => '是',
|
||||
'status' => '是',
|
||||
|
||||
);
|
||||
$barr2 = array(
|
||||
'uname' => '小乔',
|
||||
'month' => '[2017-08]',
|
||||
'base' => '1700',
|
||||
'skilljt' => '2500',
|
||||
'telbt' => '0',
|
||||
'travelbt' => '0',
|
||||
'postjt' => '500',
|
||||
'reward' => '0',
|
||||
'jiabans' => '0',
|
||||
|
||||
'explain' => '导入',
|
||||
|
||||
'punish' => '5', //处罚
|
||||
'socials' => '0',
|
||||
'taxes' => '0',
|
||||
'money' => '4695',
|
||||
'isturn' => '是',
|
||||
'status' => '是',
|
||||
|
||||
);
|
||||
return array($barr,$barr1,$barr2);
|
||||
}
|
||||
|
||||
//导入之前判断
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$uarra = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$name = $rs['uname'];
|
||||
|
||||
$month = str_replace('[','', $rs['month']);
|
||||
$month = substr(str_replace(']','', $month),0,7);
|
||||
|
||||
$arr = $rs;
|
||||
$urs = $this->adminmodel->getone("`name`='$name'");
|
||||
if(!$urs)continue;
|
||||
|
||||
$to = $this->rows("`xuid`='".$urs['id']."' and `month`='$month'");
|
||||
if($to>0)continue;//已经存在了
|
||||
|
||||
$arr['month'] = $month;
|
||||
$arr['xuid'] = $urs['id'];
|
||||
$arr['udeptname'] = $urs['deptname'];
|
||||
$arr['ranking'] = $urs['ranking'];
|
||||
|
||||
$arr['isturn'] = (arrvalue($arr,'isturn')=='是') ? 1 : 0;
|
||||
$arr['status'] = (arrvalue($arr,'status')=='是') ? 1 : 0;
|
||||
$arr['ispay'] = (arrvalue($arr,'ispay')=='是') ? 1 : 0;
|
||||
|
||||
if($arr['status']==1)$arr['isturn'] = 1;
|
||||
|
||||
$inarr[] = $arr;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
|
||||
//导入后处理,未审核需要提交审核
|
||||
public function flowdaoruafter($drdata=array())
|
||||
{
|
||||
foreach($drdata as $k=>$rs){
|
||||
//
|
||||
//if($rs['status']==0 && $rs['isturn']==1){
|
||||
// $id = $rs['id'];
|
||||
// $this->loaddata($id, false);
|
||||
// $this->submit('提交');
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//读取薪资模版上的
|
||||
private $pipeibarr = array();
|
||||
public function getfiearrs($uid, $month, $bo=true)
|
||||
{
|
||||
if($this->pipeibarr && $bo)return $this->pipeibarr;
|
||||
$month= substr($month, 0, 7);
|
||||
$rows = m('hrsalarm')->getall("`status`=1 and `startdt`<='$month' and `enddt`>='$month'",'*','`sort`');
|
||||
$rowa = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$rs['xuhao'] = $k+1;
|
||||
$rowa[$rs['atype']][] = $rs;
|
||||
}
|
||||
$kqob = m('kaoqin');
|
||||
$dbs = m('hrsalars');
|
||||
$garr = array();
|
||||
foreach($rowa as $klx=>$carr){
|
||||
$xu = $kqob->getpipeimid($uid, $carr, 'xuhao',0);
|
||||
if($xu>0){
|
||||
$nrsaa = $rows[$xu-1];
|
||||
$nrsaa['fieldsarr'] = $dbs->getall('mid='.$nrsaa['id'].'','*','`sort`');
|
||||
$garr[] = $nrsaa;
|
||||
}
|
||||
}
|
||||
|
||||
if($bo)$this->pipeibarr = $garr; //最后匹配到的模版
|
||||
|
||||
//echo $xu;
|
||||
return $garr;
|
||||
}
|
||||
|
||||
public function flowgetfields($lx)
|
||||
{
|
||||
$farr = $this->flowfieldarr($this->fieldsarra, 3);
|
||||
$barr = array();
|
||||
foreach($farr as $k=>$rs){
|
||||
if(isset($rs['iszs']) && $rs['iszs']==2)$barr[$rs['fields']]=$rs['name'];
|
||||
}
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//先运行这个$lx=0,1移动端,2保存,3展示
|
||||
public function flowfieldarr($farr, $lx)
|
||||
{
|
||||
$mid = (int)$this->rock->get('mid','0');
|
||||
$demonth = c('date')->adddate($this->rock->date,'m',-1,'Y-m');
|
||||
$dexuid = $this->adminid;
|
||||
if($mid>0 && $mrs=$this->getone($mid)){
|
||||
$demonth = $mrs['month'];
|
||||
$dexuid = $mrs['xuid'];
|
||||
}
|
||||
|
||||
$month= $this->rock->post('month', $demonth);
|
||||
$xuid = (int)$this->rock->post('xuid', $dexuid);
|
||||
|
||||
$cfarr= $this->getfiearrs($xuid, $month);
|
||||
$fnar = array();
|
||||
foreach($cfarr as $k=>$rs){
|
||||
foreach($rs['fieldsarr'] as $k1=>$rs1)$fnar[$rs1['fields']]=$rs1;
|
||||
}
|
||||
$urs = $this->adminmodel->getone($xuid);
|
||||
|
||||
foreach($farr as $k=>$rs){
|
||||
$farr[$k]['suantype']=-1;
|
||||
$fid = $rs['fields'];
|
||||
if(isset($fnar[$fid])){
|
||||
$nfrs = $fnar[$fid];
|
||||
if($nfrs['gongsi']=='last')$nfrs['gongsi']='';
|
||||
$farr[$k]['dev'] = $nfrs['devzhi'];
|
||||
$farr[$k]['gongsi'] = $nfrs['gongsi']; //公式
|
||||
$farr[$k]['islu'] = 1;
|
||||
$farr[$k]['iszs'] = 2;
|
||||
$farr[$k]['suantype']= $nfrs['type'];
|
||||
}
|
||||
if($fid=='month'){
|
||||
$farr[$k]['dev'] = $month;
|
||||
}
|
||||
if($fid=='uname'){
|
||||
$farr[$k]['dev'] = ''.$urs['name'].'|'.$xuid.'';
|
||||
}
|
||||
if($fid=='udeptname'){
|
||||
$farr[$k]['dev'] = $urs['deptname'];
|
||||
}
|
||||
if($fid=='ranking'){
|
||||
$farr[$k]['dev'] = $urs['ranking'];
|
||||
}
|
||||
if($fid=='gonghao'){
|
||||
$farr[$k]['dev'] = $urs['num'];
|
||||
}
|
||||
}
|
||||
|
||||
return $farr;
|
||||
}
|
||||
|
||||
//在运行这个,模版处理
|
||||
public function flowinputtpl($cont, $lx)
|
||||
{
|
||||
//pc
|
||||
if($lx==0){
|
||||
$cfarr = $this->pipeibarr;
|
||||
$str = '';
|
||||
foreach($cfarr as $k=>$rs){
|
||||
$carr = $rs['fieldsarr'];
|
||||
if(isempt($rs['title']))$rs['title']=$rs['atype'];
|
||||
$str.='<div><br><strong>'.$rs['title'].'</strong></div>';
|
||||
if(count($carr)%2!=0)$carr[]=array(
|
||||
'name' => '',
|
||||
'fields' => '',
|
||||
);
|
||||
$str.='<table width="100%" border="0" class="ke-zeroborder">';
|
||||
$str.='<tr>';
|
||||
foreach($carr as $k1=>$rs1){
|
||||
$str.='<td align="right" class="ys1" width="15%">'.$rs1['name'].'</td>';
|
||||
$str.='<td class="ys2" width="35%">{'.$rs1['fields'].'}</td>';
|
||||
|
||||
if(($k1+1)%2==0)$str.='</tr><tr>';
|
||||
}
|
||||
$str.='</tr>';
|
||||
$str.='</table>';
|
||||
}
|
||||
$cont = str_replace('{autotpl}', $str, $cont);
|
||||
}
|
||||
return $cont;
|
||||
}
|
||||
|
||||
public function flowviewtpl($cont, $lx)
|
||||
{
|
||||
$this->getfiearrs($this->rs['xuid'], $this->rs['month']);
|
||||
return $this->flowinputtpl($cont, $lx);
|
||||
}
|
||||
}
|
||||
17
webmain/model/flow/hrshebaoModel.php
Normal file
17
webmain/model/flow/hrshebaoModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
class flow_hrshebaoClassModel extends flowModel
|
||||
{
|
||||
protected $flowcompanyidfieds = 'none'; //不要多单位判断,是共享的
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$month = date('Y-m');
|
||||
if($rs['status']=='0' || $rs['enddt']<$month || $rs['startdt']>$month)$rs['ishui']=1;
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
22
webmain/model/flow/hrtransferModel.php
Normal file
22
webmain/model/flow/hrtransferModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 人事模块.调动的
|
||||
*/
|
||||
class flow_hrtransferClassModel extends flowModel
|
||||
{
|
||||
//审核完成处理
|
||||
protected function flowcheckfinsh($zt){
|
||||
m('hr')->hrrun();
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$where = '';
|
||||
if($key!='')$where.=" and (tranname like '%$key%' or olddeptname like '%$key%' or newdeptname like '%$key%' or oldranking like '%$key%' or newranking like '%$key%' or `trantype`='$key')";
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => '`optdt` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
18
webmain/model/flow/hrtrsalaryModel.php
Normal file
18
webmain/model/flow/hrtrsalaryModel.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* 人事模块.调薪
|
||||
*/
|
||||
class flow_hrtrsalaryClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$where = '';
|
||||
if($key!='')$where.=" and (b.udeptname like '%$key%' or b.`uname` like '%$key%')";
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'leftbill' => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
59
webmain/model/flow/jiabanModel.php
Normal file
59
webmain/model/flow/jiabanModel.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
//加班
|
||||
class flow_jiabanClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['modenum'] = $this->modenum;
|
||||
$type = arrvalue($rs,'jiatype','0');
|
||||
$types = array('调休','加班费');
|
||||
$rs['jiatype'] = $types[$type];
|
||||
$dakatime = '未打卡';
|
||||
|
||||
//详情时读取前后2小时打卡记录
|
||||
if($lx==1){
|
||||
$stime = date('Y-m-d H:i:s', strtotime($rs['stime'])-3600*2);
|
||||
$etime = date('Y-m-d H:i:s', strtotime($rs['etime'])+3600*2);
|
||||
$kqdkjl = m('kqdkjl')->getall("`uid`='".$rs['uid']."' and `dkdt`>='$stime' and `dkdt`<='$etime'",'dkdt','`dkdt` desc');
|
||||
if($kqdkjl)$dakatime='';
|
||||
foreach($kqdkjl as $k=>$rs1){
|
||||
if($k>0)$dakatime.=', ';
|
||||
$dakatime.=''.$rs1['dkdt'].'';
|
||||
}
|
||||
}
|
||||
|
||||
if($type==1)$rs['jiatype'].=''.$rs['jiafee'].'元';
|
||||
if($type=='0')$rs['jiafee'] = '';
|
||||
|
||||
$rs['dakatime'] = $dakatime;
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowgetfields($lx)
|
||||
{
|
||||
$arr['dakatime'] = '此时间段打卡';
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `stime` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)m('flow:leave')->updateenddt();
|
||||
}
|
||||
|
||||
}
|
||||
33
webmain/model/flow/knowledgeModel.php
Normal file
33
webmain/model/flow/knowledgeModel.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
class flow_knowledgeClassModel extends flowModel
|
||||
{
|
||||
protected function flowchangedata(){
|
||||
$this->rs['content'] = c('html')->replace($this->rs['content']);
|
||||
}
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
return array('title'=>'');
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$typeid = (int)$this->rock->post('typeid','0');
|
||||
$key = $this->rock->post('key');
|
||||
if($typeid!='0'){
|
||||
$alltpeid = m('option')->getalldownid($typeid);
|
||||
$where .= ' and a.`typeid` in('.$alltpeid.')';
|
||||
}
|
||||
if($key != ''){
|
||||
$where.=" and (a.`title` like '%$key%' or b.`name` like '%$key%')";
|
||||
}
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => 'a.`sort`,a.`optdt` desc',
|
||||
'asqom' => 'a.',
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]option` b on a.`typeid`=b.`id`',
|
||||
'fields'=> 'a.id,a.title,a.adddt,a.optdt,a.optname,b.`name` as typename,a.`sort`'
|
||||
);
|
||||
}
|
||||
}
|
||||
126
webmain/model/flow/knowtikuModel.php
Normal file
126
webmain/model/flow/knowtikuModel.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
class flow_knowtikuClassModel extends flowModel
|
||||
{
|
||||
protected function flowchangedata(){
|
||||
$this->rs['content'] = c('html')->replace($this->rs['content']);
|
||||
|
||||
}
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->logobj = m('log');
|
||||
$this->typearr= array('单选','多选','判断题');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs,$isv=0)
|
||||
{
|
||||
if(isset($rs['typeid']))$rs['typeid'] = $this->db->getmou('[Q]option','name',"`id`='".$rs['typeid']."'");
|
||||
$rs['type'] = arrvalue($this->typearr, $rs['type']);
|
||||
if($isv==1){
|
||||
$ss = '<font color=#888888>停用</font>';
|
||||
if($rs['status']==1)$ss = '<font color=green>启用</font>';
|
||||
$rs['status'] = $ss;
|
||||
}
|
||||
|
||||
if($isv==2){
|
||||
$zt = $this->logobj->isread($this->mtable, $rs['id'], $this->adminid);
|
||||
if($zt>0)$rs['ishui']=1;
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$typeid = (int)$this->rock->post('typeid','0');
|
||||
$key = $this->rock->post('key');
|
||||
if($lx=='xuexi')$where='and a.`status`=1';
|
||||
if($typeid!='0'){
|
||||
$alltpeid = m('option')->getalldownid($typeid);
|
||||
$where .= ' and a.`typeid` in('.$alltpeid.')';
|
||||
}
|
||||
if($key != ''){
|
||||
$where.=" and (a.`title` like '%$key%' or b.`name` like '%$key%')";
|
||||
}
|
||||
return array(
|
||||
'where' => $where,
|
||||
'order' => 'a.`sort`,a.`optdt` desc',
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]option` b on a.`typeid`=b.`id`',
|
||||
'fields'=> 'a.*,b.name as typename',
|
||||
'asqom' => 'a.'
|
||||
);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr = array(
|
||||
'title' => '信呼要求PHP最低版本',
|
||||
'typeid' => '官网知识',
|
||||
'type' => '单选',
|
||||
'ana' => '5.2',
|
||||
'anb' => '5.3',
|
||||
'anc' => '5.4',
|
||||
'and' => '5.5',
|
||||
'answer' => 'B',
|
||||
'explain' => '详见官网说明使用',
|
||||
);
|
||||
$barr1 = array(
|
||||
'title' => '信呼要求MySql最低版本',
|
||||
'typeid' => '官网知识',
|
||||
'type' => '单选',
|
||||
'ana' => '5.0',
|
||||
'anb' => '5.3',
|
||||
'anc' => '5.4',
|
||||
'and' => '5.5',
|
||||
'ane' => '',
|
||||
'answer' => 'D',
|
||||
'explain' => '详见官网说明使用',
|
||||
);
|
||||
$barr2 = array(
|
||||
'title' => 'PHP如何连接数据库方式',
|
||||
'typeid' => '技术姿势/PHP知识',
|
||||
'type' => '多选',
|
||||
'ana' => 'mysql',
|
||||
'anb' => 'mysqli',
|
||||
'anc' => 'pdo',
|
||||
'and' => 'mssql',
|
||||
'ane' => 'com',
|
||||
'answer' => 'ABC',
|
||||
'explain' => 'D选项为别的数据库',
|
||||
);
|
||||
$barr3 = array(
|
||||
'title' => '信呼官网域名是rockoa.com',
|
||||
'typeid' => '官网知识',
|
||||
'type' => '判断题',
|
||||
'ana' => '正确',
|
||||
'anb' => '错误',
|
||||
'anc' => '',
|
||||
'and' => '',
|
||||
'answer' => 'A',
|
||||
'explain' => '',
|
||||
);
|
||||
return array($barr,$barr1,$barr2,$barr3);
|
||||
}
|
||||
|
||||
//导入之前
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$num = 'knowtikutype';
|
||||
if(ISMORECOM && $cnum=$this->adminmodel->getcompanynum())$num.='_'.$cnum.'';
|
||||
foreach($rows as $k=>$rs){
|
||||
$rs['typeid'] = $this->option->gettypeid($num,$rs['typeid']);
|
||||
$types = arrvalue($rs,'type');
|
||||
$type1 = 0;
|
||||
if($types=='多选')$type1 = 1;
|
||||
if($types=='判断题')$type1 = 2;
|
||||
$rs['type'] = $type1;
|
||||
$inarr[] = $rs;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
}
|
||||
123
webmain/model/flow/knowtraimModel.php
Normal file
123
webmain/model/flow/knowtraimModel.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* 考试培训
|
||||
*/
|
||||
class flow_knowtraimClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = explode(',','<font color=#ff6600>还未开始</font>,<font color=green>进行中</font>,<font color=#888888>已结束</font>');
|
||||
}
|
||||
|
||||
public function getstatestr($zt)
|
||||
{
|
||||
return arrvalue($this->statearr, $zt);
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['status']==1)$this->sendtodo();
|
||||
}
|
||||
|
||||
//审核完成后发通知
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)$this->sendtodo();
|
||||
}
|
||||
|
||||
//发通知给对应人员
|
||||
public function sendtodo()
|
||||
{
|
||||
$rows = m('knowtrais')->getall('mid='.$this->id.' and `isks`=0','uid');
|
||||
$ids = '';
|
||||
foreach($rows as $k=>$rs)$ids.=','.$rs['uid'].'';
|
||||
if($ids=='')return;
|
||||
$ids = substr($ids, 1);
|
||||
|
||||
$cont = ''.$this->adminname.'发布培训考试,主题:{title},时间{startdt}至{enddt}。';
|
||||
$this->push($ids,'', $cont);
|
||||
}
|
||||
|
||||
public function flowisreadqx()
|
||||
{
|
||||
$to = m('knowtrais')->rows('`mid`='.$this->id.' and `uid`='.$this->adminid.'');
|
||||
return $to>0;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs,$lx=0)
|
||||
{
|
||||
$zt = $rs['state'];
|
||||
$rs['state'] = $this->getstatestr($zt);
|
||||
if($lx==1 && $zt==1){
|
||||
//我当前状态
|
||||
$ors = m('knowtrais')->getone('`mid`='.$rs['id'].' and `uid`='.$this->adminid.'');
|
||||
if($ors){
|
||||
if($ors['isks']=='0'){
|
||||
$rs['state'] .= ' <a class="zhu" href="index.php?m=hr&a=kaoshi&d=main&id='.$this->id.'">去考试</a>';
|
||||
}else{
|
||||
$rs['state'] .= ' 已考试分数:'.$ors['fenshu'].'';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//更新题库状态
|
||||
public function reloadstate($id='')
|
||||
{
|
||||
$where = '1=1';
|
||||
if($id!='')$where='id in('.$id.')';
|
||||
$rows = $this->getall($where);
|
||||
$now = $this->rock->now;
|
||||
foreach($rows as $k=>$rs){
|
||||
$zt = 0;
|
||||
if($rs['enddt']<$now){
|
||||
$zt = 2;
|
||||
}else if($rs['startdt']<$now){
|
||||
$zt = 1;
|
||||
}
|
||||
if($zt!=$rs['state'])$this->update('`state`='.$zt.'', $rs['id']);
|
||||
}
|
||||
$rows = $this->db->getall('SELECT mid,count(1)stotal FROM `[q]knowtrais` where isks=1 GROUP BY mid');
|
||||
foreach($rows as $k=>$rs)$this->update('`ydshu`='.$rs['stotal'].'', $rs['mid']);
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$this->reloadstate();
|
||||
}
|
||||
|
||||
//每天通知未考试培训人员
|
||||
public function todaytodo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//选取选择题库的条件
|
||||
public function gettikuwhere($tiid, $dwid=0)
|
||||
{
|
||||
$str1 = '';
|
||||
if($dwid==0)$dwid = $this->adminmodel->getcompanyid();
|
||||
if(ISMORECOM)$str1 = " and `comid`=".$dwid."";
|
||||
if(isempt($tiid))return $str1;
|
||||
$sid = '';
|
||||
$tarr = explode(',', $tiid);
|
||||
$dbs = m('option');
|
||||
foreach($tarr as $sid1){
|
||||
$ssid = $dbs->getalldownid($sid1);
|
||||
$sid.=','.$ssid.'';
|
||||
}
|
||||
if($sid!=''){
|
||||
$sid = substr($sid, 1);
|
||||
return ' and `typeid` in('.$sid.')';
|
||||
}else{
|
||||
return $str1;
|
||||
}
|
||||
}
|
||||
|
||||
//删除单据时调用
|
||||
protected function flowdeletebill($sm)
|
||||
{
|
||||
m('knowtrais')->delete("`mid`='".$this->id."'");
|
||||
}
|
||||
}
|
||||
147
webmain/model/flow/kqdkjlModel.php
Normal file
147
webmain/model/flow/kqdkjlModel.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
class flow_kqdkjlClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected $flowcompanyidfieds = 'uid'; //多单位用这个关联
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->dateobj = c('date');
|
||||
|
||||
$this->typearr = explode(',','在线打卡,考勤机,手机定位,手动添加,异常添加,数据导入,接口导入,企业微信打卡,钉钉打卡,中控考勤机');//0-9
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示条件过滤
|
||||
*/
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$atype = $lx;
|
||||
$dt1 = $this->rock->post('dt1');
|
||||
$dt2 = $this->rock->post('dt2');
|
||||
$key = $this->rock->post('key');
|
||||
$s = '';
|
||||
$s = ' and a.`uid`='.$this->adminid.'';
|
||||
|
||||
//全部下属打卡
|
||||
if($lx=='down' || $lx=='dwdown'){
|
||||
$s = 'and '.$this->adminmodel->getdownwheres('b.id', $uid, 0);
|
||||
}
|
||||
if($atype=='all')$s ='';
|
||||
if(!isempt($dt1))$s.=" and a.`dkdt`>='$dt1'";
|
||||
if(!isempt($dt2))$s.=" and a.`dkdt`<='$dt2 23:59:59'";
|
||||
if(!isempt($key))$s.=" and (b.`name` like '%$key%' or b.`deptallname` like '%$key%' or b.`ranking` like '%$key%')";
|
||||
$fields = 'a.*,b.`name`,b.`deptname`';
|
||||
$tabls = $this->mtable;
|
||||
|
||||
$table = '`[Q]'.$tabls.'` a left join `[Q]userinfo` b on a.uid=b.id';
|
||||
return array(
|
||||
'where' => $s,
|
||||
'table' => $table,
|
||||
'order' => 'a.`id` desc',
|
||||
'fields'=> $fields
|
||||
);
|
||||
}
|
||||
|
||||
//替换
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$week = $this->dateobj->cnweek($rs['dkdt']);
|
||||
$rs['week'] = $week;
|
||||
$rs['type'] = $this->typearr[$rs['type']];
|
||||
if($week=='六' || $week=='日')$rs['ishui']= 1;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr[] = array(
|
||||
'base_name' => '管理员',
|
||||
'dkdt' => '2016-08-08 12:00:01',
|
||||
);
|
||||
$barr[] = array(
|
||||
'base_name' => '大乔',
|
||||
'dkdt' => '2017-08-22 08:55:01',
|
||||
);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//导入之前判断
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$uarr = array();
|
||||
$dtobj = c('date');
|
||||
foreach($rows as $k=>$rs){
|
||||
$name = $rs['base_name'];
|
||||
$dkdt = $rs['dkdt'];
|
||||
if(isempt($name) || isempt($dkdt))continue;
|
||||
|
||||
$dkdt = str_replace('/','-', $dkdt);
|
||||
if(!$dtobj->isdate($dkdt))continue;
|
||||
|
||||
if(isset($uarr[$name])){
|
||||
$uid = $uarr[$name];
|
||||
}else{
|
||||
$usar = $this->adminmodel->getrows("`name`='$name'",'id');
|
||||
if($this->db->count!=1)continue;
|
||||
$uid = $usar[0]['id'];
|
||||
$uarr[$name] = $uid;
|
||||
}
|
||||
|
||||
if($this->rows("`uid`='$uid' and `dkdt`='$dkdt'")>0)continue;
|
||||
$inarr[] = array(
|
||||
'uid' => $uid,
|
||||
'dkdt' => $dkdt,
|
||||
'type' => 5,
|
||||
);
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页考勤打卡记录
|
||||
*/
|
||||
public function homekqtotal()
|
||||
{
|
||||
$dt = $this->rock->date;
|
||||
$where= $this->adminmodel->getcompanywhere(5,'a.');
|
||||
$uarr = $this->db->getall('select a.id from `[Q]admin` a left join `[Q]userinfo` b on a.id=b.id where b.`iskq`=1 and a.`status`=1 '.$where.'');
|
||||
$uids = '0';
|
||||
$uarrs = array();
|
||||
foreach($uarr as $k=>$rs){
|
||||
$uids.=','.$rs['id'].'';
|
||||
$uarrs[$rs['id']] = '未打卡';
|
||||
}
|
||||
$rows = $this->db->getall("SELECT * FROM `[Q]kqanay` where `uid` in($uids) and `dt`='$dt' and sort=0");
|
||||
foreach($rows as $k=>$rs){
|
||||
$state = $rs['state'];
|
||||
if(!isempt($rs['states']))$state = $rs['states'];
|
||||
$uarrs[$rs['uid']] = $state;
|
||||
}
|
||||
|
||||
$ztarr = array();
|
||||
foreach($uarrs as $uid=>$zt){
|
||||
if(!isset($ztarr[$zt]))$ztarr[$zt]=0;
|
||||
$ztarr[$zt]++;
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
$data = array();
|
||||
foreach($ztarr as $zt=>$vs){
|
||||
$rows[] = array(
|
||||
'value' => $vs,
|
||||
'name' => $zt
|
||||
);
|
||||
$data[] = $zt;
|
||||
}
|
||||
return array(
|
||||
'rows' => $rows,
|
||||
'data' => $data,
|
||||
'dt' => $dt,
|
||||
);
|
||||
}
|
||||
}
|
||||
63
webmain/model/flow/kqdwModel.php
Normal file
63
webmain/model/flow/kqdwModel.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class flow_kqdwClassModel extends flowModel
|
||||
{
|
||||
protected $flowcompanyidfieds = 'uid'; //多单位用这个关联
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->dateobj = c('date');
|
||||
$this->typearr = explode(',','普通,事件,企业微信定位');
|
||||
}
|
||||
|
||||
//打开详情时跳转到地理位置显示
|
||||
protected function flowchangedata()
|
||||
{
|
||||
if(!isajax() && !isempt($this->rs['location_x'])){
|
||||
$url = 'index.php?m=kaoqin&a=location&d=main&id='.$this->id.'';
|
||||
$this->rock->location($url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示条件过滤
|
||||
*/
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$atype = $lx;
|
||||
$dt1 = $this->rock->post('dt1');
|
||||
$dt2 = $this->rock->post('dt2');
|
||||
$key = $this->rock->post('key');
|
||||
$s = '';
|
||||
$s = ' and b.id='.$this->adminid.'';
|
||||
|
||||
//全部下属打卡
|
||||
if($lx=='down'){
|
||||
$s = 'and '.$this->adminmodel->getdownwheres('b.id', $uid, 0);
|
||||
}
|
||||
if($atype=='all')$s ='';
|
||||
if(!isempt($dt1))$s.=" and a.`optdt`>='$dt1'";
|
||||
if(!isempt($dt2))$s.=" and a.`optdt`<='$dt2 23:59:59'";
|
||||
if(!isempt($key))$s.=" and (b.`name` like '%$key%' or b.`deptallname` like '%$key%' or b.`ranking` like '%$key%')";
|
||||
$fields = 'a.*,b.name,b.deptname';
|
||||
$tabls = $this->mtable;
|
||||
|
||||
$table = '`[Q]'.$tabls.'` a left join `[Q]userinfo` b on a.uid=b.id';
|
||||
return array(
|
||||
'where' => $s,
|
||||
'table' => $table,
|
||||
'order' => 'a.`id` desc',
|
||||
'fields'=> $fields
|
||||
);
|
||||
}
|
||||
|
||||
//替换
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$week = $this->dateobj->cnweek($rs['optdt']);
|
||||
$rs['week'] = $week;
|
||||
if($week=='六' || $week=='日')$rs['ishui']= 1;
|
||||
$rs['type']= arrvalue($this->typearr, $rs['type']);
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
48
webmain/model/flow/kqerrModel.php
Normal file
48
webmain/model/flow/kqerrModel.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
class flow_kqerrClassModel extends flowModel
|
||||
{
|
||||
|
||||
//审核完成了添加到打卡记录
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
m('kqdkjl')->insert(array(
|
||||
'uid' => $this->uid,
|
||||
'optdt' => $this->rock->now,
|
||||
'dkdt' => $this->rs['dt'].' '.$this->rs['ytime'],
|
||||
'type' => '4',
|
||||
'explain' => '['.$this->rs['errtype'].']'.$this->rs['explain'].'',
|
||||
));
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and a.`dt` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
protected function flowbillwhere33($uid, $lx)
|
||||
{
|
||||
$dt = $this->rock->date;
|
||||
$key = $this->rock->post('key');
|
||||
$month = $this->rock->post('month');
|
||||
$where = "a.`uid`=$uid";
|
||||
if($lx=='all'){
|
||||
$where = '1=1';
|
||||
}
|
||||
if($key!='')$where.= m('admin')->getkeywhere($key, 'b.');
|
||||
if($month !='')$where.=" and a.`dt` like '$month%'";
|
||||
return array(
|
||||
'where' => 'and '.$where,
|
||||
'fields'=> 'a.*,b.name,b.deptname,b.ranking',
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]admin` b on a.`uid`=b.`id`',
|
||||
'order' => 'a.`id` desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
20
webmain/model/flow/kqjsnModel.php
Normal file
20
webmain/model/flow/kqjsnModel.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
//考勤机设备
|
||||
class flow_kqjsnClassModel extends flowModel
|
||||
{
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
if(isempt($rs['lastdt'])){
|
||||
$rs['ishui'] = 1;
|
||||
}else{
|
||||
if(time()-strtotime($rs['lastdt'])>5*60)$rs['ishui'] = 1;//5分钟没请求
|
||||
}
|
||||
if($rs['space']>0)$rs['space'] = $this->rock->formatsize($rs['space']);
|
||||
if($rs['memory']>0)$rs['memory'] = $this->rock->formatsize($rs['memory']);
|
||||
|
||||
$kqjarr = array('群英','中控');
|
||||
if(isset($rs['pinpai']))$rs['pinpai'] = $kqjarr[$rs['pinpai']];
|
||||
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
123
webmain/model/flow/leaveModel.php
Normal file
123
webmain/model/flow/leaveModel.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
//请假条的
|
||||
class flow_leaveClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$rs['modenum'] = $this->modenum;
|
||||
$totday = floatval(arrvalue($rs,'totday','0'));
|
||||
if($totday>0)$rs['totals'].='('.$totday.'天)';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `stime` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 年假添加设置(自动添加),可计划任务没有运行一次,兑换为小时的,默认一天8小时
|
||||
*/
|
||||
public function autoaddleave($ndate='')
|
||||
{
|
||||
$type = 0; //根据哪个类型计算年:0根据入职日期,1根据转正日期
|
||||
$hour = (int)m('option')->getval('kqsbtime', 8); //默认一天8小时(请自己设定)
|
||||
if($hour<=0)$hour = 8;
|
||||
if($ndate=='')$ndate = $this->rock->date;
|
||||
if($ndate > $this->rock->date)return array();
|
||||
$Y = substr($ndate,0,4);
|
||||
$niana = array(
|
||||
// 开始 截止 年假天数
|
||||
array(0, 0, 0), //0-0年,0天
|
||||
array(1, 10, 5), //1年(含)-10年(含),5天
|
||||
array(11, 20, 10), //11年(含)-20年(含),10天
|
||||
array(21, 9999, 15), //21年(含)以上,15天
|
||||
);
|
||||
//配置可根据自己情况修改
|
||||
$adlx = array('workdate','positivedt');
|
||||
$adln = array('入职','转正');
|
||||
$dtobj= c('date');
|
||||
|
||||
$usea = $this->db->getall("select `uid` from `[Q]kqinfo` where `kind`='增加年假' and `status`=1 and `optname`='系统' and `stime` like '".$Y."-%'"); //系统已经自动添加过
|
||||
$uids = '0';
|
||||
foreach($usea as $k=>$rs)$uids.=','.$rs['uid'].'';
|
||||
$rows = $this->db->getall("select a.`id`,a.`name`,a.`workdate`,b.`positivedt` from `[Q]admin` a left join `[Q]userinfo` b on a.id=b.id where a.`status`=1 and a.id not in($uids) and b.`state`<>5");
|
||||
$barr = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$dt = $rs[$adlx[$type]];
|
||||
if(isempt($dt))continue;
|
||||
$dttime = strtotime($dt);
|
||||
$rs['dt'] = $dt;
|
||||
$jg = $dtobj->datediff('d', $dt, $ndate);
|
||||
$yea= (int)($jg/365); //年限
|
||||
if($yea==0)continue;//未满1年
|
||||
$nianday = 0; //年假条数
|
||||
foreach($niana as $k1=>$ns){
|
||||
if($yea>=$ns[0] && $yea<=$ns[1]){
|
||||
$nianday = $ns[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$dt = date(''.$Y.'-m-d', $dttime);
|
||||
if(strtotime($dt) > strtotime($ndate) )continue;//还没到对应日期
|
||||
|
||||
$rs['nianday'] = $nianday;
|
||||
$rs['nyear'] = $yea; //入职年限
|
||||
$rs['stime'] = $dt.' 00:00:00';
|
||||
$rs['etime'] = $dt.' 23:59:59';
|
||||
$rs['nianhour'] = $nianday * $hour; //小时
|
||||
$barr[] = $rs;
|
||||
}
|
||||
|
||||
//添加到kqinfo表上
|
||||
$dbs = m('kqinfo');
|
||||
foreach($barr as $k=>$rs){
|
||||
$uarr['uid'] = $rs['id'];
|
||||
$uarr['uname'] = $rs['name'];
|
||||
$uarr['stime'] = $rs['stime'];
|
||||
$uarr['etime'] = $rs['etime'];
|
||||
$uarr['kind'] = '增加年假';
|
||||
$uarr['status'] = '1';
|
||||
$uarr['totals'] = $rs['nianhour'];
|
||||
$uarr['optdt'] = $this->rock->now;
|
||||
$uarr['isturn'] = '1';
|
||||
$uarr['optname'] = '系统';
|
||||
$uarr['optid'] = '0';
|
||||
$uarr['applydt'] = $this->rock->date;
|
||||
$uarr['totday'] = $rs['nianday'];
|
||||
$uarr['explain'] = ''.$rs['dt'].''.$adln[$type].'年限满'.$rs['nyear'].'年添加年假'.$rs['nianday'].'天';
|
||||
$dbs->insert($uarr);
|
||||
}
|
||||
$this->updateenddt();
|
||||
return $barr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新年假/加班单的截止时间
|
||||
*/
|
||||
public function updateenddt()
|
||||
{
|
||||
$dbs = m('option');
|
||||
$jbuse = (int)$dbs->getval('kqjiabanuse', 0); //加班
|
||||
$njuse = (int)$dbs->getval('kqnianjiause', 0);
|
||||
$db = m('kqinfo');
|
||||
if($jbuse>0){
|
||||
$key = "CONCAT(date_format(date_add(stime,interval ".$jbuse." month),'%Y-%m-%d'),' ','23:59:59')";
|
||||
$db->update('enddt='.$key.'',"`kind`='加班' and `enddt` is null"); //兑换调休的
|
||||
}
|
||||
|
||||
if($njuse>0){
|
||||
$key = "CONCAT(date_format(date_add(stime,interval ".$njuse." month),'%Y-%m-%d'),' ','23:59:59')";
|
||||
$db->update('enddt='.$key.'',"`kind`='增加年假' and `enddt` is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
50
webmain/model/flow/leavehrModel.php
Normal file
50
webmain/model/flow/leavehrModel.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//考勤信息
|
||||
class flow_leavehrClassModel extends flowModel
|
||||
{
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
$barr[]=array(
|
||||
'uname' => '张飞',
|
||||
'kind' => '增加年假',
|
||||
'stime' => '2019-07-01 00:00:00',
|
||||
'etime' => '2020-07-01 00:00:00',
|
||||
'totals' => '16',
|
||||
'totday' => '2',
|
||||
'explain' => '奖励2天年假',
|
||||
|
||||
);
|
||||
$barr[]=array(
|
||||
'uname' => '赵子龙',
|
||||
'kind' => '增加陪产假',
|
||||
'stime' => '2019-07-01 08:00:00',
|
||||
'etime' => '2020-07-01 18:00:00',
|
||||
'totals' => '120',
|
||||
'totday' => '15',
|
||||
'explain' => '陪产假男性,一般15天是要一次休完',
|
||||
|
||||
);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//导入之前判断
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$urs = $this->adminmodel->geturs($rs['uname']);
|
||||
if(!$urs)return '行'.($k+1).'找不到对应人员:'.$rs['uname'].'';
|
||||
|
||||
$rs['uid'] = $urs['id'];
|
||||
$rs['uname'] = $urs['name'];
|
||||
$rs['comid'] = $urs['companyid'];
|
||||
$rs['applydt'] = $this->rock->date;
|
||||
|
||||
$rs['status']=1;
|
||||
$rs['isturn']=1;
|
||||
$inarr[] = $rs;
|
||||
}
|
||||
return $inarr;
|
||||
}
|
||||
}
|
||||
339
webmain/model/flow/meetModel.php
Normal file
339
webmain/model/flow/meetModel.php
Normal file
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
|
||||
class flow_meetClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->hyarra = array('正常','会议中','结束','取消');
|
||||
$this->hyarrb = array('green','blue','#ff6600','#888888');
|
||||
$this->dbobj = c('date');
|
||||
|
||||
$this->reatearr = array(
|
||||
'd' => '每天',
|
||||
'w1' => '每周一',
|
||||
'w2' => '每周二',
|
||||
'w3' => '每周三',
|
||||
'w4' => '每周四',
|
||||
'w5' => '每周五',
|
||||
'w6' => '每周六',
|
||||
'w7' => '每周日',
|
||||
'm' => '每月',
|
||||
'y' => '每年',
|
||||
);
|
||||
}
|
||||
|
||||
public function getratestore()
|
||||
{
|
||||
$arr = array();
|
||||
foreach($this->reatearr as $k=>$v)$arr[] = array(
|
||||
'value' => $k,
|
||||
'name' => $v
|
||||
);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if(arrvalue($rs, 'type')=='1'){
|
||||
$ztrs = '<font color=green>启用</font>';
|
||||
if($rs['status']=='0'){
|
||||
$ztrs = '<font color=#888888>停用</font>';
|
||||
$rs['ishui']=1;
|
||||
}
|
||||
if(!isempt($rs['rate']))$ztrs.=','.arrvalue($this->reatearr,$rs['rate']).''; //转未汉字
|
||||
$rs['state'] = $ztrs;
|
||||
return $rs;//说明是固定会议
|
||||
}
|
||||
$rs['week'] = $this->dbobj->cnweek($rs['startdt']);
|
||||
$zt = $rs['state'];
|
||||
$nzt = $zt;
|
||||
$time = time();
|
||||
|
||||
$stime = strtotime($rs['startdt']);
|
||||
$etime = strtotime($rs['enddt']);
|
||||
if($zt < 2){
|
||||
if($etime<$time){
|
||||
$nzt = 2;
|
||||
}else if($stime>$time){
|
||||
$nzt = 0;
|
||||
}else{
|
||||
$nzt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if($zt != $nzt){
|
||||
$this->update('state='.$nzt.'', $rs['id']);
|
||||
$zt = $nzt;
|
||||
}
|
||||
|
||||
$rs['ishui'] = ($zt>=2) ? 1 : 0;
|
||||
if($lx==1){
|
||||
$content = '';
|
||||
$inpurl = $this->getinputurl('meetjy',0,'def_mid='.$this->id.'');
|
||||
$rows = $this->getrows('`mid`='.$this->id.' and `type`=2','id,content,optname,optdt,optid','id');
|
||||
//是否可以加会议纪要
|
||||
$dtss = c('date')->adddate($this->rock->date,'d',-10).' 00:00:00';
|
||||
$addbo = $rs['startdt']>$dtss && $zt>0;
|
||||
$fobj = m('file');
|
||||
foreach($rows as $k=>$rs1){
|
||||
$content.= '<div style="border-bottom:1px #cccccc solid;padding:5px">['.$rs1['optname'].']纪要';
|
||||
$inpurl1 = $this->getinputurl('meetjy',$rs1['id']);
|
||||
if($addbo && $rs1['optid']==$this->adminid)$content.= ' <a href="'.$inpurl1.'" class="blue">[编辑]</a>';
|
||||
$content.= ':<br>'.$rs1['content'].'';
|
||||
$fstr = $fobj->getstr('meet', $rs1['id'], 2);
|
||||
if($fstr!='')$content.= '<br>'.$fstr.'';
|
||||
$content.= '</div>';
|
||||
}
|
||||
|
||||
if($addbo){
|
||||
$content.=' <a href="'.$inpurl.'" class="blue">+新增纪要</a>';
|
||||
}
|
||||
$rs['content']= $content;
|
||||
$rs['content_style'] = 'padding:0px';
|
||||
}
|
||||
$rs['state'] = $this->getstatezt($zt);
|
||||
$rs['nzt'] = $zt;
|
||||
if(isset($rs['issms'])){
|
||||
$issms = '否';
|
||||
if($rs['issms']==1)$issms = '是';
|
||||
$rs['issms'] = $issms;
|
||||
}
|
||||
|
||||
//打印时
|
||||
if($lx==3){
|
||||
if(substr($rs['startdt'],0,10)==$this->rock->date)$rs['startdt'] = substr($rs['startdt'],11);
|
||||
if(substr($rs['enddt'],0,10)==$this->rock->date)$rs['enddt'] = substr($rs['enddt'],11);
|
||||
$rs['ermurl'] = $this->rock->jm->base64encode(getconfig('outurl',URL).'task.php?a=x&num=meet&mid='.$rs['id'].'&showtype=qd');
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//签到菜单判断
|
||||
protected function flowgetoptmenu($num)
|
||||
{
|
||||
if($num=='qdnoup'){
|
||||
if($this->rock->get('showtype')!='qd')return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getstatezt($zt)
|
||||
{
|
||||
return '<font color="'.$this->hyarrb[$zt].'">'.$this->hyarra[$zt].'</font>';
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['status']==1){
|
||||
$this->tisongtodo();
|
||||
}
|
||||
//固定会议
|
||||
if($this->rs['type']=='1'){
|
||||
$this->createmeet($this->id);
|
||||
}
|
||||
}
|
||||
|
||||
//审核完成后发通知
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
private function tisongtodo()
|
||||
{
|
||||
if($this->rs['type']!='0')return;//这个是普通会议才需要通知。
|
||||
|
||||
if($this->rs['startdt'] < $this->rock->now)return;//已过期了
|
||||
|
||||
//发给参会人
|
||||
//$cont = '{optname}发起会议“{title}”在{hyname},时间{startdt}至{enddt}';
|
||||
//$this->push($this->rs['joinid'], '会议', $cont);
|
||||
$cont = "您好,您有一个新的会议计划。\n\n会议主题:{title}\n会议时间:{startdt}至{enddt}\n会议地点:{hyname}";
|
||||
$zcren= arrvalue($this->rs,'zcren');
|
||||
if(!isempt($zcren)){
|
||||
$cont.="\n会议主持人:{zcren}";
|
||||
}else{
|
||||
$cont.="\n发起人:{optname}";
|
||||
}
|
||||
$this->pushs($this->rs['joinid'], $cont, '会议通知');
|
||||
|
||||
$tplnum = m('option')->getval('meetsmstpl', 'meetapply');
|
||||
$this->sendsms($this->rs, $tplnum, array(
|
||||
'optname' => $this->adminname,
|
||||
'title' => $this->rs['title'],
|
||||
'hyname' => $this->rs['hyname'],
|
||||
'startdt' => $this->rs['startdt'],
|
||||
'enddt' => $this->rs['enddt'],
|
||||
));
|
||||
}
|
||||
|
||||
protected function flowaddlog($a)
|
||||
{
|
||||
$actname = $a['name'];
|
||||
if($actname == '取消会议'){
|
||||
$this->push($this->rs['joinid'], '会议', ''.$this->adminname.'取消会议“{title}”,时间{startdt}至{enddt},请悉知。');
|
||||
$this->update('`state`=3', $this->id);
|
||||
|
||||
$tplnum = m('option')->getval('meetsmstplqx', 'meetcancel');
|
||||
$this->sendsms($this->rs, $tplnum, array(
|
||||
'optname' => $this->adminname,
|
||||
'title' => $this->rs['title'],
|
||||
'hyname' => $this->rs['hyname'],
|
||||
'startdt' => $this->rs['startdt'],
|
||||
'enddt' => $this->rs['enddt'],
|
||||
));
|
||||
}
|
||||
if($actname == '结束会议'){
|
||||
$this->update('`state`=2', $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
//发短信提醒
|
||||
public function sendsms($rs, $tplnum, $params)
|
||||
{
|
||||
$receid = $rs['joinid'];
|
||||
$issms = arrvalue($rs,'issms');
|
||||
|
||||
if(isempt($receid) || $issms!='1')return;
|
||||
$jyid = $rs['jyid'];
|
||||
if(!isempt($jyid))$receid.=','.$jyid.''; //发个纪要人
|
||||
|
||||
$zcrenid= arrvalue($rs, 'zcrenid');
|
||||
if(!isempt($zcrenid))$receid.=','.$zcrenid.''; //发个主持人
|
||||
|
||||
$qiannum= ''; //签名编号,可以为空
|
||||
$barr = c('xinhuapi')->sendsms($receid, $qiannum, $tplnum, $params);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$dt = $this->rock->post('dt');
|
||||
$where = '';
|
||||
//固定会议
|
||||
if($lx=='allgd'){
|
||||
$where = 'and `type`=1';
|
||||
}else{
|
||||
$where = 'and `type`=0';
|
||||
}
|
||||
if($dt!='')$where.=" and startdt like '$dt%'";
|
||||
//$fields = 'id,startdt,enddt,optname,state,title,hyname,joinname,`explain`,jyname';
|
||||
return array(
|
||||
//'fields' => $fields,
|
||||
'where' => $where,
|
||||
'order' => 'startdt desc'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//每天运行计划任务将固定会议生成普通会议通知对应人
|
||||
public function createmeet($id=0, $nowdt='', $gbrr=false)
|
||||
{
|
||||
$owhe = '';
|
||||
if($id>0)$owhe='`id`='.$id.' and ';
|
||||
$narr = $this->getall(''.$owhe.'`type`=1 and `status`=1');
|
||||
$dtobj = c('date');
|
||||
$jlarr = array();
|
||||
foreach($narr as $k=>$rs){
|
||||
$gdt = $dtobj->daterate($rs['rate'], $rs['startdt'], $nowdt);
|
||||
if(!$gdt)continue;
|
||||
$startdt = ''.$gdt.' '.substr($rs['startdt'],11).'';
|
||||
$enddt = ''.$gdt.' '.substr($rs['enddt'],11).'';
|
||||
|
||||
$ars = $rs;
|
||||
$ars['mid'] = $rs['id'];
|
||||
$ars['type'] = '0';
|
||||
$ars['startdt'] = $startdt;
|
||||
$ars['enddt'] = $enddt;
|
||||
$ars['state'] = 0;
|
||||
$ars['rate'] = '';
|
||||
unset($ars['id']);
|
||||
$this->adminmodel->setcompanyid($rs['comid']);
|
||||
$GLOBALS['adminid'] = $ars['optid'];
|
||||
$where = "`mid`=".$rs['id']." and `startdt` like '".$gdt."%'";
|
||||
$ors = $this->getone($where);
|
||||
$uwerew = '';
|
||||
$iid = 0;
|
||||
if($ors){
|
||||
$iid = $ors['id'];
|
||||
$uwerew = "`id`='$iid'";
|
||||
}
|
||||
$jlarr[] = $ars;
|
||||
|
||||
if($gbrr)continue; //不写入数据库里
|
||||
|
||||
$this->record($ars, $uwerew);
|
||||
if($iid==0){
|
||||
$iid = $this->db->insert_id();
|
||||
$this->loaddata($iid, false);
|
||||
$this->tisongtodo();//通知
|
||||
}
|
||||
}
|
||||
|
||||
return $jlarr;
|
||||
}
|
||||
|
||||
|
||||
public function meettodo()
|
||||
{
|
||||
$rows = $this->getall("`state` in(0,1) and `type`=0 and `startdt` like '".$this->rock->date."%' and `status`=1");
|
||||
$time = time();
|
||||
foreach($rows as $k=>$rs){
|
||||
$this->adminmodel->setcompanyid($rs['comid']); //设置对应单位id
|
||||
$zt = $rs['state'];
|
||||
$dts = explode(' ', $rs['startdt']);
|
||||
$sttime = strtotime($rs['startdt']);
|
||||
$ettime = strtotime($rs['enddt']);
|
||||
$GLOBALS['adminid'] = $rs['optid'];
|
||||
$nzt = -1;
|
||||
if($ettime <= $time){
|
||||
$nzt = 2;
|
||||
}else{
|
||||
if($time >= $sttime && $time< $ettime){
|
||||
if($zt==0)$nzt = 1;
|
||||
}else{
|
||||
$jg = $sttime - $time;
|
||||
if($jg <= 600 && $zt==0){ //提前10分钟就提醒
|
||||
$ssj = floor($jg/60);
|
||||
$tzuid = $this->adminmodel->gjoin($rs['joinid']);
|
||||
|
||||
//$cont = '会议“'.$rs['title'].'”将在'.$ssj.'分钟后的'.$dts[1].'开始请做好准备,在会议室“'.$rs['hyname'].'”';
|
||||
$this->loaddata($rs['id'], false);
|
||||
$this->meettodos($rs, '您好,会议即将在'.$ssj.'分钟后的'.$dts[1].'开始,请准时参加。');//快到时间通知
|
||||
|
||||
//短信通知
|
||||
if($ssj<6)$this->sendsms($rs, 'meettodo', array(
|
||||
'fenz' => ''.$ssj.'',
|
||||
'title' => $rs['title'],
|
||||
'time' => $dts[1],
|
||||
'hyname' => $rs['hyname']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
if($nzt != -1)$this->update("`state`='$nzt'", $rs['id']);
|
||||
}
|
||||
}
|
||||
|
||||
private function meettodos($rs, $kss)
|
||||
{
|
||||
$receid = $rs['joinid'];
|
||||
if(isempt($receid))return;
|
||||
|
||||
$cont = "".$kss."\n\n会议主题:{title}\n会议时间:{startdt}至{enddt}\n会议地点:{hyname}";
|
||||
$zcren= arrvalue($rs,'zcren');
|
||||
if(!isempt($zcren)){
|
||||
$cont.="\n会议主持人:{zcren}";
|
||||
}else{
|
||||
$cont.="\n发起人:{optname}";
|
||||
}
|
||||
|
||||
$jyid = $rs['jyid'];
|
||||
if(!isempt($jyid))$receid.=','.$jyid.''; //发个纪要人
|
||||
|
||||
$zcrenid= arrvalue($rs, 'zcrenid');
|
||||
if(!isempt($zcrenid))$receid.=','.$zcrenid.''; //发个主持人
|
||||
|
||||
$this->pushs($receid, $cont, '会议提醒');
|
||||
}
|
||||
}
|
||||
144
webmain/model/flow/newsModel.php
Normal file
144
webmain/model/flow/newsModel.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
class flow_newsClassModel extends flowModel
|
||||
{
|
||||
private $readunarr = array();//未读人员
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->logobj = m('log');
|
||||
$this->htmlobj = c('html');
|
||||
}
|
||||
|
||||
protected function flowchangedata(){
|
||||
$cont = c('html')->replace($this->rs['content']);
|
||||
$fm = $this->rs['fengmian'];
|
||||
if(!isempt($fm)){
|
||||
$cont='<div align="center"><img src="'.$this->rock->gethttppath($fm).'"></div>'.$cont.'';
|
||||
}
|
||||
$url = $this->rs['url'];
|
||||
if(!isempt($url))$cont.='<div><a href="'.$url.'">查看原文>></a></div>';
|
||||
$this->rs['content'] = $cont;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$content = $rs['content'];
|
||||
if($lx==2){
|
||||
unset($rs['content']);
|
||||
$rs['smallcont'] = $this->neircong($content);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
//移动端列表
|
||||
public function flowrsreplace_we($row, $rs)
|
||||
{
|
||||
if(!isempt($rs['fengmian']))$row['picurl'] = $rs['fengmian'];
|
||||
return $row;
|
||||
}
|
||||
public function flowwesearchdata($lx)
|
||||
{
|
||||
if($lx==1)return $this->option->getselectdata('newstype', true);
|
||||
return array(
|
||||
'typename' => '所有分类',
|
||||
'searchmsg' => '新闻标题/分类',
|
||||
);
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['status']==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
//审核完成后发通知
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
public function getreceids($receid, $whe='')
|
||||
{
|
||||
$receid = $this->adminmodel->gjoin($receid,'ud','where');
|
||||
if($receid=='' || $receid=='all'){
|
||||
$where = '';
|
||||
}else{
|
||||
$where = 'and id>0 and ('.$receid.')';
|
||||
}
|
||||
$ids = '';
|
||||
$rows = $this->adminmodel->getall('`status`=1 '.$where.' '.$whe.'','id');
|
||||
foreach($rows as $k=>$rs)$ids.=',u'.$rs['id'].'';
|
||||
if($ids!='')$ids = substr($ids, 1);
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
private function neircong($nr)
|
||||
{
|
||||
$cont = $this->htmlobj->htmlremove($nr);
|
||||
$cont = $this->htmlobj->substrstr($cont,0, 50);
|
||||
if(strlen($cont)>40)$cont.='...';
|
||||
return $cont;
|
||||
}
|
||||
|
||||
|
||||
//发送推送通知
|
||||
private function tisongtodo()
|
||||
{
|
||||
//还没到展示时间就不发送提醒
|
||||
$zstart= arrvalue($this->rs, 'startdt');
|
||||
if(!isempt($zstart) && $zstart>$this->rock->date)return;
|
||||
|
||||
|
||||
$cont = $this->neircong($this->rs['content']);
|
||||
if(isempt($cont))$cont = $this->rs['title']; //为空时
|
||||
$this->push($this->rs['receid'], '', $cont, $this->rs['title'],1);
|
||||
|
||||
//添加短信提醒,短信提醒
|
||||
if(arrvalue($this->rs,'issms')=='1'){
|
||||
$receid = $this->rs['receid'];
|
||||
if(isempt($receid))$receid = 'all';
|
||||
$qiannum= '';
|
||||
$tplnum = 'gongsms';
|
||||
$params = array(
|
||||
'title' => $this->rs['title'],
|
||||
'typename' => $this->rs['typename'],
|
||||
);
|
||||
$url = $this->getxiangurlx();
|
||||
c('xinhuapi')->sendsms($receid, $qiannum, $tplnum, $params, $url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$typeid = (int)$this->rock->post('typeid','0');
|
||||
$keywere= '';
|
||||
if(!isempt($key))$keywere.=" and (`title` like '%$key%' or `typename`='$key')";
|
||||
$whyere = '';
|
||||
//我和我未读
|
||||
if($lx=='my'){
|
||||
$whyere= "and (`startdt` is null or `startdt`<='{$this->rock->date}')";
|
||||
$whyere.= " and (`enddt` is null or `enddt`>='{$this->rock->date}')";
|
||||
}
|
||||
if($typeid>0){
|
||||
$typename=$this->option->getmou('name', $typeid);
|
||||
$whyere.=" and `typename`='$typename'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'order' => '`istop` desc,`optdt` desc',
|
||||
'keywere' => $keywere,
|
||||
'where' => $whyere,
|
||||
'fields' => 'id,typename,optdt,title,optname,content,zuozhe,indate,recename,fengmian,mintou,`status`,`istop`,`appxs`'
|
||||
);
|
||||
}
|
||||
|
||||
//去掉标题
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
|
||||
$arr['title'] = '';
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
30
webmain/model/flow/officiaModel.php
Normal file
30
webmain/model/flow/officiaModel.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
class flow_officiaClassModel extends flowModel
|
||||
{
|
||||
public $xiangbordercolor = 'red';//默认边框颜色
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$arr['title'] = $this->moders['name'];
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowxiangfields(&$fields)
|
||||
{
|
||||
$fields['base_name'] = '拟办人';
|
||||
$fields['base_deptname'] = '拟办人部门';
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'拟办人...','fields'=>'uid');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function inputtitle()
|
||||
{
|
||||
return '拟办发文稿纸';
|
||||
}
|
||||
}
|
||||
37
webmain/model/flow/officibModel.php
Normal file
37
webmain/model/flow/officibModel.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class flow_officibClassModel extends flowModel
|
||||
{
|
||||
public $xiangbordercolor = 'red';//默认边框颜色
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$arr['title'] = $this->moders['name'];
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowxiangfields(&$fields)
|
||||
{
|
||||
$fields['base_name'] = '登记人';
|
||||
$fields['base_deptname'] = '登记人部门';
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'登记人...','fields'=>'uid');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
//录入页面标题
|
||||
public function inputtitle()
|
||||
{
|
||||
return '收文登记';
|
||||
}
|
||||
|
||||
}
|
||||
62
webmain/model/flow/officicModel.php
Normal file
62
webmain/model/flow/officicModel.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
//公文查阅
|
||||
class flow_officicClassModel extends flowModel
|
||||
{
|
||||
public $xiangbordercolor = 'red';//默认边框颜色
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->logobj = m('log');
|
||||
}
|
||||
|
||||
//打开详情时跳转到地理位置显示
|
||||
protected function flowchangedata()
|
||||
{
|
||||
/*
|
||||
if(!isajax()){
|
||||
$num = ($this->rs['type']=='1') ? 'officib' : 'officia';
|
||||
$url = $this->getxiangurl($num, $this->id, A);
|
||||
$this->rock->location($url);
|
||||
exit();
|
||||
}*/
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
//全部的
|
||||
if($lx=='all'){
|
||||
$whyere = '';
|
||||
$this->rock->setsession('officicatype','all');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($lx==2){
|
||||
$zt = $this->logobj->isread($this->mtable, $rs['id'], $this->adminid);
|
||||
if($zt>0)$rs['ishui']=1;
|
||||
}
|
||||
//$rs['modenum'] = ($rs['type']=='1') ? 'officib' : 'officia';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
|
||||
$arr['title'] = $this->moders['name'];
|
||||
|
||||
//是否关闭查阅记录
|
||||
$arr['isgbcy'] = $this->moders['isgbcy'];
|
||||
if($this->rock->session('officicatype')=='all')$arr['isgbcy'] ='0'; //有权限看全部
|
||||
if($arr['isgbcy'] =='0'){
|
||||
$barr = $this->logobj->getreadshu($this->mtable, $this->id,$this->rs['receid'] , $this->rs['optdt'], $this->adminmodel);
|
||||
$arr['readunarr'] = $barr['wduarr'];//读取未查阅
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
67
webmain/model/flow/projectModel.php
Normal file
67
webmain/model/flow/projectModel.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* 项目的
|
||||
*/
|
||||
class flow_projectClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->workobj = m('work');
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度报告时更新对应状态
|
||||
*/
|
||||
protected function flowaddlog($a)
|
||||
{
|
||||
if($a['name']=='进度报告'){
|
||||
$arr['status'] = $a['status'];
|
||||
$this->update($arr, $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0){
|
||||
$zts = $rs['status'];
|
||||
$str = $this->getstatus($rs,'','',1);
|
||||
|
||||
if($lx==2)$rs['statusstr']= $str; //列表时替换
|
||||
|
||||
$id = $rs['id'];
|
||||
$wwc = $this->workobj->rows('projectid='.$id.' and `status` not in(1,5)');
|
||||
$wez = $this->workobj->rows('projectid='.$id.'');
|
||||
if($wwc>0)$wwc='<font color=red>'.$wwc.'</font>';
|
||||
$rs['workshu'] = ''.$wwc.'/'.$wez.'';
|
||||
|
||||
if($lx==1)$rs['status'] = $str;
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function flowisreadqx()
|
||||
{
|
||||
return $this->flowgetoptmenu('shwview');
|
||||
}
|
||||
|
||||
//显示操作菜单判断
|
||||
protected function flowgetoptmenu($num)
|
||||
{
|
||||
$fuzeid = $this->rs['fuzeid'];
|
||||
$runuserid = $this->rs['runuserid'];
|
||||
$where = m('admin')->gjoin($fuzeid.','.$runuserid, 'ud', $blx='where');
|
||||
$where = 'id='.$this->adminid.' and ('.$where.')';
|
||||
$bo = null;
|
||||
if($num=='shwview')$bo = true;
|
||||
if(m('admin')->rows($where)==0)$bo=false;
|
||||
return $bo;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
return array(
|
||||
'where' => '',
|
||||
'order' => 'optdt desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
74
webmain/model/flow/receiptModel.php
Normal file
74
webmain/model/flow/receiptModel.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
class flow_receiptClassModel extends flowModel
|
||||
{
|
||||
public function flowrsreplace($rs, $slx=0)
|
||||
{
|
||||
$rs['modenumshow'] = $rs['modenum'];
|
||||
$rs['modenum'] = '';
|
||||
$fte = '<font color=red>停用</font>';
|
||||
if($rs['status']=='1'){
|
||||
$fte = '<font color=green>启用</font>';
|
||||
}
|
||||
$rs['status'] = $fte;
|
||||
$rs['ishui']=0;
|
||||
|
||||
//判断是否已确认
|
||||
if($slx==2){
|
||||
$lx = $this->atype;
|
||||
if($lx=='my' || $lx=='myall'){
|
||||
if(contain(','.$rs['receids'].',',','.$this->adminid.','))$rs['ishui']=1;
|
||||
}
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function getweiwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
if($lx=='my' || $lx=='myall'){
|
||||
$where = ' and '.$this->rock->dbinstr('receid', $uid).''; //需要我回执
|
||||
|
||||
//为确认
|
||||
if($lx=='my'){
|
||||
$where .= ' and (not '.$this->rock->dbinstr('receids', $uid).' or `receids` is null)';
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
//未确认统计
|
||||
public function getweitotal($uid)
|
||||
{
|
||||
$where = $this->getweiwhere($uid, 'my');
|
||||
$to = $this->rows('`status`=1 '.$where.'');
|
||||
return $to;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = $this->getweiwhere($uid, $lx);
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
if($this->rs['status']==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
//审核完成后发通知
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt==1)$this->tisongtodo();
|
||||
}
|
||||
|
||||
//推送提醒
|
||||
private function tisongtodo()
|
||||
{
|
||||
$this->pushs($this->rs['receid'], "模块:{modename}\n发送人:{optname}\n内容:{explain}",'单据回执确认', array(
|
||||
'modenum' => $this->rs['modenum'],
|
||||
'id' => $this->rs['mid'],
|
||||
));
|
||||
}
|
||||
}
|
||||
315
webmain/model/flow/remindModel.php
Normal file
315
webmain/model/flow/remindModel.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
//单据提醒设置
|
||||
class flow_remindClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($rs['status']==0)$rs['ishui']=1;
|
||||
if($lx==1){
|
||||
$barrs = $this->getstatusarr();
|
||||
$zts = $barrs[$rs['status']];
|
||||
$rs['status'] = '<font color="'.$zts[1].'">'.$zts[0].'</font>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function getstatusarr()
|
||||
{
|
||||
$barr[1] = array('启用','green');
|
||||
$barr[0] = array('停用','#888888');
|
||||
return $barr;
|
||||
}
|
||||
|
||||
|
||||
//多个连表查询
|
||||
public function flowbillwhere($uid, $lx)
|
||||
{
|
||||
return array(
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]flow_set` b on a.modenum=b.`num`',
|
||||
'fields' => 'a.id,a.ratecont,a.startdt,a.enddt,a.status,a.explain,a.recename,a.optname,a.optdt,b.name as modename',
|
||||
'orlikefields' => 'b.name,a.ratecont',
|
||||
'asqom' => 'a.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//获取进入需要提醒内容
|
||||
public function getreminddt($dt='',$modenum='')
|
||||
{
|
||||
if($dt=='')$dt = $this->rock->date;
|
||||
$dt = substr($dt, 0, 10);
|
||||
$now = $this->rock->now;
|
||||
$rows = $this->getall("`status`=1 and `startdt`<='$now' and (`enddt` is null or `enddt`>='$now')");
|
||||
$dtobj = c('date');
|
||||
$w = date('w', strtotime($dt));
|
||||
if($w==0)$w = 7;
|
||||
$nw = 'w'.$w.'';
|
||||
$nrows = array();
|
||||
$timestr= '';
|
||||
foreach($rows as $k=>$rs){
|
||||
$ratea = explode(',', $rs['rate']);
|
||||
$rateb = explode(',', $rs['rateval']);
|
||||
$len = count($ratea);
|
||||
for($i=0; $i<$len; $i++){
|
||||
$timea = $this->getssdt($dt, $nw, $ratea[$i], arrvalue($rateb, $i), $rs['uid'], $rs['startdt']);
|
||||
if($timea)foreach($timea as $time){
|
||||
if(!contain($timestr, '['.$time.']')){
|
||||
$rs['runtime'] = $time;
|
||||
$rs['runtimes'] = date('Y-m-d H:i:s',$time);
|
||||
$rs['rates'] = $ratea[$i]; //频率类型
|
||||
$nrows[] = $rs;
|
||||
$timestr.='['.$time.']';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $nrows;
|
||||
}
|
||||
|
||||
//判断时间是否可使用
|
||||
private function getssdt($dt, $nw, $rate, $valstr, $uid, $startdts)
|
||||
{
|
||||
$timea = array();
|
||||
$vala = explode('|', $valstr);
|
||||
$val = $vala[0];
|
||||
$val2 = arrvalue($vala, 1);
|
||||
|
||||
//仅一次
|
||||
if($rate=='o' && contain($val, $dt)){
|
||||
$timea[] = strtotime($val);
|
||||
}
|
||||
|
||||
//星期和天
|
||||
if($nw==$rate || $rate=='d'){
|
||||
$time = ''.$dt.' '.$val.'';
|
||||
$timea[] = strtotime($time);
|
||||
}
|
||||
//每小时
|
||||
if($rate=='h'){
|
||||
$ksis = substr($startdts, 11);
|
||||
if(isempt($val2))$val2 = '23:59:59';
|
||||
$stime = strtotime(''.$dt.' '.$ksis.'');
|
||||
$etime = strtotime(''.$dt.' '.$val2.'');
|
||||
for($i=0;$i<=23;$i++){
|
||||
$time = strtotime(''.$dt.' '.$i.':'.$val.'');
|
||||
if($stime<=$time && $etime>=$time)$timea[] = $time;
|
||||
}
|
||||
}
|
||||
//每月
|
||||
if($rate=='m'){
|
||||
$time = ''.substr($dt,0, 8).''.$val.'';
|
||||
if(contain($time, $dt))$timea[] = strtotime($time);
|
||||
}
|
||||
//每年
|
||||
if($rate=='y'){
|
||||
$time = ''.substr($dt,0, 5).''.$val.'';
|
||||
if(contain($time, $dt))$timea[] = strtotime($time);
|
||||
}
|
||||
|
||||
//工作日,休息日
|
||||
if($rate=='g' || $rate=='x'){
|
||||
$time = ''.$dt.' '.$val.'';
|
||||
$timea[] = strtotime($time);
|
||||
}
|
||||
|
||||
return $timea;
|
||||
}
|
||||
|
||||
//时间段读取
|
||||
public function getremindtodo($startdt='', $enddt='')
|
||||
{
|
||||
if($startdt=='')$startdt = $this->rock->now;
|
||||
$stime= strtotime($startdt)-10;
|
||||
if($enddt=='')$enddt = date('Y-m-d H:i:s', $stime + 310); //默认是5分钟内提醒
|
||||
$dt = substr($startdt, 0, 10);
|
||||
$rows = $this->getreminddt($startdt);
|
||||
|
||||
$etime= strtotime($enddt);
|
||||
$sarr = $modearr = array();
|
||||
$modenums = '';
|
||||
$kqd = m('kaoqin');
|
||||
foreach($rows as $k=>$rs){
|
||||
$rate = $rs['rates']; //频率类型
|
||||
$bo = true;
|
||||
if($rs['runtime']>=$stime && $rs['runtime']<=$etime){
|
||||
//工作日休息日判断
|
||||
if($rate=='g' || $rate=='x'){
|
||||
$isw = $kqd->isworkdt($rs['uid'], $dt);
|
||||
if($isw==1 && $rate=='x')$bo = false;
|
||||
if($isw==0 && $rate=='g')$bo = false;
|
||||
}
|
||||
if($bo){
|
||||
$modenums.=",'".$rs['modenum']."'";
|
||||
$sarr[] = $rs;
|
||||
}
|
||||
}
|
||||
}
|
||||
//$this->flowtodosettx(8);
|
||||
if($modenums=='')return false;
|
||||
$modenums = substr($modenums, 1);
|
||||
$modrs = m('flow_set')->getall("`num` in ($modenums) and `status`=1");
|
||||
foreach($modrs as $k=>$rs)$modearr[$rs['num']] = $rs;
|
||||
|
||||
|
||||
$flowtodoid = ''; //单据通知设置ID
|
||||
$subscribid = array(); //订阅的
|
||||
|
||||
foreach($sarr as $k=>$rs){
|
||||
$mid = $rs['mid'];
|
||||
|
||||
if($rs['modenum']=='flowtodo'){
|
||||
$flowtodoid.=','.$mid.'';
|
||||
continue;
|
||||
}
|
||||
$mrs = arrvalue($modearr, $rs['modenum']);
|
||||
if(!$mrs)continue;
|
||||
$cont = $rs['explain'];
|
||||
$GLOBALS['adminid'] = $rs['uid'];
|
||||
$receid = $rs['uid'];
|
||||
$recename = $rs['optname'];
|
||||
if(!isempt($rs['receid'])){
|
||||
$receid = 'u'.$receid.','.$rs['receid'].'';
|
||||
$recename .= ','.$rs['recename'].'';
|
||||
}
|
||||
|
||||
//订阅的
|
||||
if($rs['modenum']=='subscribe'){
|
||||
$subscribid[] = array(
|
||||
'id' => $mid,
|
||||
'uid' => $rs['uid'],
|
||||
'receid'=> $receid,
|
||||
'recename'=> $recename,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->pushs($receid, $cont, $mrs['name'], array(
|
||||
'id' => $mid,
|
||||
'modenum' => $rs['modenum'],
|
||||
'modename' => $mrs['name'],
|
||||
'moders' => $mrs
|
||||
));
|
||||
}
|
||||
|
||||
//单据通知提醒需要另外提醒
|
||||
if($flowtodoid !='')$this->flowtodosettx(substr($flowtodoid, 1));
|
||||
|
||||
//订阅的处理(建议用异步的)
|
||||
if($subscribid){
|
||||
if(getconfig('asynsend')){
|
||||
|
||||
$reim = m('reim');
|
||||
foreach($subscribid as $subo){
|
||||
$GLOBALS['adminid'] = $subo['uid'];
|
||||
$reim->asynurl('asynrun','subscribe', array(
|
||||
'recename' => $this->rock->jm->base64encode($subo['recename']),
|
||||
'receid' => $subo['receid'],
|
||||
'id' => $subo['id'],
|
||||
'uid' => $subo['uid']
|
||||
));
|
||||
}
|
||||
}else{
|
||||
//没有异步直接调用
|
||||
$subflow = m('flow')->initflow('subscribeinfo');
|
||||
foreach($subscribid as $subo){
|
||||
$GLOBALS['adminid'] = $subo['uid'];
|
||||
$subflow->subscribe($subo['id'],$subo['uid'],$subo['receid'],$subo['recename']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sarr;
|
||||
}
|
||||
|
||||
//单据通知设置的,必须有触发条件和选择计划任务
|
||||
private function flowtodosettx($tids)
|
||||
{
|
||||
$rows = $this->db->getall('select a.*,b.num as modenum from `[Q]flow_todo` a left join `[Q]flow_set` b on a.`setid`=b.`id` where a.`id` in('.$tids.') and b.`status`=1 and a.`status`=1 and a.`botask`=1 and a.whereid>0');
|
||||
//print_r($rows);
|
||||
//有设置了提醒
|
||||
foreach($rows as $rk=>$rs){
|
||||
|
||||
$modenum = $rs['modenum'];
|
||||
$flow = m('flow')->initflow($modenum);
|
||||
$flowrows = $flow->gettodorows($rs['whereid']);
|
||||
$zongcount = count($flowrows);
|
||||
|
||||
$tostr = '';//提醒的内容
|
||||
$todofields = array();
|
||||
if(!isempt($rs['todofields']))$todofields = explode(',', $rs['todofields']);
|
||||
$title = $rs['name'];
|
||||
$sanda = array();
|
||||
|
||||
foreach($flowrows as $k1=>$rs1){
|
||||
if($k1>0)$tostr .= "\n";
|
||||
$tostrs = $this->rock->reparr($rs['summary'], $rs1);
|
||||
$tostr .= $tostrs;
|
||||
|
||||
$receid = $rs['receid']; //接收人
|
||||
//提交人
|
||||
if($rs['toturn']=='1' && isset($rs1['optid']))$receid = $this->strappend($receid,$rs1['optid']);
|
||||
//参与人
|
||||
if($rs['tocourse']=='1'){
|
||||
$cyrenId = $this->billmodel->getmou('allcheckid', "`table`='".$flow->mtable."' and `mid`='".$rs1['id']."'");
|
||||
$receid = $this->strappend($receid, $cyrenId);
|
||||
}
|
||||
foreach($todofields as $tfid){
|
||||
$tfss = arrvalue($rs1, $tfid);
|
||||
if(!isempt($tfss))$receid = $this->strappend($receid, $tfss);
|
||||
}
|
||||
|
||||
if(!isempt($receid)){
|
||||
$receid = $this->adminmodel->gjoins($receid);
|
||||
if($zongcount<20){
|
||||
$flow->id = $rs1['id'];
|
||||
$flow->push($receid, '', $tostrs, $title);
|
||||
}else{
|
||||
$receida= explode(',', $receid);
|
||||
foreach($receida as $ruid){
|
||||
if(!isset($sanda[$ruid]))$sanda[$ruid] = array();
|
||||
if(!in_array($tostrs,$sanda[$ruid]))$sanda[$ruid][] = $tostrs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//相同内容转化
|
||||
if($sanda){
|
||||
$sendarr = array();
|
||||
foreach($sanda as $uid=>$narr){
|
||||
$enstr = '';
|
||||
foreach($narr as $k=>$v){
|
||||
if($k>0)$enstr.='<br>';
|
||||
$enstr.=''.$v.'';
|
||||
}
|
||||
if($enstr!=''){
|
||||
$sendarr[md5($enstr)][] = array(
|
||||
'uid' => $uid,
|
||||
'cont'=> $enstr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//发送
|
||||
foreach($sendarr as $key=>$rowss){
|
||||
$uids = '';
|
||||
$cont = $rowss[0]['cont'];
|
||||
foreach($rowss as $k=>$rsc){
|
||||
$uids.=','.$rsc['uid'].'';
|
||||
}
|
||||
//发送
|
||||
if($uids!=''){
|
||||
$uids = substr($uids, 1);
|
||||
$flow->flowweixinarr = array(
|
||||
'url' => $flow->getweurl()
|
||||
);
|
||||
$flow->push($uids, '', $cont, $title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
24
webmain/model/flow/repairModel.php
Normal file
24
webmain/model/flow/repairModel.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
//维修报备
|
||||
class flow_repairClassModel extends flowModel
|
||||
{
|
||||
public function initModel()
|
||||
{
|
||||
$this->iswxarr = c('array')->strtoarray('否|#888888,是|#ff6600');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if(isset($rs['iswx'])){
|
||||
$zt = $this->iswxarr[$rs['iswx']];
|
||||
$rs['iswx'] = '<font color="'.$zt[1].'">'.$zt[0].'</font>';
|
||||
}
|
||||
|
||||
if($this->rock->arrvalue($rs,'money','0')==0)$rs['money']='';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
41
webmain/model/flow/rewardModel.php
Normal file
41
webmain/model/flow/rewardModel.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
class flow_rewardClassModel extends flowModel
|
||||
{
|
||||
|
||||
public function initModel(){
|
||||
$this->typearr = array('<font color=green>奖励</font>','<font color=red>处罚</font>');
|
||||
}
|
||||
|
||||
protected function flowcheckname($num)
|
||||
{
|
||||
if($num=='objectque'){
|
||||
return array($this->rs['objectid'], $this->rs['object']);
|
||||
}
|
||||
}
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'申请人...','fields'=>'uid');
|
||||
$arr[] = array('name'=>'奖惩对象...','fields'=>'objectid');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
public function flowrsreplace($rs){
|
||||
$type = $rs['type'];
|
||||
$rs['type'] = $this->typearr[$type];
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$key = $this->rock->post('key');
|
||||
$where = '';
|
||||
if($key!='')$where.=" and (b.udeptname like '%$key%' or b.`uname` like '%$key%' or a.`object` like '%$key%')";
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'leftbill' => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
34
webmain/model/flow/scheduldModel.php
Normal file
34
webmain/model/flow/scheduldModel.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
//日程待办
|
||||
class flow_scheduldClassModel extends flowModel
|
||||
{
|
||||
protected function flownexttodo($type){
|
||||
|
||||
if($type=='daiban'){
|
||||
$btn[] = array(
|
||||
'key' => 1,
|
||||
'name' => '已完成',
|
||||
'replace_name' => '已完成',
|
||||
'color' => 'blue',
|
||||
'is_bold' => true
|
||||
);
|
||||
$btn[] = array(
|
||||
'key' => 2,
|
||||
'name' => '未完成',
|
||||
'replace_name' => '未完成',
|
||||
'color' => 'red'
|
||||
);
|
||||
$this->flowweixinarr = array(
|
||||
//'task_id' => ''.$this->mtable.'_'.$this->id.'',
|
||||
//'btn' => $btn
|
||||
);
|
||||
$cont = '发起人:{optname}'.chr(10).'时间:{startdt}';
|
||||
if(!isempt($this->rs['explain']))$cont.= '\n说明:{explain}';
|
||||
$cont.= '\n请尽快去处理';
|
||||
return array(
|
||||
'title' => '日程待办:{title}',
|
||||
'cont' => $cont
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
63
webmain/model/flow/scheduleModel.php
Normal file
63
webmain/model/flow/scheduleModel.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class flow_scheduleClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected function flowinit(){
|
||||
$this->ratearr = array('d'=>'天','w'=>'周','m'=>'月');
|
||||
}
|
||||
|
||||
//是否有读权限
|
||||
public function flowisreadqx()
|
||||
{
|
||||
if(!isempt($this->rs['receid'])){
|
||||
$where = m('admin')->gjoin($this->rs['receid'], 'ud', $blx='where');
|
||||
$where = 'id='.$this->adminid.' and ('.$where.')';
|
||||
$bo = true;
|
||||
if(m('admin')->rows($where)==0)$bo=false;
|
||||
return $bo;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getstatusarr()
|
||||
{
|
||||
$barr[1] = array('启用','green');
|
||||
$barr[0] = array('停用','#888888');
|
||||
return $barr;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$txsj = (int)$rs['txsj'];
|
||||
$str = '不提醒';
|
||||
if($txsj==1)$str = '提醒';
|
||||
$rs['txsj'] = $str;
|
||||
$rate = $rs['rate'];
|
||||
if(isset($this->ratearr[$rate])){
|
||||
if($rate=='w')$rate='每周'.$rs['rateval'].'';
|
||||
if($rate=='d')$rate='每天';
|
||||
if($rate=='m')$rate='每月'.$rs['rateval'].'号';
|
||||
$rs['rate'] = $rate;
|
||||
}
|
||||
if($rs['status']==0)$rs['ishui']=1;
|
||||
if($lx==1){
|
||||
$barrs = $this->getstatusarr();
|
||||
$zts = $barrs[$rs['status']];
|
||||
$rs['status'] = '<font color="'.$zts[1].'">'.$zts[0].'</font>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$dt = $this->rock->post('dt');
|
||||
if($dt!='')$where =" and `startdt` like '$dt%'";
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'order' => 'optdt desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
71
webmain/model/flow/sealaplModel.php
Normal file
71
webmain/model/flow/sealaplModel.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 模块.印章申请
|
||||
*/
|
||||
class flow_sealaplClassModel extends flowModel
|
||||
{
|
||||
//读取印章保管人来审批
|
||||
protected function flowcheckname($num)
|
||||
{
|
||||
if($num=='bgque'){
|
||||
$sealrs = m('seal')->getall('`id` in('.$this->rs['sealid'].')');
|
||||
if($sealrs){
|
||||
$bgid = $bgname = array();
|
||||
foreach($sealrs as $k1=>$rs1){
|
||||
$bgidaa = explode(',', $rs1['bgid']);
|
||||
$bgidab = explode(',', $rs1['bgname']);
|
||||
foreach($bgidaa as $x=>$kv){
|
||||
if(!in_array($kv, $bgid)){
|
||||
$bgid[]=$kv;
|
||||
$bgname[] = $bgidab[$x];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return array(join(',', $bgid), join(',', $bgname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function usefangshi()
|
||||
{
|
||||
$barr[] = array('value'=>'0','name'=>'盖章查看');
|
||||
$barr[] = array('value'=>'1','name'=>'外带');
|
||||
$barr[] = array('value'=>'2','name'=>'电子印章');
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//展示是替换一下
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$utype = $this->usefangshi();
|
||||
$rs['isout'] = $utype[$rs['isout']]['name'];
|
||||
if($lx==1){
|
||||
$mknum = arrvalue($rs, 'mknum');
|
||||
if(!isempt($mknum)){
|
||||
$numa = explode(',', $mknum);
|
||||
$num = $numa[0];
|
||||
$mid = (int)arrvalue($numa,1);
|
||||
$url = $this->getxiangurl($num, $mid, 'auto');
|
||||
if($mid>0)$rs['mknum'] = '<a href="'.$url.'">查看对应单据详情</a>';
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function inputtitle()
|
||||
{
|
||||
$tit = $this->moders['name'];
|
||||
if($this->rock->get('def_isout')=='2' || arrvalue($this->rs,'isout')=='2')$tit = '电子印章申请';
|
||||
return $tit;
|
||||
}
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
|
||||
$arr['title'] = $this->inputtitle();
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
64
webmain/model/flow/subscribeModel.php
Normal file
64
webmain/model/flow/subscribeModel.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
//订阅的
|
||||
class flow_subscribeClassModel extends flowModel
|
||||
{
|
||||
public $uidfields = 'optid';
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getstatusarr()
|
||||
{
|
||||
$barr[] = array('停用','#888888');
|
||||
$barr[] = array('启用','green');
|
||||
return $barr;
|
||||
}
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$ztstatus = $rs['status'];
|
||||
if($lx==1){
|
||||
$ztarr = $this->getstatusarr();
|
||||
$zta = $ztarr[$ztstatus];
|
||||
$rs['status'] = '<font color="'.$zta[1].'">'.$zta[0].'</font>';
|
||||
|
||||
$ors = $this->remindmodel->getone($this->mwhere);
|
||||
if($ors){
|
||||
$rs['recename'] = $ors['recename'];
|
||||
$rs['ratecont'] = $ors['ratecont'];
|
||||
}
|
||||
}
|
||||
|
||||
if($ztstatus==0 || isempt(arrvalue($rs,'ratecont')))$rs['ishui']=1;
|
||||
|
||||
if($lx==2){
|
||||
|
||||
unset($rs['suburl']);
|
||||
unset($rs['suburlpost']);
|
||||
if(!isempt($rs['dinguser']))$rs['optname'] = $rs['dinguser']; //订阅人
|
||||
}
|
||||
if(isset($rs['suburl'])){
|
||||
$rs['suburl'] = '<div class="wrap" style="">'.$this->rock->jm->base64decode($rs['suburl']).'</div>';
|
||||
}
|
||||
if(isset($rs['suburlpost'])){
|
||||
$rs['suburlpost'] = '<div class="wrap">'.$this->rock->jm->base64decode($rs['suburlpost']).'</div>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
|
||||
return array(
|
||||
'order' => 'a.id desc',
|
||||
'table' => '`[Q]'.$this->mtable.'` a left join `[Q]flow_remind` b on a.id=b.mid and b.`table`=\''.$this->mtable.'\'',
|
||||
'fields' => 'a.*,b.recename,b.ratecont,b.optname as dinguser',
|
||||
'asqom' => 'a.',
|
||||
'orlikefields' => 'b.recename,b.ratecont,b.optname'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
110
webmain/model/flow/subscribeinfoModel.php
Normal file
110
webmain/model/flow/subscribeinfoModel.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
//订阅的
|
||||
class flow_subscribeinfoClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$filepath = $rs['filepath'];
|
||||
if(!file_exists(iconv('utf-8','gb2312',$filepath))){
|
||||
$filepath = '文件不存在了';
|
||||
$rs['ishui']= 1;
|
||||
}else{
|
||||
$filepath = '<a href="'.URL.''.$filepath.'"';
|
||||
if(!$this->rock->ismobile())$filepath.=' target="_blank"';
|
||||
$filepath .= '>打开</a>';
|
||||
}
|
||||
$rs['filepath'] = $filepath;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订阅运行发送
|
||||
*/
|
||||
public function subscribe($id, $nowid=0, $receid='', $recename='')
|
||||
{
|
||||
$rs = $this->db->getone('[Q]subscribe','`id`='.$id.'');
|
||||
if(!$rs)return returnerror('不存在');
|
||||
|
||||
if($rs['status']=='0')return returnerror('未启用不能运行');
|
||||
$title = $rs['title']; //订阅标题
|
||||
$cont = $rs['cont']; //提醒内容
|
||||
$suburl = $this->rock->jm->base64decode($rs['suburl']);
|
||||
$suburlpost = $this->rock->jm->base64decode($rs['suburlpost']);
|
||||
if(isempt($suburl) || isempt($suburlpost))return;
|
||||
$base = m('base');
|
||||
|
||||
$suburlpost = $base->strreplace($suburlpost,0,1);
|
||||
$title = $base->strreplace($title,0,1);
|
||||
$cont = $base->strreplace($cont,0,1);
|
||||
|
||||
$url = getconfig('localurl', URL).$suburl;
|
||||
//请求参数处理
|
||||
$params = array();
|
||||
$canarr = explode('&', $suburlpost);
|
||||
foreach($canarr as $csnstr){
|
||||
$nets = explode('=', $csnstr);
|
||||
$params[$nets[0]] = $nets[1];
|
||||
}
|
||||
|
||||
if($nowid==0)$nowid = $rs['optid'];
|
||||
|
||||
$params['exceltitle'] = $title;
|
||||
$params['exceltype'] = 'html';
|
||||
$params['tablename_abc'] = $this->rock->jm->encrypt($params['tablename_abc']);
|
||||
$params['exceltitle'] = $this->rock->jm->encrypt($params['exceltitle']);
|
||||
$params['excelfields'] = $this->rock->jm->encrypt($params['excelfields']);
|
||||
$params['excelheader'] = $this->rock->jm->encrypt($params['excelheader']);
|
||||
|
||||
//传个让不需要登录验证
|
||||
$subscribe_post = 'subscribe_'.time().'';
|
||||
$subscribe_key = md5($url.time().$subscribe_post);
|
||||
$params['subscribe_key'] = $subscribe_key;
|
||||
$params['subscribe_post'] = $subscribe_post;
|
||||
$params['subscribe_adminid']= $nowid;
|
||||
$this->option->setval('subscribe_key', $subscribe_key);
|
||||
|
||||
$bstr = c('curl')->postcurl($url, $params);
|
||||
$this->db->update('[Q]subscribe',"`lastdt`='{$this->rock->now}'", '`id`='.$id.'');
|
||||
|
||||
if(!isempt($bstr) && substr($bstr, 0, 1)=='{'){
|
||||
$publicurl = $this->rock->getouturl();//公网URL
|
||||
$barr = json_decode($bstr, true);
|
||||
$htmlpath = $barr['url'];
|
||||
|
||||
if($barr['downCount']==0)return returnerror('记录数为0,没有可订阅数据');
|
||||
|
||||
$url = $publicurl.$htmlpath;
|
||||
//发送提醒
|
||||
if(isempt($receid)){
|
||||
$receid = $rs['optid'];
|
||||
$recename = $rs['optname'];
|
||||
}
|
||||
|
||||
$newid = $this->insert(array(
|
||||
'mid' => $id,
|
||||
'receid' => $receid,
|
||||
'recename' => $recename,
|
||||
'title' => $title,
|
||||
'cont' => $cont,
|
||||
'optdt' => $this->rock->now,
|
||||
'filepath' => $htmlpath,
|
||||
));
|
||||
|
||||
//推送提醒
|
||||
$receid = $this->pushs($receid, $cont,$title,array(
|
||||
'id' => $newid
|
||||
));
|
||||
|
||||
$this->update(array('receid' => $receid), $newid);
|
||||
|
||||
return returnsuccess();
|
||||
}else{
|
||||
m('log')->addlogs('订阅运行', 'ID('.$id.')运行失败:'.$bstr.'', 2);
|
||||
return returnerror('error:'.$bstr.'');
|
||||
}
|
||||
}
|
||||
}
|
||||
47
webmain/model/flow/tovoidModel.php
Normal file
47
webmain/model/flow/tovoidModel.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class flow_tovoidClassModel extends flowModel
|
||||
{
|
||||
|
||||
//展示是替换一下
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$str= '作废';
|
||||
if($rs['type']==1)$str= '删除';
|
||||
$rs['type'] = $str;
|
||||
|
||||
//详情
|
||||
if($lx==1){
|
||||
$bilrs= $this->billmodel->getone("`sericnum`='".$rs['tonum']."'");
|
||||
if(!$bilrs){
|
||||
$rs['tonum']='<s>'.$rs['tonum'].'</s>';
|
||||
return $rs;
|
||||
}
|
||||
$mors = $this->db->getone('[Q]flow_set',"`id`='".$bilrs['modeid']."'");
|
||||
if(!$mors)return $rs;
|
||||
$url = $this->getxiangurl($mors['num'], $bilrs['mid'], 'a');
|
||||
$rs['tonum'] = '<a href="'.$url.'">'.$rs['tonum'].'</a>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//审核完成了处理单据,删除还是作废
|
||||
protected function flowcheckfinsh($zt)
|
||||
{
|
||||
if($zt!=1)return;
|
||||
$type = $this->rs['type'];
|
||||
$bilrs= $this->billmodel->getone("`sericnum`='".$this->rs['tonum']."'");
|
||||
if(!$bilrs)return;
|
||||
$mors = $this->db->getone('[Q]flow_set',"`id`='".$bilrs['modeid']."'");
|
||||
if(!$mors)return;
|
||||
//作废
|
||||
if($type==0){
|
||||
m('flow')->zuofeibill($mors['num'], $bilrs['mid'], $this->rs['explain']);
|
||||
}
|
||||
//删除
|
||||
if($type==1){
|
||||
m('flow')->deletebill($mors['num'], $bilrs['mid'], $this->rs['explain'], false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
63
webmain/model/flow/tuihuoModel.php
Normal file
63
webmain/model/flow/tuihuoModel.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
//退货
|
||||
class flow_tuihuoClassModel extends flowModel
|
||||
{
|
||||
public $minwidth = 600;//子表最小宽
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
$this->cangobj = m('godepot');
|
||||
}
|
||||
|
||||
//审核完成处理,要通知仓库管理员出入库
|
||||
protected function flowcheckfinsh($zt){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//子表数据替换处理
|
||||
protected function flowsubdata($rows, $lx=0){
|
||||
$db = m('goods');
|
||||
foreach($rows as $k=>$rs){
|
||||
$one = $db->getone($rs['aid']);
|
||||
if($one){
|
||||
$name = $one['name'];
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1)$rows[$k]['aid'] = $name; //1展示时
|
||||
$rows[$k]['temp_aid'] = $name;
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//$lx,0默认,1详情展示,2列表显示
|
||||
public function flowrsreplace($rs,$lx=0)
|
||||
{
|
||||
$rs['states']= $rs['state'];
|
||||
$rs['state'] = $this->goodsobj->crkstate($rs['state']);
|
||||
|
||||
$custractid = (int)$rs['custractid'];
|
||||
if($custractid>0){
|
||||
$htrs = $this->getone('`id`='.$custractid.'');
|
||||
if($htrs){
|
||||
$custractid = $htrs['num'];//读取关联销售
|
||||
if($lx==1)$custractid = '<a href="'.$this->getxiangurl('custxiao',$rs['custractid'],'auto').'">'.$custractid.'</a>';
|
||||
}else{
|
||||
$custractid = 0;//不存在
|
||||
$this->update('`custractid`='.$custractid.'', $rs['id']);
|
||||
}
|
||||
}
|
||||
if($custractid===0){
|
||||
$custractid = '<font color=#aaaaaa>无关联</a>';
|
||||
}
|
||||
$rs['custractid'] = $custractid;
|
||||
|
||||
|
||||
//读取物品
|
||||
if($lx==2){
|
||||
$rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
267
webmain/model/flow/userModel.php
Normal file
267
webmain/model/flow/userModel.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
class flow_userClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected $flowviewufieds = 'id';
|
||||
protected $flowcompanyidfieds = 'companyid';
|
||||
|
||||
public function getstatusarr()
|
||||
{
|
||||
$barr[1] = array('启用','green');
|
||||
$barr[0] = array('停用','#888888');
|
||||
return $barr;
|
||||
}
|
||||
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'部门/用户...','fields'=>'id');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户显示展示
|
||||
*/
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$pnum = $this->rock->get('pnum');
|
||||
//其他地方来的,需要权限
|
||||
if($pnum != 'all' ){
|
||||
$where = 'and `status`=1 '.$this->viewmodel->viewwhere($this->moders, $uid, 'id');//权限控制
|
||||
}
|
||||
$detpid = (int)$this->rock->post('deptid','0');
|
||||
if($detpid>0){
|
||||
$where.= " and instr(`deptpath`,'[$detpid]')>0";
|
||||
}
|
||||
return array(
|
||||
'fields'=> '`name`,`id`,`id` as uid,`face`,`sort`,`deptallname`,deptpath,`ranking`,`tel`,`mobile`,`email`,`user`,num,workdate,sex,deptname,deptnames,superman,status,type,online,lastonline,isvcard,`companyid`',
|
||||
'order' => '`status` desc,`sort`',
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//替换
|
||||
private $companyarr = array();
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if(!$this->companyarr){
|
||||
$this->companyarr = $this->db->getkeyall('[Q]company','id,name');
|
||||
}
|
||||
if(isset($rs['mobile'])){
|
||||
$sjhao = $rs['mobile'];
|
||||
}
|
||||
if(getconfig('systype')=='demo')$rs['mobile']='';
|
||||
|
||||
if($this->rock->ismobile()){
|
||||
if(isset($rs['mobile']) && !isempt($rs['mobile']))$rs['mobile']='<a onclick="return callPhone(\''.$sjhao.'\')" href="tel:'.$sjhao.'">'.$rs['mobile'].'</a>';
|
||||
if(isset($rs['tel']) && !isempt($rs['tel']))$rs['tel']='<a onclick="return callPhone(this)" href="tel:'.$rs['tel'].'">'.$rs['tel'].'</a>';
|
||||
}
|
||||
$type = arrvalue($rs,'type');
|
||||
if($type=='0')$rs['type']='';
|
||||
if($type=='1')$rs['type']='<font color=green>是</font>';
|
||||
if(isset($rs['companyid']))$rs['companyid'] = arrvalue($this->companyarr, $rs['companyid']);
|
||||
|
||||
//判断当前用户状态
|
||||
$online = arrvalue($rs,'online','0');
|
||||
$lastonline = arrvalue($rs,'lastonline');
|
||||
if($online=='1'){
|
||||
$jgtime = time()- strtotime($lastonline);
|
||||
if($jgtime>210){
|
||||
$online = '0'; //超过200
|
||||
$this->adminmodel->update('online=0', $rs['id']);
|
||||
}
|
||||
}
|
||||
$rs['online'] = $online;
|
||||
if($lx==1){
|
||||
$rs['temp_dwid'] = $this->getdwname($rs);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//编辑时候替换
|
||||
protected function flowrsreplaceedit($rs)
|
||||
{
|
||||
$rs['groupname'] = m('sjoin')->getgroupid($rs['id']);
|
||||
$rs['pass'] = '';
|
||||
unset($rs['deptallname']);
|
||||
|
||||
$rs['temp_dwid'] = $this->getdwname($rs);
|
||||
if(getconfig('systype')=='demo')$rs['mobile'] = '';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
private function getdwname($rs)
|
||||
{
|
||||
$dwid = arrvalue($rs,'dwid');
|
||||
$temp_dwid = '';
|
||||
if(!isempt($dwid)){
|
||||
$dwarr = m('company')->getall('`id` in('.$dwid.')');
|
||||
foreach($dwarr as $k1=>$rs1)$temp_dwid.=','.$rs1['name'].'';
|
||||
if($temp_dwid!='')$temp_dwid = substr($temp_dwid, 1);
|
||||
}
|
||||
return $temp_dwid;
|
||||
}
|
||||
|
||||
//删除用户时
|
||||
protected function flowdeletebill($sm)
|
||||
{
|
||||
$id = $this->id;
|
||||
$name = $this->rs['name'];
|
||||
m('im_messzt')->delete('`uid`='.$id.'');
|
||||
m('im_history')->delete('`uid`='.$id.'');
|
||||
|
||||
|
||||
$dbs = m('userinfo');
|
||||
$urs = $dbs->getone($id);
|
||||
if(!$urs)return;
|
||||
$quitdt = $urs['quitdt'];
|
||||
$state = $urs['state'];
|
||||
$uarr = array();
|
||||
if(isempt($quitdt))$uarr['quitdt'] = date('Y-m-d'); //设置离职日期
|
||||
if($state != '5')$uarr['state'] = 5;//离职状态为5
|
||||
if($uarr)$dbs->update($uarr, $id);
|
||||
}
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'user' => 'zhangsan',
|
||||
'name' => '张三',
|
||||
'sex' => '男',
|
||||
'mobile' => '15812345678',
|
||||
'ranking' => '程序员',
|
||||
'superman' => '磐石',
|
||||
'deptname' => '信呼开发团队/开发部',
|
||||
'tel' => '0592-1234567-005',
|
||||
'email' => 'zhangsan@rockoa.com',
|
||||
'workdate' => '2017-01-17',
|
||||
);
|
||||
}
|
||||
|
||||
//导入之后
|
||||
public function flowdaoruafter()
|
||||
{
|
||||
//更新设置上级主管
|
||||
foreach($this->superarrar as $superman=>$suparr){
|
||||
$superid = (int)$this->getmou('id', "`name`='$superman'");
|
||||
$userld = "'".join("','", $suparr)."'";
|
||||
if($superid>0){
|
||||
$this->update(array(
|
||||
'superman' => $superman,
|
||||
'superid' => $superid,
|
||||
),"`user` in($userld)");
|
||||
}
|
||||
}
|
||||
m('admin')->updateinfo();
|
||||
}
|
||||
|
||||
//导入之前判断
|
||||
private $superarrar = array();
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$sort = (int)$this->getmou('max(`sort`)', '`id`>0');
|
||||
$dbs = m('dept');
|
||||
$py = c('pingyin');
|
||||
$dname = $dbs->getmou('name', 1);if(isempt($dname))$dname = '信呼开发团队';
|
||||
|
||||
foreach($rows as $k=>$rs){
|
||||
$user = $rs['user'];
|
||||
$name = $rs['name'];
|
||||
$mobile = $rs['mobile'];
|
||||
$arr = $rs;
|
||||
|
||||
$arr['pingyin'] = $py->get($name,1);
|
||||
if($this->rows("`name`='$name'")>0)$name = $name.'1';
|
||||
if(isempt($user))$user = $arr['pingyin'];
|
||||
|
||||
if($this->rows("`user`='$user'")>0)$user = $user.'1'; //相同用户名?
|
||||
|
||||
|
||||
$arr['user'] = strtolower($user);
|
||||
$arr['name'] = $name;
|
||||
|
||||
$arr['pass'] = md5('123456');
|
||||
$arr['sort'] = $sort+$k+1;
|
||||
$arr['workdate'] = arrvalue($rs,'workdate', $this->rock->date);
|
||||
$arr['adddt'] = $this->rock->now;
|
||||
$arr['companyid'] = $this->companyid; //默认单位
|
||||
|
||||
//读取上级主管Id
|
||||
if(isset($arr['superman'])){
|
||||
//$superid = (int)$this->getmou('id', "`name`='".$arr['superman']."'");
|
||||
//if($superid==0)$arr['superman'] = '';
|
||||
//$arr['superid'] = $superid;
|
||||
$this->superarrar[$arr['superman']][] = $arr['user'];
|
||||
}
|
||||
$arr['superman'] = '';
|
||||
$arr['superid'] = '';
|
||||
|
||||
//读取部门Id
|
||||
$deptarr = $this->getdeptid($rs['deptname'], $dbs);
|
||||
|
||||
if($deptarr['deptid']==0)return '行'.($k+1).'找不到顶级部门['.$rs['deptname'].'],请写完整部门路径如:'.$dname.'/'.$rs['deptname'].'';
|
||||
|
||||
foreach($deptarr as $k1=>$v1)$arr[$k1]=$v1;
|
||||
|
||||
$inarr[] = $arr;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
private function getdeptid($str,$dobj)
|
||||
{
|
||||
$deptid = '0';
|
||||
if(isempt($str))return $deptid;
|
||||
$stra = explode(',', $str);
|
||||
$depad = $this->getdeptids($stra[0],$dobj);
|
||||
$deptids= '';
|
||||
$deptnames= '';
|
||||
for($i=1;$i<count($stra);$i++){
|
||||
$depads = $this->getdeptids($stra[$i],$dobj);
|
||||
if($depads[0]>0){
|
||||
$deptids.=','.$depads[0].'';
|
||||
$deptnames.=','.$depads[1].'';
|
||||
}
|
||||
}
|
||||
if($deptids!='')$deptids = substr($deptids, 1);
|
||||
if($deptnames!='')$deptnames = substr($deptnames, 1);
|
||||
|
||||
return array(
|
||||
'deptid' => $depad[0],
|
||||
'deptname' => $depad[1],
|
||||
'deptallname' => $stra[0],
|
||||
'deptids' => $deptids,
|
||||
'deptnames' => $deptnames,
|
||||
);
|
||||
}
|
||||
private function getdeptids($str,$dobj)
|
||||
{
|
||||
$stra = explode('/', $str);
|
||||
$pid = 0;
|
||||
$id = 1;//默认顶级ID
|
||||
$deptname = '';
|
||||
for($i=0;$i<count($stra);$i++){
|
||||
$name = $stra[$i];
|
||||
$deptname = $name;
|
||||
$id = (int)$dobj->getmou('id',"`pid`='$pid' and `name`='$name'");
|
||||
//不存在就创建部门
|
||||
if($id==0){
|
||||
if($pid==0)return array(0, $deptname);
|
||||
$cjbm['name'] = $deptname;
|
||||
$cjbm['pid'] = $pid;
|
||||
$id = $dobj->insert($cjbm);
|
||||
$pid = $id;
|
||||
}else{
|
||||
$pid = $id;
|
||||
}
|
||||
}
|
||||
|
||||
return array($id, $deptname);
|
||||
}
|
||||
}
|
||||
229
webmain/model/flow/userinfoModel.php
Normal file
229
webmain/model/flow/userinfoModel.php
Normal file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
class flow_userinfoClassModel extends flowModel
|
||||
{
|
||||
public $uidfields = 'id';
|
||||
protected $flowviewufieds = 'id';
|
||||
protected $flowcompanyidfieds = 'companyid';
|
||||
|
||||
public function flowsearchfields()
|
||||
{
|
||||
$arr[] = array('name'=>'部门/用户...','fields'=>'id');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
//读取状态
|
||||
$this->statearr = array();
|
||||
$this->statearrs = array();
|
||||
$ztarrs = m('option')->getmnum('userstate');
|
||||
if(!$ztarrs){
|
||||
$ztarrs[] = array('value'=>0,'name'=>'试用期');
|
||||
$ztarrs[] = array('value'=>1,'name'=>'正式');
|
||||
$ztarrs[] = array('value'=>2,'name'=>'实习生');
|
||||
$ztarrs[] = array('value'=>3,'name'=>'兼职');
|
||||
$ztarrs[] = array('value'=>4,'name'=>'临时工');
|
||||
$ztarrs[] = array('value'=>5,'name'=>'离职');
|
||||
}
|
||||
foreach($ztarrs as $k=>$rs){
|
||||
$this->statearr[$rs['value']] = $rs['name'];
|
||||
$this->statearrs[] = array('id'=> $rs['value'], 'name'=>$rs['name']);
|
||||
}
|
||||
|
||||
$this->birtypearr = explode(',','阳历,农历');
|
||||
//$this->calendar = c('calendar');去掉了,没用
|
||||
}
|
||||
|
||||
public function getstatusarr()
|
||||
{
|
||||
$barr = array();
|
||||
foreach($this->statearr as $k=>$v){
|
||||
$barr[$k] = array($v,'');
|
||||
}
|
||||
|
||||
return $barr;
|
||||
}
|
||||
|
||||
private function getdwname($rs)
|
||||
{
|
||||
$dwid1 = arrvalue($rs,'companyid','0');
|
||||
$dwid = arrvalue($rs,'dwid','0');
|
||||
$dwid .= ','.$dwid1.'';
|
||||
$temp_dwid = '';
|
||||
if(!isempt($dwid)){
|
||||
$dwarr = m('company')->getall('`id` in('.$dwid.')');
|
||||
foreach($dwarr as $k1=>$rs1)$temp_dwid.=','.$rs1['name'].'';
|
||||
if($temp_dwid!='')$temp_dwid = substr($temp_dwid, 1);
|
||||
}
|
||||
return $temp_dwid;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($rs['state']==5)$rs['ishui']=1;
|
||||
$rs['stateval'] = $rs['state'];
|
||||
$rs['state'] = $this->getuserstate($rs['state']);
|
||||
|
||||
$rs['shengri'] = '';
|
||||
if(!isempt($rs['birthday'])){
|
||||
if($rs['birtype']==0){
|
||||
//$rs['shengri'] = $rs['birthday'];
|
||||
}else{
|
||||
//$days = $this->calendar->daytocal($rs['birthday']);
|
||||
//$rs['shengri'] = ''.$days['year'].'年农历'.$days['month'].'月'.$days['day'].'';
|
||||
}
|
||||
}
|
||||
|
||||
$rs['birtype'] = $this->birtypearr[$rs['birtype']];
|
||||
|
||||
if($lx==1){
|
||||
$rs['companyid'] = $this->getdwname($rs);
|
||||
}
|
||||
|
||||
if(getconfig('systype')=='demo')$rs['mobile']='';
|
||||
|
||||
//导出处理
|
||||
if($this->daochubo){
|
||||
//if(isset($rs['mobile']))$rs['mobile'] = ' '.$rs['mobile'];
|
||||
//if(isset($rs['idnum']))$rs['idnum'] = ' '.$rs['idnum'];
|
||||
//if(isset($rs['banknum']))$rs['banknum'] = ' '.$rs['banknum'];
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//编辑时候替换
|
||||
protected function flowrsreplaceedit($rs)
|
||||
{
|
||||
if(getconfig('systype')=='demo')$rs['mobile'] = '';
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function getuserstate($zt)
|
||||
{
|
||||
return $this->rock->arrvalue($this->statearr,$zt,'未知');
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$fields = 'a.id,a.name,a.deptname,a.ranking,a.state,a.tel,a.sex,a.mobile,a.workdate,a.jiguan,a.minzu,a.xueli,a.email,a.syenddt,a.quitdt,a.positivedt,a.birtype,a.birthday,a.num,b.name as companyid';
|
||||
if($this->daochubo)$fields='a.*,b.name as companyid';//导出的
|
||||
return array(
|
||||
'ztfields' => 'state',
|
||||
'order' => 'a.id',
|
||||
'table' => '`[Q]userinfo` a left join `[Q]company` b on a.companyid=b.id',
|
||||
'fields' => $fields,
|
||||
'asqom' => 'a.',
|
||||
'orlikefields' => 'b.name'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工生日提醒
|
||||
*/
|
||||
public function birthdaytodo()
|
||||
{
|
||||
$dt = date('m-d');
|
||||
//$cala = $this->calendar->toCalday($this->rock->date);
|
||||
$nongli = '';
|
||||
$rows = $this->db->getall("select a.`birthday`,b.`id`,b.`name` from `[Q]".$this->mtable."` a left join `[Q]admin` b on a.`id`=b.`id` where b.`status`=1 and a.`state`<>5 and a.`birthday` like '%".$dt."' ");
|
||||
|
||||
//是否生日短信提醒
|
||||
$smsnum = $this->option->getval('smsbirthday');
|
||||
$dxobj = c('xinhuapi');
|
||||
$dt = date('Y年m月d日');
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$dtnong = '';
|
||||
$cont = '今天是'.$dt.',是你的生日,我们在这里祝你生日快乐。';
|
||||
$this->push($rs['id'],'', $cont, '生日祝福');
|
||||
|
||||
if(!isempt($smsnum)){
|
||||
$smarr = explode(',', $smsnum);
|
||||
$tpl = $smarr[0];
|
||||
$qmv = arrvalue($smarr, 1, ''); //签名
|
||||
|
||||
$dxobj->sendsms($rs['id'], $qmv, $tpl, array(
|
||||
'name' => $rs['name'],
|
||||
'dt' => $dt,
|
||||
'dtnong'=> $dtnong
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//导入数据的测试显示
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'name' => '张三',
|
||||
'state' => '正式',
|
||||
'mobile' => '15812345678',
|
||||
'ranking' => '程序员',
|
||||
'idnum' => '1001111111',
|
||||
'housedizhi'=> '福建',
|
||||
'nowdizhi' => '福建',
|
||||
'hunyin' => '未婚',
|
||||
'birthday' => '2017-01-17',
|
||||
'xueli' => '博士后',
|
||||
'minzu' => '汉族',
|
||||
'email' => 'zhangsan@rockoa.com',
|
||||
'workdate' => '2017-01-17',
|
||||
'syenddt' => '2017-03-17',
|
||||
'positivedt'=> '2017-04-01',
|
||||
'jiguan' => '福建',
|
||||
);
|
||||
}
|
||||
|
||||
//导入之前判断
|
||||
public function flowdaorubefore($rows)
|
||||
{
|
||||
$inarr = array();
|
||||
$dba = m('admin');
|
||||
//根据手机号关联用户
|
||||
foreach($rows as $k=>$rs){
|
||||
|
||||
$arr = $rs;
|
||||
if(!isset($rs['mobile']))return '手机号必须开启导入';
|
||||
|
||||
$mobile = $rs['mobile'];
|
||||
$urs = $this->adminmodel->getone("`mobile`='$mobile'");
|
||||
|
||||
if(!$urs)return '行'.($k+1).'的手机号('.$mobile.')找不对应用户,请先添加用户';
|
||||
$arr['id'] = $urs['id'];
|
||||
$arr['ranking'] = $urs['ranking'];
|
||||
$arr['deptname'] = $urs['deptname'];
|
||||
|
||||
if(isset($rs['state'])){
|
||||
$state = $rs['state'];
|
||||
$zt = 0; //默认人员状态
|
||||
foreach($this->statearrs as $k1=>$rs1){
|
||||
if($rs1['name']==$state){
|
||||
$zt = $rs1['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$arr['state'] = $zt;
|
||||
}
|
||||
|
||||
//更新入职日期
|
||||
$workdate = arrvalue($arr, 'workdate');
|
||||
if(!isempt($workdate)){
|
||||
$dba->update("`workdate`='$workdate'", $arr['id']);
|
||||
}
|
||||
|
||||
$inarr[] = $arr;
|
||||
}
|
||||
|
||||
return $inarr;
|
||||
}
|
||||
|
||||
//导入之后
|
||||
public function flowdaoruafter()
|
||||
{
|
||||
|
||||
$this->adminmodel->updateinfo();
|
||||
}
|
||||
}
|
||||
39
webmain/model/flow/userractModel.php
Normal file
39
webmain/model/flow/userractModel.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
class flow_userractClassModel extends flowModel
|
||||
{
|
||||
protected $flowcompanyidfieds = 'companyid';
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = explode(',','<font color=blue>待执行</font>,<font color=green>生效中</font>,<font color=#888888>已终止</font>,<font color=red>已过期</font>');
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs)
|
||||
{
|
||||
$rs['state'] = $this->statearr[$rs['state']];
|
||||
return $rs;
|
||||
}
|
||||
public function updatestate()
|
||||
{
|
||||
$dt = $this->rock->date;
|
||||
$this->update("`state`=2", "`tqenddt` is not null and `tqenddt`<`enddt` and `tqenddt`<'$dt'");
|
||||
$this->update("`state`=1", "`startdt`<='$dt' and `enddt`>='$dt' and `tqenddt` is null");
|
||||
$this->update("`state`=3", "`enddt`<'$dt' and `tqenddt` is null");
|
||||
$this->update("`state`=0", "`startdt`>'$dt'");
|
||||
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$this->updatestate();
|
||||
$table = '`[Q]userract` a left join `[Q]admin` b on a.uid=b.id';
|
||||
return array(
|
||||
'where' => '',
|
||||
'table' => $table,
|
||||
'fields'=> 'a.*,b.deptname',
|
||||
'orlikefields'=>'b.deptname',
|
||||
'order' => 'a.`optdt` desc',
|
||||
'asqom' => 'a.'
|
||||
);
|
||||
}
|
||||
}
|
||||
21
webmain/model/flow/userzhengModel.php
Normal file
21
webmain/model/flow/userzhengModel.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
//证书
|
||||
class flow_userzhengClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
public function flowrsreplace($rs,$lx=0)
|
||||
{
|
||||
if($rs['edt'] && $rs['edt']<$this->rock->date){
|
||||
$rs['ishui'] = 1;
|
||||
$rs['explain'].='已过期';
|
||||
}
|
||||
|
||||
if($lx==2){
|
||||
if(!isempt($rs['fengmian']))$rs['fengmian']='<img height="60" src='.$rs['fengmian'].'>';
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
}
|
||||
41
webmain/model/flow/vcardModel.php
Normal file
41
webmain/model/flow/vcardModel.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
class flow_vcardClassModel extends flowModel
|
||||
{
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '`uid`='.$uid.'';
|
||||
$key = $this->rock->post('key');
|
||||
$gname = $this->rock->post('gname');
|
||||
if(!isempt($gname))$where.=" and `gname`='$gname'";
|
||||
if(!isempt($key))$where.=" and (`name` like '%$key%' or `unitname` like '%$key%' or `mobile` like '%$key%' or `gname` = '$key')";
|
||||
|
||||
return array(
|
||||
'where' => 'and '.$where,
|
||||
);
|
||||
}
|
||||
|
||||
//替换
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($lx==2 && $this->rock->ismobile()){
|
||||
if(!isempt($rs['mobile']))$rs['mobile']='<a onclick="return callPhone(this)" href="tel:'.$rs['mobile'].'">'.$rs['mobile'].'</a>';
|
||||
if(!isempt($rs['tel']))$rs['tel']='<a onclick="return callPhone(this)" href="tel:'.$rs['tel'].'">'.$rs['tel'].'</a>';
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function flowdaorutestdata()
|
||||
{
|
||||
return array(
|
||||
'name' => '关羽',
|
||||
'sex' => '男',
|
||||
'mobile' => '15812345678',
|
||||
'tel' => '0592-123456',
|
||||
'unitname' => '蜀国荆州守将',
|
||||
'email' => 'guanyu@rockoa.com',
|
||||
'gname' => '同事',
|
||||
'address' => '荆州市',
|
||||
);
|
||||
}
|
||||
}
|
||||
44
webmain/model/flow/waichuModel.php
Normal file
44
webmain/model/flow/waichuModel.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
class flow_waichuClassModel extends flowModel
|
||||
{
|
||||
protected function flowgetfields($lx)
|
||||
{
|
||||
$arr['location'] = '此时间定位打卡';
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
if($lx==1){
|
||||
$s = $this->getdklocation($rs['outtime'], $rs['intime']);
|
||||
$rs['location'] = $s;
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
private function getdklocation($sdt,$edt)
|
||||
{
|
||||
$rows = $this->db->getrows('[Q]location',"`uid`='$this->uid' and `type`=0 and `optdt`>='$sdt' and `optdt`<='$edt'",'location_x,location_y,scale,label,`precision`,`optdt`,`id`');
|
||||
$s = '';
|
||||
foreach($rows as $k=>$rs){
|
||||
$s.=''.($k+1).'.'.$rs['label'].'('.$rs['optdt'].') <a href="javascript:;" onclick="js.locationshow('.$rs['id'].')" class="zhu">查看</a><br>';
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$month = $this->rock->post('month');
|
||||
$where = '';
|
||||
if($month!=''){
|
||||
$where.=" and `outtime` like '$month%'";
|
||||
}
|
||||
|
||||
return array(
|
||||
'where' => $where
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
152
webmain/model/flow/wenjuanModel.php
Normal file
152
webmain/model/flow/wenjuanModel.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
//问卷调查模块接口问卷
|
||||
class flow_wenjuanClassModel extends flowModel
|
||||
{
|
||||
public $inputwidth = 950;
|
||||
|
||||
private $readunarr = array();//未读人员
|
||||
|
||||
|
||||
//替换读取统计
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
|
||||
if($lx==2 && $this->adminid==$rs['uid']){
|
||||
$where = $this->adminmodel->gjoin($rs['receid'],'','where');
|
||||
$where.= " and `workdate`<='".$rs['startdt']."' and `status`=1";
|
||||
$yito = $this->adminmodel->rows($where);
|
||||
$yato = 0;
|
||||
if(!isempt($rs['dauserids']))$yato = count(explode(',', $rs['dauserids']));
|
||||
$temp_total = ''.$yato.'/'.$yito.'';
|
||||
|
||||
$rs['temp_total'] = $temp_total;
|
||||
}
|
||||
if($rs['enddt']<$this->rock->date)$rs['ishui']=1;
|
||||
|
||||
//未查阅人
|
||||
if($lx==1){
|
||||
$barr = m('log')->getreadshu($this->mtable, $rs['id'],$rs['receid'] , $rs['startdt'], $this->adminmodel);
|
||||
foreach($barr as $k=>$v)$rs[$k]=$v;
|
||||
$this->readunarr = $barr['wduarr'];
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
protected function flowzuofeibill($sm)
|
||||
{
|
||||
m('wenjuau')->delete("`mid`='$this->id'");
|
||||
}
|
||||
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
|
||||
$arr['title'] = '';
|
||||
$itemarr = m('wenjuat')->getall("`mid`='$this->id'",'*','sort asc');
|
||||
$suid = (int)$this->rock->get('suid','0');
|
||||
if($suid==0)$suid = $this->adminid;
|
||||
|
||||
//读取我提交的结果
|
||||
$tjrows = m('wenjuau')->getall("`mid`='$this->id' and `optid`='$suid'");
|
||||
$arr['tjcount'] = count($tjrows);//是否提交过
|
||||
$hlx = $this->rock->get('hlx');
|
||||
foreach($itemarr as $k=>$rs)$itemarr[$k]['daan']='';
|
||||
|
||||
//显示汇总
|
||||
if($hlx=='true'){
|
||||
$xuan= explode(',','a,b,c,d,e,f,g,h,i,k');
|
||||
$zongtiarr = m('wenjuau')->getall("`mid`='$this->id'");
|
||||
foreach($itemarr as $k=>$rs){
|
||||
$showcont = '';
|
||||
$piaoshu = 0;
|
||||
foreach($xuan as $xua)$itemarr[$k]['daan'.$xua.'']=0;
|
||||
$itemarr[$k]['zong'] = 0;
|
||||
foreach($zongtiarr as $k1=>$rs1){
|
||||
if($rs['id']==$rs1['sid']){
|
||||
if($rs['itemtype']=='2'){
|
||||
$showcont.='<div>'.$rs1['optname'].':'.$rs1['conts'].' <span style="font-size:12px;color:#888888">('.$rs1['optdt'].')</font></div>';
|
||||
}else{
|
||||
$conts = ','.$rs1['conts'].',';
|
||||
foreach($xuan as $xua){
|
||||
if(contain($conts,','.$xua.',')){
|
||||
$itemarr[$k]['daan'.$xua.'']++;
|
||||
$itemarr[$k]['zong']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$itemarr[$k]['showcont'] = $showcont;
|
||||
}
|
||||
}else if($arr['tjcount']>0){
|
||||
$rand = $tjrows[0]['rand'];
|
||||
foreach($itemarr as $k=>$rs){
|
||||
foreach($tjrows as $k1=>$rs1){
|
||||
if($rs1['rand']==$rand && $rs1['sid']==$rs['id']){
|
||||
$itemarr[$k]['daan'] = $rs1['conts'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arr['readunarr'] = $this->readunarr;//读取未查阅
|
||||
$arr['itemarr'] = $itemarr;
|
||||
$arr['showname'] = $this->adminmodel->getmou('name', $suid);
|
||||
$arr['hlx'] = $hlx;
|
||||
return $arr;
|
||||
}
|
||||
|
||||
//显示调查内容
|
||||
public function showitem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交问卷了
|
||||
*/
|
||||
public function submitwenjuan()
|
||||
{
|
||||
if(isset($this->rs['status']) && $this->rs['status']!='1')return '记录审核未完成';
|
||||
if($this->rs['startdt']>$this->rock->date)return '还没开始呢';
|
||||
if($this->rs['enddt']<$this->rock->date)return '已经结束了哦';
|
||||
$itemarr = m('wenjuat')->getall("`mid`='$this->id'",'*','sort asc');
|
||||
$rand = rand(100000,999999);
|
||||
$dbs = m('wenjuau');
|
||||
if($dbs->rows("`mid`='$this->id' and `optid`='$this->adminid'")>0)return '已经提交过了哦';
|
||||
if(!isempt($this->rs['dauserids'])){
|
||||
$dauserids = explode(',', $this->rs['dauserids']);
|
||||
if(!in_array($this->adminid, $dauserids))$dauserids[] = $this->adminid;
|
||||
}else{
|
||||
$dauserids = array($this->adminid);
|
||||
}
|
||||
foreach($itemarr as $k1=>$rs1){
|
||||
$tyname = 'itemname_'.$rs1['id'].'';
|
||||
$tyvale = $this->rock->post($tyname);
|
||||
if(isempt($tyvale))return '选项'.($k1+1).'你还没选呢';
|
||||
$itemarr[$k1]['tyvale'] = $tyvale;
|
||||
}
|
||||
|
||||
foreach($itemarr as $k1=>$rs1){
|
||||
$uarr = array('mid'=>$this->id);
|
||||
$uarr['sid'] = $rs1['id'];
|
||||
$uarr['comid'] = $this->rs['comid'];
|
||||
$uarr['conts'] = $rs1['tyvale'];
|
||||
$uarr['optid'] = $this->adminid;
|
||||
$uarr['optname'] = $this->adminname;
|
||||
$uarr['optdt'] = $this->rock->now;
|
||||
$uarr['rand'] = $rand;
|
||||
$dbs->insert($uarr);
|
||||
}
|
||||
|
||||
$this->update(array(
|
||||
'dauserids' => join(',', $dauserids)
|
||||
), $this->id);
|
||||
|
||||
$this->numtodosend('wmsubmit','提交问卷');
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
}
|
||||
15
webmain/model/flow/worcModel.php
Normal file
15
webmain/model/flow/worcModel.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class flow_worcClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
//删除分区前判断
|
||||
protected function flowdeletebillbefore()
|
||||
{
|
||||
if(m('word')->rows('cid='.$this->id.'')>0)return '分区下有存在文件/文件夹不能删除';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
10
webmain/model/flow/wordModel.php
Normal file
10
webmain/model/flow/wordModel.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
//文档模块word
|
||||
class flow_wordClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
75
webmain/model/flow/wordxieModel.php
Normal file
75
webmain/model/flow/wordxieModel.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
//文档协作
|
||||
class flow_wordxieClassModel extends flowModel
|
||||
{
|
||||
|
||||
|
||||
public function flowrsreplace($rs, $lx=0)
|
||||
{
|
||||
$rs['xiebool'] = false;
|
||||
$xienameid = $rs['xienameid'];
|
||||
if($rs['optid']==$this->adminid){
|
||||
$rs['xiebool'] = true;
|
||||
}else if(!isempt($xienameid)){
|
||||
if($this->adminmodel->containjoin($xienameid, $this->adminid))
|
||||
$rs['xiebool'] = true;
|
||||
}
|
||||
$str = '';
|
||||
if(arrvalue($rs,'isgk')=='1')$str='<font color=green>可做模版</font>';
|
||||
$rs['isgk'] = $str;
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowgetoptmenu($num)
|
||||
{
|
||||
//判断是否可协作
|
||||
if($num=='editfile'){
|
||||
$rs = $this->flowrsreplace($this->rs,0);
|
||||
if($rs['xiebool']){
|
||||
return array('officebj'=>getconfig('officebj')); //返回编辑方式
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 协作好了上传文件
|
||||
*/
|
||||
public function savefile($fileid)
|
||||
{
|
||||
$fobj = m('file');
|
||||
$filename = ''.$this->rs['name'].'.'.$this->rs['wtype'].'';
|
||||
//把原来的文件名修改
|
||||
$ofrs = $fobj->getone($this->rs['fileid']);
|
||||
if($ofrs){
|
||||
$ofilename = ''.$this->rs['name'].'_'.$ofrs['optname'].'_'.date('YmdHis', strtotime($ofrs['adddt'])).'.'.$this->rs['wtype'].'';
|
||||
$fobj->update(array(
|
||||
'filename' => $ofilename
|
||||
),$this->rs['fileid']);
|
||||
}
|
||||
|
||||
$this->update(array(
|
||||
'fileid' => $fileid
|
||||
), $this->id);
|
||||
$fobj->update(array(
|
||||
'filename' => $filename,
|
||||
'mid' => $this->id,
|
||||
'mtype' => $this->mtable,
|
||||
'mknum' => $this->modenum,
|
||||
),$fileid);
|
||||
|
||||
$this->addlog(array(
|
||||
'name' => '上传文件'
|
||||
));
|
||||
//通知给对应人
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
|
||||
//在线编辑
|
||||
public function floweditoffice($frs, $ofrs)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
210
webmain/model/flow/workModel.php
Normal file
210
webmain/model/flow/workModel.php
Normal file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
class flow_workClassModel extends flowModel
|
||||
{
|
||||
private $absfile = false;
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->statearr = c('array')->strtoarray('待执行|blue,已完成|green,执行中|#ff6600,终止|#888888,验证未通过|#9D4FF7');
|
||||
}
|
||||
|
||||
//自定义审核人读取
|
||||
protected function flowcheckname($num){
|
||||
$sid = '';
|
||||
$sna = '';
|
||||
if($num=='run'){
|
||||
$sid = $this->rs['distid'];
|
||||
$sna = $this->rs['dist'];
|
||||
}
|
||||
return array($sid, $sna);
|
||||
}
|
||||
|
||||
//转办时要更新对应的执行人员
|
||||
protected function flowcheckbefore(){
|
||||
$up = array();
|
||||
if($this->checkiszhuanyi==1){
|
||||
$up['dist'] = $this->rs['syszb_name'];
|
||||
$up['distid'] = $this->rs['syszb_nameid'];
|
||||
$up['status'] = 3; //待执行状态
|
||||
}
|
||||
if($up)$up['update'] = $up;
|
||||
return $up;
|
||||
}
|
||||
|
||||
public function flowrsreplace($rs, $slx=0){
|
||||
|
||||
$zts = $rs['status'];
|
||||
$str = $this->getstatus($rs,'','',1);
|
||||
if($slx>=1){
|
||||
$projectid = (int)$rs['projectid'];
|
||||
$rs['projectid'] = '';
|
||||
if($projectid>0){
|
||||
$prs = $this->db->getone('[Q]project', $projectid);
|
||||
if($prs){
|
||||
$rs['projectid']=''.$prs['title'].'('.$prs['progress'].'%)';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isempt($rs['enddt']) && !in_array($zts,array(1,2,5))){
|
||||
if(strtotime($rs['enddt'])<time())$rs['explain'].='<font color=red>(已超期)</font>';
|
||||
}
|
||||
//$rs['status']= $str;
|
||||
if($rs['score']==0)$rs['score']='';
|
||||
if($rs['mark']==0)$rs['mark']='';
|
||||
if($slx==1){
|
||||
$zhuid = (int)arrvalue($rs,'zhuid','0');
|
||||
$nrs = arrvalue($rs,'file_content');
|
||||
if($zhuid>0 && isempt($nrs)){
|
||||
$rs['file_content'] = m('file')->getstr($this->mtable, $zhuid, 3);
|
||||
$this->absfile = true;
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
protected function flowgetfields($lx)
|
||||
{
|
||||
if($this->absfile){
|
||||
return array('file_content'=>'关联文件');
|
||||
}
|
||||
}
|
||||
|
||||
protected function flowchangedata(){
|
||||
$this->rs['stateid'] = $this->rs['state'];
|
||||
}
|
||||
|
||||
|
||||
protected function flowdatalog($arr)
|
||||
{
|
||||
$isaddlog = 0;
|
||||
$uid = $this->adminid;
|
||||
$ispingfen = 0;
|
||||
$distid = ','.$this->rs['distid'].',';
|
||||
$zt = $this->rs['stateid'];
|
||||
if($this->contain($distid, ','.$this->adminid.',') && ($zt==0||$zt==2)){
|
||||
$isaddlog = 1;
|
||||
}
|
||||
|
||||
$arr['isaddlog'] = $isaddlog; //是否可以添加日志记录
|
||||
$arr['state'] = $this->rs['stateid'];
|
||||
|
||||
//判断是否可以督导评分
|
||||
$where = $this->ddwhere($uid);
|
||||
if($this->rows("`id`='$this->id' and `status`=1 and `mark`=0 $where")==1){
|
||||
$ispingfen = 1;
|
||||
}
|
||||
$arr['ispingfen'] = $ispingfen; //是否可以评分
|
||||
$arr['score'] = $this->rs['score'];
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function flowsubmit($na, $sm)
|
||||
{
|
||||
//$this->push($this->rs['distid'], '', '[{type}]{title}');//提交给对应人提醒
|
||||
$this->push($this->rs['ddid'], '', '{optname}提交任务[{type}.{title}]分配给:{dist},需要你督导','任务督导');//提醒给督导人员
|
||||
|
||||
$zt = 0;
|
||||
if(!isempt($this->rs['distid']))$zt = 3;//待执行的状态值
|
||||
$this->updatestatus($zt);
|
||||
|
||||
}
|
||||
|
||||
protected function flowaddlog($a)
|
||||
{
|
||||
//提交报告时发送给创建人和督导人员
|
||||
if($a['name']=='进度报告'){
|
||||
$state = $a['status'];
|
||||
$arr['state'] = $state;
|
||||
$cont = ''.$this->adminname.'添加[{type}.{title}]的任务进度,说明:'.$a['explain'].'';
|
||||
if($state=='1')$cont='[{type}.{title}]任务'.$this->adminname.'已完成';
|
||||
$toid = $this->rs['optid'];
|
||||
$ddid = $this->rs['ddid'];
|
||||
if(!isempt($ddid))$toid.=','.$ddid.'';
|
||||
$this->push($toid, '任务', $cont);
|
||||
$this->update($arr, $this->id);
|
||||
}
|
||||
if($a['name']=='指派给' || $a['name']=='转发'){
|
||||
$cname = $this->rock->post('changename');
|
||||
$cnameid = $this->rock->post('changenameid');
|
||||
$state = '0';
|
||||
$arr['state'] = $state;
|
||||
$arr['distid'] = $cnameid;
|
||||
$arr['dist'] = $cname;
|
||||
$this->update($arr, $this->id);
|
||||
$this->push($cnameid, '任务', ''.$this->adminname.'指派任务[{type}.{title}]给你');
|
||||
}
|
||||
if($a['name'] == '任务评分'){
|
||||
$fenshu = (int)$this->rock->post('fenshu','0');
|
||||
$this->push($this->rs['distid'], '任务', ''.$this->adminname.'评分[{type}.{title}],分数('.$fenshu.')','任务评分');
|
||||
$this->update(array(
|
||||
'mark' => $fenshu
|
||||
), $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
private function ddwhere($uid)
|
||||
{
|
||||
$downid = m('admin')->getdown($uid, 1);
|
||||
$where = 'and `ddid`='.$uid.'';
|
||||
if($downid!='')$where = 'and (('.$uid.' in(`ddid`)) or (ifnull(`ddid`,\'0\')=\'0\' and `distid` in('.$downid.')) or (ifnull(`ddid`,\'0\')=\'0\' and `optid`='.$uid.'))';
|
||||
return $where;
|
||||
}
|
||||
|
||||
protected function flowbillwhere($uid, $lx)
|
||||
{
|
||||
$where = '';
|
||||
$projcetid = (int)$this->rock->post('projcetid');
|
||||
if($projcetid>0)$where='and `projectid`='.$projcetid.'';
|
||||
|
||||
return array(
|
||||
'keywhere' => $where,
|
||||
'order' => '`optdt` desc'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提醒快过期的任务
|
||||
* $txsj 提前几天提醒
|
||||
*/
|
||||
public function tododay($txsj = 1)
|
||||
{
|
||||
$dtobj= c('date');
|
||||
$dt = $this->rock->date;
|
||||
$rows = $this->getrows("`status` in(0,3,4) and ifnull(`distid`,'')<>'' and `enddt`>='$dt'");
|
||||
$arr = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$jg = $dtobj->datediff('d', $this->rock->date, $rs['enddt']);
|
||||
if($jg <= $txsj){
|
||||
$dista = explode(',', $rs['distid']);
|
||||
foreach($dista as $distid){
|
||||
if(!isset($arr[$distid]))$arr[$distid] = array();
|
||||
$tis = ''.$jg.'天后截止';
|
||||
if($jg == 0)$tis = '需今日完成';
|
||||
$arr[$distid][]= '['.$rs['type'].']'.$rs['title'].'('.$tis.');';
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($arr as $uid => $strarr){
|
||||
$this->flowweixinarr['url'] = $this->getwxurl();//设置微信提醒的详情链接
|
||||
$str = '';
|
||||
foreach($strarr as $k=>$str1){
|
||||
if($k>0)$str.="\n";
|
||||
$str.="".($k+1).".$str1";
|
||||
}
|
||||
if($str != '')$this->push($uid, '', $str, '任务到期提醒');
|
||||
}
|
||||
}
|
||||
|
||||
//任务待办格式推送
|
||||
protected function flownexttodo($type)
|
||||
{
|
||||
if($type=='daiban'){
|
||||
return array(
|
||||
'cont' => '标题:{title}\n创建人:{optname}\n任务类型:{type}\n等级:{grade}',
|
||||
'title'=> '任务待处理'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user