Crazy 7 hónapja
szülő
commit
ede71d6a79

+ 1 - 0
app/admin/controller/project/Audit.php

@@ -2403,6 +2403,7 @@ class Audit extends BaseController
 
 
             $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
+            add_project_log('审批通过', $param['project_id'], "业主项目审核二通过,项目审核通过");
 
 
             return to_assign("0", "操作成功");

+ 21 - 12
app/admin/controller/project/Cost.php

@@ -762,12 +762,16 @@ class Cost extends BaseController
                 $field = $this->Field->get_field_rules_new($this->uid);
                 $field_edit = $this->Field->get_field_rules_edit_new($this->uid);
 
-                $c = $detail['project_end_time'] - time();
-                if ($c > 0) {
-                    $advent_time = floor($c / 86400) . "天";
-                } else {
-                    $c = -$c;
-                    $advent_time = floor($c / 86400) . "天";
+                if ($detail["project_end_time"]!=null){
+                    $c = $detail['project_end_time'] - time();
+                    if ($c > 0) {
+                        $advent_time = floor($c / 86400) . "天";
+                    } else {
+                        $c = -$c;
+                        $advent_time = floor($c / 86400) . "天";
+                    }
+                }else{
+                    $advent_time = null;
                 }
                 if (!empty($detail)) {
                     View::assign('advent_time', $advent_time);
@@ -865,13 +869,18 @@ class Cost extends BaseController
                 $red = ["detail" => 0, "comment" => 0, "report" => 0, "user" => 0, "contact" => 0];
             }
             // dump($red);
-            $c = $detail['project_end_time'] - time();
-            if ($c > 0) {
-                $advent_time = floor($c / 86400) . "天";
-            } else {
-                $c = -$c;
-                $advent_time = floor($c / 86400) . "天";
+            if ($detail['project_end_time']!=null){
+                $c = $detail['project_end_time'] - time();
+                if ($c > 0) {
+                    $advent_time = floor($c / 86400) . "天";
+                } else {
+                    $c = -$c;
+                    $advent_time = floor($c / 86400) . "天";
+                }
+            }else{
+                $advent_time = null;
             }
+
             if (!empty($detail)) {
                 View::assign('advent_time', $advent_time);
 

+ 12 - 6
app/admin/controller/project/CostProprietor.php

@@ -572,15 +572,21 @@ class CostProprietor extends BaseController
                 ->order('mf.create_time desc')
                 ->where(array('mf.topic_id' => $id, 'mf.module' => 'project'))
                 ->select()->toArray();
-            $c = $detail['project_end_time'] - time();
             $project_log = self::project_log($id);
             View::assign('project_log', $project_log);
-            if ($c > 0) {
-                $advent_time = floor($c / 86400) . "天";
-            } else {
-                $c = -$c;
-                $advent_time = floor($c / 86400) . "天";
+
+            if ($detail["project_end_time"]!=null){
+                $c = $detail['project_end_time'] - time();
+                if ($c > 0) {
+                    $advent_time = floor($c / 86400) . "天";
+                } else {
+                    $c = -$c;
+                    $advent_time = floor($c / 86400) . "天";
+                }
+            }else{
+                $advent_time=null;
             }
+
             $comment_type = isset($param["comment_type"])?$param['comment_type'] : 0;
             $comment = Db::name("project_comment")->where("type",$comment_type)
                 ->where("project_id", $id)->order('create_time', 'asc')->select();

+ 164 - 168
app/admin/controller/project/Report.php

@@ -48,7 +48,8 @@ class Report extends BaseController
         $where = [
             ["cp_project_report.delete_time", "=", 0],
             ["project_id", "=", $param["project_id"]],
-            ["a.status","<",6]//公司待审批之前
+            ["a.status","<>",6],//公司待审批之前
+            ["a.status","<>",7]//公司待审批之前
         ];
 
         $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
@@ -379,8 +380,10 @@ class Report extends BaseController
                 ->order('r.create_time desc')
                 ->where(array('r.id' => $id))
                 ->select()->toArray();
+
             View::assign('file_array', $file_array);
             View::assign('detail', $detail);
+
             return view();
         }
     }
@@ -407,7 +410,7 @@ class Report extends BaseController
 
             "project_name" => $details["project_name"],
             "project_type" => "造价项目",
-            "audit_name" => "删除报告申请",
+            "audit_name" => "财评删除报告审核",
             "audit_type" => 2,
             "else_id" => $id,
             "sponsor" => get_login_admin("nickname"),
@@ -443,53 +446,48 @@ class Report extends BaseController
         $param = get_params();
         $handle = $this->Pushmessage->handleParam($param);
         $param = $handle['param'];
-        //return json($param);
-        //dump($param);
 
-        $type = isset($param['type']) ? $param['type'] : 0;
+        if (!isset($param["type"])) {//在项目列表通过
 
-        if (!isset($param["type"])) {//在审核列表通过
             $id = isset($param['id']) ? $param['id'] : 0;
-            $this->model->where("id", $id)->update(["status" => 1]);//财评已通过
             $detail = $this->model->where("id", $id)->find();//在Project_report里
+            $project_id = $this->model->where("id", $id)->value("project_id");//在Project_report里
 
             try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2, "audit_time" => time()]);//更新审批通过
+                Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","财评报告审核")->update(["audit_status" => 2, "audit_time" => time()]);//更新审批通过
+                $this->model->where("id", $id)->update(["status" => 1]);//财评已通过
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
             //给业主新增报告审核
-            $where = [
-                ["project_id", "=", $param["project_id"]],
-                ["else_id", "=", $param["else_id"]],//项目报告id
-                ["audit_type", "=", 2]
-            ];
-            $de = Db::name("cost_project")->where("id", $param["project_id"])->field("sent_review_head,sent_review_head_name")->find();
-            if (isset($de)) {
-                $auditData = $this->Auditmodel->where($where)->find()->toArray();
-                $auditData["audit_name"] = "业主报告审核";
-                $auditData["audit_status"] = 1;
-                //$auditData["audit_type"] = 2;
-                $auditData["approver"] = $de["sent_review_head"];
-                $auditData["approver_name"] = $de["sent_review_head_name"];
-                $auditData["create_time"] = time();
-                $auditData["audit_time"] = null;
-                $auditData["remark"] = null;
-                $auditData["audit_remark"] = null;
-                unset($auditData["id"]);
-                try {
-                    $this->Auditmodel->save($auditData);
-                } catch (\Exception $e) {
-                    return to_assign(1, '操作失败,原因:' . $e->getMessage());
-                }
-            }
-
+                $where = [
+                    ["project_id", "=", $project_id],
+                    ["else_id", "=", $id],//项目报告id
+                    ["audit_type", "=", 2]
+                ];
+                $de = Db::name("costProject")->where("id", $detail["project_id"])->field("sent_review_head,sent_review_head_name")->find();
+                if (isset($de)) {
+                    $auditData = $this->Auditmodel->where($where)->find()->toArray();
+                    $auditData["audit_name"] = "业主报告审核";
+                    $auditData["audit_status"] = 1;
+                    $auditData["audit_type"] = 2;
+                    $auditData["approver"] = $de["sent_review_head"];
+                    $auditData["approver_name"] = $de["sent_review_head_name"];
+                    $auditData["create_time"] = time();
+                    $auditData["audit_time"] = null;
+                    $auditData["remark"] = null;
+                    $auditData["audit_remark"] = null;
+                    unset($auditData["id"]);
+                    try {
+                        $this->Auditmodel->save($auditData);
+                    } catch (\Exception $e) {
+                        return to_assign(1, '操作失败,原因:' . $e->getMessage());
+                    }
 
+                }
             //发给公司
             $people = $this->model->where('id', $id)->value("maker_id");
-            //发送信息给业主审核
-            $proprietor =Db::name("costProject")->where("id",$detail["project_id"])->value("sent_review_head");
-
+            $proprietor =Db::name("costProject")->where("id", $project_id)->value("sent_review_head");
             if (empty($handle['company'])) {
                 $handle['company'] = (array)$people;
             } else {
@@ -501,11 +499,11 @@ class Report extends BaseController
                 $handle['proprietor'] = array_merge($handle['proprietor'], (array)$proprietor);
             }
 
-            $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company'], $handle['proprietor']);
-            add_project_log('财政局审批通过', $param['project_id'], "报告审批通过");
+            $this->Pushmessage->pushMessage( $project_id, $handle['financial'], $handle['company'],$handle["proprietor"]);
+            add_project_log('财政局审批通过', $project_id, "报告审批通过");
 
-        } else {//在项目报告里同意
-            $param['audit_time'] = time();
+        } else {//在审核列表里同意
+            //$param['audit_time'] = time();
             $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
             add_log('edit', $param['id'], $param);
             $id = $param['id'];
@@ -574,27 +572,18 @@ class Report extends BaseController
         $param = get_params();
         $handle = $this->Pushmessage->handleParam($param);
         $param = $handle['param'];
-        $type = isset($param['type']) ? $param['type'] : 0;
+        //$type = isset($param['type']) ? $param['type'] : 0;
         if (!isset($param["type"])) {//在审核列表通过
+
             $id = isset($param['id']) ? $param['id'] : 0;
             $this->model->where("id", $id)->update(["status" => 8]);
             $detail = $this->model->where("id", $id)->find();
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">", $detail["type"]]],
-                ["status", ">", 1],
-                ["status", "<>", 2],
-                ["status", "<", 4]
-            ])->count();
+
             //type,0初审,1对数,2审定
             $report_status = $detail["type"] + 1;
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
+            $data = ['report_time' => time(), "report_status" => $report_status];
             try {
-                Db::name("cost_project")->where("id", $detail["project_id"])->update($data);
+                Db::name("cost_project")->where("id",  $detail["project_id"])->update($data);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
@@ -611,8 +600,8 @@ class Report extends BaseController
             } else {
                 $handle['company'] = array_merge($handle['company'], (array)$people);
             }
