north %!s(int64=8) %!d(string=hai) anos
pai
achega
dba8c5d645

+ 16 - 0
www/protected/modules/moonclub/controllers/ComplaintsController.php

@@ -35,6 +35,22 @@ class ComplaintsController extends AdminController
         echo CommonFn::composeDatagridData($parsedRows, $total);
     }
 
+    public function actionEdit() {
+        $id = Yii::app()->request->getParam('id','');
+        $result = Yii::app()->request->getParam('result','');
+        $feedback = Yii::app()->request->getParam('feedback','');
+        $desc = Yii::app()->request->getParam('desc','');
+        if (!CommonFn::isMongoId($id)) {
+            CommonFn::requestAjax(false,'id_not_exits');exit;
+        }
+        $comp = Complaints::get(new MongoId($id));
+        $comp->result = $result;
+        $comp->feedback = $feedback;
+        $comp->desc = $desc;
+        $comp->save();
+        CommonFn::requestAjax(true,'修改成功');exit;
+    }
+
 
     public function actionAdd () {
 

+ 56 - 5
www/protected/modules/moonclub/controllers/POrderController.php

@@ -72,6 +72,7 @@ class POrderController extends AdminController
         $package = Yii::app()->request->getParam('package','');//服务标准
         $service_employer = Yii::app()->request->getParam('service_employer','');//服务人员
         $status = Yii::app()->request->getParam('status_edit','');//状态
+
         if (empty($service_employer)) {
             CommonFn::requestAjax(false, '服务人员信息不存在');exit;
         } else {
@@ -93,7 +94,10 @@ class POrderController extends AdminController
         if (!empty($out_room_time)) {
             $porder->out_room_time = intval($out_room_time);
         }
-        $porder->order_time = intval($order_time);
+        if (!empty($order_time)) {
+            $porder->order_time = intval($order_time);
+        }
+
 
         $porder->service_standards = intval($package);
         $porder->service_employer = $employer->_id;
@@ -167,8 +171,8 @@ class POrderController extends AdminController
 
         $order_id = Yii::app()->request->getParam('id','');
         $user_name = Yii::app()->request->getParam('user_name','');
-        $result = Yii::app()->request->getParam('result','');
-        $feedback = Yii::app()->request->getParam('feedback','');
+        $c_info = Yii::app()->request->getParam('c_info','');
+
         $desc = Yii::app()->request->getParam('desc','');
 
         if (!CommonFn::isMongoId($order_id)) {
@@ -180,9 +184,8 @@ class POrderController extends AdminController
         $complaints->address = $porder->address;
         $complaints->user_name = $user_name;
         $complaints->p_id = $order_id;
+        $complaints->c_info = $c_info;
         $complaints->employer = Employe::get(new MOngoId($porder->service_employer))->user_name;
-        $complaints->result = $result;
-        $complaints->feedback = $feedback;
         $complaints->desc = $desc;
         $res = $complaints->save();
         if ($res) {
@@ -236,4 +239,52 @@ class POrderController extends AdminController
         $res=Service::factory('ExcelToArrayService')->push($data,$name,'porder');
         echo "导出成功";
     }
+    public function actionOutputExcel1()
+    {
+        $beginYesterday=mktime(0,0,0,date('m')-1,1,date('Y'));
+        $endYesterday=mktime(0,0,0,date('m'),1,date('Y'))-1;
+        $name=date("Y-m",strtotime("-1 months",time())).'月服务明细汇总';
+
+        $criteria = new EMongoCriteria();
+        $criteria->order_time('>=',$beginYesterday);//开始时间
+        $criteria->order_time('<=',$endYesterday);//结束时间
+        $p_orders = POrder::model()->findAll($criteria);
+        $i =0;
+        $data = array();
+        $address = array();
+
+        foreach ($p_orders as $k => $order ) {
+
+            $times = 0;
+            $floor = intval($order->address['floor']);
+            $room = intval($order->address['room']);
+            //判断地址是否重复
+            if (!in_array($floor.'-'.$room,$address)) {
+                $address[] = $floor.'-'.$room;//不重复加入数组 然后计算 这个地址被服务过的总数和时长
+                $data[$i]['floor'] = $floor;
+                $data[$i]['room'] = $room;
+                $data[$i]['total'] =0;
+                $data[$i]['times'] =0;
+                //计算 一个房间的数据
+                $tmp = POrder::model()->findAll($criteria);
+                foreach ($tmp as $k => $v) {
+
+                    if (intval($floor) == intval($v->address['floor']) && intval($room) == intval($v->address['room'])) {
+                        $data[$i]['total'] += 1;
+                        if (!empty($v->out_room_time)  && !empty($v->in_room_time))//只有当进房时间和出房时间都不为空时计算时长
+                            $times = ($v->out_room_time - $v->in_room_time)/3600;//小时
+                        $data[$i]['times'] += $times;
+                    }
+
+                }
+                $i++;
+            }
+
+        }
+
+
+
+        $res=Service::factory('ExcelToArrayService')->push($data,$name,'total');
+        echo "导出成功";
+    }
 }

+ 45 - 121
www/protected/modules/moonclub/views/complaints/index.php

@@ -48,51 +48,75 @@
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
-                      <span>日期:</span>
+                      <span>投诉日期:</span>
                     </div>
                     <div class="box_flex f_content">
-                      <input id="c_time" name="c_time" />
+                      <span id="c_time"></span>
                     </div>
                   </div>
                 </li>
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
-                      <span>姓名: </span>
+                      <span>客户姓名: </span>
                     </div>
                     <div class="box_flex f_content">
-                      <input name="user_name" id="user_name" />
+                      <span id="user_name"></span>
 
                     </div>
                   </div>
                 </li>
+                <li class="f_item">
+                  <div class="box">
+                    <div class="f_label">
+                      <span>地址: </span>
+                    </div>
+                    <div class="box_flex f_content">
+                      <span id="address"></span>
+
+                    </div>
+                  </div>
+                </li>
+                <li class="f_item">
+                  <div class="box">
+                    <div class="f_label">
+                      <span>服务人员: </span>
+                    </div>
+                    <div class="box_flex f_content">
+                      <span id="employer"></span>
+
+                    </div>
+                  </div>
+                </li>
+
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
                       <span>投诉信息: </span>
                     </div>
                     <div class="box_flex f_content">
-                      <input name="c_info" id="c_info" />
+                      <span id="info"></span>
+
                     </div>
                   </div>
                 </li>
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
-                      <span id="s_time">处理结果: </span>
+                      <span>处理结果: </span>
                     </div>
                     <div class="box_flex f_content">
-                      <input id="result" name="result" type="text" >
+                      <textarea id="result" name="result" style="width: 250px;min-height: 50px" ></textarea>
                     </div>
                   </div>
                 </li>
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
-                      <span id="s_time">客户意见: </span>
+                      <span>客户意见: </span>
                     </div>
                     <div class="box_flex f_content">
-                      <input id="feedback" name="feedback" type="text" >
+                      <textarea id="feedback" name="feedback" style="width: 250px;min-height: 50px" ></textarea>
                     </div>
                   </div>
                 </li>
@@ -125,116 +149,6 @@
   <div id="add_dialog" style="padding: 15px 0;">
 
     <form id="add_form" method="post">
-
-      <ul>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>客户手机号: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="user_phone" name="user_phone" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>客户姓名: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="user_name" name="user_name" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>管家: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="houserkeeper" name="houserkeeper" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>签约人: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="sign_name" name="sign_name" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>预产日期: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="pre_production_date" name="pre_production_date" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>生产日期: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="production_date" name="production_date" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>医院名称: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="hospital" name="hospital" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>婴儿性别: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input type="radio"  id="baby_sex" name="baby_sex" value="1" checked />男
-              <input type="radio"   name="baby_sex"  value="0" />女
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>产品套餐: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="package" name="package" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-        <li class="f_item">
-          <div class="box">
-            <div class="f_label">
-              <span>月子地址: </span>
-            </div>
-            <div class="box_flex f_content">
-              <input id="add_address" name="address" style="width: 250px;"  />
-            </div>
-          </div>
-        </li>
-
-
-
-      </ul>
-
-
     </form>
   </div>
 
@@ -553,7 +467,7 @@
           return value.floor +'楼'+value.room+'号';
         }},
 
