Explorar el Código

fleat: rebate update

igb hace 1 día
padre
commit
037a02d0c3
Se han modificado 3 ficheros con 69 adiciones y 26 borrados
  1. 59 16
      rebate_expiring.php
  2. 5 5
      rebate_redeem.php
  3. 5 5
      rebate_summary.php

+ 59 - 16
rebate_expiring.php

@@ -32,17 +32,17 @@ $employee_id = $_SESSION['employee_id'];
 $isAdmin = checkIfAdmin();
 
 // 查询即将过期的返点订单
-// 这里我们获取那些在60天期限内,但是已经接近过期的订单(比如只剩7天有效期)
-$cutoffDate = date('Y-m-d', strtotime("-" . (60 - $expiryDays) . " days"));
-$expiryDate = date('Y-m-d', strtotime("-60 days"));
+// 这里我们获取那些在90天期限内,但是已经接近过期的订单(比如只剩7天有效期)
+$cutoffDate = date('Y-m-d', strtotime("-" . (90 - $expiryDays) . " days"));
+$expiryDate = date('Y-m-d', strtotime("-90 days"));
 
 $customerListSql = "SELECT DISTINCT 
     o.customer_id,
     c.cs_company AS customer_name,
     c.cs_code,
     MIN(o.order_date) AS oldest_order_date,
-    DATE_ADD(MIN(o.order_date), INTERVAL 60 DAY) AS expiry_date,
-    DATEDIFF(DATE_ADD(MIN(o.order_date), INTERVAL 60 DAY), CURRENT_DATE()) AS days_left
+    DATE_ADD(MIN(o.order_date), INTERVAL 90 DAY) AS expiry_date,
+    DATEDIFF(DATE_ADD(MIN(o.order_date), INTERVAL 90 DAY), CURRENT_DATE()) AS days_left
 FROM orders o
 JOIN order_items oi ON o.id = oi.order_id
 JOIN customer c ON o.customer_id = c.id
@@ -66,7 +66,7 @@ WHERE
         JOIN orders o2 ON oi2.order_id = o2.id
         WHERE o2.customer_id = o.customer_id
         AND oi2.product_id = oi.product_id
