12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- /**
- * Created by PhpStorm.
- * User: sicilon_IT
- * Date: 2020/1/13
- * Time: 9:13
- */
- namespace app\index\model;
- use think\Model;
- class checkoprmodel extends Model{
- protected $table='t_headcheckrecord';
- //
- public function getShiftbyWid($wid){
- $datenow=date('Y-m-d ');
- $datestart=date('Y-m-d',strtotime('-1 day'));
- //暂时取今天昨天
- $strsql="select * from t_headcheckrecord";
- $strsql=$strsql." where checkdate<='".$datenow."' and checkdate>='".$datestart."' and headid=".$wid." and isopr=1";
- //$wherearr['checkdate']=$datestart;
- $recordlist=$this->query($strsql);
- return $recordlist;
- }
- public function saveOprRecord($oprinfo){
- $id=$this->save($oprinfo);
- return $id;
- }
- public function getoprinfobypid($pid,$checkdate){
- // $where_arr['pid']=$pid;
- // $where_arr['checkdate']=$checkdate;
- // $where_arr['checkorder']=$checkshift;
- //采用语句查询,
- //20200203 改成按日,汇总,不再区分班次
- $strsql="select a.checkdate,a.checkorder,a.pid,a.headid,sum(a.wnum) as countwnum,b.wname";
- $strsql=$strsql." from t_headcheckrecord a left join t_workerinfo b on a.headid=b.id";
- // $strsql=$strsql.' where pid='.$pid." and checkdate='".$checkdate."' and checkorder=".$checkshift;
- $strsql=$strsql.' where pid='.$pid." and checkdate='".$checkdate."' ";
- $strsql=$strsql." group by headid";
- $list=$this->query($strsql);
- return $list;
- }
- /*
- * 20200402
- * 获取项目经理的记工记录
- * 这个功能在这种情况下可能会出现错误,即同一个项目经理,上下午在不同工地的时候
- * 需要在获取详情的代码中查看,是否有此问题
- * 按大于某一天查询
- */
- public function seloprlistbyhid($hid,$startdate){
- $strsql="select a.checkdate,a.checkorder,a.pid,a.headid,sum(a.wnum) as countwnum,b.wname";
- $strsql=$strsql." from t_headcheckrecord a left join t_workerinfo b on a.headid=b.id";
- // $strsql=$strsql.' where pid='.$pid." and checkdate='".$checkdate."' and checkorder=".$checkshift;
- $strsql=$strsql.' where headid='.$hid." and checkdate > '".$startdate."' ";
- $strsql=$strsql." group by checkdate";
- $strsql=$strsql." having countwnum>0";
- $list=$this->query($strsql);
- return $list;
- }
- /*
- * 20230215
- */
- public function selinfobyid($id){
- $where['id']=$id;
- $rec=$this->where($where)->find();
- return $rec;
- }
- }
|