public function getVenta($ventId) { $this->load->model(array('Venta')); $venta = new Venta($ventId); $venta->rows = $venta->getDetalle(); echo json_encode($venta); }
private function getListaVenta($lista) { $listaAux = array(); foreach ($lista as $item) { $venta = new Venta(); $venta->setIdVenta($item["idVenta"]); $venta->setNombre($item["nombre"]); $venta->setDireccion($item["Direccion"]); $listaAux[] = $venta; } return $listaAux; }
protected function realizarCompra($producto, $cliente) { $actualizar = ProductoPeer::retrieveByPK($producto); $stock = $actualizar->getStock() - 1; $actualizar->setStock($stock); $actualizar->save(); $fecha = date('Y-m-d'); $nuevo = new Venta(); $nuevo->setIdcliente($cliente); $nuevo->setIdproducto($producto); $nuevo->setFecha($fecha); $nuevo->save(); }
function registrar() { $producto = new Producto(); $restado = $producto->restar($_POST['cantidad'], $_POST['id_producto']); if ($restado == '') { $modelo = new Venta(); $modelo->registar($_POST['id_producto'], $_POST['cantidad'], $_POST['observacion']); $_SESSION['alerta'] = 'Nueva venta registrado'; $this->nuevo(); } else { $_SESSION['alerta'] = 'No hay suficientes productos para la venta, quedan ' . $restado; $this->nuevo(); } }
public function getDashboard() { $users = User::where('padre_id', '=', Auth::user()->id)->orderBy('id', 'DESC')->take(5)->get(); $eventos = Evento::where('user_id', '=', Auth::user()->id)->orderBy('id', 'DESC')->take(5)->get(); $ventas = Venta::where('user_id', '=', Auth::user()->id)->orderBy('id', 'DESC')->take(5)->get(); $this->layout->content = View::make('admin/dashboard')->with('users', $users)->with('eventos', $eventos)->with('ventas', $ventas); }
function getList($p = 0, $rpp = 3, $condicion = "1=1", $parametro = array(), $orderby = "1") { $principio = $p * $rpp; $list = array(); $sql = "select * from {$this->tabla} where {$condicion} order by {$orderby} limit {$principio},{$rpp}"; $r = $this->bd->setConsulta($sql, $parametro); if ($r) { while ($fila = $this->bd->getFila()) { $venta = new Venta(); $venta->set($fila); $list[] = $venta; } } else { return null; } return $list; }
public function getEstadisticos() { setlocale(LC_TIME, 'spanish'); $mes = strftime("%B", mktime(0, 0, 0, date('m'), 1, 2000)); $anio = date('Y'); $pagos = Pago::where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where(DB::raw('MONTH(created_at)'), '=', date('m'))->where('cancelado', 0)->sum('monto'); $ventas = Venta::where(DB::raw('YEAR(fecha)'), '=', date('Y'))->where(DB::raw('MONTH(fecha)'), '=', date('m'))->where('cancelada', 0)->where('cotizacion', 0)->where('autorizado', 1)->groupby(DB::raw('YEAR(fecha)'), DB::raw('MONTH(fecha)'))->orderby('fecha')->sum('total'); return Response::json(array("ventas" => number_format($ventas, 0, ".", ","), "ingresos" => number_format($pagos, 0, ".", ","), "mes" => Str::title($mes) . ' de ' . $anio)); }
function actualizaInserta($opcion) { sesionNivel('a', 'e', 'g'); include 'Modelos/' . $this->modelo . '.php'; include 'Modelos/VentaProducto.php'; include 'Modelos/Producto.php'; $modelo = $this->modelo; $ok = true; if (!isset($_POST['id_producto'], $_POST['id_cliente'])) { $ok = false; } if ($ok) { $venta = new Venta(); $venta->id_usuario = $_SESSION['usuario']->id_usuario; $count = count($_POST['cantidad']); $venta->total = 0; if (isset($_POST['cantidad'])) { for ($i = 0; $i < $count; $i++) { $venta->total += floatval($_POST['cantidad'][$i]) * floatval($_POST['precioUnitario'][$i]); } } $venta->id_cliente = $_POST['id_cliente']; if ($venta->insertar() === "") { $n_venta = $venta->insert_id(); $ventaProducto = new VentaProducto(); for ($i = 0; $i < count($_POST['id_producto']); $i++) { $ventaProducto->id_producto = $_POST['id_producto'][$i]; $ventaProducto->id_venta = $n_venta; $ventaProducto->cantidad = $_POST['cantidad'][$i]; $ventaProducto->precio = $_POST['precioUnitario'][$i]; $ventaProducto->insertar(); Producto::reducirExistencias($ventaProducto->id_producto, $ventaProducto->cantidad); } echo json_encode($n_venta); } else { echo '-3'; } } else { echo "-4"; } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (isset($_GET['buscar'])) { $buscar = Input::get('buscar'); $ventas = DB::table('reportesventas')->orderBy('created_at', 'desc')->where('n_zetas', 'LIKE', '%' . $buscar . '%')->orwhere('total_v', 'LIKE', '%' . $buscar . '%')->orwhere('tributado', 'LIKE', '%' . $buscar . '%')->orwhere('exento', 'LIKE', '%' . $buscar . '%')->orwhere('impuesto', 'LIKE', '%' . $buscar . '%')->paginate(10); } else { $ventas = DB::table('reportesventas')->orderBy('created_at', 'desc')->paginate(10); } $totalVentas = DB::table('reportesventas')->count(); $contador = 0; $agente = Agente::find(1); $fechaVentas = Venta::all(); return View::make('all-ventas.index', array('ventas' => $ventas, 'agente' => $agente, 'fechaVentas' => $fechaVentas, 'totalVentas' => $totalVentas))->with('contador', $contador); //var_dump($facturas); }
public function mail($id) { $producto = Producto::where('id', $id)->first(); $nombre = $producto->nombre; $description = $producto->descripcion; // return $producto; $mail = '*****@*****.**'; $nombreCliente = 'Cliente'; $data = ['mail' => $mail, 'nombre' => $nombre, 'from' => '*****@*****.**', 'from_name' => 'Enlaces']; Venta::create(['cliente_id' => '1', 'producto_id' => $id, 'despacho' => 'En 3 días hábiles']); Mail::send('emails.welcome', ['key' => 'value', 'nombre' => $nombre, 'description' => $description], function ($message) use($data) { $message->from($data['from'], 'Enlaces'); $message->to($data['mail'], 'Nidia')->subject('Orden de compra.'); }); $productos = Producto::where('stock', '>', 0)->get(); return View::make('productos.index', compact('productos')); }
/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->aLugarinventario instanceof Persistent) { $this->aLugarinventario->clearAllReferences($deep); } if ($this->aServicio instanceof Persistent) { $this->aServicio->clearAllReferences($deep); } if ($this->aVenta instanceof Persistent) { $this->aVenta->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aLugarinventario = null; $this->aServicio = null; $this->aVenta = null; }
$json['msg'] = 'Venta creada.'; } $objTipo = new Venta(); $cheque = new Cheque(); if ($_POST['cheque'] != 0) { $objTipo->insertTipo($_POST['fecha'], $numVenta); foreach ($_POST['array'] as $key => $value) { $numero = $value['numero']; $banco = $value['banco']; $fechaCheque = $value['fechaCheque']; $titular = $value['titular']; $monto = $value['monto']; $cheque->insertCheque($numero, $banco, $fechaCheque, $titular, $monto, $numVenta); } } session_start(); $objProducto = new Venta(); require_once '../model/classCarrito.php'; $carrito->get_content(); $carro = $carrito; foreach ((array) $carro as $key) { foreach ((array) $key as $value) { if (is_array($value)) { $objProducto->insertProducto($value['cantidad'], $numVenta, $value['id'], $value['precio']); $objProducto->updateCantidad($value['id'], $value['cantidad']); } } } $carrito->destroy(); $json['id'] = $numVenta; echo json_encode($json);
/** * Filter the query by a related Venta object * * @param Venta|PropelObjectCollection $venta the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PacienteQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByVenta($venta, $comparison = null) { if ($venta instanceof Venta) { return $this->addUsingAlias(PacientePeer::IDPACIENTE, $venta->getIdpaciente(), $comparison); } elseif ($venta instanceof PropelObjectCollection) { return $this->useVentaQuery()->filterByPrimaryKeys($venta->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByVenta() only accepts arguments of type Venta or PropelCollection'); } }
<?php require '../impresion/mc_table.php'; require_once '../clases/ventas_data.php'; $venta = new Venta(); $producto = new Producto(); $tipoproducto = new Tipoproducto(); $pdf = new PDF_MC_Table(); class PDF extends FPDF { //Pie de página function Footer() { //Posición: a 1,5 cm del final $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Número de página $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } $pdf->FPDF('P', 'mm', 'A4'); //$pdf->Open(); $pdf->AliasNbPages(); $pdf->SetLeftMargin(15); $pdf->PageNo(); //$pdf->SetTopMargin(0); $pdf->AddPage(); $pdf->SetFont('Arial', '', 7); $pdf->Cell(190, 10, 'REPORTE DE VENTA DE PRODUCTOS', 0, 0, 'C'); $pdf->Ln(10);
public function asignarAction() { $pacienteQuery = \PacienteQuery::create()->filterByPacienteNombre('Publico')->filterByPacienteAp('en')->filterByPacienteAm('general')->findOne(); $id = $pacienteQuery->getIdpaciente(); $request = $this->getRequest(); // Start Actualizar consulta_status = pagada if ($request->getPost()->subTotalVenta == "0") { if (\VentaQuery::create()->filterByIdventa($request->getPost()->idventa)->exists()) { $ventaActualizarStatus = \VentaQuery::create()->filterByIdventa($request->getPost()->idventa)->findOne(); $ventaActualizarStatus->setVentaStatus($request->getPost()->venta_status)->setVentaReferenciapago($request->getPost()->venta_referenciapago)->setVentaTipodepago($request->getPost()->venta_tipodepago)->setVentaFacturada(0)->setVentaTotal($request->getPost()->venta_total)->save(); $ventaArray = $ventaActualizarStatus->toArray(BasePeer::TYPE_FIELDNAME); return new JsonModel(array('ventaArray' => $ventaArray)); } } // End Actualizar consulta_status = pagada // Start Cancelar Venta if ($request->getPost()->ecancelar == "true") { if (\VentaQuery::create()->filterByIdventa($request->getPost()->idventa)->exists()) { \VentaQuery::create()->filterByIdventa($request->getPost()->idventa)->delete(); return new JsonModel(array('ventaEliminada' => true)); } } // End Cancelar Venta // Start Eliminar cargoventa if ($request->getPost()->idcargoventa) { if ($request->getPost()->eliminar_cargoventa_tipo == 'articulo') { if (\CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->exists()) { $cargoventaEliminado = \CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->findOne(); $lugarinventarioEntity = $cargoventaEliminado->getLugarinventario(); $cantidad = $lugarinventarioEntity->getLugarinventarioCantidad(); $lugarinventarioEntity->setLugarinventarioCantidad($cantidad + $request->getPost()->cantidad); $lugarinventarioEntity->save(); $cargoventaEliminadoArray = array(); if ($cargoventaEliminado->getIdlugarinventario() != null) { $articulovarianteEliminado = $cargoventaEliminado->getLugarinventario()->getOrdencompradetalle()->getArticulovariante(); $propiedadvalorNombreEliminado = null; foreach ($articulovarianteEliminado->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEliminado) { $propiedadEliminadoQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEliminado->getIdpropiedad())->findOne(); $propiedadvalorEliminadoQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEliminado->getIdpropiedadvalor())->findOne(); $propiedadvalorNombreEliminado .= $propiedadEliminadoQuery->getPropiedadNombre() . " " . $propiedadvalorEliminadoQuery->getPropiedadvalorNombre() . " "; } $cargoventaEliminado = array('idcargoventa' => $cargoventaEliminado->getIdcargoventa(), 'idventa' => $cargoventaEliminado->getIdventa(), 'status' => $cargoventaEliminado->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEliminado->getCantidad(), 'articulo' => $cargoventaEliminado->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulo()->getArticuloNombre(), 'descripcion' => utf8_encode($propiedadvalorNombreEliminado), 'salida' => $cargoventaEliminado->getLugarinventario()->getLugar()->getLugarNombre(), 'fechahora' => $cargoventaEliminado->getCargoventaFecha(), 'precio' => $cargoventaEliminado->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulovariantePrecio(), 'subtotal' => $cargoventaEliminado->getMonto()); array_push($cargoventaEliminadoArray, $cargoventaEliminado); } \CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->delete(); $cargoventaQuery = \CargoventaQuery::create()->filterByIdventa($request->getPost()->idventa)->find(); if ($cargoventaQuery->getArrayCopy()) { $cargoventaArray = array(); foreach ($cargoventaQuery as $cargoventaEntity) { if ($cargoventaEntity->getIdlugarinventario() != null) { $articulovarianteEntity = $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante(); $propiedadvalorNombre = null; foreach ($articulovarianteEntity->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity) { $propiedadQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEntity->getIdpropiedad())->findOne(); $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEntity->getIdpropiedadvalor())->findOne(); $propiedadvalorNombre .= $propiedadQuery->getPropiedadNombre() . " " . $propiedadvalorQuery->getPropiedadvalorNombre() . " "; } $cargoventa = array('idcargoventa' => $cargoventaEntity->getIdcargoventa(), 'idventa' => $cargoventaEntity->getIdventa(), 'status' => $cargoventaEntity->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEntity->getCantidad(), 'articulo' => $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulo()->getArticuloNombre(), 'descripcion' => utf8_encode($propiedadvalorNombre), 'salida' => $cargoventaEntity->getLugarinventario()->getLugar()->getLugarNombre(), 'fechahora' => $cargoventaEntity->getCargoventaFecha(), 'precio' => $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulovariantePrecio(), 'subtotal' => $cargoventaEntity->getMonto()); array_push($cargoventaArray, $cargoventa); } } } return new JsonModel(array('cargoventaArray' => $cargoventaArray, 'cargoventaEliminadoArray' => $cargoventaEliminadoArray)); } } if ($request->getPost()->eliminar_cargoventa_tipo == 'servicio') { if (\CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->exists()) { $cargoventaEliminado = \CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->findOne(); $cargoventaEliminadoArray = array(); if ($cargoventaEliminado->getIdservicio() != null) { $cargoventaEliminado = array('idcargoventa' => $cargoventaEliminado->getIdcargoventa(), 'idventa' => $cargoventaEliminado->getIdventa(), 'status' => $cargoventaEliminado->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEliminado->getCantidad(), 'servicio' => $cargoventaEliminado->getServicio()->getServicioNombre(), 'descripcion' => $cargoventaEliminado->getServicio()->getServicioDescripcion(), 'precio' => $cargoventaEliminado->getServicio()->getServicioPrecio(), 'subtotal' => $cargoventaEliminado->getMonto(), 'fechahora' => $cargoventaEliminado->getCargoventaFecha()); array_push($cargoventaEliminadoArray, $cargoventaEliminado); } \CargoventaQuery::create()->filterByIdcargoventa($request->getPost()->idcargoventa)->delete(); $cargoventaQuery = \CargoventaQuery::create()->filterByIdventa($request->getPost()->idventa)->find(); if ($cargoventaQuery->getArrayCopy()) { $cargoventaArray = array(); foreach ($cargoventaQuery as $cargoventaEntity) { if ($cargoventaEntity->getIdservicio() != null) { $cargoventa = array('idcargoventa' => $cargoventaEntity->getIdcargoventa(), 'idventa' => $cargoventaEntity->getIdventa(), 'status' => $cargoventaEntity->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEntity->getCantidad(), 'servicio' => $cargoventaEntity->getServicio()->getServicioNombre(), 'descripcion' => $cargoventaEntity->getServicio()->getServicioDescripcion(), 'precio' => $cargoventaEntity->getServicio()->getServicioPrecio(), 'subtotal' => $cargoventaEntity->getMonto(), 'fechahora' => date('Y-m-d H:i:s')); array_push($cargoventaArray, $cargoventa); } } } return new JsonModel(array('cargoventaArray' => $cargoventaArray, 'cargoventaEliminadoArray' => $cargoventaEliminadoArray)); } } } // End Eliminar cargoventa if ($id) { $paciente = PacienteQuery::create()->filterByIdpaciente($id)->findOne(); //Intanciamos nuestro formulario venta $ventaForm = new VentaForm(); //Instanciamos un nuevo objeto de nuestro objeto Paciente $venta = new \Venta(); //Intanciamos nuestro formulario cargoventa "SIN PARAMETROS" $cargoventaForm = new CargoventaForm(); if ($request->getPost()->cargoventaarticulo_by != null) { if ($request->getPost()->cargoventaarticulo_by == 'nombre') { if ($request->getPost()->busquedaArticulo != null) { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->useArticulovarianteQuery()->useArticuloQuery()->filterBy(BasePeer::translateFieldname('articulo', 'articulo_nombre', BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME), '%' . $request->getPost()->busquedaArticulo . '%', \Criteria::LIKE)->endUse()->endUse()->find(); } else { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->find(); } } if ($request->getPost()->cargoventaarticulo_by == 'código de barras') { if ($request->getPost()->busquedaArticulo != null) { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->useArticulovarianteQuery()->filterBy(BasePeer::translateFieldname('articulovariante', 'articulovariante_codigobarras', BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME), '%' . $request->getPost()->busquedaArticulo . '%', \Criteria::LIKE)->endUse()->find(); } else { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->find(); } } if ($request->getPost()->cargoventaarticulo_by == 'proveedor') { if ($request->getPost()->busquedaArticulo != null) { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->useOrdencompraQuery()->useProveedorQuery()->filterBy(BasePeer::translateFieldname('proveedor', 'proveedor_nombre', BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME), '%' . $request->getPost()->busquedaArticulo . '%', \Criteria::LIKE)->endUse()->endUse()->find(); } else { $ordencompradetalleQuery = \OrdencompradetalleQuery::create()->find(); } } if ($ordencompradetalleQuery->getArrayCopy()) { $ordencompradetalleArray = array(); $lugarNombre = null; foreach ($ordencompradetalleQuery as $ordencompradetalleEntity) { /* foreach($ordencompradetalleEntity->getLugarinventarios()->getArrayCopy() as $lugarinventarioEntity){ $idlugarinventario = $lugarinventarioEntity->getIdlugarinventario(); $lugarNombre = $lugarinventarioEntity->getLugar()->getLugarNombre(); $lugarinventarioCantidad = $lugarinventarioEntity->getLugarinventarioCantidad(); $articuloNombre = $ordencompradetalleEntity->getArticulovariante()->getArticulo()->getArticuloNombre(); foreach($ordencompradetalleEntity->getArticulovariante()->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity){ $propiedadQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEntity->getIdpropiedad())->findOne(); $propiedadNombre = $propiedadQuery->getPropiedadNombre(); } foreach($ordencompradetalleEntity->getArticulovariante()->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity){ $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEntity->getIdpropiedadvalor())->findOne(); $propiedadvalorNombre = $propiedadvalorQuery->getPropiedadvalorNombre(); } } */ foreach ($ordencompradetalleEntity->getLugarinventarios()->getArrayCopy() as $lugarinventarioEntity) { $idlugarinventario = $lugarinventarioEntity->getIdlugarinventario(); $lugarNombre = $lugarinventarioEntity->getLugar()->getLugarNombre(); $lugarinventarioCantidad = $lugarinventarioEntity->getLugarinventarioCantidad(); $articuloNombre = $ordencompradetalleEntity->getArticulovariante()->getArticulo()->getArticuloNombre(); /* foreach($ordencompradetalleEntity->getArticulovariante()->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity){ $propiedadQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEntity->getIdpropiedad())->findOne(); $propiedadNombre = $propiedadQuery->getPropiedadNombre(); array_push($propiedadArray, $propiedadNombre); } foreach($ordencompradetalleEntity->getArticulovariante()->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity){ $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEntity->getIdpropiedadvalor())->findOne(); $propiedadvalorNombre = $propiedadvalorQuery->getPropiedadvalorNombre(); array_push($propiedadValorArray, $propiedadvalorNombre); } */ $propiedadvalorNombre = null; foreach ($ordencompradetalleEntity->getArticulovariante()->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity) { $propiedadQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEntity->getIdpropiedad())->findOne(); $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEntity->getIdpropiedadvalor())->findOne(); $propiedadvalorNombre .= $propiedadQuery->getPropiedadNombre() . " " . $propiedadvalorQuery->getPropiedadvalorNombre() . " "; } } $ordencompradetalle = array('idordencompradetalle' => $ordencompradetalleEntity->getIdordencompradetalle(), 'idlugarinventario' => $idlugarinventario, 'cargoventa_tipo' => 'articulo', 'cargoventa_fecha' => date('Y-m-d H:i:s'), 'ordencompradetalle_caducidad' => $ordencompradetalleEntity->getOrdencompradetalleCaducidad(), 'existencia' => $lugarinventarioCantidad, 'articulo' => $articuloNombre, 'descripcion' => utf8_encode($propiedadvalorNombre), 'precio' => $ordencompradetalleEntity->getArticulovariante()->getArticulovariantePrecio(), 'salida' => $lugarNombre); array_push($ordencompradetalleArray, $ordencompradetalle); } } return new JsonModel(array('ordencompradetalleArray' => $ordencompradetalleArray)); } if ($request->getPost()->cargoventaservicio_by != null) { if ($request->getPost()->cargoventaservicio_by == 'nombre') { if ($request->getPost()->busquedaServicio != null) { $servicioQuery = \ServicioQuery::create()->filterBy(BasePeer::translateFieldname('servicio', 'servicio_nombre', BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME), '%' . $request->getPost()->busquedaServicio . '%', \Criteria::LIKE)->find(); } else { $servicioQuery = \ServicioQuery::create()->find(); } } if ($servicioQuery->getArrayCopy()) { $servicioArray = array(); foreach ($servicioQuery as $servicioEntity) { $servicio = array('idservicio' => $servicioEntity->getIdservicio(), 'cargoventa_tipo' => 'servicio', 'cargoventa_fecha' => date('Y-m-d H:i:s'), 'servicio_nombre' => $servicioEntity->getServicioNombre(), 'servicio_descripcion' => $servicioEntity->getServicioDescripcion(), 'servicio_precio' => $servicioEntity->getServicioPrecio()); array_push($servicioArray, $servicio); } } return new JsonModel(array('servicioArray' => $servicioArray)); } // Fin Preparando Form Cargoventa if ($request->isPost()) { //Si hicieron POST //Instanciamos nuestro filtro $ventaFilter = new VentaFilter(); //Le ponemos nuestro filtro a nuesto fromulario $ventaForm->setInputFilter($ventaFilter->getInputFilter()); //Le ponemos los datos a nuestro formulario $ventaForm->setData($request->getPost()); //Validamos nuestro formulario if ($ventaForm->isValid()) { //Recorremos nuestro formulario y seteamos los valores a nuestro objeto Venta foreach ($ventaForm->getData() as $ventaKey => $ventaValue) { if ($ventaKey == 'venta_fecha') { $venta->setVentaFecha($ventaValue . date('H:i:s')); } else { $venta->setByName($ventaKey, $ventaValue, \BasePeer::TYPE_FIELDNAME); } $venta->setVentaStatus('no pagada'); } //Guardamos en nuestra base de datos $venta->save(); $ventaArray = \VentaQuery::create()->filterByIdventa($venta->getIdventa())->findOne()->toArray(BasePeer::TYPE_FIELDNAME); return new JsonModel(array('ventaArray' => $ventaArray)); //Redireccionamos a nuestro list //return $this->redirect()->toRoute('pacientes'); } //Instanciamos nuestro filtro $cargoventaFilter = new CargoventaFilter(); //Le ponemos nuestro filtro a nuesto fromulario $cargoventaForm->setInputFilter($cargoventaFilter->getInputFilter()); //Le ponemos los datos a nuestro formulario $cargoventaForm->setData($request->getPost()); //Validamos nuestro formulario if ($cargoventaForm->isValid()) { $cargoventaArray = array(); if ($request->getPost()->cargoventa_tipo == 'articulo') { //Instanciamos un nuevo objeto de nuestro objeto Paciente $cargoventa = new \Cargoventa(); //Recorremos nuestro formulario y seteamos los valores a nuestro objeto Venta foreach ($cargoventaForm->getData() as $cargoventaKey => $cargoventaValue) { if ($cargoventaKey != 'cargoventaarticulo_by' && $cargoventaKey != 'cargoventaservicio_by' && $cargoventaKey != 'busquedaArticulo' && $cargoventaKey != 'busquedaServicio') { $cargoventa->setByName($cargoventaKey, $cargoventaValue, \BasePeer::TYPE_FIELDNAME); } } // Validar precio, caducidad y existencia de ordencompradetalle $existencia = $cargoventa->getLugarinventario()->getLugarinventarioCantidad(); $caducidad = $cargoventa->getLugarinventario()->getOrdencompradetalle()->getOrdencompradetalleCaducidad(); $precio = $cargoventa->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulovariantePrecio(); if ($existencia > 0) { if ($caducidad < date('Y-m-d')) { $cargoventa->setMonto($request->getPost()->cantidad * $precio); } } //Guardamos en nuestra base de datos $cargoventa->save(); $lugarinventarioQuery = $cargoventa->getLugarinventario(); $lugarinventarioQuery->setLugarinventarioCantidad($lugarinventarioQuery->getLugarinventarioCantidad() - $cargoventa->getCantidad()); $lugarinventarioQuery->save(); $cargoventaQuery = \CargoventaQuery::create()->filterByIdventa($cargoventa->getIdventa())->find(); if ($cargoventaQuery->getArrayCopy()) { foreach ($cargoventaQuery as $cargoventaEntity) { if ($cargoventaEntity->getIdlugarinventario() != null) { $articulovarianteEntity = $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante(); $propiedadvalorNombre = null; foreach ($articulovarianteEntity->getArticulovariantevalors()->getArrayCopy() as $articulovariantevalorEntity) { $propiedadQuery = \PropiedadQuery::create()->filterByIdpropiedad($articulovariantevalorEntity->getIdpropiedad())->findOne(); $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByIdpropiedadvalor($articulovariantevalorEntity->getIdpropiedadvalor())->findOne(); $propiedadvalorNombre .= $propiedadQuery->getPropiedadNombre() . " " . $propiedadvalorQuery->getPropiedadvalorNombre() . " "; } $cargoventa = array('idcargoventa' => $cargoventaEntity->getIdcargoventa(), 'idventa' => $cargoventaEntity->getIdventa(), 'venta_status' => $cargoventaEntity->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEntity->getCantidad(), 'articulo' => $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulo()->getArticuloNombre(), 'descripcion' => utf8_encode($propiedadvalorNombre), 'salida' => $cargoventaEntity->getLugarinventario()->getLugar()->getLugarNombre(), 'fechahora' => $cargoventaEntity->getCargoventaFecha(), 'precio' => $cargoventaEntity->getLugarinventario()->getOrdencompradetalle()->getArticulovariante()->getArticulovariantePrecio(), 'subtotal' => $cargoventaEntity->getMonto()); array_push($cargoventaArray, $cargoventa); } } } } if ($request->getPost()->cargoventa_tipo == 'servicio') { //Instanciamos un nuevo objeto de nuestro objeto Paciente $cargoventa = new \Cargoventa(); //Recorremos nuestro formulario y seteamos los valores a nuestro objeto Venta foreach ($cargoventaForm->getData() as $cargoventaKey => $cargoventaValue) { if ($cargoventaKey != 'cargoventaarticulo_by' && $cargoventaKey != 'cargoventaservicio_by' && $cargoventaKey != 'busquedaArticulo' && $cargoventaKey != 'busquedaServicio') { $cargoventa->setByName($cargoventaKey, $cargoventaValue, \BasePeer::TYPE_FIELDNAME); } } $precio = $cargoventa->getServicio()->getServicioPrecio(); $cargoventa->setMonto($request->getPost()->cantidad * $precio); //Guardamos en nuestra base de datos $cargoventa->save(); $cargoventaQuery = \CargoventaQuery::create()->filterByIdventa($cargoventa->getIdventa())->find(); if ($cargoventaQuery->getArrayCopy()) { foreach ($cargoventaQuery as $cargoventaEntity) { if ($cargoventaEntity->getIdservicio() != null) { $cargoventa = array('idcargoventa' => $cargoventaEntity->getIdcargoventa(), 'idventa' => $cargoventaEntity->getIdventa(), 'venta_status' => $cargoventaEntity->getVenta()->getVentaStatus(), 'cantidad' => $cargoventaEntity->getCantidad(), 'servicio' => $cargoventaEntity->getServicio()->getServicioNombre(), 'descripcion' => $cargoventaEntity->getServicio()->getServicioDescripcion(), 'precio' => $cargoventaEntity->getServicio()->getServicioPrecio(), 'subtotal' => $cargoventaEntity->getMonto(), 'fechahora' => $cargoventaEntity->getCargoventaFecha()); array_push($cargoventaArray, $cargoventa); } } } } return new JsonModel(array('cargoventaArray' => $cargoventaArray)); } /* else { $messageArray = array(); foreach ($cargoventaForm->getMessages() as $key => $value){ foreach($value as $val){ //Obtenemos el valor de la columna con error $message = $key.' '.$val; array_push($messageArray, $message); } } var_dump($messageArray); return new ViewModel(array( 'input_error' => $messageArray )); }*/ } return new ViewModel(array('pacienteEntity' => $paciente, 'ventaForm' => $ventaForm, 'cargoventaForm' => $cargoventaForm)); } else { return $this->redirect()->toRoute('pacientes'); } }
/** * Exclude object from result * * @param Venta $venta Object to remove from the list of results * * @return VentaQuery The current query, for fluid interface */ public function prune($venta = null) { if ($venta) { $this->addUsingAlias(VentaPeer::IDVENTA, $venta->getIdventa(), Criteria::NOT_EQUAL); } return $this; }
static function obtenerHastaLaFecha() { return Venta::obtenerTodos(' where id_usuario=' . $_SESSION['usuario']->id_usuario . ' and fecha_hora between "' . $_SESSION['turno']->fecha_hora_inicio . '" and CURRENT_TIMESTAMP'); }
<?php require_once '../model/classVenta.php'; $objVenta = new Venta(); $objVenta->selectVentaById($_POST['id']); $json['success'] = false; foreach ((array) $objVenta as $key) { foreach ($key as $value) { if (is_array($value)) { $json['success'] = true; } } } echo json_encode($json);
/** * @param Venta $venta The venta object to add. */ protected function doAddVenta($venta) { $this->collVentas[] = $venta; $venta->setCliente($this); }
$pdf->Cell(40, 10, utf8_decode('Banco'), 1, 0, 'C'); $pdf->Cell(60, 10, utf8_decode('Titular'), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode('Fecha'), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode('Monto'), 1, 0, 'C'); $pdf->Ln(10); foreach ($key as $key2) { $pdf->Cell(30, 10, utf8_decode($key2['che_numero']), 1, 0, 'C'); $pdf->Cell(40, 10, utf8_decode($key2['che_banco']), 1, 0, 'C'); $pdf->Cell(60, 10, utf8_decode($key2['che_titular']), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode($key2['che_fecha']), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode(number_format($key2['che_monto'], 0, ',', '.')), 1, 0, 'C'); $pdf->Ln(10); } $pdf->Ln(40); } $objVentas = new Venta(); $objVentas->listVenta($fecha); foreach ((array) $objVentas as $key) { $pdf->Cell(50, 10, utf8_decode('Cantidad de ventas: ' . count($key))); $pdf->Ln(10); $pdf->Cell(40, 10, utf8_decode('Correlativo'), 1, 0, 'C'); $pdf->Cell(40, 10, utf8_decode('Rut Cliente'), 1, 0, 'C'); $pdf->Cell(80, 10, utf8_decode('Nombre Cliente'), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode('Total Venta'), 1, 0, 'C'); $pdf->Ln(10); foreach ($key as $key2) { $pdf->Cell(40, 10, utf8_decode($key2['ven_id']), 1, 0, 'C'); $pdf->Cell(40, 10, utf8_decode($key2['cli_rut']), 1, 0, 'C'); $pdf->Cell(80, 10, utf8_decode($key2['cli_nombre']), 1, 0, 'C'); $pdf->Cell(30, 10, utf8_decode(number_format($key2['ven_valor_neto'], 0, ',', '.')), 1, 0, 'C'); $pdf->Ln(10);
public function comprarAction($ciudad, $slug) { $em = $this->getDoctrine()->getManager(); $usuario = $this->get('security.context')->getToken()->getUser(); // Solo pueden comprar los usuarios registrados y logueados if (null == $usuario || !$this->get('security.context')->isGranted('ROLE_USUARIO')) { $this->get('session')->getFlashBag()->add('info', 'Antes de comprar debes registrarte o conectarte con tu usuario y contraseña.'); return $this->redirect($this->generateUrl('usuario_login')); } // Comprobar que existe la ciudad indicada $ciudad = $em->getRepository('CiudadBundle:Ciudad')->findOneBySlug($ciudad); if (!$ciudad) { throw $this->createNotFoundException('La ciudad indicada no está disponible'); } // Comprobar que existe la oferta indicada $oferta = $em->getRepository('OfertaBundle:Oferta')->findOneBy(array('ciudad' => $ciudad->getId(), 'slug' => $slug)); if (!$oferta) { throw $this->createNotFoundException('La oferta indicada no está disponible'); } // Un mismo usuario no puede comprar dos veces la misma oferta $venta = $em->getRepository('OfertaBundle:Venta')->findOneBy(array('oferta' => $oferta->getId(), 'usuario' => $usuario->getId())); if (null != $venta) { $fechaVenta = $venta->getFecha(); $formateador = \IntlDateFormatter::create($this->get('translator')->getLocale(), \IntlDateFormatter::LONG, \IntlDateFormatter::NONE); $this->get('session')->getFlashBag()->add('error', 'No puedes volver a comprar la misma oferta (la compraste el ' . $formateador->format($fechaVenta) . ').'); return $this->redirect($peticion->headers->get('Referer', $this->generateUrl('portada'))); } // Guardar la nueva venta e incrementar el contador de compras de la oferta $venta = new Venta(); $venta->setOferta($oferta); $venta->setUsuario($usuario); $venta->setFecha(new \DateTime()); $em->persist($venta); $oferta->setCompras($oferta->getCompras() + 1); $em->flush(); return $this->render('UsuarioBundle:Default:comprar.html.twig', array('oferta' => $oferta, 'usuario' => $usuario)); }
private static function Cotizar($descuento, $id_comprador_venta, $impuesto, $subtotal, $tipo_venta, $total, $datos_cheque = null, $detalle_orden = null, $detalle_paquete = null, $detalle_venta = null, $id_sucursal = null, $saldo = "0", $tipo_de_pago = null) { Logger::log("Cotizando ...."); //Se obtiene el id del usuario actualmente logueado $aS = SesionController::Actual(); $id_usuario = $aS["id_usuario"]; //Se busca al usuario comprador $usuario = UsuarioDAO::getByPK($id_comprador_venta); if (!is_null($id_sucursal)) { $sucursal = SucursalDAO::getByPK($id_sucursal); if (is_null($sucursal)) { Logger::error("La sucursal " . $id_sucursal . " no existe"); throw new InvalidDataException("La sucursal no existe", 901); } if (!$sucursal->getActiva()) { Logger::error("La sucursal " . $id_sucursal . " esta desactivada"); throw new InvalidDataException("La sucursal esta desactivada", 901); } } //Se inicializa la venta con los parametros obtenidos $venta = new Venta(); $venta->setRetencion(0); $venta->setEsCotizacion(true); $venta->setIdCompradorVenta($id_comprador_venta); $venta->setSubtotal($subtotal); $venta->setImpuesto($impuesto); $venta->setTotal($total); $venta->setDescuento($descuento); $venta->setTipoDeVenta($tipo_venta); $venta->setIdCaja(null); $venta->setIdSucursal($id_sucursal); $venta->setIdUsuario($id_usuario); $venta->setIdVentaCaja(NULL); $venta->setCancelada(0); $venta->setTipoDePago(null); $venta->setSaldo(0); $venta->setFecha(time()); DAO::transBegin(); try { VentaDAO::save($venta); } catch (Exception $e) { DAO::transRollback(); Logger::error("No se pudo realizar la venta: " . $e); throw new Exception("No se pudo realizar la venta", 901); } //Si el detalle de las ordenes compradas, el detalle de los paquetes y el detalle de los productos //son nulos, manda error. if (is_null($detalle_orden) && is_null($detalle_paquete) && is_null($detalle_venta)) { throw new InvalidDataException("No se recibieron ni paquetes ni productos ni servicios para esta venta", 901); } //Por cada detalle, se valida la informacion recibida, se guarda en un registro //que contiene el id de la venta generada y se guarda el detalle en su respectiva tabla. if (!is_null($detalle_venta)) { $detalle_producto = object_to_array($detalle_venta); if (!is_array($detalle_producto)) { throw new Exception("El detalle del producto es invalido", 901); } foreach ($detalle_producto as $d_p) { $d_producto = new VentaProducto(); $d_producto->setIdVenta($venta->getIdVenta()); if (!array_key_exists("id_producto", $d_p) || !array_key_exists("cantidad", $d_p) || !array_key_exists("precio", $d_p) || !array_key_exists("descuento", $d_p) || !array_key_exists("impuesto", $d_p) || !array_key_exists("retencion", $d_p) || !array_key_exists("id_unidad", $d_p)) { throw new Exception("El detalle del producto es invalido", 901); } Logger::log("Insertando venta_producto:"); $d_producto->setCantidad($d_p["cantidad"]); $d_producto->setDescuento($d_p["descuento"]); $d_producto->setIdProducto($d_p["id_producto"]); $d_producto->setIdUnidad($d_p["id_unidad"]); $d_producto->setImpuesto($d_p["impuesto"]); $d_producto->setPrecio($d_p["precio"]); $d_producto->setRetencion($d_p["retencion"]); Logger::log($d_producto); try { VentaProductoDAO::save($d_producto); } catch (Exception $e) { DAO::transRollback(); Logger::error("No se pudo realizar la venta: " . $e); throw new Exception("No se pudo realizar la venta", 901); } } } /* Fin de if para detalle_producto */ DAO::transEnd(); Logger::log("====== Cotizacion realizada exitosamente ======== "); return array("id_venta" => $venta->getIdVenta()); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Venta::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
if (!empty($titulo)) { $graph->title->Set($titulo); } //Creamos el plot de tipo tarta $p1 = new PiePlot3D($data); $p1->SetSliceColors($color); #indicamos la leyenda para cada porcion de la tarta $p1->SetLegends($nombres); //Añadirmos el plot al grafico $graph->Add($p1); //mostramos el grafico en pantalla $graph->Stroke("{$nombreGrafico}.png"); $this->Image("{$nombreGrafico}.png", $x, $y, $ancho, $altura); unlink("{$nombreGrafico}.png"); } } } $pdf = new Reporte(); //creamos el documento pdf $pdf->AddPage(); //agregamos la pagina $pdf->SetFont("Arial", "B", 16); //establecemos propiedades del texto tipo de letra, negrita, tamaño //$pdf->Cell(40,10,'hola mundo',1); $pdf->Cell(0, 5, "Estadisticas de los ultimos 30 dias", 0, 0, 'C'); $compra = new Compra(); $venta = new Venta(); $nro_compra = $compra->contar(); $nro_venta = $venta->contar(); $pdf->gaficoPDF(array('Ingresos' => array($nro_compra['0']['compras'], 'red'), 'Egresos' => array($nro_venta['0']['ventas'], 'blue')), 'Grafico', array(20, 40, 170, 170), 'Ingresos ' . $nro_compra['0']['compras'] . ' | Egresos ' . $nro_venta['0']['ventas']); $pdf->Output();
function insertDoVenta() { $nombre = Leer::post("nombre"); $direccion = Leer::post("direccion"); session_start(); if (!isset($_SESSION["__carrito"])) { header('Location: ?op=select&action=view&target=produ'); exit; } $bd = new BaseDatos(); $modelodetalle = new ModeloDetalleVenta($bd); $modeloventa = new ModeloVenta($bd); $venta = new Venta(); $venta->setNombre($nombre); $venta->setDireccion($direccion); $idventa = $modeloventa->add($venta); $preciototal = 0; $carrito = $_SESSION["__carrito"]; foreach ($carrito as $clave => $valor) { $detalle = new DetalleVenta(null, $idventa, $valor->getProducto()->getId(), $valor->getCantidad(), $valor->getProducto()->getPrecio(), $valor->getProducto()->getIva()); $r = $modelodetalle->add($detalle); if ($r != -1) { $preciototal += $valor->getCantidad() * $valor->getProducto()->getPrecio(); } } $venta = $modeloventa->get($idventa); $venta->setPrecio($preciototal); $modeloventa->edit($venta); header("Location: ?op=insert&action=view&target=paypal&idventa={$idventa}"); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id, $modelClass = __CLASS__) { $model = Venta::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getContratar($id) { $cotizacion = Venta::with('planpagoventa')->find($id); $recibo = new Recibo(); $recibo->fecha_limite = Carbon\Carbon::now(); $plan_pago = PlanPago::find($cotizacion->planpagoventa[0]->plan_pago_id); $recibo->monto = $cotizacion->total * $plan_pago->porcentaje_anticipo / 100; $cotizacion->cotizacion = 0; $cotizacion->recibo()->save($recibo); $cotizacion->save(); return Redirect::action('CotizacionControlador@getIndex'); }
case 28: $movimientocaja = new Movimientocaja(); $movimientocaja->insertarmovimiento($miconexion, $_GET); $tipoguardado = $_GET['tipomovimiento']; if ($tipoguardado > 0 && $tipoguardado < 3) { $entradacaja = new Entrada_caja(); $entradacaja->insertarentradacaja($miconexion, $_GET); } else { $salidacaja = new Salida_caja(); $salidacaja->insertarsalidacaja($miconexion, $_GET); } break; case 29: //guarda costos de la compra $costoscompra = new Costo_compra(); $costoscompra->insertarcostoscompra($miconexion, $_GET); break; case 30: $venta = new Venta(); $venta->editarventa($miconexion, $_GET); break; case 31: $venta = new Venta(); $venta->editarventaplaya($miconexion, $_GET); break; } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
<?php require '../impresion/mc_table.php'; require_once "../clases/ventas_data.php"; require_once "../clases/numeros_a_letras_data.php"; $venta = new Venta(); //$comprobante = new Comprobante; $cliente = new Cliente(); $numerosletras = new Numeros_a_letras(); $pdf = new PDF_MC_Table(); class PDF extends FPDF { //Pie de página function Footer() { //Posición: a 1,5 cm del final $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Número de página $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } //$pdf->FPDF('P','mm','A4'); $pdf = new FPDF('P', 'cm', 'custom', 300.28, 458.92); //ingreso medida puntos //$pdf->Open(); $pdf->AliasNbPages(); $pdf->SetLeftMargin(0.7); $pdf->PageNo(); $pdf->SetTopMargin(5);
function cargarVentas() { $mdb2 = conectar(); $fechas = new Venta($mdb2['dsn']); $fechas->setSelect("fecha"); $fechas->setWhere("idUsuario = " . $_SESSION['usuario']['idUsuario']); $fechas->setGroup("fecha"); $fechas = $fechas->getAll(); $reg = array(); for ($i = 0; $i < count($fechas); $i++) { $ventas = new Venta($mdb2['dsn']); $ventas->setSelect("idVenta"); $ventas->addSelect("cantidad"); $ventas->addSelect("DATE(fecha) AS fecha"); $ventas->addSelect("idProducto"); $ventas->addSelect(TABLA_PRODUCTO . ".nombre AS nombre"); $ventas->addSelect(TABLA_PRODUCTO . ".precioWeb AS precioWeb"); $ventas->addSelect(TABLA_IMAGEN_PRODUCTO . ".nombre AS imagen"); $ventas->setWhere("carrito = 0"); $ventas->addWhere("idUsuario = " . $_SESSION['usuario']['idUsuario']); $ventas->addWhere("fecha = '" . $fechas[$i]["fecha"] . "'"); $ventas->setJoin(TABLA_PRODUCTO, "venta.idProducto = " . TABLA_PRODUCTO . ".idProducto", inner); $ventas->addJoin(TABLA_IMAGEN_PRODUCTO, TABLA_PRODUCTO . ".idProducto = " . TABLA_IMAGEN_PRODUCTO . ".idProducto", inner); $ventas->setGroup("idVenta"); array_push($reg, $ventas->getAll()); } return $reg; }