wugg há 1 ano atrás
pai
commit
eedf680d8e
1 ficheiros alterados com 28 adições e 0 exclusões
  1. 28 0
      app/command/Report.php

+ 28 - 0
app/command/Report.php

@@ -126,6 +126,10 @@ class Report extends Command
 		        $method="U";
 		        $file='项目部2月前业绩提成';
 		        break;
+		    case 'V':
+		        $method="V";
+		        $file='退货明细';
+		        break;
 			default:
 				$file='暂无数据';
 				$method="";
@@ -1218,4 +1222,28 @@ class Report extends Command
 			yield $value;
 		}
 	}
+
+	//退货明细
+	private function V($param=[]){
+		$where = [["is_del","=",0]];
+		if (($param['start'] != '') && ($param['end'] != '')) $where[] = ['addtime', 'between', [date("Y-m-d 00:00:00",strtotime($param['start'])),date("Y-m-d 23:59:59",
+		strtotime($param['end']))]];
+		$Db= Db::connect("mysql_wsm");
+		$list =$Db->name("th_data")->alias("a")
+		->leftJoin("sale b","a.orderCode=b.orderCode")
+		->field("a.thCode 退货单号,b.orderCode 销售单号,a.apply_name 业务人员,a.apply_id 业务部门,a.cat_id 分类,a.th_fee 退货金额,a.addtime 日期")
+		->where($where)
+		->cursor();
+		$depart=[];
+		foreach ($list as $value){
+			if(!isset($depart[$value['业务部门']])){
+				$temp = getDepartByUid($value['业务部门']);
+				if(isset($temp['data']) && !empty($temp['data']))
+					$depart[$value['业务部门']]=$temp['data'][$value['业务部门']];
+			}
+			$value['业务部门'] = $depart[$value['业务部门']]??"";
+			$value['分类'] = $Db->name("cat")->where(["id"=>$value['分类']])->value("search","");
+			yield $value;
+		}
+	}
 }