Пример #1
0
 public function refund($id)
 {
     $compra = new Compra();
     $usuario = new Usuario();
     $stock = new Stock();
     $tempMaxCompra = new TempMaxCompra();
     $info = $this->joinCompra($id);
     /**
      * @internal Resto de la compra
      * @param num
      * @param user
      * @param id
      */
     $newTotal = $info->total - $info->pagado;
     try {
         /**
          * @php Seteo la devolucion del stock personal (maximos y minimos)
          */
         $remains = new stdClass();
         $remains->{'intCantidad'} = $info->cantidad;
         $remains->{'idProducto'} = $info->producto;
         $remains->{'idUsuario'} = $info->user;
         $tempMaxCompra->setUser($info->user);
         $tempMaxCompra->storeRemains(null, $remains);
         $compra->setTotal($newTotal, $info->user, $info->compra);
         $usuario->sumarCredito($info->pagado, $info->user);
         $stock->sumStock($info->talle, $info->color, $info->cantidad, $info->producto);
         $this->delete($id);
         if ($compra->isEmpty($info->compra)) {
             $compra->delete($info->compra);
         }
         @header('location: v_compras.php?activo=1&sub=c');
         exit;
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
 }
Пример #2
0
<?php

require_once '/home/nmaxx/public_html/marketingNet/libs.php';
$stock = new TempMaxCompra();
$expiredShoppingCart = $stock->getExpiredShoppingCard();
$shoppingCart = new ShoppingCart();
if (!empty($expiredShoppingCart)) {
    foreach ($expiredShoppingCart as $k => $v) {
        $type = $shoppingCart->getType($v->talle, $v->color);
        $user = $v->idUsuario;
        $id = $v->intContador;
        $stock->storeRemains($type);
        if (isset($type)) {
            switch ($type) {
                case '1':
                    try {
                        $x = new TempStock();
                        $x->liberarStockTalle($id, $user);
                    } catch (Exception $e) {
                        echo $e->getMessage();
                    }
                    break;
                case '2':
                    try {
                        $x = new TempStock();
                        $x->liberarStockColor($id, $user);
                    } catch (Exception $e) {
                        echo $e->getMessage();
                    }
                    break;
                case '3':
Пример #3
0
if (!isset($_SESSION)) {
    session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// require_once('/control/resources/pdo.php');
require_once 'control/productos/classes/class.tallesColores.php';
$cond = isset($_GET['recordID']) && !empty($_GET['recordID']) && !isset($_GET['talle_colores']);
$tempMaxCompra = new TempMaxCompra();
if (isset($_GET['require'])) {
    switch ($_GET['require']) {
        case '1':
            try {
                $x = new TempStock();
                $x->liberarStockTalle($_GET['recordID'], $_SESSION['MM_IdUsuario']);
                $tempMaxCompra->storeRemains($_GET['recordID']);
            } catch (Exception $e) {
                echo $e->getMessage();
            }
            break;
        case '2':
            try {
                $x = new TempStock();
                $x->liberarStockColor($_GET['recordID'], $_SESSION['MM_IdUsuario']);
                $tempMaxCompra->storeRemains($_GET['recordID']);
            } catch (Exception $e) {
                echo $e->getMessage();
            }
            break;
        case '3':
            try {