]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
draft table no search form
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 24 Apr 2025 13:27:50 +0000 (16:27 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 24 Apr 2025 13:27:50 +0000 (16:27 +0300)
erp24/modul/sales_checks/index.php

index 86c93db56947ccca1d767eb36a817ae5cb53fba4..acdfada889b3120fe4cb146a8edeb6c1c725a772 100644 (file)
@@ -1,10 +1,8 @@
-<?
+<?php
 include_once("startup.php");
 include_once("inc/db.php");
 include_once("inc/base_new.php");
 
-include"templates/top.php";
-
 error_reporting(E_ALL ^ E_NOTICE);
 
 $modul="sales_checks";
@@ -43,12 +41,12 @@ $date2=date("Y-m-d");
 if(!empty($_REQUEST["date1"]))   { $date1=htmlentities($_REQUEST["date1"]); $where .=" AND date>='$date1 00:00:00'";   $get .="&date1=$date1";    } 
 if(!empty($_REQUEST["date2"]))   { $date2=htmlentities($_REQUEST["date2"]); $where .=" AND date<='$date2 23:59:59'";   $get .="&date2=$date2";    } 
     
-$where .="order by $sort_by $asc_desc";
+$where .=" group by id, date order by $sort_by $asc_desc";
 
 
 // получаем кол-во записей
-$resultNum = $db::getRow("SELECT COUNT(*) as postNum FROM sales WHERE 1 $where ",$binding); //'%'.$name.'%'
-$rowCount = $resultNum['postNum'];
+$resultNum = $db::getRow("SELECT COUNT(*) as postNum FROM sales WHERE 1=1 $where ",$binding); //'%'.$name.'%'
+$rowCount = $resultNum['postnum'];
 
 $limit = 100;
 $offset = !empty($_GET['p'])?(($_GET['p']-1)*$limit):0;
@@ -60,15 +58,15 @@ $offset=(int)$offset;
 
 echo"<form method=post>"
     . '<input type="hidden" name="_csrf" value="' . Yii::$app->request->getCsrfToken() . '" />' .
-"наименование чека  <input type=text name=search[number] value=\"".$search["number"]."\">
+"наименование чека  <input type=text name=search[number] value=\"".($search["number"] ?? '')."\">
 
-Телефон <input type=text name=search[phone] value=\"".$search["phone"]."\">
+Телефон <input type=text name=search[phone] value=\"".($search["phone"] ?? '')."\">
 
-Операция <input type=text name=search[operation] value=\"".$search["operation"]."\">
+Операция <input type=text name=search[operation] value=\"".($search["operation"] ?? '')."\">
 
-Сумма <input type=text name=search[summ] value=\"".$search["summ"]."\">
+Сумма <input type=text name=search[summ] value=\"".($search["summ"] ?? '')."\">
 
-GUID чека <input type=text name=search[id] value=\"".$search["id"]."\">
+GUID чека <input type=text name=search[id] value=\"".($search["id"] ?? '')."\">
 
 
 Дата <input type=date name=date1 value=\"".$date1."\">-Дата2 <input type=date name=date2 value=\"".$date2."\">
@@ -96,7 +94,7 @@ echo'</select>
 </form>';
 
 
-$data = $db::getRows("SELECT * FROM sales WHERE 1 $where LIMIT $offset,$limit",$binding);
+$data = $db::getRows("SELECT * FROM sales WHERE 1=1 $where LIMIT $limit OFFSET $offset",$binding);
 echo"<table class=\"table table-bordered table-hover table-sm m-0\">
 <thead></thead><tbody>";
 foreach ($data as $row)  {
@@ -105,7 +103,7 @@ if($row["operation"]=="Удален") echo'danger';
 if($row["operation"]=="Возврат") echo'warning';
 echo'"> '.$row["operation"].' '.$row["status"].'</td>
 <td>'.$row["date"].'</td>
-<td>'.$store_arr[$row["store_id_1c"]].', '.$user_arr[$row["seller_id"]].'</td>
+<td>'.($store_arr[$row["store_id_1c"]] ?? '').', '.($user_arr[$row["seller_id"]] ?? '').'</td>
 <td>'.$row["number"].'</td><td>'.$row["summ"].' ';
 
 
@@ -113,7 +111,7 @@ if(!empty($row["skidka"])) echo'скидка  '.$row["skidka"].'';
 echo'</td>
 <td>';
 
-if(!empty($row["phone"])) echo'бонусная <a href="/bonus/bonus_users/?search[phone]='.$row["phone"].'" class="btn btn-info" target=new>'.$row["phone"].'</a>';
+if(!empty($row["phone"])) echo'бонусная <a href="/bonus/bonus-users/?search[phone]='.$row["phone"].'" class="btn btn-info" target=new>'.$row["phone"].'</a>';
 
 if(!empty($row["order_id"])) echo'заказ с сайта '.$row["order_id"].'';