-        AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+        AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
         AND NOT EXISTS (
             SELECT 1
             FROM rebate_redemption_items rri
@@ -140,7 +140,7 @@ foreach ($paginatedCustomers as &$customer) {
                     JOIN orders o2 ON oi2.order_id = o2.id
                     WHERE o2.customer_id = o.customer_id
                     AND oi2.product_id = oi.product_id
-                    AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+                    AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
                     AND NOT EXISTS (
                         SELECT 1
                         FROM rebate_redemption_items rri
@@ -160,7 +160,7 @@ foreach ($paginatedCustomers as &$customer) {
         products p ON oi.product_id = p.id
     WHERE 
         o.customer_id = $customer_id
-        AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+        AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
         AND p.rebate = 1
         AND NOT EXISTS (
             SELECT 1
@@ -299,18 +299,59 @@ foreach ($paginatedCustomers as &$customer) {
             border: 1px solid #f5c6cb;
             border-radius: 4px;
         }
+
+        .fastSelect .selectItem
+        {
+            width: 50%;
+        }
+
+        
+
+
+        .inputSearch {
+            display: flex;
+            align-items: center;
+        }
+        
+        .inputTxt {
+            padding: 5px;
+            border: 1px solid #ccc;
+            border-radius: 3px;
+            margin-right: 5px;
+            width: 180px;
+        }
+        
+        .searchgo {
+            padding: 5px 15px;
+            background: #3498db;
+            color: white;
+            border: none;
+            border-radius: 3px;
+            cursor: pointer;
+        }
+        
+        .searchgo:hover {
+            background: #2980b9;
+        }
+        
+        .action-buttons {
+            width: 100%;
+            display: flex;
+            justify-content: flex-end;
+            margin-top: 10px;
+        }
     </style>
 </head>
 <body>
 <div id="man_zone">
     <div class="alert-box">
-        <strong>注意!</strong> 此页面显示即将过期的返点信息。返点订单在创建后60天内有效,过期后将无法兑换。请尽快处理以下客户的返点兑换。
+        <strong>注意!</strong> 此页面显示即将过期的返点信息。返点订单在创建后90天内有效,过期后将无法兑换。请尽快处理以下客户的返点兑换。
     </div>
-    
+
     <div class="fastSelect clear">
-        <H1>即将过期返点订单</H1>
+        <H1>筛选条件</H1>
         <div class="selectItem">
-            <label>最早订单日期</label>
+            <label>订单日期</label>
             <input type="date" name="fliterFromDate" class="date-input filterSearch" value="<?= $fliterFromDate ?>">
             <label>到</label>
             <input type="date" name="fliterToDate" class="date-input filterSearch" value="<?= $fliterToDate ?>">
@@ -328,10 +369,12 @@ foreach ($paginatedCustomers as &$customer) {
             <input type="button" id="searchgo" class="searchgo" value="搜索"
                 onClick="location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)+'&expiryDays='+document.getElementsByName('expiryDays')[0].value" />
         </div>
-        <div style="text-align: right; margin-top: 10px; clear: both;">
-            <a href="rebate_history.php" class="btn1" style="display: inline-flex; align-items: center; justify-content: center; padding: 5px 15px; margin-top: 0; height: 22px; margin-right: 5px;">查看返点历史</a>
-            <a href="rebate_summary.php" class="btn1" style="display: inline-flex; align-items: center; justify-content: center; padding: 5px 15px; margin-top: 0; height: 22px;">返回返点统计</a>
-        </div>
+    </div>
+    <div align="right" style="margin-bottom: 10px;">
+
+
+        <a href="rebate_history.php" class="btn1" style="display: inline-flex; align-items: center; justify-content: center; padding: 5px 15px; margin-top: 0; height: 22px; margin-right: 5px;">查看返点历史</a>
+        <a href="rebate_summary.php" class="btn1" style="display: inline-flex; align-items: center; justify-content: center; padding: 5px 15px; margin-top: 0; height: 22px;">返回返点统计</a>
     </div>
 
     <div class="table2 em<?= $_SESSION['employee_id'] ?>">

+ 5 - 5
rebate_redeem.php

@@ -40,7 +40,7 @@ SELECT
             JOIN orders o2 ON oi2.order_id = o2.id
             WHERE o2.customer_id = o.customer_id
             AND oi2.product_id = oi.product_id
-            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
             AND NOT EXISTS (
                 SELECT 1
                 FROM rebate_redemption_items rri
@@ -60,7 +60,7 @@ SELECT
             JOIN orders o2 ON oi2.order_id = o2.id
             WHERE o2.customer_id = o.customer_id
             AND oi2.product_id = oi.product_id
-            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
             AND NOT EXISTS (
                 SELECT 1
                 FROM rebate_redemption_items rri
@@ -80,7 +80,7 @@ SELECT
             JOIN orders o2 ON oi2.order_id = o2.id
             WHERE o2.customer_id = o.customer_id
             AND oi2.product_id = oi.product_id
-            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
             AND NOT EXISTS (
                 SELECT 1
                 FROM rebate_redemption_items rri
@@ -98,7 +98,7 @@ JOIN
     products p ON oi.product_id = p.id
 WHERE 
     o.customer_id = $customerId
-    AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+    AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
     AND p.rebate = 1
     AND NOT EXISTS (
         SELECT 1
@@ -116,7 +116,7 @@ WHERE
             JOIN orders o2 ON oi2.order_id = o2.id
             WHERE o2.customer_id = o.customer_id
             AND oi2.product_id = oi.product_id
-            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+            AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
             AND NOT EXISTS (
                 SELECT 1
                 FROM rebate_redemption_items rri

+ 5 - 5
rebate_summary.php

@@ -38,7 +38,7 @@ JOIN order_items oi ON o.id = oi.order_id
 JOIN customer c ON o.customer_id = c.id
 JOIN products p ON oi.product_id = p.id
 WHERE 
-    o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+    o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
     AND p.rebate = 1
     AND NOT EXISTS (
         SELECT 1
@@ -56,7 +56,7 @@ WHERE
         JOIN orders o2 ON oi2.order_id = o2.id
         WHERE o2.customer_id = o.customer_id
         AND oi2.product_id = oi.product_id
-        AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+        AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
         AND NOT EXISTS (
             SELECT 1
             FROM rebate_redemption_items rri
@@ -169,7 +169,7 @@ if (!empty($customers)) {
                     JOIN orders o2 ON oi2.order_id = o2.id
                     WHERE o2.customer_id = o.customer_id
                     AND oi2.product_id = oi.product_id
-                    AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+                    AND o2.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
                     AND NOT EXISTS (
                         SELECT 1
                         FROM rebate_redemption_items rri
@@ -189,7 +189,7 @@ if (!empty($customers)) {
         products p ON oi.product_id = p.id
     WHERE 
         o.customer_id IN ($customerIdsForDetailsStr)
-        AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+        AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
         AND p.rebate = 1
         AND NOT EXISTS (
             SELECT 1
@@ -234,7 +234,7 @@ if (!empty($customers)) {
             products p ON oi.product_id = p.id
         WHERE 
             o.customer_id = $customerId
-            AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 60 DAY)
+            AND o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
             AND p.rebate = 1
             AND NOT EXISTS (
                 SELECT 1