$payments2 = json_encode($payments2, JSON_UNESCAPED_UNICODE);
$items2 = json_encode($items2, JSON_UNESCAPED_UNICODE);
try{
-$db::sql("INSERT IGNORE INTO create_checks (date,kkm_id,seller_id, store_id, type, order_id,items,payments) VALUES (NOW(),?,?,?,?,?,?,?)",
-[$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2 ]);
+$db::sql("INSERT IGNORE INTO create_checks (date,kkm_id,seller_id, store_id, type, order_id,items,payments,phone) VALUES (NOW(),?,?,?,?,?,?,?,?)",
+[$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2, $row['phone'] ]);
}
catch (Exception $e0) {
echo 'Выброшено исключение: ', $e0->getMessage(), "\n";
$param["check_id"]=create_guid_my("11","$id");
$param["sales_check"]=$data["check_id"];
$param["items"]=$data["items"];
- $param["payments"]=$data["payments"];
+ $param["payments"]=$data["payments"];
+ $param["phone"]=$data["phone"];
if(!empty($param["sales_check"])) {
- $sql="INSERT INTO create_checks (`date`,`status`,type,kkm_id,seller_id,store_id,order_id, check_id,sales_check,items, payments)
- VALUES (NOW(), '0', 'Возврат',:kkm_id,:seller_id,:store_id,:order_id,:check_id,:sales_check,:items,:payments)";
+ $sql="INSERT INTO create_checks (`date`,`status`,type,kkm_id,seller_id,store_id,order_id, check_id,sales_check,items, payments,phone)
+ VALUES (NOW(), '0', 'Возврат',:kkm_id,:seller_id,:store_id,:order_id,:check_id,:sales_check,:items,:payments,:phone)";
echo $sql;
$db::sql($sql,$param);
if(!empty($_POST["create_check"]) and $_POST["create_check"]==2) {
$check_id=create_guid_my("01","$lid_id");
-$db::sql("INSERT IGNORE INTO create_checks (check_id,date,kkm_id,seller_id, store_id, type, order_id,items,payments) VALUES (?,NOW(),?,?,?,?,?,?,?)",[$check_id,$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2 ]);
+$db::sql("INSERT IGNORE INTO create_checks (check_id,date,kkm_id,seller_id, store_id, type, order_id,items,payments,phone) VALUES (?,NOW(),?,?,?,?,?,?,?,?)",[$check_id,$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2, $row['phone'] ]);
//$db::sql("INSERT IGNORE INTO create_checks2 (check_id,date,kkm_id,seller_id, store_id, type, order_id,items,payments) VALUES (?,NOW(),?,?,?,?,?,?,?)",[$check_id,$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2 ]);
//$db2::sql("INSERT IGNORE INTO create_checks (check_id,date,kkm_id,seller_id, store_id, type, order_id,items,payments) VALUES (?,NOW(),?,?,?,?,?,?,?)",[$check_id,$kkm_id, $seller_id ,$store_id, "Продажа", $lid_id, $items2, $payments2 ]);
mess("Чек добавлен Сумма чека $summ ");
namespace yii_app\records;
use Yii;
+use yii_app\api3\core\validators\PhoneValidator;
/**
* This is the model class for table "create_checks".
* @property string|null $delivery_date Дата доставки
* @property string|null $date_up дата обновления из 1с
* @property string $comments комментарий к чеку- номер телефона клиента
+ * @property string|null $phone Телефон клиента
*/
class CreateChecks extends \yii\db\ActiveRecord
{
return [
[['kkm_id', 'store_id', 'order_id', 'check_id', 'guid', 'name', 'sales_check', 'items', 'payments', 'held', 'date', 'comments'], 'required'],
[['order_id', 'held', 'status'], 'integer'],
- [['type', 'items', 'payments'], 'string'],
- [['date', 'delivery_date', 'date_up'], 'safe'],
+ [['type', 'items', 'payments', 'phone'], 'string'],
+ [['date', 'delivery_date', 'date_up', 'phone'], 'safe'],
[['kkm_id', 'seller_id', 'store_id', 'check_id', 'guid', 'sales_check'], 'string', 'max' => 36],
[['name', 'comments'], 'string', 'max' => 255],
+ [['phone'], 'string', 'max' => 20],
+ ['phone', PhoneValidator::class],
[['order_id', 'check_id', 'type', 'date'], 'unique', 'targetAttribute' => ['order_id', 'check_id', 'type', 'date']],
];
}