-        {field:'com_time', title:'下单时间', width:25,sortable:false,formatter: function(value, row){
+        {field:'com_time', title:'投诉日期', width:25,sortable:false,formatter: function(value, row){
           var now=new Date(value*1000);
 
           var   month=now.getMonth()+1;
@@ -567,6 +481,16 @@
         console.log(row)
         $('#id_str').html(row.id);
         $('#xorder_id').val(row.id);
+        $('#c_time').html(formatDate(new Date(row.com_time*1000)));
+        $('#user_name').html(row.user_name);
+        $('#address').html(row.address.floor+'楼'+row.address.room+'号');
+        $('#employer').html(row.employer);
+        //$('#order_time').html(row.order_time);
+        $('#info').html(row.c_info);
+        $('#feedback').val(row.feedback);
+        $('#desc').val(row.desc);
+        $('#result').val(row.result);
+
       },
       onLoadSuccess : function () {
 
@@ -604,7 +528,7 @@
 
 
     jq_content_form.form({
-      url: module_router + '/AddTechInfo',
+      url: module_router + '/edit',
       onSubmit: function(param){
         if ($('#order_id').val() == ""){
           return false;

+ 19 - 48
www/protected/modules/moonclub/views/pOrder/index.php

@@ -20,7 +20,10 @@
         <input id="filter_status" />
       </div>
       <div class="tb_line">
-        <a href="#" class='easyui-linkbutton' iconCls="icon-add" plain="true" onclick="export_order();return false;">导出日订单</a>
+        <a href="#" class='easyui-linkbutton' iconCls="icon-add" plain="true" onclick="export_order();return false;">导出月考勤明细汇总</a>
+      </div>
+      <div class="tb_line">
+        <a href="#" class='easyui-linkbutton' iconCls="icon-add" plain="true" onclick="export_order1();return false;">导出月服务明细汇总</a>
       </div>
 
       <div class="tb_line">
@@ -176,7 +179,7 @@
                 <li class="f_item">
                   <div class="box">
                     <div class="f_label">
-                      <span>姓名: </span>
+                      <span>客户姓名: </span>
                     </div>
                     <div class="box_flex f_content">
                       <input name="user_name" id="user_name" />
@@ -194,26 +197,6 @@
                     </div>
                   </div>
                 </li>
-                <li class="f_item">
-                  <div class="box">
-                    <div class="f_label">
-                      <span id="s_time">处理结果: </span>
-                    </div>
-                    <div class="box_flex f_content">
-                      <input id="result" name="result" type="text" >
-                    </div>
-                  </div>
-                </li>
-                <li class="f_item">
-                  <div class="box">
-                    <div class="f_label">
-                      <span id="s_time">客户意见: </span>
-                    </div>
-                    <div class="box_flex f_content">
-                      <input id="feedback" name="feedback" type="text" >
-                    </div>
-                  </div>
-                </li>
 
                 <li class="f_item">
                   <div class="box">
@@ -350,6 +333,7 @@
       var vals = $('#order_time').datetimebox('spinner').spinner('getValue').split(':');
       $('#order_time').val(  parseInt($('#order_time').val())-(parseInt($('#order_time').val())+8*3600)%86400 +vals[0]*3600+vals[1]*60);
 
+
       var d=new Date(parseInt($('#order_time').val())*1000);
       $('#order_time').datetimebox('setText',formatDate(d));
       $('#order_time').datetimebox('hidePanel');
@@ -365,27 +349,6 @@
       }
     });
 
-    var buttons0 = $.extend([], $.fn.datebox.defaults.buttons);
-    buttons0[0].text = '确定';
-    buttons0[0].handler=function(){
-      var vals = $('#c_time').datetimebox('spinner').spinner('getValue').split(':');
-      $('#c_time').val(  parseInt($('#c_time').val())-(parseInt($('#c_time').val())+8*3600)%86400 +vals[0]*3600+vals[1]*60);
-
-      var d=new Date(parseInt($('#c_time').val())*1000);
-      $('#c_time').datetimebox('setText',formatDate(d));
-      $('#c_time').datetimebox('hidePanel');
-    };
-
-    $('#c_time').datetimebox({
-      required: false,
-      showSeconds:false,
-      buttons:buttons0,
-      onSelect: function(date){
-        var currentDate = new Date();
-
-        $('#c_time').val(date.getTime()/1000);
-      }
-    });
 
     var buttons2 = $.extend([], $.fn.datebox.defaults.buttons);
     buttons2[0].text = '确定';
@@ -396,6 +359,7 @@
       var d=new Date(parseInt($('#edit_order_time').val())*1000);
       $('#edit_order_time').datetimebox('setText',formatDate(d));
       $('#edit_order_time').datetimebox('hidePanel');
+      $('#edit_order_time_str').val(parseInt($('#edit_order_time').val()));
     };
 
     $('#edit_order_time').datetimebox({
@@ -406,7 +370,7 @@
         var currentDate = new Date();
 
         $('#edit_order_time').val(date.getTime()/1000);
-        $('#edit_order_time_str').val(date.getTime()/1000);
+
       }
     });
 
@@ -417,6 +381,8 @@ var buttons3 = $.extend([], $.fn.datebox.defaults.buttons);
       $('#in_room_time').val(  parseInt($('#in_room_time').val())-(parseInt($('#in_room_time').val())+8*3600)%86400 +vals[0]*3600+vals[1]*60);
 
       var d=new Date(parseInt($('#in_room_time').val())*1000);
+
+      $('#in_room_time_str').val(parseInt($('#in_room_time').val()));
       $('#in_room_time').datetimebox('setText',formatDate(d));
       $('#in_room_time').datetimebox('hidePanel');
     };
@@ -427,9 +393,10 @@ var buttons3 = $.extend([], $.fn.datebox.defaults.buttons);
       buttons:buttons3,
       onSelect: function(date){
         var currentDate = new Date();
-
+        //console.log(date);
+        //console.log(368);
         $('#in_room_time').val(date.getTime()/1000);
-        $('#in_room_time_str').val(date.getTime()/1000);
+
       }
     });
 