-
-            $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company']);
+            $this->Pushmessage->pushMessage(  $detail["project_id"], $handle['financial'], $handle['company']);
+            //add_project_log('业主审批通过', $detail["project_id"], "报告审批通过");
 
 
         } else {//在项目报告里通过
@@ -623,26 +612,16 @@ class Report extends BaseController
             unset($param["id"]);
 
             $detail = ProjectReport::where("id", $param["else_id"])->find();
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">", $detail["type"]]],
-                ["status", ">", 1],
-                ["status", "<>", 2],
-                ["status", "<", 4]
-            ])->count();
+
             //type,0初审,1对数,2审定
             $report_status = $detail["type"] + 1;
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
+
+            $data = ['report_time' => time(), "report_status" => $report_status];
+
             $type_status = $detail["status"];
             if ($type_status == 1) {//财政局已通过
                 ProjectReport::where("id", $param["else_id"])->update(["status" => 8, "update_time" => time()]);
                 $this->CostModel->where('id', $param['project_id'])->strict(false)->update($data);
-            } elseif ($type_status == 4) {//财政局删除已通过
-                ProjectReport::where("id", $param["else_id"])->update(["status" => 10, "update_time" => time()]);
             }
 
             $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
@@ -654,14 +633,14 @@ class Report extends BaseController
             }
             $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
 
