lvhao 1 dienu atpakaļ
vecāks
revīzija
207ae229e0
1 mainītis faili ar 47 papildinājumiem un 29 dzēšanām
  1. 47 29
      core/CoreApp/controllers/User.php

+ 47 - 29
core/CoreApp/controllers/User.php

@@ -629,6 +629,8 @@ class User extends Start_Controller
 			}
 			}
 		}
 		}
 		if (isset($post['time'])) {
 		if (isset($post['time'])) {
+			// 2026年09月22日 应要求修改
+			//总金额 = 订单金额  + 补/退原额     实收金额 = 预估到账金额 +补/退净额
 			$zdt = $this->input->post('time', true);
 			$zdt = $this->input->post('time', true);
 			$k = $zdt;
 			$k = $zdt;
 			$tab = $this->input->post('tab', true);
 			$tab = $this->input->post('tab', true);
@@ -799,10 +801,10 @@ class User extends Start_Controller
 				$ct = strtotime(date('Ymd', $t));
 				$ct = strtotime(date('Ymd', $t));
 				$ctj = strtotime(date('Ymd', $t + 24 * 3600));
 				$ctj = strtotime(date('Ymd', $t + 24 * 3600));
 				//var_dump(date("Y-m-d H:i:s",$ct)."=================".date("Y-m-d H:i:s",$ctj));
 				//var_dump(date("Y-m-d H:i:s",$ct)."=================".date("Y-m-d H:i:s",$ctj));
-				$dlz = $this->fullorder->find_all("state != 217 and state != 214  and  dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
-				$smt = $this->fullordersmt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,refundy,userid,budget,refundy');
-				$tt = $this->fullordertt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
-				$amz = $this->fullorderamz->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
+				$dlz = $this->fullorder->find_all("state != 217 and state != 214  and  dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
+				$smt = $this->fullordersmt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,refundy,userid,refundj');
+				$tt = $this->fullordertt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
+				$amz = $this->fullorderamz->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
 
 
 				$ab[] = $dlz;
 				$ab[] = $dlz;
 				//数量及金额开始
 				//数量及金额开始
@@ -810,6 +812,7 @@ class User extends Start_Controller
 				$smtnum[] = count($smt);
 				$smtnum[] = count($smt);
 				$ttnum[] = count($smt);
 				$ttnum[] = count($smt);
 				$amznum[] = count($amz);
 				$amznum[] = count($amz);
+				//订单金额
 				$dlzm = sprintf("%01.2f", array_sum(array_column($dlz, 'shouldmoney')));
 				$dlzm = sprintf("%01.2f", array_sum(array_column($dlz, 'shouldmoney')));
 				$smtm = sprintf("%01.2f", array_sum(array_column($smt, 'shouldmoney')));
 				$smtm = sprintf("%01.2f", array_sum(array_column($smt, 'shouldmoney')));
 				$ttm = sprintf("%01.2f", array_sum(array_column($tt, 'shouldmoney')));
 				$ttm = sprintf("%01.2f", array_sum(array_column($tt, 'shouldmoney')));
@@ -836,18 +839,26 @@ class User extends Start_Controller
 				$amzbty = sprintf("%01.2f", array_sum(array_column($amz, 'refundy')));
 				$amzbty = sprintf("%01.2f", array_sum(array_column($amz, 'refundy')));
 				//补/退原额
 				//补/退原额
 
 
+
+				//补/退净额
+				$dlzbtj = sprintf("%01.2f", array_sum(array_column($dlz, 'refundj')));
+				$smtbtj = sprintf("%01.2f", array_sum(array_column($smt, 'refundj')));
+				$ttbtj = sprintf("%01.2f", array_sum(array_column($tt, 'refundj')));
+				$amzbtj = sprintf("%01.2f", array_sum(array_column($amz, 'refundj')));
+				//补/退净额
+
 				$dlzmoney[] = $dlzm;
 				$dlzmoney[] = $dlzm;
 				$smtmoney[] = $smtm;
 				$smtmoney[] = $smtm;
 				$ttmoney[] = $ttm;
 				$ttmoney[] = $ttm;
 				$amzmoney[] = $amzm;
 				$amzmoney[] = $amzm;
 				$dlzsl += count($dlz);
 				$dlzsl += count($dlz);
-				$dlzje += $dlzm;
+				$dlzje += $dlzm  + $dlzbty;
 				$smtsl += count($smt);
 				$smtsl += count($smt);
-				$smtje += $smtm;
+				$smtje += $smtm + $smtbty;
 				$ttsl += count($tt);
 				$ttsl += count($tt);
-				$ttje += $ttm;
+				$ttje += $ttm  + $ttbty;
 				$amzsl += count($amz);
 				$amzsl += count($amz);
-				$amzje += $amzm;
+				$amzje += $amzm  + $amzbty;
 
 
 				/**
 				/**
 		//减去的实收金额
 		//减去的实收金额
@@ -855,19 +866,19 @@ class User extends Start_Controller
 		$smtssje += $smtm+$smtmss;
 		$smtssje += $smtm+$smtmss;
 					**/
 					**/
 
 
-				//实收和补/退
-				$dlzssje += $dlzmss + $dlzbty;
-				$smtssje += $smtmss + $smtbty;
-				$ttssje += $ttmss + $ttbty;
-				$amzssje += $amzmss + $amzbty;
+				//实收和补/退净额
+				$dlzssje += $dlzmss + $dlzbtj;
+				$smtssje += $smtmss + $smtbtj;
+				$ttssje += $ttmss + $ttbtj;
+				$amzssje += $amzmss + $amzbtj;
 
 
 				//数量及金额结束
 				//数量及金额结束
 				$sd = array_merge($dlz, $smt, $tt,$amz);
 				$sd = array_merge($dlz, $smt, $tt,$amz);
 				foreach ($sd as $v) {
 				foreach ($sd as $v) {
 					if (isset($shopdata[$v['shop']])) {
 					if (isset($shopdata[$v['shop']])) {
 						$shopdata[$v['shop']]['num'] += 1;
 						$shopdata[$v['shop']]['num'] += 1;
-						$shopdata[$v['shop']]['money'] += $v['shouldmoney'];
-						$shopdata[$v['shop']]['tmoney'] += $v['budget'] + $v['refundy'];
+						$shopdata[$v['shop']]['money'] += $v['shouldmoney']  + $v['refundy'] ;
+						$shopdata[$v['shop']]['tmoney'] += $v['budget']  + $v['refundj'];
 					}
 					}
 				}
 				}
 			} else if ($n > 13 && $i <= $n / 2) {
 			} else if ($n > 13 && $i <= $n / 2) {
@@ -1004,10 +1015,10 @@ class User extends Start_Controller
 					$ct = strtotime(date('Ymd', $t));
 					$ct = strtotime(date('Ymd', $t));
 					// [修复 3] $ctj 减 1 秒
 					// [修复 3] $ctj 减 1 秒
 					$ctj = strtotime(date('Ymd', $t + 24 * 3600)) ;
 					$ctj = strtotime(date('Ymd', $t + 24 * 3600)) ;
-					$dlz = $this->fullorder->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
-					$smt = $this->fullordersmt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,refundy,userid,budget,refundy');
-					$tt = $this->fullordertt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
-					$amz = $this->fullorderamz->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,budget,email,refundy');
+					$dlz = $this->fullorder->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
+					$smt = $this->fullordersmt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,refundy,userid,refundj');
+					$tt = $this->fullordertt->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
+					$amz = $this->fullorderamz->find_all("state != 217 and state != 214  and dtime >= " . $ct . " and dtime < " . $ctj . $where . " and shop != '0' and (" . rtrim($fgshop, 'or') . ") and shop != '18' and shop != '19'", 'budget,shouldmoney,shop,number,refundy,email,refundj');
 
 
 					$ab[] = $dlz;
 					$ab[] = $dlz;
 					//数量及金额开始
 					//数量及金额开始
@@ -1041,18 +1052,25 @@ class User extends Start_Controller
 					$amzbty = sprintf("%01.2f", array_sum(array_column($amz, 'refundy')));
 					$amzbty = sprintf("%01.2f", array_sum(array_column($amz, 'refundy')));
 					//补/退原额
 					//补/退原额
 
 
+					//补/退净额
+					$dlzbtj = sprintf("%01.2f", array_sum(array_column($dlz, 'refundj')));
+					$smtbtj = sprintf("%01.2f", array_sum(array_column($smt, 'refundj')));
+					$ttbtj = sprintf("%01.2f", array_sum(array_column($tt, 'refundj')));
+					$amzbtj = sprintf("%01.2f", array_sum(array_column($amz, 'refundj')));
+					//补/退净额
+
 					$dlzmoney[] = $dlzm;
 					$dlzmoney[] = $dlzm;
 					$smtmoney[] = $smtm;
 					$smtmoney[] = $smtm;
 					$ttmoney[] = $ttm;
 					$ttmoney[] = $ttm;
 					$amzmoney[] = $amzm;
 					$amzmoney[] = $amzm;
 					$dlzsl += count($dlz);
 					$dlzsl += count($dlz);
-					$dlzje += $dlzm;
+					$dlzje += $dlzm + $dlzbty;
 					$smtsl += count($smt);
 					$smtsl += count($smt);
-					$smtje += $smtm;
+					$smtje += $smtm + $smtbty;
 					$ttsl += count($tt);
 					$ttsl += count($tt);
-					$ttje += $ttm;
+					$ttje += $ttm + $ttbty;
 					$amzsl += count($amz);
 					$amzsl += count($amz);
-					$amzje += $amzm;
+					$amzje += $amzm + $amzbty;
 
 
 					/**
 					/**
 			//减去的实收金额
 			//减去的实收金额
@@ -1061,18 +1079,18 @@ class User extends Start_Controller
 						**/
 						**/
 
 
 					//实收和补/退
 					//实收和补/退
-					$dlzssje += $dlzmss + $dlzbty;
-					$smtssje += $smtmss + $smtbty;
-					$ttssje += $ttmss + $ttbty;
-					$amzssje += $amzmss + $amzbty;
+					$dlzssje += $dlzmss + $dlzbtj;
+					$smtssje += $smtmss + $smtbtj;
+					$ttssje += $ttmss + $ttbtj;
+					$amzssje += $amzmss + $amzbtj;
 
 
 					//数量及金额结束
 					//数量及金额结束
 					$sd = array_merge($dlz, $smt, $tt, $amz);
 					$sd = array_merge($dlz, $smt, $tt, $amz);
 					foreach ($sd as $v) {
 					foreach ($sd as $v) {
 						if (isset($shopdata[$v['shop']])) {
 						if (isset($shopdata[$v['shop']])) {
 							$shopdata[$v['shop']]['num'] += 1;
 							$shopdata[$v['shop']]['num'] += 1;
-							$shopdata[$v['shop']]['money'] += $v['shouldmoney'];
-							$shopdata[$v['shop']]['tmoney'] += $v['budget'] + $v['refundy'];
+							$shopdata[$v['shop']]['money'] += $v['shouldmoney'] + $v['refundy'];
+							$shopdata[$v['shop']]['tmoney'] += $v['budget'] + $v['refundj'];
 						}
 						}
 					}
 					}
 				}
 				}