@@ -440,6 +407,7 @@ var buttons4 = $.extend([], $.fn.datebox.defaults.buttons);
       $('#out_room_time').val(  parseInt($('#out_room_time').val())-(parseInt($('#out_room_time').val())+8*3600)%86400 +vals[0]*3600+vals[1]*60);
 
       var d=new Date(parseInt($('#out_room_time').val())*1000);
+      $('#out_room_time_str').val(parseInt($('#out_room_time').val()));
       $('#out_room_time').datetimebox('setText',formatDate(d));
       $('#out_room_time').datetimebox('hidePanel');
     };
@@ -452,7 +420,7 @@ var buttons4 = $.extend([], $.fn.datebox.defaults.buttons);
         var currentDate = new Date();
 
         $('#out_room_time').val(date.getTime()/1000);
-        $('#out_room_time_str').val(date.getTime()/1000);
+
       }
     });
 
@@ -937,9 +905,12 @@ var buttons4 = $.extend([], $.fn.datebox.defaults.buttons);
       }
     });
   };
-  function export_order(exp,export_type) {
+  function export_order() {
     window.location.href = module_router+'/OutputExcel';
   }
+  function export_order1() {
+    window.location.href = module_router+'/OutputExcel1';
+  }
   function parse_time(data,attr){
     if(data[attr]){
       var d=new Date(data[attr]*1000);

+ 23 - 0
www/protected/services/ExcelToArrayService.php

@@ -229,6 +229,29 @@ class ExcelToArrayService extends Service
                 $num += 1;
             }
         }
+        else if ($export == 'total') {
+            $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $num, '楼号');
+            //Excel的第A列,uid是你查出数组的键值,下面以此类推
+
+            $objPHPExcel->setActiveSheetIndex(0)->setCellValue('B' . $num, '房号');
+            $objPHPExcel->setActiveSheetIndex(0)->setCellValue('C' . $num, '总服务次数');
+            $objPHPExcel->setActiveSheetIndex(0)->setCellValue('D' . $num, '总服务时长(小时)');
+            ;
+
+            $num += 1;
+            foreach($data as $key => $value){
+
+                $objPHPExcel->setActiveSheetIndex(0)
+                    //Excel的第A列,uid是你查出数组的键值,下面以此类推
+                    ->setCellValue('A' . $num, $value['floor'])
+                    ->setCellValue('B' . $num, $value['room'])
+                    ->setCellValue('C' . $num, $value['total'])
+                    ->setCellValue('D' . $num, $value['times'])
+
+                ;
+                $num += 1;
+            }
+        }
 
         $objPHPExcel->getActiveSheet()->setTitle('User');
         $objPHPExcel->setActiveSheetIndex(0);