-            add_project_log('业主审批通过', $param['project_id'], "报告审批通过");
+            add_project_log('审批通过', $param['project_id'], "报告审批通过");
         }
 
         return to_assign(0, "操作成功");
     }
 
     /**
-     * 财评
+     * 财评(已修改)
      * 不同意-报告
      */
     public function un_report()
@@ -689,6 +668,7 @@ class Report extends BaseController
             }
             $project_id = $this->model->where("id", $id)->value("project_id");
             $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']);
+            add_project_log('审批未通过', $project_id, "报告审批未通过");
 
         } else {//项目报告列表拒绝
             $param = get_params();
@@ -716,6 +696,7 @@ class Report extends BaseController
                     $handle['company'] = array_merge($handle['company'], (array)$people);
                 }
                 $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
+                add_project_log('审批未通过', $param['project_id'], "报告审批未通过");
 
 
             } catch (\Exception $e) {
@@ -736,13 +717,13 @@ class Report extends BaseController
         $param = get_params();
         $handle = $this->Pushmessage->handleParam($param);
         $param = $handle['param'];
-        if (!isset($param["type"])) {//项目报告里审核
+        if (!isset($param["type"])) {//项目报告列表
             $id = isset($param['id']) ? $param['id'] : 0;
             $this->model->where("id", $id)->update(["status" => 9]);
 
             try {
                 //一开始将所有的都改成了拒绝,改成了只改变业主的审批状态
-                Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","业主报告审核")->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"]]);
+                Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","业主报告审核")->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"],"audit_time" => time()]);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
@@ -755,8 +736,9 @@ class Report extends BaseController
             }
             $project_id = $this->model->where("id", $id)->value("project_id");
             $this->Pushmessage->pushMessage($project_id, [], $handle['company']);
+            //add_project_log('审批未通过', $project_id, "报告审批未通过");
 
-        } else {//审核列表里审核
+        } else {//项目报告列表
             $param = get_params();
             $handle = $this->Pushmessage->handleParam($param);
             $param = $handle['param'];
@@ -782,6 +764,7 @@ class Report extends BaseController
                     $handle['company'] = array_merge($handle['company'], (array)$people);
                 }
                 $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company']);
+                //add_project_log('审批未通过', $param['project_id'], "报告审批未通过");
 
             } catch (\Exception $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
@@ -793,7 +776,7 @@ class Report extends BaseController
 
 
     /**
-     * 财评
+     * 财评(已修改)
      * 同意-删除
      */
     public function agree_delete()
@@ -807,48 +790,60 @@ class Report extends BaseController
             $this->model->where("id", $id)->update(["status" => 4]);
 
             $detail = $this->model->where("id", $id)->find();
-            //type,0初审,1对数,2审定
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">=", $detail["type"]]],
-                ["status", ">", 1],
-                ["status", "<>", 2],
-                ["status", "<", 4]
-            ])->count();
-            //type,0初审,1对数,2审定
-            $report_status = $detail["type"];
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
-            try {
-                Db::name("cost_project")->where("id", $detail["project_id"])->update($data);
-            } catch (DbException $e) {
-                return to_assign(1, '操作失败,原因:' . $e->getMessage());
-            }
+            $project_id = $this->model->where("id", $id)->value("project_id");//在Project_report里
 
