public function eliminarMasivo($ArrGrupoPrecioOfertaData) { $GrupoPrecioOfertaDAO = new GrupoPrecioOfertaDAO(); $GrupoPrecioOfertaDAO->setEntityManager($this->getEntityManager()); $this->getEntityManager()->getConnection()->beginTransaction(); try { foreach ($ArrGrupoPrecioOfertaData as $GrupoPrecioOfertaData) { $GrupoPrecioOfertaDAO->eliminar($GrupoPrecioOfertaData); } //end foreach $this->getEntityManager()->getConnection()->commit(); return true; } catch (Exception $e) { $this->getEntityManager()->getConnection()->rollback(); $this->getEntityManager()->close(); throw $e; } }
public function consultarPrecioOfertaPorClienteHueso($cliente_id, $usuario_id, $marcacion_sec, $oferta_producto_id, $oferta_variedad_id, $oferta_grado_id, $oferta_tallos_x_bunch, $oferta_tipo_caja_id, $oferta_nro_caja) { $GrupoPrecioDetDAO = new GrupoPrecioDetDAO(); $GrupoPrecioOfertaDAO = new GrupoPrecioOfertaDAO(); $GrupoPrecioDetDAO->setEntityManager($this->getEntityManager()); $GrupoPrecioOfertaDAO->setEntityManager($this->getEntityManager()); //Nos permite identificar el grupo_precio_cab_id en que se encuentra el cliente para poder saber con que precio va a trabajar $reg_grupo_precio_det = $GrupoPrecioDetDAO->consultarPorUsuarioIdPorVariedadIdPorGradoId($usuario_id, $oferta_producto_id, $oferta_variedad_id, $oferta_grado_id, $oferta_tallos_x_bunch); //Se obtiene los registros HUESO (EL COMBO), de acuerdo a la CARNE $rs_precio_oferta = $GrupoPrecioOfertaDAO->consultarPorGrupoPrecioCabPorVariedadIdPorGradoId($reg_grupo_precio_det['grupo_precio_cab_id'], $oferta_producto_id, $oferta_variedad_id, $oferta_grado_id, $oferta_tallos_x_bunch); //Se pregunta registro por registro la disponibilidad y la conversion de las cajas $result_hueso = null; foreach ($rs_precio_oferta as $reg_precio_oferta) { $rs_dispo_precio_oferta = $this->getDispo($cliente_id, $usuario_id, $marcacion_sec, $oferta_tipo_caja_id, $reg_precio_oferta['variedad_combo_id'], $reg_precio_oferta['grado_combo_id'], false, true, false, $oferta_producto_id, $oferta_tallos_x_bunch); if ($rs_dispo_precio_oferta) { if (array_key_exists('result_dispo', $rs_dispo_precio_oferta)) { $reg_dispo_precio_oferta = $rs_dispo_precio_oferta['result_dispo'][0]; $hueso_cajas_minima = $reg_precio_oferta['factor_combo'] * $oferta_nro_caja; if ($reg_dispo_precio_oferta['nro_cajas'] >= $hueso_cajas_minima) { $reg_hueso = array(); $reg_hueso['producto_id'] = $reg_dispo_precio_oferta['producto_id']; $reg_hueso['variedad_id'] = $reg_dispo_precio_oferta['variedad_id']; $reg_hueso['variedad_nombre'] = $reg_dispo_precio_oferta['variedad_nombre']; $reg_hueso['grado_id'] = $reg_dispo_precio_oferta['grado_id']; $reg_hueso['tallos_x_bunch'] = $reg_dispo_precio_oferta['tallos_x_bunch']; $reg_hueso['tipo_caja_id'] = $reg_dispo_precio_oferta['tipo_caja_id']; $reg_hueso['precio'] = $reg_dispo_precio_oferta['precio']; $reg_hueso['nro_cajas'] = $reg_dispo_precio_oferta['nro_cajas']; $reg_hueso['nro_cajas_requeridas'] = $hueso_cajas_minima; $result_hueso[] = $reg_hueso; } //end if } //end if } //end if } //end foreach return $result_hueso; }