wzh 5 سال پیش
والد
کامیت
e3017ba765
2فایلهای تغییر یافته به همراه20 افزوده شده و 6 حذف شده
  1. 15 1
      api/application/controllers/Lampcontrol.php
  2. 5 5
      api/application/controllers/Project.php

+ 15 - 1
api/application/controllers/Lampcontrol.php

@@ -39,7 +39,21 @@ class Lampcontrol extends Base_Controller {
         $filter = array('L.projectid'=>$project_id);
         $network_id = $this->input->post('network_id', true);
         $section = $this->input->post('section', true);
-        // $type = intval($this->input->post('type', true));
+        $type = intval($this->input->post('type', true));
+        $company = intval($this->input->post('company', true));
+        if (!empty($type) && !empty($company)) {
+            
+            if ($type == 2) {
+                $filter['L.manu'] = $company;
+            }elseif ($type == 2) {
+                $filter['L.supplier'] = $company;
+            }elseif ($type == 3) {
+                $filter['L.po'] = $company;
+            }else {
+                $filter['L.upazilla'] = $company;
+            }
+        }
+        
         if (!empty($network_id)) $filter['L.networkid'] = $network_id;
         if (!empty($section)) $filter['L.section'] = $section;
         // $offline = $this->input->post('offline', true);

+ 5 - 5
api/application/controllers/Project.php

@@ -28,7 +28,7 @@ class Project extends Base_Controller {
         $project_id = intval($this->input->post('project_id', true));
         $type = intval($this->input->post('type', true));
         $section = $this->input->post('section', true);
-        $company = $this->input->post('company', true);
+        $company = intval($this->input->post('company', true));
         $version = $this->session->userdata('version');
 
         $data = array();
@@ -50,14 +50,14 @@ class Project extends Base_Controller {
             $where['section'] = $section;
             $where2['L.section'] = $section;
         }
-        if ($company !== '' && $company !== NUll) {
-            if ($type == 1) {
+        if (!empty($company) && !empty($type)) {
+            if ($type == 2) {
                 $where['manu'] = $company;
                 $where2['L.manu'] = $company;
-            }elseif ($type == 2) {
+            }elseif ($type == 3) {
                 $where['supplier'] = $company;
                 $where2['L.supplier'] = $company;
-            }elseif ($type == 3) {
+            }elseif ($type == 4) {
                 $where['po'] = $company;
                 $where2['L.po'] = $company;
             }else {