-            try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2]);
-            } catch (DbException $e) {
-                return to_assign(1, '操作失败,原因:' . $e->getMessage());
+
+            Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","财评删除报告审核")->update(["audit_status" => 2]);
+
+            //给业主新增报告删除审核
+            $where = [
+                ["project_id", "=",$project_id],
+                ["else_id", "=", $id],//项目报告id
+                ["audit_type", "=", 2],
+                ["audit_name","=","财评删除报告审核"]
+            ];
+            $de = Db::name("cost_project")->where("id", $project_id)->field("sent_review_head,sent_review_head_name")->find();
+            if (isset($de)) {
+                $auditData = $this->Auditmodel->where($where)->find()->toArray();//
+                $auditData["audit_name"] = "业主删除报告审核";
+                $auditData["audit_status"] = 1;
+                $auditData["approver"] = $de["sent_review_head"];
+                $auditData["approver_name"] = $de["sent_review_head_name"];
+                $auditData["create_time"] = time();
+                $auditData["audit_time"] = null;
+                //$auditData["remark"] = null;
+                $auditData["audit_remark"] = null;
+                unset($auditData["id"]);
+                try {
+                    $this->Auditmodel->save($auditData);
+                } catch (\Exception $e) {
+                    return to_assign(1, '操作失败,原因:' . $e->getMessage());
+                }
             }
 
             $people = $this->model->where('id', $id)->value("maker_id");
+            $proprietor =Db::name("costProject")->where("id",$project_id)->value("sent_review_head");
+
+            if (empty($handle['proprietor'])) {
+                $handle['proprietor'] = (array)$proprietor;
+            } else {
+                $handle['proprietor'] = array_merge($handle['proprietor'], (array)$proprietor);
+            }
             if (empty($handle['company'])) {
                 $handle['company'] = (array)$people;
             } else {
                 $handle['company'] = array_merge($handle['company'], (array)$people);
             }
-            $project_id = $this->model->where("id", $id)->value("project_id");
-            $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']);
+            $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company'],$handle["proprietor"]);
+            add_project_log('审批通过', $project_id, "报告删除审批通过");
+
         } else {//审核项目里
-            $param['audit_time'] = time();
+
             $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
 
             $id = $param['id'];
             unset($param["id"]);
-
+            //$param{else_id是项目报告id
             $detail = ProjectReport::where("id", $param["else_id"])->find();
 
             $type_status = $detail["status"];
@@ -857,21 +852,54 @@ class Report extends BaseController
             }
 
             $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
+            $proprietor =Db::name("costProject")->where("id",$detail["project_id"])->value("sent_review_head");
+            if (empty($handle['proprietor'])) {
+                $handle['proprietor'] = (array)$proprietor;
+            } else {
+                $handle['proprietor'] = array_merge($handle['proprietor'], (array)$proprietor);
+            }
             if (empty($handle['company'])) {
                 $handle['company'] = (array)$people;
             } else {
                 $handle['company'] = array_merge($handle['company'], (array)$people);
             }
 
-            $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
+            $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'],$handle["proprietor"]);
             add_project_log('审批通过', $param['project_id'], "报告删除审批通过");
+
+            //给业主新增报告删除审核
+            $where = [
+                ["project_id", "=", $param["project_id"]],
+                ["else_id", "=", $param["else_id"]],//项目报告id
+                ["audit_type", "=", 2],
+                ["audit_name","=","财评删除报告审核"]
+            ];
+            $de = Db::name("cost_project")->where("id", $param["project_id"])->field("sent_review_head,sent_review_head_name")->find();
+            if (isset($de)) {
+                $auditData = $this->Auditmodel->where($where)->find()->toArray();
+                $auditData["audit_name"] = "业主删除报告审核";
+                $auditData["audit_status"] = 1;
+
+                $auditData["approver"] = $de["sent_review_head"];
+                $auditData["approver_name"] = $de["sent_review_head_name"];
+                $auditData["create_time"] = time();
+                $auditData["audit_time"] = null;
+                //$auditData["remark"] = null;
+                $auditData["audit_remark"] = null;
+                unset($auditData["id"]);
+                try {
+                    $this->Auditmodel->save($auditData);
+                } catch (\Exception $e) {
+                    return to_assign(1, '操作失败,原因:' . $e->getMessage());
+                }
+            }
         }
 
         return to_assign(0, "操作成功");
     }
 
     /**
-     * 业主 (未修改)
+     * 业主 (修改)
      * 同意-删除
      */
     public function proprietor_agree_delete()
@@ -881,32 +909,18 @@ class Report extends BaseController
         $param = $handle['param'];
         if (!isset($param["type"])) {
             $id = isset($param['id']) ? $param['id'] : 0;
-            $this->model->where("id", $id)->update(["status" => 4]);
+            $this->model->where("id", $id)->update(["status" => 10]);
 
             $detail = $this->model->where("id", $id)->find();
-            //type,0初审,1对数,2审定
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">=", $detail["type"]]],
-                ["status", ">", 1],
-                ["status", "<>", 2],
-                ["status", "<", 4]
-            ])->count();
-            //type,0初审,1对数,2审定
-            $report_status = $detail["type"];
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
+
             try {
-                Db::name("cost_project")->where("id", $detail["project_id"])->update($data);
+                Db::name("cost_project")->where("id", $detail["project_id"])->update(['report_time' => time()]);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
 
             try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2]);
+                Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","业主删除报告审核")->update(["audit_status" => 2]);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
@@ -919,37 +933,21 @@ class Report extends BaseController
             }
             $project_id = $this->model->where("id", $id)->value("project_id");
             $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']);
-        } else {
-            $param['audit_time'] = time();
+            add_project_log('业主审批通过', $project_id, "报告删除审批通过");
+        } else {//在项目报告里
+
             $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
 
             $id = $param['id'];
             unset($param["id"]);
 
-
             $detail = ProjectReport::where("id", $param["else_id"])->find();
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">=", $detail["type"]]],
-                ["status", ">", 1],
-                ["status", "<>", 2],
-                ["status", "<", 4]
-            ])->count();
-            //type,0初审,1对数,2审定
-            $report_status = $detail["type"];
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
-            $type_status = $detail["status"];
-            if ($type_status == 0) {
-                ProjectReport::where("id", $param["else_id"])->update(["status" => 1, "update_time" => time()]);
-                $this->CostModel->where('id', $param['project_id'])->strict(false)->update($data);
-            } elseif ($type_status == 3) {
-                ProjectReport::where("id", $param["else_id"])->update(["status" => 4, "update_time" => time()]);
-                Db::name("cost_project")->where("id", $detail["project_id"])->update(["report_status" => $report_status]);
 
+
+            $type_status = $detail["status"];
+              if ($type_status == 4) {
+                ProjectReport::where("id", $param["else_id"])->update(["status" => 10, "update_time" => time()]);
+                Db::name("cost_project")->where("id", $detail["project_id"])->update(['report_time' => time()]);
             }
 
             $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
@@ -960,14 +958,14 @@ class Report extends BaseController
             }
 
             $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
