return $this->render('couriers_stats');
}
+ public function actionAjaxReturnCheck() { return $this->renderPartial('ajax-return-check'); }
+ public function actionAjaxCreateCheck() { return $this->renderPartial('ajax-create-check'); }
+ public function actionAjaxCreateCheckJson() { return $this->renderPartial('ajax-create-check-json'); }
+ public function actionAjaxCheckRemove() { return $this->renderPartial('ajax-check-remove'); }
+
public function actionDelivery2()
{
if (!empty($_REQUEST["umoup"])) {
*/
function create_guid_my($prefix="01",$id_db="") {
if(empty($id_db)) $id_db=rand(0,99999999);
- $id_db=100000000000+$id_db;
+ $id_db=100000000000+(int)$id_db;
$str= "$prefix".date("Ym")."-".date("di")."-".date("hs")."-".bin2hex(random_bytes(2))."-".$id_db."";
return strtolower($str);
}
-<?
-include_once("startup.php");
-include_once("inc/base_new.php");
-include_once("inc/db2.php");
-include_once("inc/db.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");
if(!empty($_REQUEST["order_id"])) {
$order_id=htmlentities($_REQUEST["order_id"]);
$amo_id=(int)$_SESSION["order_id_dell"][$order_id];
- $z="DELETE FROM orders_amo WHERE id=? AND amo_id=? AND amo_id!='' LIMIT 1 ";
- $z2="DELETE FROM create_checks WHERE order_id=? AND status=0 order BY date LIMIT 1 ";
+ $z="DELETE FROM orders_amo WHERE id=? AND amo_id=? AND amo_id!=''";
+ $z2="DELETE FROM create_checks WHERE order_id=? AND status=0";
- $db2::sql("DELETE FROM orders_amo WHERE id=? AND amo_id=? AND amo_id!='' LIMIT 1",[$order_id,$amo_id]);
- $db::sql("DELETE FROM orders_amo WHERE id=? AND amo_id=? AND amo_id!='' LIMIT 1",[$order_id,$amo_id]);
-
-
- $db2::sql("DELETE FROM create_checks WHERE order_id=? AND status=0 order BY date LIMIT 1",[$order_id]);
- $db::sql("DELETE FROM create_checks WHERE order_id=? AND status=0 order BY date LIMIT 1",[$order_id]);
- $db::sql("DELETE FROM create_checks2 WHERE order_id=? AND status=0 order BY date LIMIT 1",[$order_id]);
+ $db::sql("DELETE FROM orders_amo WHERE id=? AND amo_id=? AND amo_id!=''",[$order_id,$amo_id]);
+
+ $db::sql("DELETE FROM create_checks WHERE order_id=? AND status=0",[$order_id]);
+ $db::sql("DELETE FROM create_checks2 WHERE order_id=? AND status=0",[$order_id]);
mess("Заказ можно удалить $amo_id $z $z2");
}
-//$db2::sql("UPDATE create_checks SET status=1 WHERE type='Продажа' AND order_id=? order BY date DESC LIMIT 1",[(int)$_REQUEST["order_id"]]);
+//$db::sql("UPDATE create_checks SET status=1 WHERE type='Продажа' AND order_id=? order BY date DESC LIMIT 1",[(int)$_REQUEST["order_id"]]);
//$db::sql("UPDATE create_checks SET status=1 WHERE type='Продажа' AND order_id=? order BY date DESC LIMIT 1",[(int)$_REQUEST["order_id"]]);
}
-<?
-include_once("startup.php");
-include_once("inc/base_new.php");
-include_once("inc/db2.php");
-include_once("inc/db.php");
-include_once("inc/checks.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/checks.php");
+
if(!empty($_REQUEST["order_id"])) {
$order_id=(int)$_REQUEST["order_id"];
-$amo_id=$db2::getValue("SELECT amo_id FROM orders_amo WHERE id=? LIMIT 1",[$order_id]);
+$amo_id=$db::getValue("SELECT amo_id FROM orders_amo WHERE id=? LIMIT 1",[$order_id]);
$lid_id=create_order_from_amo($amo_id);
$type="Продажа";
-$row = $db2::getRow("SELECT * FROM create_checks WHERE status='0' AND type='$type' AND order_id=? order BY date DESC LIMIT 1",[(int)$_REQUEST["order_id"]]);
+$row = $db::getRow("SELECT * FROM create_checks WHERE status='0' AND type='$type' AND order_id=? order BY date DESC LIMIT 1",[(int)$_REQUEST["order_id"]]);
//print_r($row);
-$florist_id = $db2::getValue("SELECT florist_id FROM orders_amo WHERE id=? LIMIT 1",[(int)$_REQUEST["order_id"]]);
+$florist_id = $db::getValue("SELECT florist_id FROM orders_amo WHERE id=? LIMIT 1",[(int)$_REQUEST["order_id"]]);
$seller_id = $db::getValue("SELECT export_val FROM export_import_table WHERE export_id='1' AND entity_id=? AND entity='admin' LIMIT 1",[$florist_id]);
$new_row["seller_id"]=$seller_id;
//$new_row["guid"]=create_guid();
$new_row["check_id"]=create_guid();
-$db2::sql("UPDATE create_checks SET check_id=? WHERE type='$type' AND order_id=? order BY date DESC LIMIT 1",[$new_row["check_id"],(int)$_REQUEST["order_id"]]);
+$db::sql("UPDATE create_checks SET check_id=? WHERE type='$type' AND order_id=? order BY date DESC LIMIT 1",[$new_row["check_id"],(int)$_REQUEST["order_id"]]);
//$q="INSERT IGNORE INTO create_checks2 ($sql0) VALUES ($sqlv)";
//$db::sql($q,$new_row);
-<?
-include_once("startup.php");
-include_once("inc/base_new.php");
-include_once("inc/db2.php");
-include_once("inc/db.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");
if(!empty($_REQUEST["order_id"])) {
$order_id=(int)$_REQUEST["order_id"];
try {
-$row = $db2::getRow("SELECT * FROM orders_amo WHERE delivery!='Самовывоз' AND delivery!='Доставка из магазина' AND amo_id=? order by delivery_date DESC LIMIT 1",[$order_id]);
+$row = $db::getRow("SELECT * FROM orders_amo WHERE delivery!='Самовывоз' AND delivery!='Доставка из магазина' AND amo_id=? order by delivery_date DESC LIMIT 1",[$order_id]);
}
catch (Exception $e) {
var_dump($e);
// ставим в соответствие вид оплаты
-$date = $db::getValue("SELECT extract(epoch FROM date) as date FROM create_checks WHERE order_id=? AND type='Продажа' order by date desc LIMIT 1",[$lid_id]);
+$date = $db::getValue("SELECT extract(epoch FROM date) as date FROM create_checks WHERE order_id=? AND type='Продажа' order by date desc LIMIT 1",[$order_id]);
$error="";
if($date>(time()-60) and !empty($date)) $error="Чек не создан так как чек с таким заказом уже создан";
if(!empty($error)) echo($error);
-<?
-include_once("startup.php");
-include_once("inc/base_new.php");
-include_once("inc/db2.php");
-include_once("inc/db.php");
-include_once("inc/checks.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/checks.php");
+
if(!empty($_REQUEST["sales_check"])) {
$type="Возврат";
$sales_check=htmlentities($_REQUEST["sales_check"]);
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/',
+ 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);
$('#check__'+sales_check+'').remove();
function ajax_create_check(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_create_check/',
+ 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();
function ajax_create_check_json(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_create_check_json/',
+ url: '/orders/ajax-create-check-json/',
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();
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/',
+ 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);
}});
--- /dev/null
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/orders/ajax_check_remove.php';
--- /dev/null
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/orders/ajax_create_check_json.php';
--- /dev/null
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/orders/ajax_create_check.php';
--- /dev/null
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/orders/ajax_return_check.php';