]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix part 001
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 6 Jun 2024 10:35:52 +0000 (13:35 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 6 Jun 2024 10:35:52 +0000 (13:35 +0300)
erp24/controllers/OrdersController.php
erp24/modul/orders/collation.php
erp24/views/orders/collation.php [new file with mode: 0644]

index e4147dcb350234cc380039fe910a0b368cf242ec..def5f55452c8348ad0f9914d9f4858ff217a0343 100644 (file)
@@ -51,6 +51,8 @@ class OrdersController extends Controller
     public function actionAjaxCreateCheckJson() { return $this->renderPartial('ajax-create-check-json'); }
     public function actionAjaxCheckRemove() { return $this->renderPartial('ajax-check-remove'); }
 
+    public function actionCollation() { return $this->render('collation'); }
+
     public function actionDelivery2()
     {
         if (!empty($_REQUEST["umoup"])) {
index 4bf0166dc068b2dbaf4c8cc2eb1c3664a69522c4..90e43f7794b72cf9f682bdd905adee2189cd2f88 100644 (file)
@@ -1,14 +1,13 @@
-<?
-include_once("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
-include_once("inc/db2.php");
+<?php
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
+
+error_reporting(E_ALL ^ E_NOTICE);
 
  try {
      
-include"templates/top.php";  
-
 $delivery_arr=["Доставка","Такси", "Самовывоз", "Доставка из магазина"];
 $delivery_arr_in=["Доставка","Такси", "Самовывоз", "Доставка из магазина"];
 
@@ -36,7 +35,7 @@ echo'<h1>Сверка интернет магазин <a href="/content/Amo142/?
 $products=array(); $payment_types=array();
     
     
-$data = $db2::getRows("SELECT status_id, color, name FROM orders_status WHERE pipeline_id='4021495'");
+$data = $db::getRows("SELECT status_id, color, name FROM orders_status WHERE pipeline_id='4021495'");
 foreach($data as $row) {
  if($row["status_id"]==142)  $row["name"]="Успешно";
   if($row["status_id"]==143)  $row["name"]="Отказ";
@@ -56,7 +55,7 @@ if(!empty($_POST["delivery"])) $delivery_arr_in=$_POST["delivery"];
 
    
 echo"<form action=\"\" method=post>  
-<table><td><input type=text name=lid_id value=\"$lid_id\" placeholder=\"ID заказа\" class=\"form-control\" style=\"width:100px;\">
+<table><td><input type=text name=lid_id value=\"" . ($lid_id ?? '') . "\" placeholder=\"ID заказа\" class=\"form-control\" style=\"width:100px;\">
 </td><td><input type=text name=amo_id value=\"\"  placeholder=\"amo ID\"  class=\"form-control\" style=\"width:100px;\">
 </td><td>дата доставки:</td><td>
 <input type=date name=delivery_date value=\"$delivery_date\"  class=\"form-control\"></td>
@@ -85,14 +84,14 @@ unset($status_ar2[38207182]);
 //foreach($status_ar2 as $id =>$name)    echo"<label from=\"st__$id\" class=\"m-1\"><input type=checkbox name=statuses[$id] id=\"st__$id\">$name</label>";
     
 
-$data = $db::getRows("SELECT id, name FROM admin WHERE 1 ");
+$data = $db::getRows("SELECT id, name FROM admin WHERE 1 = 1");
 foreach($data as $row) $users_arr[$row["id"]]=$row["name"];
 
-$data = $db::getRows("SELECT id, name FROM products_1c WHERE tip='city_store' ");
+$data = $db::getRows("SELECT id, name FROM products_1c WHERE tip='city_store'");
 foreach($data as $row) $stores_arr[$row["id"]]=$row["name"];
 
 
-$data = $db::getRows("SELECT id, name FROM city_store WHERE 1 ");
+$data = $db::getRows("SELECT id, name FROM city_store WHERE 1 = 1");
 foreach($data as $row) $store_arr[$row["id"]]=$row["name"];
    
   
@@ -120,7 +119,7 @@ if(!empty($delivery_arr_in)) $where0 .=" ) ";
       
   
   $where2="";  
-foreach($_REQUEST["statuses"] as $is =>$idf)  {
+foreach($_REQUEST["statuses"] ?? [] as $is =>$idf)  {
     if($idf=='on')  $where2 .=" or status_id='$is'";  
     
 }  
@@ -134,7 +133,7 @@ foreach($_REQUEST["statuses"] as $is =>$idf)  {
 
 
 
-$data= $db::getRows("SELECT * FROM orders_cheking WHERE date>=NOW()- INTERVAL 17 day "); 
+$data= $db::getRows("SELECT * FROM orders_cheking WHERE date>=NOW()::date- INTERVAL '17 day'");
 foreach($data as $row) {
  $orders_cheking_array[$row["amo_id"]]=" ".$row["name"]." ".$row["date"]."  ".$row["delivery_date"]."  ".$users_arr[$row["admin_id"]]."  ".$row["status"]." ";  
  $orders_cheking_status_array[$row["amo_id"]]=$row["status"];
@@ -144,7 +143,7 @@ foreach($data as $row) {
     
 
    
-$checkarr= $db::getRows("SELECT * FROM sales WHERE date>=NOW()- INTERVAL 120 day order by date DESC"); 
+$checkarr= $db::getRows("SELECT * FROM sales WHERE date>=NOW()::date - INTERVAL '120 day' order by date DESC");
 //$cheks_txt=";
 foreach($checkarr as $checkr) {
 $cheks_txt ="<div class=\"cur col text-center p-1 m-1 "; 
@@ -161,17 +160,17 @@ $cheks_txt .="</div>";
 if($checkr["operation"]=="Возврат")  $check_vozvrat_cnt[$checkr["order_id"]]=$check_vozvrat_cnt[$checkr["order_id"]]+1; 
 if($checkr["operation"]=="Продажа") $check_sale_cnt[$checkr["order_id"]]=$check_sale_cnt[$checkr["order_id"]]+1;  
 
-$sale[$checkr["order_id"]] .=$cheks_txt;   
+$sale[$checkr["order_id"]] = ($sale[$checkr["order_id"]] ?? '') . $cheks_txt;
 
 }
 //$cheks_txt .="</div>";   
    
 
-$data4= $db::getRow("SELECT * FROM create_checks WHERE date>=NOW()- INTERVAL 1 day  AND type='Продажа'"); 
+$data4= $db::getRow("SELECT * FROM create_checks WHERE date>=NOW()::date- INTERVAL '1 day'  AND type='Продажа'");
 
 foreach($data4 as $row4) $create_check_arr[$row4["order_id"]]=$row4;
 $j=0;  
-$data = $db2::getRows("SELECT *,DATE_FORMAT(delivery_date, '%d.%m.%Y') as dated FROM orders_amo WHERE 1  $where AND delivery_date <= NOW() order by delivery_date DESC LIMIT 750"); 
+$data = $db::getRows("SELECT *,TO_CHAR(delivery_date, 'DD.MM.YYYY') as dated FROM orders_amo WHERE 1 = 1  $where AND delivery_date <= NOW() order by delivery_date DESC LIMIT 750");
 echo"<table class=\"table table-hover\"><thead>
 <th>проверка</th>
 <th>дата доставки</th><th>номер заказа, статус заказа</th><th>сумма заказа, магазин</th><th>вид оплаты чеки</th><th>создать новый чек</th>
@@ -427,7 +426,7 @@ echo"</tbody></table>
  
 
  } catch (Exception $e) {
-    echo 'Выброшено исключение: ',  $e->getMessage(), "\n";
+    echo 'Выброшено исключение: ',  $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString(), "\n";
 }
 
 echo"<script>
@@ -443,12 +442,15 @@ $_CONFIG["jscss"]="<script>
 
 function ajax_order_show(id,amo_id,price,delivery_date, phone) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/info_db2/',
        method: 'post',       
        dataType: 'html',        
-       data: { id: ''+id+'',amo_id: ''+amo_id+'' ,price: ''+price+'' , delivery_date: ''+delivery_date+'' , phone: ''+phone+''},  
+       data: { id: ''+id+'',amo_id: ''+amo_id+'' ,price: ''+price+'' , delivery_date: ''+delivery_date+'' , phone: ''+phone+'', [param3]: token3},  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -462,12 +464,15 @@ $.ajax({
 
 function ajaxOrdersPays(id,amo_id,price,delivery_date) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
-       url: '/orders/ajaxOrdersPays/',
+       url: '/orders/ajax-orders-pays/',
        method: 'post',       
        dataType: 'html',        
-       data: { id: ''+id+'', amo_idid: ''+amo_id+'', price: ''+price+'', delivery_date: ''+delivery_date+''},  
+       data: { id: ''+id+'', amo_idid: ''+amo_id+'', price: ''+price+'', delivery_date: ''+delivery_date+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -478,12 +483,15 @@ $.ajax({
 
 function ajaxOrderConnectPay(pay_id,order_id) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+   
 $.ajax({
-       url: '/orders/ajaxOrderConnectPay/',
+       url: '/orders/ajax-order-connect-pay/',
        method: 'post',       
        dataType: 'html',        
-       data: { pay_id: ''+pay_id+'', order_id: ''+order_id+''},  
+       data: { pay_id: ''+pay_id+'', order_id: ''+order_id+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -494,12 +502,15 @@ $.ajax({
 
 function ajax_collation(amo_id) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/ajax_collation/',
        method: 'post',       
        dataType: 'html',        
-       data: { amo_id: ''+amo_id+'',   name: ''+$('#name__'+amo_id+'').val()+'',  status: ''+$('#status__'+amo_id+'').val()+'',},  
+       data: { amo_id: ''+amo_id+'',   name: ''+$('#name__'+amo_id+'').val()+'',  status: ''+$('#status__'+amo_id+'').val()+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -510,12 +521,15 @@ $.ajax({
 
 function ajax_return_check_dell(check_id) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('Удаление чека');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/ajax_check_dell/',
        method: 'post',       
        dataType: 'html',        
-       data: { check_id: ''+check_id+''},  
+       data: { check_id: ''+check_id+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -524,12 +538,15 @@ $.ajax({
 
 function ajax_return_check(sales_check) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/ajax_return_check/',
        method: 'post',       
        dataType: 'html',        
-       data: { sales_check: ''+sales_check+''},  
+       data: { sales_check: ''+sales_check+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        
@@ -539,15 +556,18 @@ $.ajax({
 function ajax_create_check(order_id) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
    $('.btn__'+order_id+'').remove();
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/ajax_create_check/',
        method: 'post',       
        dataType: 'html',        
-       data: { order_id: ''+order_id+'', create_check: '2' },  
+       data: { order_id: ''+order_id+'', create_check: '2', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        $('.btn__'+order_id+'').hide();
-      
        
        }}); 
 }
@@ -556,12 +576,15 @@ $.ajax({
 
 function ajax_check_remove(order_id) {
  jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('');  
+
+    const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+    const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
+
 $.ajax({
        url: '/orders/ajax_check_remove/',
        method: 'post',       
        dataType: 'html',        
-       data: { order_id: ''+order_id+''},  
+       data: { order_id: ''+order_id+'', [param3]: token3 },  
        success: function(data){  
        $('#modal-7 .modal-body').html(data);
        }}); 
@@ -587,10 +610,8 @@ $.ajax({
                        </div>
                </div>
 
-'; 
+';
 
- include"templates/bottom.php";
-    
+
+include_once dirname(__DIR__, 2) . '/templates/bottom_light.php';
     
-    
\ No newline at end of file
diff --git a/erp24/views/orders/collation.php b/erp24/views/orders/collation.php
new file mode 100644 (file)
index 0000000..314ddfb
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/orders/collation.php';
\ No newline at end of file