-            add_project_log('审批通过', $param['project_id'], "报告删除审批通过");
+            add_project_log('业主审批通过', $param['project_id'], "报告删除审批通过");
         }
 
         return to_assign(0, "操作成功");
     }
 
     /**
-     * 财评
+     * 财评(已修改)
      * 不同意-删除
      */
     public function un_delete()
@@ -980,7 +978,7 @@ class Report extends BaseController
             $this->model->where("id", $id)->update(["status" => 5]);
 
             try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"]]);
+                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
@@ -993,24 +991,22 @@ class Report extends BaseController
             }
             $project_id = $this->model->where("id", $id)->value("project_id");
             $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']);
+            add_project_log('财政局审批未通过',  $project_id, "报告删除审批未通过");
         } else {
             $param = get_params();
             $handle = $this->Pushmessage->handleParam($param);
             $param = $handle['param'];
             try {
-                $param['audit_time'] = time();
+
                 $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
 
                 $id = $param['id'];
                 unset($param["id"]);
 
-                $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status");
-                if ($type_status == 0) {
-                    //新建
-                    Db::name("contact")->where("id", $param["else_id"])->update(["status" => 2, "update_time" => time()]);
-                } elseif ($type_status == 3) {
+                $type_status = Db::name("project_report")->where("id", $param["else_id"])->value("status");
+                if ($type_status == 3) {
                     //删除
-                    Db::name("contact")->where("id", $param["else_id"])->update(["status" => 5, "update_time" => time()]);
+                    Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 5, "update_time" => time()]);
                 }
 
                 $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
@@ -1021,6 +1017,7 @@ class Report extends BaseController
                 }
 
                 $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
+                add_project_log('财政局审批未通过', $param['project_id'], "报告删除审批未通过");
 
             } catch (\Exception $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
@@ -1032,7 +1029,7 @@ class Report extends BaseController
     }
 
     /**
-     * 业主 (修改)
+     * 业主 (修改)
      * 不同意-删除
      */
     public function proprietor_un_delete()
@@ -1042,10 +1039,10 @@ class Report extends BaseController
         $param = $handle['param'];
         if (!isset($param["type"])) {
             $id = isset($param['id']) ? $param['id'] : 0;
-            $this->model->where("id", $id)->update(["status" => 5]);
+            $this->model->where("id", $id)->update(["status" => 11]);
 
             try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"]]);
+                Db::name("project_audit")->where([["else_id", "=", $id]])->where("audit_name","业主删除报告审核")->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
@@ -1058,24 +1055,22 @@ class Report extends BaseController
             }
             $project_id = $this->model->where("id", $id)->value("project_id");
             $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']);
+            add_project_log('业主审批未通过', $project_id, "报告删除审批未通过");
         } else {
             $param = get_params();
             $handle = $this->Pushmessage->handleParam($param);
             $param = $handle['param'];
             try {
-                $param['audit_time'] = time();
+
                 $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
 
                 $id = $param['id'];
                 unset($param["id"]);
 
-                $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status");
-                if ($type_status == 0) {
-                    //新建
-                    Db::name("contact")->where("id", $param["else_id"])->update(["status" => 2, "update_time" => time()]);
-                } elseif ($type_status == 3) {
+                $type_status = Db::name("project_report")->where("id", $param["else_id"])->value("status");
+                if ($type_status == 4) {
                     //删除
-                    Db::name("contact")->where("id", $param["else_id"])->update(["status" => 5, "update_time" => time()]);
+                    Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 11, "update_time" => time()]);
                 }
 
                 $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
@@ -1086,6 +1081,7 @@ class Report extends BaseController
                 }
 
                 $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
+                add_project_log('业主审批未通过', $param['project_id'], "报告删除审批未通过");
 
             } catch (\Exception $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());

+ 1 - 1
app/admin/view/project/cost/edit.html

@@ -405,7 +405,7 @@
         <div class="layui-col-md1" style="padding: 0;">
             <div class="layui-card countdown">
                 <div class="countdown-top" style="\font-size:1.1vw;">
-                    {if $detail.project_end_time>time()}剩 余{else}逾 期{/if}
+                    {if $detail.project_end_time > time()}剩 余{else}逾 期{/if}
                 </div>
                 <div class="countdown-bottom" style="font-size:1.1vw;">
                     {$advent_time}

+ 2 - 2
app/admin/view/project/cost/edit_first.html

@@ -431,11 +431,11 @@
       <th class="form-title">项目周期 <font style="color: red !important;">*</font></th>
       <th id="date" colspan="2">
         <div class="layui-input-inline" style="width: 47%;">
