cqpCow 1 ano atrás
pai
commit
afa65835f8

+ 17 - 0
app/Service/CustomerService.php

@@ -823,4 +823,21 @@ class CustomerService extends Service
 
         return [true,''];
     }
+
+    public function searchBy($data,$user){
+        $model = BasicType::TopClear($user,$data);
+        $result = $model->where('del_time',0)
+            ->where('type', 2)
+            ->where('title', 'LIKE', '%'.$data['title'].'%')
+            ->select('id')
+            ->get()->toArray();
+
+        $model2 = Customer::Clear($user,$data);
+        $customer = $model2->where('del_time',0)
+            ->whereIn('customer_from', array_column($result,'id'))
+            ->select('id')
+            ->get()->toArray();
+
+        return array_column($customer,'id');
+    }
 }

+ 4 - 0
app/Service/SalesOrderService.php

@@ -797,6 +797,10 @@ class SalesOrderService extends Service
             $model->where('dispatch_time_second','>=',$return[0]);
             $model->where('dispatch_time_second','<=',$return[1]);
         }
+        if(! empty($data['customer_from'])){
+            $id = (new CustomerService())->searchBy($data,$user);
+            $model->whereIn('customer_id', $id);
+        }
 
         $list = $this->limit($model,'',$data);
         $list = $this->fillData($list,$data);

+ 26 - 16
app/Service/U8ServerService.php

@@ -549,22 +549,32 @@ class U8ServerService extends Service
 //            "imoney"=>$son['imoney'], //原币无税金额
 //            "itax"=>$son['itax'],//原币税额
             //计算金额
-            if($value['rate'] > 0){
-                $value['itaxrate'] = $value['rate'];
-                $rate = round($value['rate'] / 100,2);
-                $value['iunitprice'] = round($value['final_amount'] / (1 + $rate),2);
-                $value['itaxunitprice'] = $value['final_amount'];
-                $value['isum'] = round($value['final_amount'] * $value['number'],2);
-                $value['imoney'] = round($value['iunitprice'] * $value['number'],2);
-                $value['itax'] = round($value['isum'] - $value['imoney'],2);
-            }else{
-                $value['itaxrate'] = 0;
-                $value['iunitprice'] = $value['final_amount'];
-                $value['itaxunitprice'] = $value['final_amount'];
-                $value['isum'] = $value['final_amount'] * $value['number'];
-                $value['imoney'] = $value['isum'];
-                $value['itax'] = 0;
-            }
+            //比如这4个产品合同金额是300.11,那么价税合计就是300.11,
+            //含税单价就是300.11/4,目前加了税率的没有计算规则。税率不进入计算
+
+            $value['itaxrate'] = 0;//税率
+            $value['iunitprice'] = $value['price'];
+            $value['itaxunitprice'] = $value['price'];
+            $value['isum'] = $value['final_amount']; //原币价税合计
+            $value['imoney'] = $value['isum']; //原币无税金额
+            $value['itax'] = 0;
+
+//            if($value['rate'] > 0){
+//                $value['itaxrate'] = $value['rate'];
+//                $rate = round($value['rate'] / 100,2);
+//                $value['iunitprice'] = round($value['final_amount'] / (1 + $rate),2);
+//                $value['itaxunitprice'] = $value['final_amount'];
+//                $value['isum'] = round($value['final_amount'] * $value['number'],2);
+//                $value['imoney'] = round($value['iunitprice'] * $value['number'],2);
+//                $value['itax'] = round($value['isum'] - $value['imoney'],2);
+//            }else{
+//                $value['itaxrate'] = 0;
+//                $value['iunitprice'] = $value['final_amount'];
+//                $value['itaxunitprice'] = $value['final_amount'];
+//                $value['isum'] = $value['final_amount'] * $value['number'];
+//                $value['imoney'] = $value['isum'];
+//                $value['itax'] = 0;
+//            }
             $value['cdefine25'] = $code_map[$main_tmp['plat_type']] ?? ""; //平台类型
             $value['cdefine28'] = $cdefine28; //平台单号
 //            $top_depart_id = $see[$value['sales_order_id']] ?? 0;