-          <input type="text" id="start_time" name="project_start_time" readonly lay-verify="required" lay-reqText="请选择开始时间" placeholder="请选择" {if $field_edit.project_time_edit != 1} disabled {/if} class="layui-input" value="{$detail.project_start_time|date='Y-m-d'}">
+          <input type="text" id="start_time" name="project_start_time" readonly lay-verify="required" lay-reqText="请选择开始时间" placeholder="请选择" {if $field_edit.project_time_edit != 1} disabled {/if} class="layui-input" value="">
         </div>
         -
         <div class="layui-input-inline" style="width: 47%;">
-          <input type="text" id="end_time" name="project_end_time" readonly lay-verify="required" lay-reqText="请选择结束时间" placeholder="请选择" {if $field_edit.project_time_edit != 1} disabled {/if} class="layui-input" value="{$detail.project_end_time|date='Y-m-d'}">
+          <input type="text" id="end_time" name="project_end_time" readonly lay-verify="required" lay-reqText="请选择结束时间" placeholder="请选择" {if $field_edit.project_time_edit != 1} disabled {/if} class="layui-input" value="">
         </div>
       </th>
       {/if}

+ 2 - 2
app/admin/view/project/cost/edit_report.html

@@ -35,7 +35,7 @@
             cols: [[
                 {field: 'id', title: '序号', width: 80, align: 'center',
                     templet: function (d) {
-					        console.log(allcount,d.LAY_NUM)
+					        //console.log(allcount,d.LAY_NUM)
                             return allcount - (d.LAY_NUM - 1);
                         
                         }
@@ -44,7 +44,7 @@
                     field: 'title', title: '报告名称', align: 'center',
                     templet: function (d) {
                         var html = "";
-                        if (d.status == 5) {
+                        if (d.status == 10) {
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
                         } else {
                             html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';

+ 1 - 1
app/admin/view/project/cost/project_report.html

@@ -39,7 +39,7 @@
                 {field: 'title', title: '报告名称',align: 'center',
                     templet: function (d) {
                         var html = "";
-                        if (d.status == 5) {
+                        if (d.status == 10) {
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
                         } else {
                             html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';

+ 4 - 4
app/admin/view/project/cost_company/edit_report.html

@@ -44,11 +44,10 @@
                 {field: 'title', title: '报告名称',align: 'center',
                     templet: function (d) {
                         var html = "";
-                        if(d.status == 4||d.status == 7){
+                        if(d.status == 10||d.status == 7){
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
                         }else{
                             html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
-
                         }
                         return '<div style="text-align:left">' + html + '</div>'
                     }
@@ -130,8 +129,9 @@
             if (obj.event === 'del') {
 
                 if(data.status==7){
-                    layer.msg("已拒绝,请重新创建");
-                }else if(data.status==1 ){
+                    layer.msg("公司已拒绝,请重新创建");
+                //     修改了一下让拒绝后,也还可以继续申请删除,之后也可改
+                }else if(data.status==8||data.status ==5||data.status == 9 ){
                     layer.prompt({title: '请输入<span style="color: red">删除</span>原因', formType: 2,area: ['35vw', '15vw']}, function(text, index){
 
                         let callback = function (e) {

+ 3 - 0
app/admin/view/project/cost_proprietor/add.html

@@ -403,6 +403,9 @@
                         <option value="">请选择项目类型</option>
                         <option value="1">预算</option>
                         <option value="2">结算</option>
+                        <option value="3">概算</option>
+                        <option value="4">决算</option>
+                        <option value="5">工程总承包(EPC)</option>
                     </select>
                 </div>
             </th>

+ 2 - 1
app/admin/view/project/cost_proprietor/edit_first.html

@@ -573,6 +573,7 @@
 
 </form>
 {else/}
+<!--之后的预览-->
 <form class="layui-form p-4">
   <table id="tabniubi" cellpadding="1" cellspacing="1">
     <tr>
@@ -621,7 +622,7 @@
     <tr>
       {if $field.project_time == 1}
       <th class="form-title">项目周期</th>
-      <th colspan="8" style="text-align: left; padding-left: 3.5vw;">{$detail.project_start_time|date="Y-m-d"} 至 {$detail.project_end_time|date="Y-m-d"}</th>
+      <th colspan="8" style="text-align: left; padding-left: 3.5vw;">{if $detail.project_start_time != null&& $detail.project_end_time != null}{$detail.project_start_time|date="Y-m-d"} 至 {$detail.project_end_time|date="Y-m-d"}{/if}</th>
       {/if}
     </tr>
 

+ 1 - 1
app/admin/view/project/cost_proprietor/edit_main.html

@@ -405,7 +405,7 @@
         <div class="layui-col-md1" style="padding: 0;">
             <div class="layui-card countdown">
                 <div class="countdown-top" style="\font-size:1.1vw;">
-                    {if $detail.project_end_time>time()}剩 余{else}逾 期{/if}
+                    {if $detail.project_end_time > time()}剩 余{else}逾 期{/if}
                 </div>
                 <div class="countdown-bottom" style="font-size:1.1vw;">
                     {$advent_time}

+ 1 - 1
app/admin/view/project/cost_proprietor/edit_report.html

@@ -44,7 +44,7 @@
                     field: 'title', title: '报告名称', align: 'center',
                     templet: function (d) {
                         var html = "";
-                        if (d.status == 5) {
+                        if (d.status == 10) {
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
                         } else {
                             html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';

+ 40 - 40
app/admin/view/project/cost_proprietor/project_comments.html

@@ -36,46 +36,46 @@
     </div>
 </div>
 <hr class="ws-space-16">
-<div class="log_item_bottom">
-    <div class="layui-form log_bottom_left">
-        <form class="layui-form" action="">
-            <div class="layui-form-item layui-form-text" style="float: left;width: 95%;">
-                <label class="layui-form-label">普通文本域</label>
-                <div class="layui-input-block" style="margin-left: 100px;">
-                    <textarea id="text" name="content" placeholder="请输入内容" maxlength="3000"class="layui-textarea"></textarea>
-                </div>
-                <div class="wrapper">
-                    <span></span><span class="total">0/3000字</span>
-                  </div>
-            </div>
-            <div class="layui-form-item" style="float: left;width: 4.5%;">
-                <div class="layui-input-block">
-                    <button type="submit" class="layui-btn" lay-submit lay-filter="webform" type="button"
-                            style="width: 100%;height: 100% !important;background-color: #16baaa00 !important;margin-top: 30%;">
-                        <img src="/static/home/images/allupload.png" height="100"
-                        style="max-width: 40px;height: 40px;"/>
-                    </button>
-                </div>
-            </div>
-            <div style="clear: both;"></div>
-            <div class="layui-form-item" id="imgItem">
-                <label class="layui-form-label">上传图片:</label>
-                <div class="layui-input-inlines-self">
-                    <div class="layui-upload-drag-self">
-                        <div id="uploadBtn" style="position:relative;">
-                            <img src="/static/home/images/upload.png" height="100"
-                                 style="max-width: 100%; width: 100%;"/>
-                            <input type="hidden" name="thumb" value="">
-
-                            <i class="layui-icon  layui-icon-clear" id="imgdel"></i>
-
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </form>
-    </div>
-</div>
+<!--<div class="log_item_bottom">-->
+<!--    <div class="layui-form log_bottom_left">-->
+<!--        <form class="layui-form" action="">-->
+<!--            <div class="layui-form-item layui-form-text" style="float: left;width: 95%;">-->
+<!--                <label class="layui-form-label">普通文本域</label>-->
+<!--                <div class="layui-input-block" style="margin-left: 100px;">-->
+<!--                    <textarea id="text" name="content" placeholder="请输入内容" maxlength="3000"class="layui-textarea"></textarea>-->
+<!--                </div>-->
+<!--                <div class="wrapper">-->
+<!--                    <span></span><span class="total">0/3000字</span>-->
+<!--                  </div>-->
+<!--            </div>-->
+<!--            <div class="layui-form-item" style="float: left;width: 4.5%;">-->
+<!--                <div class="layui-input-block">-->
+<!--                    <button type="submit" class="layui-btn" lay-submit lay-filter="webform" type="button"-->
+<!--                            style="width: 100%;height: 100% !important;background-color: #16baaa00 !important;margin-top: 30%;">-->
+<!--                        <img src="/static/home/images/allupload.png" height="100"-->
+<!--                        style="max-width: 40px;height: 40px;"/>-->
+<!--                    </button>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--            <div style="clear: both;"></div>-->
+<!--            <div class="layui-form-item" id="imgItem">-->
+<!--                <label class="layui-form-label">上传图片:</label>-->
+<!--                <div class="layui-input-inlines-self">-->
+<!--                    <div class="layui-upload-drag-self">-->
+<!--                        <div id="uploadBtn" style="position:relative;">-->
+<!--                            <img src="/static/home/images/upload.png" height="100"-->
+<!--                                 style="max-width: 100%; width: 100%;"/>-->
+<!--                            <input type="hidden" name="thumb" value="">-->
+
+<!--                            <i class="layui-icon  layui-icon-clear" id="imgdel"></i>-->
+
+<!--                        </div>-->
+<!--                    </div>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </form>-->
+<!--    </div>-->
+<!--</div>-->
 
 
 

+ 2 - 2
app/admin/view/project/cost_proprietor/project_contact.html

@@ -26,9 +26,9 @@
                     templet: function (d) {
                         var html = "";
                         if(d.audit_status == 0 || d.audit_status == 2){
-                            html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
-                        }else{
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
+                        }else{
+                            html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
                         }
                         return '<div style="text-align:left">' + html + '</div>'
                     }

+ 20 - 18
app/admin/view/project/cost_proprietor/project_overview.html

@@ -95,23 +95,23 @@
             {if $field.engineering_type == 1}
             <th class="form-title">工程类型</th>
             <th>
-                {$detail.engineering_type1}
-               <!-- <div>
-                    <select name="type" lay-verify="required" lay-filter="aihao">
-                        <option value="1" style="align-items: center;">预算</option>
-                        <option value="2">结算</option>
-                    </select>
-                </div>-->
+                {if $detail.engineering_type1==1}
+                预算
+                {elseif $detail.engineering_type1==2}
+                结算
+                {elseif $detail.engineering_type1==3}
+                概算
+                {elseif $detail.engineering_type1==4}
+                决算
+                {elseif $detail.engineering_type1==5}
+                工程总承包(EPC)
+                {/if}
+
             </th>
             <th class="form-title">——</th>
             <th>
-                {$detail.engineering_type2}
-                <!-- <div>
-                    <select name="type" lay-verify="required" lay-filter="aihao">
-                        <option value="1">审核</option>
-                        <option value="2">编制</option>
-                    </select>
-                </div> -->
+                {if $detail.engineering_type2==1}审核{else}编制{/if}
+
             </th>
             {/if}
 
@@ -270,19 +270,21 @@
             <th class="form-title forright" colspan="1">
                 送审单位承担<br>审核费(元)
             </th>
-            <th colspan="1">{$detail.sent_review_approver_amount}</th>
+            <th colspan="2">{$detail.sent_review_approver_amount}</th>
             {/if}
 
             {if $field.construction_approver_amount == 1}
-            <th class="form-title forright" colspan="1">
+            <th class="form-title forright" colspan="2">
                 施工单位负责<br>核减超5%评审费部分(元)
             </th>
-            <th colspan="1">{$detail.construction_approver_amount}</th>
+            <th colspan="2">{$detail.construction_approver_amount}</th>
             {/if}
 
             {if $field.report_time == 1}
             <th class="form-title" colspan="1">报告时间</th>
-            <th colspan="4" style="text-align: left; padding-left: 3.5vw;">{if $detail.report_time!=0}{$detail.report_time|date="Y-m-d"}{/if}</th>
+            <th colspan="1" style="text-align: left; padding-left: 3.5vw;">{if
+                $detail.report_time!=0}{$detail.report_time|date="Y-m-d"}{/if}
+            </th>
             {/if}
         </tr>
         {/if}

+ 7 - 7
app/admin/view/project/cost_proprietor/project_record.html

@@ -10,7 +10,7 @@
 </div>
 <script type="text/html" id="toolbarrecord">
     <div class="layui-btn-container">
-        <button class="layui-btn layui-btn-sm" lay-event="add">+ 新建记录</button>
+<!--        <button class="layui-btn layui-btn-sm" lay-event="add">+ 新建记录</button>-->
     </div>
 </script>
 
@@ -47,12 +47,12 @@
                 {field: 'create_time', title: '创建时间', align: 'center', width: 150},
                 {field: 'admin_name', title: '创建人', align: 'center', width: 100},
                 {field: 'right', fixed: 'right', title: '操作', width: 100, align: 'center',
-                    templet: function (d) {
-                        var html = '<div class="layui-btn-group">';
-                        var btn1 = '<span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
-                        var btn2 = '<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span>';
-                        return html + btn1 + btn2 + '</div>';
-                    }
+                    // templet: function (d) {
+                    //     var html = '<div class="layui-btn-group">';
+                    //     var btn1 = '<span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
+                    //     var btn2 = '<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span>';
+                    //     return html + btn1 + btn2 + '</div>';
+                    // }
                 }
             ]]
         });

+ 3 - 3
app/admin/view/project/cost_proprietor/project_report.html

@@ -25,10 +25,10 @@
                 {field: 'title', title: '报告名称',align: 'center',
                     templet: function (d) {
                         var html = "";
-                        if(d.status == 1){
-                            html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
-                        }else{
+                        if(d.status == 10){
                             html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
+                        }else{
+                            html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
                         }
                         return '<div style="text-align:left">' + html + '</div>'
                     }

+ 15 - 15
app/admin/view/project/cost_proprietor/read.html

@@ -364,15 +364,15 @@
             <li data-load="" data-id="4">项目人员</li>
             {/if}
 
-            {if $project_five.project_log == 1}
-            <li data-load="" data-id="5">项目动态</li>
-            {/if}
-
             {if $project_five.project_report == 1}
-            <li data-load="" data-id="6">项目报告</li>
+            <li data-load="" data-id="5">项目报告</li>
             {/if}
 
-            <li data-load="" data-id="7">预约看现场</li>
+            <li data-load="" data-id="6">预约看现场</li>
+
+            {if $project_five.project_log == 1}
+            <li data-load="" data-id="7">项目动态</li>
+            {/if}
 
 
         </ul>
@@ -396,7 +396,7 @@
 <!--            联系函-->
 
             <div class="layui-tab-item">
-                {include file="/project/cost_proprietor/edit_contact" /}
+                {include file="/project/cost_proprietor/project_contact" /}
             </div>
 
 
@@ -404,20 +404,20 @@
                 {include file="/project/cost_proprietor/project_user" /}
             </div>
 
+
             <div class="layui-tab-item">
-                {include file="/project/projectlog/index" /}
+                {include file="/project/cost_proprietor/project_report" /}
             </div>
 
-
             <div class="layui-tab-item">
-                {include file="/project/cost_proprietor/edit_report" /}
+                {include file="/project/cost_proprietor/project_appointment" /}
             </div>
 
-
             <div class="layui-tab-item">
-                {include file="/project/cost_proprietor/edit_appointment" /}
+                {include file="/project/projectlog/index" /}
             </div>
 
+
         </div>
     
 </div>
@@ -450,12 +450,12 @@
                 project_user(index)
 
             } else if (index == 5) {
-
-            } else if (index == 6) {
                 report(index);
+            } else if (index == 6) {
+                appointment(index)
             }
             else if (index == 7) {
-                appointment(index)
+
             }
         });
         //看报告