function mostrarFichaInventario($nombreProducto) { $objResponse = new xajaxResponse(); $ficha = new Inventario(); $resultado = $ficha->mostrarFicha($nombreProducto, false); $objResponse->addAssign("control", "innerHTML", $resultado); return $objResponse; }
public function agregarInventario($tipo_documento, $nroSerie, $nro_documento, $tipo, $idProducto, $cantidad, $Precio, $Total) { $resultado = array('valor' => 1, 'message' => 'Su solicitud ha sido procesada correctamente.'); $Inventario = new Inventario(); $Inventario->tipo_documento = $tipo_documento; $Inventario->serie = $nroSerie; $Inventario->nro_documento = $nro_documento; $Inventario->tipo = $tipo; $Inventario->idproducto = $idProducto; $Inventario->cantidad = $cantidad; $Inventario->valor_unitario = $Precio; $Inventario->total = $Total; $Inventario->save(); return $resultado; }
public function actionActualizahorometro($idequipo) { $model = new Carteres(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Carteres'])) { $model->attributes = $_POST['Carteres']; if ($model->save()) { $this->redirect(array("partes/index&codep=" . $codep)); } } $modeloinv = new Inventario(); $provi = $modeloinv->search3($codep); $this->render('creacarter', array('model' => $model, 'provi' => $provi, 'codep' => $codep)); }
public function checkcantidaddescripcion($attribute, $params) { //si se puede mover o el innteot de trsnportarlo es licito $inve = Inventario::recordByPlate($this->c_codactivo); $descripcion = is_null($inve) ? '' : $inve->descripcion; if (!strtolower(trim($this->c_descri)) == strtolower(trim($this->c_descri))) { $this->adderror('c_descri', 'La descripcion del activo y del documenrto no coinciden'); } }
public function checkplaca($attribute, $params) { //Primero debemos verificar que el codigo SAP y el codigo de AF son los correctos // $codigosap=$this->c_codsap; $codigoaf = $this->c_codactivo; if (!($codigoaf === null)) { //if ( !is_null($codigoaf)) { $vali = Inventario::model()->find('codigoaf=:codito', array(':codito' => $codigoaf)); //if(!(trim($codigoaf)==trim(is_null($vali)?'':$vali->codigoaf)) ) //{ if ($vali === null) { //$this->adderror('c_codactivo','El codigo de activo no Existe'); } else { $milugar = $vali->codlugar; //Si esta repetido en otro item de la guia o la NE $registros = Detgui::model()->findAll("c_codactivo=:micodigoaf and n_hguia=:valorcabeza and n_detgui <> :idregistro", array(":valorcabeza" => $this->n_hguia, ":idregistro" => $this->n_detgui, ":micodigoaf" => $codigoaf)); if (count($registros) > 0) { $this->adderror('c_codactivo', 'Este activo ya esta registrado en este documento'); } //Si este activo esta comprometido con otro transporte ROCOTO==1, en otro documento //si es una guia de remision , elactivo en rocoto==1 y ademas el iddocu del inventario es diferente al iddocu actual $modelocab = Guia::model()->find('n_guia=:myid', array(':myid' => $this->n_hguia)); if ($vali->rocoto == '1' and $this->n_hguia != $vali->iddocu and $modelocab->c_salida == '1') { $this->adderror('c_codactivo', 'Este activo esta en proceso de transporte con el documento ' . $vali->numerodocumento); } } ///si permite restricciones antes de mover los activos , validar desde donde se quiere mover , no permitira /// mover un activo desde un lugar donde no se encuentre actualmente if (Yii::app()->params['restriccionguia'] == '1') { //si hay restricciones validar... //$this->adderror('c_codactivo','este es el codigo del lugar :'.Inventario::model()->find('codigoaf=:codito',array(':codito'=>$codigoaf))->codlugar); // $direccion=Guia::model()->find("n_guia=:miguia", array(":miguia"=>$this->n_hguia))->n_dirsoc; ///sacando el registro de la guia //$modlugar=Lugares::model()->find("codlugar=:milugar and n_direc=:midireccion ", array(":milugar"=>$milugar,":midireccion"=>$direccion)); // $this->adderror('c_codactivo','este es el codigo del lugar :'); // if(!($modeldireccion===null)) { //$direccion=$modeldireccion->n_dirsoc; ///sacamos el punto de partida // } else { // $this->adderror('c_codactivo','No se ha encontrado la guia '); // } //verificar que este activo se esta sacando de algun lugar del punto de partida*/ // if ($modelolugar===null) { //$this->adderror('c_codactivo','Este activo no se encuentra en el punto de partida'); // } else { //$this->adderror('c_codactivo','pasoi'); // } } } }
public function actionAjaxAgregarDetalleOrdenCompra() { $json = $_POST['json']; $array = json_decode($json); $nroSerie = $_POST['nroSerie']; $nroOrden = $_POST['nroOrden']; $nro_documento = $_POST['nroOrden']; $tipo_documento = "2"; $tipo = "E"; foreach ($array as $obj) { $idProducto = $obj->Codigo; $cantidad = $obj->Cantidad; $Precio = $obj->Precio; $Total = $obj->Importe; DetalleOrdenCompra::model()->agregarDetalleOrdenCompra($nroSerie, $nroOrden, $idProducto, $cantidad, $Precio); Inventario::model()->agregarInventario($tipo_documento, $nroSerie, $nro_documento, $tipo, $idProducto, $cantidad, $Precio, $Total); } }
public function canMove($codigoaf) { if (Yii::app()->params['trancheck'] == '1') { $isthere = false; //verificando el lugar del AF $recInventario = Inventario::recordByPlate($codigoaf); if (!is_null($recInventario)) { $placeofasset = $recInventario->codlugar; $places = $this->direccionespartida->lugares; foreach ($places as $fila) { if ($fila->codlugar == $placeofasset) { $isthere = true; break; } } return $isthere; } else { return false; } } else { return true; } }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->form = new IngresoInventarioForm(); if ($request->isMethod('POST')) { $this->form->bind($request->getParameter('ingreso_inventario')); if ($this->form->isValid()) { $valores = $this->form->getValues(); $BitacoraCambios = new BitacoraCambios(); $BitacoraCambios->setModelo('Inventario'); $Producto = ProductoQuery::create()->findOneById($valores['Producto']); $BitacoraCambios->setDescripcion('Ingreso de Inventario de Producto: ' . $Producto->getDescripcion() . ' con cantidad ' . $valores['Cantidad']); $BitacoraCambios->setIp($request->getRemoteAddress()); $Usuario = UsuarioQuery::create()->findOneById(sfContext::getInstance()->getUser()->getAttribute('usuario', null, 'seguridad')); if ($Usuario) { $BitacoraCambios->setCreatedBy($Usuario->getUsuario()); } $Movimiento = new Movimiento(); $Movimiento->setTipoMovimiento('+'); $Movimiento->setProveedorId($valores['Proveedor']); $Movimiento->setProductoId($Producto->getId()); $Movimiento->setCantidad($valores['Cantidad']); $Movimiento->setPrecio($valores['Precio']); $Movimiento->save(); $BitacoraCambios->save(); $Comprobacion = InventarioQuery::create()->filterByProductoId($valores['Producto'])->filterByProveedorId($valores['Proveedor'])->findOne(); if ($Comprobacion) { $Comprobacion->setCantidad($Comprobacion->getCantidad() + $valores['Cantidad']); $anterior = $Comprobacion->getCantidad() * $Comprobacion->getPrecioCompra(); $actual = $valores['Cantidad'] * $valores['Precio']; $suma = ($anterior + $actual) / ($valores['Cantidad'] + $Comprobacion->getCantidad()); $Comprobacion->setPrecioCompra($suma); $Comprobacion->save(); } else { $Inventario = new Inventario(); $Inventario->setPrecioCompra($valores['Precio']); $Inventario->setProductoId($valores['Producto']); $Inventario->setProveedorId($valores['Proveedor']); $Inventario->setCantidad($valores['Cantidad']); $Inventario->save(); } $this->redirect('inventario/index'); } } $this->cinco = InventarioQuery::create()->orderById('DESC')->limit(5)->find(); }
public function executeEntregado(sfWebRequest $request) { $id = $request->getParameter('id'); $BitacoraCambios = new BitacoraCambios(); $BitacoraCambios->setModelo('Pedido Proveedores'); $Usuario = UsuarioQuery::create()->findOneById(sfContext::getInstance()->getUser()->getAttribute('usuario', null, 'seguridad')); $BitacoraCambios->setDescripcion('Cambio de estado de Pedido a Proveedor a Entregado con id : ' . $id . ' el usuario ' . $Usuario->getNombre()); $BitacoraCambios->setIp($request->getRemoteAddress()); $pedido = PedidoProveedorQuery::create()->findOneById($id); $pedido->setEstado('Entregado'); $pedido->save(); $detalle_pedido = DetallePedidoProveedorQuery::create()->filterByPedidoProveedor($pedido)->find(); foreach ($detalle_pedido as $det) { $Comprobacion = InventarioQuery::create()->filterByProductoId($det->getProductoId())->filterByProveedorId($pedido->getProveedorId())->findOne(); if ($Comprobacion) { $Comprobacion->setCantidad($Comprobacion->getCantidad() + $det->getCantidad()); $anterior = $det->getCantidad() * $Comprobacion->getPrecioCompra(); $actual = $det->getCantidad() * $det->getPrecio(); $suma = ($anterior + $actual) / ($det->getCantidad() + $Comprobacion->getCantidad()); $Comprobacion->setPrecioCompra($suma); $Comprobacion->save(); } else { $Inventario = new Inventario(); $Inventario->setPrecioCompra($det->getPrecio()); $Inventario->setProductoId($det->getProductoId()); $Inventario->setProveedorId($pedido->getProveedorId()); $Inventario->setCantidad($det->getCantidad()); $Inventario->save(); } $Movimiento = new Movimiento(); $Movimiento->setTipoMovimiento('+'); $Movimiento->setProveedorId($pedido->getProveedorId()); $Movimiento->setProductoId($det->getProductoId()); $Movimiento->setCantidad($det->getCantidad()); $Movimiento->setPrecio($det->getPrecio()); $Movimiento->save(); } $this->redirect('pedido_proveedor/index'); }
public function save() { $post = $this->_post(NULL, TRUE); try { if (is_array($post)) { $producto = NomProductoTable::getInstance()->find($post['producto_id']); if (!$producto) { //Si el producto no existe devuelvo un error $msg = "Producto no encontrado."; return $this->_jsonResponse(array("msg" => $msg), 404, $msg); } $entidad = NomEntidadTable::getInstance()->find($post['entidad_id']); if (!$entidad) { //Si la entidad no existe devuelvo un error $msg = "Entidad no encontrada."; return $this->_jsonResponse(array("msg" => $msg), 404, $msg); } if ($post['id']) { $inventario = $this->_getTable()->find($post['id']); if (!$inventario) { //Si el inventario no existe devuelvo un error $msg = "Inventario no encontrado."; return $this->_jsonResponse(array("msg" => $msg), 404, $msg); } } else { $inventario = new Inventario(); } $inventario->fromArray($post, false); $inventario->set('Producto', $producto); $inventario->set('Entidad', $entidad); $inventario->save(); $this->_jsonResponse($inventario->toArray()); } } catch (Exception $exc) { log_message('error', $exc->getMessage()); log_message('error', $exc->getTraceAsString()); $this->_jsonResponse(array("msg" => "Ha ocurrido un error mientras se intentaba guardar un producto."), 500); } }
$proveedor->editarproveedor($miconexion, $_GET); break; case 9: $articulo = new Articulo(); $articulo->insertararticulo($miconexion, $_GET); break; case 10: $articulo = new Articulo(); $articulo->editararticulo($miconexion, $_GET); break; case 11: $inventario = new Inventario(); $inventario->insertararticuloinventario($miconexion, $_GET); break; case 12: $inventario = new Inventario(); $inventario->editararticuloinventario($miconexion, $_GET); break; case 13: $compra = new Compra(); $compra->insertarcompra($miconexion, $_GET); $compra = new Compra(); $numero = $compra->seleccionarultimoid($miconexion); while ($rs = mysqli_fetch_assoc($numero)) { echo $rs["id"]; } break; case 14: $entradaproducto = new Entrada_producto(); $entradaproducto->insertarentrada($miconexion, $_GET); $entradaproducto = new Entrada_producto();
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Inventario $obj A Inventario object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null InventarioPeer::$instances[$key] = $obj; } }
/** * @param Inventario $inventario The inventario object to add. */ protected function doAddInventario($inventario) { $this->collInventarios[] = $inventario; $inventario->setProveedor($this); }
<?php $this->renderpartial('_viewpedazo', array('model' => $model)); $form = $this->beginWidget('CActiveForm', array('enableClientValidation' => false, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true), 'enableAjaxValidation' => false, 'id' => 'upload-form', 'htmlOptions' => array('enctype' => 'multipart/form-data'))); // ... echo $form->labelEx($model, 'imagen'); echo $form->fileField($model, 'imagen'); echo $form->error($model, 'imagen'); $mia = Inventario::model()->findByPk($id); echo $form->hiddenField($model, 'codigosap', array('value' => $mia->codigosap, 'border' => 0)); ?> <?php /* $directorio = opendir("d:/web/"); //ruta actual while ($archivo = readdir($directorio)) //obtenemos un archivo y luego otro sucesivamente { if (is_dir($archivo))//verificamos si es o no un directorio { echo "[".$archivo . "]<br />"; //de ser un directorio lo envolvemos entre corchetes } else { echo $archivo . "<br />"; } }*/ ?> <?php echo CHtml::submitButton('Grabar');
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $inventario = Inventario::model()->findByPk($model->idactivo); if (is_null($inventario)) { throw new CHttpException(404, 'El enlace o direccion solicitado no existe'); } // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Controlactivos'])) { //yii::app()->end(); $model->attributes = $_POST['Controlactivos']; if ($model->save()) { } yii::app()->user->setFlash('success', 'Se han grabado los datos ' . $model->codestado); //$this->redirect(array('view','id'=>$model->idformato)); } $this->render('update', array('model' => $model, 'inventario' => $inventario)); }
public function actionAjaxAgregarDetalleBoleta() { $json = $_POST['json']; $array = json_decode($json); $nroSerie = $_POST['nroSerie']; $nroBol = $_POST['nroBol']; $nro_documento = $_POST['nroBol']; $tipo_documento = "3"; $tipo = "S"; foreach ($array as $obj) { $idProducto = $obj->Codigo; $cantidad = $obj->Cantidad; $Precio = $obj->Precio; $Total = $obj->Importe; DetalleBoleta::model()->agregarDetalleBoleta($nroSerie, $nroBol, $idProducto, $cantidad, $Precio); Inventario::model()->agregarInventario($tipo_documento, $nroSerie, $nro_documento, $tipo, $idProducto, $cantidad, $Precio, $Total); } //$array_string=mysql_escape_string(serialize($array)); //header('Content-Type: application/json; charset="UTF-8"'); Util::renderJSON(array('success' => true)); }
<div class="row"> <?php echo $form->labelEx($model, 'idequipo'); ?> <?php if ($model->isNewRecord) { } else { //buscando el codigo de la embarcacion $modeloinv = Inventario::model()->findByAttributes(array('idinventario' => $model->idequipo)); $codep = $modeloinv->codep; } $criteria = new CDbCriteria(); $criteria->addcondition("codep='" . $codep . "'"); $criteria->addcondition("tienecarter='1'"); $criteria->addcondition("codlugar='000015'"); $datos = CHtml::listData(Inventario::model()->findall($criteria), 'idinventario', 'descripcion'); echo $form->DropDownList($model, 'idequipo', $datos, array('empty' => '--Seleccione el equipo--')); ?> <?php echo $form->error($model, 'idequipo'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'capacidad'); ?> <?php echo $form->textField($model, 'capacidad'); ?>
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Observaciones'])) { $model->attributes = $_POST['Observaciones']; $model->usuario = Yii::app()->user->name; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } if (trim($model->usuario) == trim(Yii::app()->user->name)) { $modeloinventario = Inventario::model()->findByPk($model->hidinventario); $fot = new Fotos($modeloinventario->codigosap, Yii::app()->params['rutafotosinventario'], '.JPG'); $misfotos = $fot->devuelveFotos(); $this->render('update', array('model' => $model, 'modeloinventario' => $modeloinventario, 'misfotos' => $misfotos, 'ruta' => Yii::app()->params['rutafotosinventario_'], 'fot' => $fot)); } else { $this->render('denegado', array('model' => $model)); } }
/** * @name obtenerExistencia * * @description Retorna un listado solamente con las existencias y precios del producto, * este servicio por tener solo existencias es el más liviano y rápido de * consumir por lo cual se recomienda que los sistemas que actualicen su * inventario varias veces al día invoquen este método. */ public function obtenerExistencia() { $sede = DB::table('sedes')->where('id', '=', Auth::user()->sede_id)->first(); set_time_limit(10000); $autorizacion = json_decode($this->obtenerTokenUsuario()); $option = ['http' => ['method' => 'GET', 'header' => ['Authorization: GUID ' . $autorizacion->Guid, 'Content-Type: application/json']]]; $context = stream_context_create($option); $existencias = json_decode(file_get_contents("http://test.dronena.com:8083/REST/Cloud/Producto/Existencias/" . $sede->Codigo . "/Cliente/" . Auth::user()->Codigo_Cliente, false, $context)); if ($existencias) { foreach ($existencias->Existencias->Producto as $e) { $inve = Inventario::where('user_id', '=', Auth::user()->id)->where('Codigo', '=', $e->Codigo)->where('CodigoBarra', '=', $e->CodigoBarra)->where('updated_at', '<>', Fecha::arreglarFecha2(Fecha::fechaActual()))->first(); if (!$inve) { continue; } else { $inve->Precio = $e->Precio; $inve->Descuento = $e->Descuento; $inve->Existencia = $e->Existencia; $inve->save(); } } } }
/** * Filter the query by a related Inventario object * * @param Inventario|PropelObjectCollection $inventario the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ProveedorQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByInventario($inventario, $comparison = null) { if ($inventario instanceof Inventario) { return $this->addUsingAlias(ProveedorPeer::ID, $inventario->getProveedorId(), $comparison); } elseif ($inventario instanceof PropelObjectCollection) { return $this->useInventarioQuery()->filterByPrimaryKeys($inventario->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByInventario() only accepts arguments of type Inventario or PropelCollection'); } }
private function proceso($idevento, $id) { $mensaje = ""; switch ($idevento) { case 2: ///APROBAR GUIA $filas = Guia::model()->findByPk($id)->detalle; foreach ($filas as $row) { if (!is_null($row->c_codactivo)) { $recInventario = Inventario::recordByPlate(trim($row->c_codactivo)); if (!is_null($recInventario)) { /*$recInventario->setScenario('cambiaestado'); $recInventario->rocoto='1'; $recInventario->save();*/ $guiaocupada = VwGuia::hayactivoentransporte($row->c_codactivo); if (!is_null($guiaocupada)) { $mensaje .= " El activo " . $row->c_codactivo . " ya esta registrado en la guia " . $guiaocupada; } } unset($recInventario); } } break; case 64: ///revertir autorizacion /* $filas=Guia::model()->findByPk($id)->detalle; foreach($filas as $row ) { if(!is_null($row->c_codactivo)){ $recInventario=Inventario::recordByPlate(trim($row->c_codactivo)); if(!is_null( $recInventario)) { $recInventario->setScenario('cambiaestado'); $recInventario->rocoto='0'; $recInventario->save(); } unset($recInventario); } }*/ break; case 36: ///autorizar transporte $filas = Guia::model()->findByPk($id)->detalle; foreach ($filas as $row) { if (!is_null($row->c_codactivo)) { $recInventario = Inventario::recordByPlate(trim($row->c_codactivo)); if (!is_null($recInventario)) { $recInventario->setScenario('cambiaestado'); $recInventario->rocoto = '1'; $recInventario->save(); } unset($recInventario); } } break; case 68: ///deshacer confirmacion de transporte $filas = Guia::model()->findByPk($id)->detalle; foreach ($filas as $row) { if (!is_null($row->c_codactivo)) { $recInventario = Inventario::recordByPlate(trim($row->c_codactivo)); if (!is_null($recInventario)) { $recInventario->setScenario('cambiaestado'); $recInventario->rocoto = '0'; $recInventario->save(); } unset($recInventario); } } break; case 37: ///Confirmar entrega 20 -> 80 $filaguia = Guia::model()->findByPk($id); $filas = $filaguia->detalle; foreach ($filas as $row) { if (!is_null($row->c_codactivo)) { $recInventario = Inventario::recordByPlate(trim($row->c_codactivo)); if (!is_null($recInventario)) { $recInventario->loguea($row->c_codep, $filaguia->codocu, $filaguia->id, $filaguia->c_numgui); $recInventario->setScenario('BATCH_UPD_INVENTARIO_FISICO'); $recInventario->fecha = $filaguia->d_fectra; $recInventario->numerodocumento = $filaguia->c_numgui; $recInventario->rocoto = '0'; $recInventario->iddocu = $filaguia->id; $recInventario->coddocu = $filaguia->codocu; /*************************************************** * AQUI LA CLAVE PARA ACTUALIZACION AUTOMATICA DEL LUGAR *****************************************************/ $filaslugares = $filaguia->direccionesllegada->lugares; foreach ($filaslugares as $filalugar) { ///aqui debemos de tener en cuenta el modo de envio if ($row->modo == '2') { ///EMBARQUE $recInventario->codlugar = CODIGO_LUGAR_A_BORDO; } else { ///RETIORNO O DEFINITIVO $recInventario->codlugar = $filalugar->codlugar; } break; //SOLO AGARRA EL PRIMNER VALOR DE LUGARES } /****************************************************/ if (!$recInventario->save()) { /*print_r($recInventario->geterrors()); echo " el documento ".$recInventario->coddocu. " el docu de la guia ".$filaguia->codocu; yii::app()->end();*/ $mensaje = "No se pudo grabar el inventario "; } } unset($recInventario); } } break; case 69: ///REVERTIR entrega 80 -> 20 $filaguia = Guia::model()->findByPk($id); //se podra rever tor siempre que nohay pASADO MUCHO TIEMPO Y ADEMAS EL ACTIVO ESTE EN ESE LUGAR /// 1) SI ESTAMOS A TIEMPO , SEGUN PARAMETRO DE TIEMPO CONNFIGURABLE $diftiempo = strtotime('now') - strtotime($filaguia->d_fectra); if ($diftiempo <= yii::app()->params['guia_tmp_rever_entrega']) { $filas = $filaguia->detalle; foreach ($filas as $row) { if (!is_null($row->c_codactivo)) { $recInventario = Inventario::recordByPlate(trim($row->c_codactivo)); if (!is_null($recInventario)) { $criterio = new CDbCriteria(); $criterio->addCondition(" hidinventario=:vidinventario"); $criterio->addCondition(" iddocumov=:viddocu"); $criterio->addCondition(" codocumov=:vcodocu"); $criterio->params = array(":vidinventario" => $recInventario->idinventario, ":viddocu" => $filaguia->id, ":vcodocu" => $filaguia->codocu); $modelog = Loginventario::model()->find($criterio); if (!is_null($modelog)) { //$mensaje.=" Encontro el log del activo ".$recInventario->idinventario."<br>"; } else { // $mensaje.=" NO Encontro el log del activo ".$recInventario->idinventario."<br>"; } /* echo $criterio->condition; echo "<br>"; echo $recInventario->idinventario."<br>"; echo $filaguia->id."<br>"; echo $filaguia->codocu."<br>";*/ //2) si el activo permanece EN ALGUNLUGAR DE LALDIRECCION DE LLEGADA $lugaresvalidos = array(); $filalugaresvalidos = $filaguia->direccionesllegada->lugares; /* var_dump($filalugaresvalidos); yii::app()->end();*/ if (count($filalugaresvalidos) > 0) { foreach ($filalugaresvalidos as $filadirelle) { $lugaresvalidos[] = $filadirelle->codlugar; } } $seracierto = in_array($recInventario->codlugar, $lugaresvalidos) and $recInventario->rocoto == '0'; if ($seracierto) { //$mensaje.=" SI esta en lugares ...procesando la recuparcion del log ".$recInventario->idinventario."<br>"; //$recInventario->loguea(); $recInventario->setScenario('BATCH_UPD_INVENTARIO_FISICO'); $recInventario->fecha = $modelog->fecha; $recInventario->numerodocumento = $modelog->numerodocumento; $recInventario->rocoto = '1'; $recInventario->codep = $modelog->codep; $recInventario->codepanterior = $modelog->codepanterior; $recInventario->iddocu = $modelog->iddocu; $recInventario->coddocu = $modelog->coddocu; $recInventario->codlugar = $modelog->codlugar; $recInventario->save(); $modelog->delete(); } else { $mensaje .= " El activo " . $recInventario->idinventario . " ya ha cambiado de lugar " . $recInventario->codlugar . " / " . $modelog->codlugar . " o esta en trasnporte<br>"; } } } } } else { $mensaje .= " No se puede revertir la entrega, ha pasado mas tiempo de la tolerancia <br>"; } break; } return $mensaje; }
public function guardarInventario() { if (Request::ajax()) { $data = Input::all(); $guardado = Inventario::create($data); if ($guardado) { return Response::json(array('guardado' => true, 'msg' => 'Guardado')); } else { return Response::json(array('guardado' => false, 'msg' => 'No Guardado')); } } }
} if ($get->instanciar) { $get->id = base64_decode($get->id); $conexion = new Conexion(); $inventario = new Inventario($get->id, $conexion); $_SESSION['inventario'] = serialize($inventario); $operation['message'] = "Se cargo correctamente la información."; $operation["ejecution"] = true; $operation['result'] = true; echo json_encode($operation); } if ($get->reporte) { $get->item = base64_decode($get->item); if ($get->item != "") { $conexion = new Conexion(); $operation = Inventario::reporteItem($get->item, $conexion); if (count($operation['result']) == 1) { $operation['message'] = "Se encontro " . count($operation['result']) . " registro."; } elseif (count($operation['result']) > 1) { $operation['message'] = "Se encontraron " . count($operation['result']) . " registros."; } else { $operation['message'] = "No se encuentran registros con los parametros ingresados."; } } else { $operation['ejecution'] = true; $operation['result'] = false; $operation['message'] = "Por favor diligencie los campos de busqueda."; } echo json_encode($operation); } }
<center><table style="width: 400px; height: 56px;" border="1"> <tbody> <tr> <td style="width: 150.65px;"><center>NOMBRE</center></td> <td style="width: 307.533px;"><center>BODEGA</center></td> <td style="width: 200.067px;"><center>SELECCIONAR</center></td> </tr> <?php include_once '../../../class/inventario/inventario.php'; include_once '../../../class/conexion.php'; $id = $_GET['id']; if ($id == 0) { $inventario = new Inventario(); $tabla = $inventario->seleccionartodo($miconexion); } if ($id > 0) { $inventario = new Inventario(); $tabla = $inventario->seleccionartodoid($miconexion, $_GET); } while ($rs = mysqli_fetch_array($tabla)) { echo "\n <tr>\n \n <td class='productonombreinventario" . $rs["idinventario_producto"] . "'>" . $rs["nombreproducto"] . "<br>\n </td>\n <td class='bodegainventario" . $rs["idinventario_producto"] . "'>" . $rs["nombrebodega"] . "<br>\n </td>\n \n <td >\n <img src='images/selecciona.png' class='seleccionarventaproducto' id='" . $rs["idinventario_producto"] . "' '> \n<br>\n </td>\n </tr>\n "; } ?>
public function actionPio() { echo " falta copmpraer " . Desolpe::model()->findByPk(730)->cuantofaltacomprar(); yii::app()->end(); echo " del material azufre <br>"; echo " una caja vale : " . Alconversiones::convierte('18004728', '190') . " unidades <br>"; echo " un KG vale : " . Alconversiones::convierte('18004728', '123') . " unidades <br>"; echo " unA caja vale : " . Alconversiones::convierte('18004728', '190', '120') . " unidades <br>"; echo " unA UNIDAD vale : " . Alconversiones::convierte('18004728', '120', '190') . " CAJAS <br>"; echo " un KG vale : " . Alconversiones::convierte('18004728', '123', '120') . " unidades <br>"; echo " unA UNIDAD vale : " . Alconversiones::convierte('18004728', '120', '123') . " KILOGRAMOS <br>"; echo " un KG vale : " . Alconversiones::convierte('18004728', '123', '190') . " CAJAS <br>"; echo " unA CAJA vale : " . Alconversiones::convierte('18004728', '190', '123') . " KILOGRAMOS <br>"; yii::app()->end(); $model = new Noticias(); var_dump(get_class($model)); yii::app()->end(); var_dump(count(Peticion::model()->search()->getdata())); yii::app()->end(); ini_set('soap.wsdl_cache_enable', 0); ini_set('soap.wsdl_cache_ttl', 0); $wsdlURL = 'https://www.sunat.gob.pe/ol-ti-itcpgem-beta/billService?wsdl'; $client = new SoapClient($wsdlURL); var_dump($client->__getFunctions()); echo "<BR>"; echo "<BR>"; var_dump($client->__getTypes()); //var_dump($client); yii::app()->end(); //$result=$client->giveTimestamp(); //echo $result; var_dump(yii::app()->user); echo "<br>"; echo "<br>"; echo "<br>"; $elusuario = Yii::app()->user->um->LoadUserById(yii::app()->user->id); var_dump($elusuario); $sesion_activa = Yii::app()->user->um->findSession($elusuario); echo "<br>"; echo " LA DURACION MAXIMA DE LA SESION " . Yii::app()->user->um->getDefaultSystem()->getn('sessionmaxdurationmins') . " Minutos"; echo "<br>"; echo " la sesion expira " . date("Y-m-d H:i:s", $sesion_activa->expire); echo "<br>"; echo " la sesion inicio en " . date(" H:i:s", $sesion_activa->created); echo "<br>"; echo " Ultimo uso " . date("H:i:s", $sesion_activa->lastusage); echo "<br>"; echo " la hora actual " . date("H:i:s"); echo "<br>"; echo " Han pasado : " . (time() - $sesion_activa->created) / 60 . " minutos con "; echo "<br>"; echo " Sesion expirada? :\n\t\t -> " . var_dump($sesion_activa->isSessionExpired()); echo "<br>"; echo " Sesion name : " . $sesion_activa->getSessionName(); echo "<br>"; echo " Sesion valida : " . $sesion_activa->validateSession(); // $sesion_activa->getSessionFilter(); echo "<br>"; //print_r($sesion_activa); yii::app()->end(); echo yii::getPathOfAlias('webroot.materiales'); //echo yii::app()->baseUrl; YII::APP()->END(); /*var_dump(yii::app()->request); echo "<br>"; print_r(yii::app()->request->baseUrl);*/ echo yii::app()->getBaseUrl(true); echo "<br>"; var_dump(is_dir(yii::app()->getBaseUrl(true))); YII::APP()->END(); $images = glob(yii::getPathOfAlias('webroot.materiales') . DIRECTORY_SEPARATOR . "{*.JPG,*.PNG,*.JPEG,*.GIF,*.BMP}", GLOB_BRACE); //echo yii::getPathOfAlias('webroot.materiales.gallery').DIRECTORY_SEPARATOR; //echo "<br>"; //imprime el nombre de cada archivo foreach ($images as $image) { echo $image . '<br />'; } print_r($images); yii::app()->end(); var_dump(is_dir("/public_html/recurso/materiales/")); YII::APP()->END(); var_dump(yii::app()->estadisticas->linear_regression(array(2, 3, 3.5, 5), array(2, 3, 4, 6))); $this->render('//alinventario/vw_loginventario', array()); yii::app()->end(); $modelinv = Alinventario::model()->findByPk(343569); $modelinv->actualiza_stock('77', 1, null); yii::app()->end(); echo Yii::app()->baseUrl; yii::app()->end(); $criterio = new CDbcriteria(); $criterio->addcondition("hidsolpe=:vid"); $criterio->params = array(":vid" => 387); $objeto = new Miproveedor('Desolpe', array('criteria' => $criterio)); //var_dump($objeto->getdata()); $objeto->camposasumar = array("TOTAL CANTIDAD" => 'cant', 'SUBTOTAL PLANEADO' => "punitplan", 'SUBTOTAL REAL' => "punitreal"); $subtotales = $objeto->Total(); var_dump($subtotales); yii::app()->end(); $nuevoarray = array(); $nuevoarray['uno'] = 1; $nuevoarray['dos'] = 2; var_dump($nuevoarray); yii::app()->end(); $criterio = new CDbcriteria(); $objeto = new CActiveDataProvider('Impuestos'); // $dataProvider->getData() will return a list of Post objects var_dump($objeto->getdata()); yii::app()->end(); //echo Almacendocs::model()->findByPk(709)->almacendocs_almacenmovimientos->eventos->estadofinal; var_dump(Almacendocs::model()->findByPk(709)->almacendocs_almacenmovimientos); yii::app()->end(); $criterio = new CDbCriteria(); $criterio->addCondition("hidguia=:xdet"); $criterio->params = array(':xdet' => 59); //var_dump($criterio->condition); print_r(MiFactoria::arrayColumnaSQL(Docompra::model()->tableName(), 'id', $criterio)); yii::app()->end(); $images = glob(yii::getPathOfAlias('webroot.materiales') . DIRECTORY_SEPARATOR . "{*.JPG,*.PNG,*.JPEG,*.GIF,*.BMP}", GLOB_BRACE); //echo yii::getPathOfAlias('webroot.materiales.gallery').DIRECTORY_SEPARATOR; //echo "<br>"; //imprime el nombre de cada archivo foreach ($images as $image) { echo $image . '<br />'; } print_r($images); yii::app()->end(); $modelito = new Ocompra(); $modelito->codocu = $this->documento; echo $modelito->correlativo('numcot'); yii::app()->end(); echo dirname(__FILE__) . '/css/estilogrid.css'; var_dump(is_file($_SERVER['SCRIPT_NAME'] . '/css/estilogrid.css')); //ECHO "..//".(strlen(dirname($_SERVER['SCRIPT_NAME']))>1 ? dirname($_SERVER['SCRIPT_NAME']) : '' ) . '/css/estilogrid.css'; yii::app()->end(); // una ffraccion de la forma 1/2 , 3/4 , 45/3, 1 /2 , 7./3 , 1/ 3, 234/567, 4/.5 , $cadena1 = "PERNO 11/45 INOXIDABLE 7/8 HF 1/2 x 3/4 1/12 * 5/16 "; $cadena2 = "PERNO 12./. 56 3 1/2 INOXIDABLE 17/8 HF "; $cadena3 = "PERNO 45/ 34 INOXIDABLE 7./ 8 HF "; $cadena4 = "PERNO 1/2 4 5/34 INOXIDABLE 7 /8 HF "; $cadena5 = " PERNO 4/.63 INOXIDABLE 756/458 HF "; $cadena6 = "3/4 PERNO 1 / 3 INOXIDABLE 17/8*1 HF "; $cadena7 = "PERNO INOXIDABLE 3*41 25/16 1781 HF "; $patron = "/^(\\s)[0-9]{1,}[\\.|\\s]?[\\/]{1}[\\.|\\s]?[0-9]{1,}(\\s)\$/"; $patron2 = '/[1-9]{0,}+[\\s|*|x|X]{1}[0-9]{1,}[\\.|\\s]{0,1}[\\/]{1}[\\.|\\s]{0,1}[0-9]{1,}[\\s|*|x|X]{1}/'; echo $cadena1 . " " . preg_match_all($patron2, $cadena1, $resultado1) . "<br>"; print_r($resultado1); echo "<br>"; echo "<br>"; echo $cadena2 . " " . preg_match_all($patron2, $cadena2, $resultado2) . "<br>"; print_r($resultado2); echo "<br>"; echo "<br>"; echo $cadena3 . " " . preg_match_all($patron2, $cadena3, $resultado3) . "<br>"; print_r($resultado3); echo "<br>"; echo "<br>"; echo $cadena4 . " " . preg_match_all($patron2, $cadena4, $resultado4) . "<br>"; print_r($resultado4); echo "<br>"; echo "<br>"; echo $cadena5 . " " . preg_match_all($patron2, $cadena5, $resultado5) . "<br>"; print_r($resultado5); echo "<br>"; echo "<br>"; echo $cadena6 . " " . preg_match_all($patron2, $cadena6, $resultado6) . "<br>"; print_r($resultado6); echo "<br>"; echo "<br>"; echo $cadena7 . " " . preg_match_all($patron2, $cadena7, $resultado7) . "<br>"; print_r($resultado7); echo "<br>"; echo "<br>"; //echo $cadena8. " ". preg_match('/^(\s)[0-9]{1,}[\.|\s]?[\/]{1}[\.|\s]?[0-9]{1,}(\s)$/',$cadena1) ."<br>"; yii::app()->end(); print_r(Yii::app()->user->rbac->getMenu()); yii::app()->end(); //$model=new Impuestos; yii::app()->crugemailer->mail_con_archivo('*****@*****.**', '*****@*****.**', 'hi', '130165'); // var_dump(mail('*****@*****.**','holas','holas')); yii::app()->end(); echo Valorimpuestos::getimpuesto('200'); $model->codocumento = '1'; echo Valorimpuestos::model()->getimpuesto('100'); yii::app()->end(); $model->codocumento = '130'; echo $model->Correlativo('numero'); yii::app()->end(); $modelin = CactiveRecord::model('Alkardex'); print_r($modelin->getTableSchema()); yii::app()->end(); echo get_include_path(); yii::app()->end(); echo " la sesion expira " . date("Y-m-d,H-i:s"); yii::app()->end(); echo MiFactoria::decimal(47 / 3); yii::app()->end(); print_r(MiFactoria::opcionestoolbar(345, '130', '20')); yii::app()->end(); $model = new Inventario(); $objeto = $model->getMetaData(); foreach ($objeto->columns as $columna) { echo "campo " . $columna->name . " ancho " . $columna->size . " el tipo : " . $columna->dbType . "<br>"; } print_r($objeto->columns); //$model->rucpro='121212121212121'; //$model->save(); //print_r($model->getMetaData()); yii::app()->end(); $movimientoauxiliar = '45'; $filakardexoriginal = Alkardex::model()->findByPk(1691); $filakardexoriginal->alkardex_alinventario->actualiza_stock($movimientoauxiliar, abs(3), null); yii::app()->end(); $modeloreserva = Alreserva::model()->findByPk(255); var_dump($modeloreserva->alreserva_cantidadatendida); yii::app()->end(); var_dump($kardex = Alkardex::model()->findByPk(1514)->alkardex_despacho); yii::app()->end(); //tag(string $tag, array $htmlOptions=array ( ), mixed $content=false, boolean $closeTag=true) $arrayes = Almacendocs::model()->findAll("numvale=:nimi", array("nimi" => trim('130200000129'))); echo count($arrayes); yii::app()->end(); if (is_dir('assets')) { echo " si es un directrio"; } yii::app()->end(); Yii::app()->crugemailer->prueba(); //echo CHtml::tag("div",array("style"=>"font:23px;fotn-size:445;"),"AQUI",true); $calse = new Cc(); echo $calse::BELONGS_TO; // var_dump($calse); //phpinfo(INFO_MODULES); yii::app()->end(); //tag(string $tag, array $htmlOptions=array ( ), mixed $content=false, boolean $closeTag=true) $arrayes = Almacendocs::model()->findAll("numvale=:nimi", array("nimi" => trim('130200000129'))); echo count($arrayes); yii::app()->end(); echo strpos("manicomo", "c"); Yii::app()->user->setFlash('error', "MENSAJE ERRO1"); Yii::app()->user->setFlash('error2', "MENSAJE ERR2"); Yii::app()->user->setFlash('error3', "MENSAJE ERR3"); Yii::app()->user->setFlash('notice', "MENSAJE NORICE1"); Yii::app()->user->setFlash('notice2', "MENSAJE NOTICE2"); Yii::app()->user->setFlash('notice3', "MENSAJE NOTICE3"); Yii::app()->user->setFlash('success', "SUCCESS ERRO1"); Yii::app()->user->setFlash('success2', "SUCCESS ERR2"); Yii::app()->user->setFlash('success3', "SUCCESS ERR3"); // PRINT_R(Yii::app()->user->getFlashes()); yii::app()->end(); //$this->ConfirmaBuffer($id); $kardexhijos = MiFactoria::DevuelveKardexHijos($id); echo count($kardexhijos); /*foreach ( $kardexhijos as $filakardex ) { //$filakardex->preciounit=$filakardex->getMonto(); //$filakardex->VerificaCantAtenReservas(); //$filakardex->InsertaAtencionReserva($filakardex->id); echo " id del kardex ".$filakardex->id."<br>"; //$filakardex->alkardex_alinventario->actualiza_stock($filakardex->codmov,abs($filakardex->cantidadbase()),null); //$filakardex->InsertaCcGastos(); } */ yii::app()->end(); $id = 160; $modeloreserva = Alreserva::model()->findByPk($id); $modeloreserva->anular(); PRINT_R(Yii::app()->user->getFlashes()); yii::app()->end(); $id = 490; $kardexhijos = MiFactoria::DevuelveKardexHijos($id); //var_dump($kardexhijos); foreach ($kardexhijos as $filakardex) { //calculando el precio unitario $filakardex->preciounit = $filakardex->getMonto(); if ($filakardex->VerificaCantAtenReservas()) { PRINT_R($filakardex->mensajes); } //ECHO " GRABA ".$filakardex->InsertaAtencionReserva($filakardex->id); $filakardex->alkardex_alinventario->actualiza_stock($filakardex->codmov, abs($filakardex->cantidadbase()), null); print_r($filakardex->alkardex_alinventario->mensajes); //verificandso si hay errrores recoger los mensajes /*if(!$filakardex->VerificaCantAtenReservas() or !$filakardex->InsertaAtencionReserva() or !$filakardex->alkardex_alinventario->actualiza_stock($filakardex->codmovimiento,$filakardex->cant,null) ) $this->mensajes=array_merge($this->mensajes,$filakardex->mensajes,$filakardex->alkardex_alinventario->mensajes); */ $filakardex->InsertaCcGastos(); } yii::app()->end(); //$nuevo=new MiFactoria(); //Mifactoria::InsertaAtencionReserva(1357); $row = Alkardex::model()->findByPk(NULL); $matrix = Alreserva::model()->findAll("hidesolpe=:vhidsolpe AND codocu='450' ", array(":vhidsolpe" => $row->idref)); $model = new Atencionreserva(); $model->cant = $row->cant; $model->hidkardex = $row->id; $model->hidreserva = $matrix[0]['id']; $model->estadoatencion = Atencionreserva::ESTADO_CREADO; if (!$model->save()) { throw new CHttpException(500, "NO se Pudo insertar el registro de atenciones reservas "); } unset($model); unset($matrix); unset($row); yii::app()->end(); $mimo = new ModeloGeneral(); $mimo->insertamensaje('success', 'primermamesaje'); $mimo->insertamensaje('success1', 'segundo mensaje'); $mimo->insertamensaje('error', 'tercer mensaje'); $mimox = new ModeloGeneral(); $mimox->insertamensaje('successx', 'primermamesaje'); $mimox->insertamensaje('success1x', 'segundo mensaje'); $mimox->insertamensaje('errorx', 'tercer mensaje'); /*$gg= new Alinventario();*/ print_r($mimo->mensajes); echo "<br><br>"; print_r($mimox->mensajes); $mensaj = array(); $mensaj = array_merge($mensaj, $mimo->mensajes); $mensaj = array_merge($mensaj, $mimox->mensajes); //array_merge($mensaj,$mimox->mensajes); //$mensaj[]=$mimo->mensajes; //$mensaj[]=$mimox->mensajes+$mimo->mensajes; //array_push($mensaj,$mimox->mensajes); echo "<br><br>"; print_r($mensaj); yii::app()->end(); var_dump(Almacenmovimientos::model()->findByPk('10')->signo); //echo "total ".Alinventario::getStockTotal('11000004'); yii::app()->end(); /*if(Yii::app()->periodo->getModel()->HoyDentroPeriodo()){ echo "ESTAMOS DENTRO DEL PERIODO"; } else { echo "no ESTAMOS DENTRO DEL PERIODO"; } yii::app()->end();*/ if (Yii::app()->periodo->verificaFechas('2015-03-5', '2015-03-4')) { echo "ESTAMOS DENTRO DEL PERIODO"; } else { echo "no ESTAMOS DENTRO DEL PERIODO"; } yii::app()->end(); $gg = new Alkardex(); //$gg=Alkardex::model()->findByPk(1236); //var_dump($gg->oldAttributes); echo "<BR><BR> ESCENARIO :" . $gg->getScenario() . "<BR>"; $gg->save(); var_dump($gg->errors); $ggt = new Tempalkardex(); //$gg=Alkardex::model()->findByPk(1236); //var_dump($gg->oldAttributes); echo "<BR><BR> ESCENARIO :" . $ggt->getScenario() . "<BR>"; $ggt->save(); var_dump($ggt->errors); yii::app()->end(); $matriz = $gg->relations(); $nuevoarr = array(); //print_r($matriz); foreach ($matriz as $clave => $matricita) { if ($matricita[0] == 'CHasManyRelation') { $nuevoarr[$matricita[2]] = $matricita[1]; } } print_r($nuevoarr); //$hallo=array_search('CHasManyRelation',$matriz); // echo var_dump($hallo); yii::app()->end(); $arreglo = array(); /*$arreglo1=array('uno'=>1); $arreglo2=array('dos'=>2); $arreglo3=array('tres'=>3);*/ $arreglo['uno'] = 1; $arreglo['dos'] = 2; print_r($arreglo); yii::app()->end(); /*********************************************** * Prueba de la propieda mensajes ARRAY() de * la clase MODELOGENERAL * * ******************* */ $modelo = new ModeloGeneral(); $modelo->insertamensaje('error', 'MENSAJE 1'); $modelo->insertamensaje('error', 'MENSAJE 2'); $modelo->insertamensaje('error', 'MENSAJE 3'); $modelo->insertamensaje('notice', 'notice 1'); $modelo->insertamensaje('notice', 'notice 2'); $modelo->insertamensaje('success', 'succes 3'); echo $modelo->parsemensajes('error'); echo $modelo->parsemensajes('notice'); echo $modelo->parsemensajes('success'); //PRINT_R($modelo->mensajes); yii::app()->end(); foreach ($arreglo as $registro) { echo $registro->cant; echo " <br><br>"; } //var_dump($modelo->desolpe_alreserva); yii::app()->end(); /*********************************************************** * */ /*********************************************** * Prueba de que los registros hijos pueden ser * llmados desde la relacion * HAS:MANY */ $modelo = Desolpe::model()->findByPk(168); $arreglo = $modelo->desolpe_alreserva; ///LLAMA A LA RELACION Y RETORNA OBJETOS HIJOS PRINT_R($arreglo); foreach ($arreglo as $registro) { echo $registro->cant; echo " <br><br>"; } //var_dump($modelo->desolpe_alreserva); yii::app()->end(); /*********************************************************** * */ echo Alconversiones::convierte('18005239', '120'); yii::app()->end(); $petri = new Peticion(); print_r($petri->behaviors()); if (array_key_exists('ActiveRecordLogableBehavior', $petri->behaviors())) { echo "salio"; } yii::app()->end(); /*print_r(MiFactoria::ExisteRegistroTemporal('Tempdpeticion',127)); yii::app()->end();*/ /*print_r(Peticion::relations()); $campoenlace=Peticion::getFieldLink(Peticion::relations(),'Peticion','Tempdpeticion'); echo "<br>"; echo "campo enl ace : ".$campoenlace; yii::app()->end();*/ $id = 127; $con = $this->IniciaBuffer($id); foreach ($con as $grupo) { echo "<br>"; foreach ($grupo as $objeto) { echo "<br>"; foreach ($objeto as $row) { echo "======================================================<br>"; print_r($row); echo "======================================================<br>"; echo "<br>"; } } echo "<br>"; } $nombremodelocabecera = 'Peticion'; foreach ($con as $registroshijos) { // foreach ($grupo as $registroshijos) //{ // $campoenlace=$nombremodelocabecera::getFieldLink($nombremodelocabecera::relations(), $nombremodelocabecera,$nombremodelohijo); // $registroshijos=MiFactoria::getRegistrosHijos($nombremodelohijo,$campoenlace,$id); foreach ($registroshijos as $row) { if (is_null(MiFactoria::ExisteRegistro('Tempdpeticion', $id))) { if ($row->save()) { echo " <br>"; echo " *********************************"; echo " <br>"; echo "grabo " . $row->getTableAlias(); echo " <br>"; echo " *********************************"; echo " <br>"; } } } } yii::app()->end(); print_r($con); yii::app()->end(); // $lalo=null; $modeloant = Solpe::model()->findByPk(239); $matriz = $modeloant->relations(); $palo = $this->recorro($matriz); //echo Solpe::HAS_MANY; print_r($palo); yii::app()->end(); $modeloant = Solpe::model()->findByPk(239); print_r($modeloant->relations()); //echo $modeloant->codart; yii::app()->end(); $modelo = "Dpeticion"; $s = new $modelo(); print_r($s); yii::app()->end(); $clasetemporal = "Alinventario"; $valor = $clasetemporal::model()->hasAttribute('codart'); echo " gfgfgf " . $valor; yii::app()->end(); $registroshijos = $modelo::model()->findAllBySql(" select *from\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . Yii::app()->params['prefijo'] . "dpeticion\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t hidpeticion=54 "); print_r($registroshijos); yii::app()->end(); $inv = 'Alinventario'; $arraymodelos = array(); $modelo = $inv::model()->findByPk(343563); $modelo2 = $inv::model()->findByPk(343564); array_push($arraymodelos, $modelo); array_push($arraymodelos, $modelo2); //$nuevomod=Bloqueos::prueba(); echo $arraymodelos[0]->codart; //print_r($modelo); yii::app()->end(); // $modelo=new ModInventario(); $modelo = ModInventario::loadModel(343563); $modeloant = ModInventario::loadModel(343563); //echo " hola ".gettype($modelo->codart); //$modelo->actualizaprecio($cantmov,1.23,$this->CAMPO_STOCK_LIBRE); $nuevoprecio = 500; $cantmov = 100; if ($modelo->actualizaprecio($cantmov, $nuevoprecio, ModInventario::CAMPO_STOCK_LIBRE)) { echo "ok se relaizo el proceso :<br>"; echo "cant libre : " . $modelo->cantlibre . " anterior : " . $modeloant->cantlibre . "<br>"; echo "cant reserva : " . $modelo->cantres . " anterior : " . $modeloant->cantres . "<br>"; echo "cant reserva : " . $modelo->canttran . " anterior : " . $modeloant->canttran . "<br>"; echo "Precio unitario :" . $modelo->punit . " anterior : " . round($modeloant->punit, 3) . "<br>"; echo "dif de precio unitario : " . $modelo->punitdif . " anterior : " . $modeloant->punitdif . "<br>"; echo "cant stock afectado por el ambio de precio : " . $modelo->getStockCamposAfectadosPrecio() . "<br>"; echo "cant movida : " . $cantmov . "<br>"; echo "precio unitario nuevo : " . $nuevoprecio . "<br>"; echo "-------<br><br>"; } else { $matriz = $modelo->getMensajes(); echo " HAY " . COUNT($matriz) . " Elementos"; print_r($matriz); foreach ($matriz as $arreglo) { // echo " ".$arregloclave." : ".$valor."<br>"; } echo "hu,,-------<br><r>"; } yii::app()->end(); $am = new MyCrugeAuthManager(); $am->init(); foreach ($am->autoDetect() as $itemName) { printf("%s\n", $itemName); } echo " la direccion IP: " . CrugeUtil::hash("julian"); echo " es una instancia de " . gettype(Yii::app()->crugemailer); /*if (Yii::app()->CrugeMailer instanceof CrugeMailer) { echo 'Crugemailer'; } else { echo "que carajo sera"; }*/ yii::app()->end(); $id = 54; $difiere = false; ///Asumismos que no ha variado $registrosactuales = Tempdpeticion::model()->findAllBySql(" select *from\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . Yii::app()->params['prefijo'] . "tempdpeticion\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t hidpeticion=" . $id . " and idusertemp = " . Yii::app()->user->id . " "); $registrosviejos = Dpeticion::model()->findAllBySql(" select *from\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . Yii::app()->params['prefijo'] . "dpeticion\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t hidpeticion=" . $id . " "); foreach ($registrosactuales as $row) { $newattributes = $row->getAttributes(); ///Los valores de este instante foreach ($registrosviejos as $rowviejo) { $oldattributes = $rowviejo->getAttributes(); echo " Emparewjando : " . $oldattributes['id'] . " con " . $newattributes['id'] . " <br>"; if ($oldattributes['id'] == $newattributes['id']) { echo " En la fila " . $oldattributes['id'] . " : <br>"; foreach ($oldattributes as $clave => $valor) { echo "Comparando :<br>"; echo " original : " . $clave . " original=" . $valor . " actual=" . $newattributes[$clave] . "<br>"; if ($valor != $newattributes[$clave] and $clave != 'idtemp' and $clave != 'idusertemp') { echo " DIFERENTE <br><br> "; $difiere = true; break; } } echo " <br><br><br><br>"; } /* print_r($newattributes ); echo "<br>"; print_r($atributos); echo "<br><br><br>";*/ if ($difiere) { break; } } /*print_r($this->bufferdetalle); echo "<br>"; if($difiere) break;*/ if ($difiere) { break; } } echo "<br><br> total " . $difiere; yii::app()->end(); $registrostemporalesdpeticion = array(); $datosdebuffer = array(); ///Estos datos $datosbufferdefila = array(); $registroshijos = Dpeticion::model()->findAllBySql(" select *from\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . Yii::app()->params['prefijo'] . "dpeticion\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t hidpeticion=" . $hidpeticion . " "); foreach ($registroshijos as $row) { ///Evitamos levantar items duplicados $existeregistro = Tempdpeticion::model()->find("id= " . $row->id . " AND idusertemp=" . Yii::app()->user->id . " "); if (is_null($existeregistro)) { ///Solo si no existe $modelotempdpeticion = new Tempdpeticion(); $modelotempdpeticion->attributes = $row->attributes; $modelotempdpeticion->idusertemp = Yii::app()->user->id; array_push($registrostemporalesdpeticion, $modelotempdpeticion); $datosbufferdefila = $row->attributes; //array_push($datosbufferdefila,array('micalve'=>$row->id)); array_push($datosdebuffer, $datosbufferdefila); } } //print_r($datosdebuffer); foreach ($datosdebuffer as $clave => $atributos) { print_r($atributos); echo "<br><br>"; } //$this->bufferdetalle=$registrostemporalesdpeticion; ///Guarda el bu¡ffer de datos //return $registrostemporalesdpeticion; yii::app()->end(); $arreglo = array(); $arreglo1 = array('uno' => 1); $arreglo2 = array('dos' => 2); $arreglo3 = array('tres' => 3); array_push($arreglo, array('uno' => 1)); array_push($arreglo, array('dos' => 2)); print_r($arreglo); yii::app()->end(); $id = 34; if ($id) { echo "dsdsdsds eco "; } yii::app()->end(); $me = Yii::app()->user->id; $cadena = " select distinct idusertemp from " . Yii::app()->params['prefijo'] . "temppeticion WHERE id=" . $id . " and idusertemp <> " . $me . " "; $quien = Yii::app()->db->createCommand($cadena)->queryScalar(); echo $cadena; echo " El tipo de quien " . gettype($quien) . " ----- " . $quien; //yii::app()->end(); if ($quien) { /// Quiere decir que hay otros que estan ediotnado el documento ///PARA VER SIS ES CIERTO DEEBMOS VERIFICAR Q ESTE USUARIO NO HA DEJADO LA VENTANA ABANDONADA CON E DOMCUENTO EN EDICION $elusuario = Yii::app()->user->um->LoadUserById($quien); ///hallando la sesion activa de este usuario $sesion_activa = Yii::app()->user->um->findSession($elusuario); if (is_null($sesion_activa)) { echo " NO esta cupado man "; //No esta ocupado por que estaba editando pero ya temrino sus sesion, alo mejor dejo la ventana abierta } else { echo " Estaa cupado por el usuario " . $elusuario->username; ///Si esta ocupado por que el usuario tiene sesion activa, y eszta editando } } else { echo " NO esta cupado , estas solo mano "; } yii::app()->end(); $usuariojesus = Yii::app()->user->um->loadUser('admin', false); print_r($usuariojesus); echo "<br><br><br><br>"; $modelo = Yii::app()->user->um->findSession($usuariojesus); echo " el tipo retoranado es " . gettype($modelo); print_r($modelo); echo "<br><br><br><br>El modelo de sesion de Jesus"; $modelo = Yii::app()->user->um->findSession(Yii::app()->user->um->loadUser('jesus', false)); echo " el tipo retoranado es " . gettype($modelo); print_r($modelo); yii::app()->end(); $modelo->isSessionExpired(); if ($expiro) { echo " Ya expiro "; } else { echo " Todavia esta vignte la sesion "; } yii::app()->end(); $this->layout = '//layouts/iframe'; $this->render('carachita'); yii::app()->end(); // $modelosolpe=Desolpe::model()->findByPk(79); $modelokardex = Alkardex::model()->findByPk(1236); $clonado = $modelokardex->clonaregistro(); //echo $clonado->cant; print_r($clonado); yii::app()->end(); echo " numeor reservar compras " . $modelosolpe->numero_reservascompras; echo " modelo cant " . $modelosolpe->cant; yii::app()->end(); if ($cantidadatendidaacumulada + $modelokardex->cant == $modeloreserva->cant) { $modeloreserva->estadoreserva = '20'; ///Completo...! ///Veriifcar primero si DESOLPE tiene partido RESERVA +RESERVA PARA COMPRA if ($modelodesolpe->numero_reservascompras == 0) { ///Si no tiene solicitudes de compra $modelodesolpe->est == '40'; } ///Completo...! } $kardex = Alkardex::model()->findByPk(1125); echo " la sumatoria de las cantidades : " . $kardex->alkardex_alkardextraslado_emisor_cant; echo " la cantidad : " . $kardex->cant; yii::app()->end(); $modelo = new Alkardex(); $centro = $modelo->alkardex_alinventario->cantlibre; echo " el cento es " . $centro; yii::app()->end(); $modelo = Desolpe::model()->findByPk(74)->desolpe_alinventario; $modelo->cantlibre = 1234; $modelo->setScenario('modificacantidad'); $modelo->save(); echo " ES " . $modelo->codart; yii::app()->end(); //$modelo->Actualizar($movimiento,$cantidad,$unidad,$punitario=null); $mensaje = $modelo->Actualizar('80', 0.03, '140', null); //echo " El almacen : ".$modelo->desolpe_alinventario->codalm." \n"; if (strlen($mensaje) == 0) { echo " cantidad libre : " . $modelo->cantlibre . " \n"; echo " cantidad libre : " . $modelo->cantlibre . " \n"; echo " cantidad reservada : " . $modelo->cantres . " \n"; echo " cantidad transito : " . $modelo->canttran . " \n"; echo " precio unitario : " . $modelo->punit . " \n"; echo " cantidad movida : " . $modelo->cantidadmovida . " \n"; echo " monto movido : " . $modelo->montomovido . " \n"; // echo " La conversion : ".Alconversiones::model()->convierte($modelo->codart,$modelo->um)." \n"; //echo " catidad reservada : ".$modelo->desolpe_alinventario->cantres." \n"; } else { echo " " . $mensaje; } yii::app()->end(); }
public function actionAjaxObtenerInventarioProducto() { $idProducto = $_POST['idProducto']; $inventario = Inventario::model()->ObtenerInventarioProducto($idProducto); Util::renderJSON($inventario); }
<?php require_once "Ficha.php"; $ficha = new Inventario(); $ficha->mostrarFicha('MOUSE LASER', false);
public function actiongestionafotos() { $this->layout = '//layouts/iframe'; $fotos = $_GET['fotos']; /*print_r($fotos); Yii::app()->end();*/ //verificando que ningun travieso meta la mato en el URL colocando referfncias a fotos que //que no coresponde, (que nos epasen de vivos) ; $nuevo = array(); foreach ($fotos as $foto) { if (strpos($foto, "_") === false) { $codigosap = $foto; } else { $codigosap = substr($foto, 0, strpos($foto, "_")); } $arraymodelo = Inventario::model()->findAll("codigosap='" . $codigosap . "'"); if (count($arraymodelo) > 0) { array_push($nuevo, $foto); } } $modelo = Inventario::model()->find("codigosap='" . $codigosap . "'"); $this->render("vw_galeria", array("fotos" => $nuevo, "modelo" => $modelo)); //$myfile = Yii::app()->file->set(Yii::app()->params['rutafotosinventario'].$nombreimagen, true); //return $myfile->delete(); }
$inv->Entrada = $i->Existencia; $inv->Existencia = $i->Existencia; $inv->DescuentoUfi = $i->DescuentoUfi; $inv->DescuentoEmpaque = $i->DescuentoEmpaque; $inv->UnidadEmpaque = $i->UnidadEmpaque; $inv->DescuentoComercial = $i->DescuentoComercial; $inv->DescuentoProntoPago = $i->DescuentoProntoPago; $inv->Lote = $i->Lote; $inv->Vencimiento = $i->Vencimiento; $inv->UnidadManejo = $i->UnidadManejo; $inv->FechaVenta = Fecha::arreglarFecha2(Fecha::fechaActual()); $inv->save(); $inv->productos()->attach($produ->id); echo "Guardado inventario con codigo: " . $i->Codigo . "<br>"; } else { $inv = Inventario::find($inve->id); $inv->user_id = 1; $inv->Codigo = $i->Codigo; $inv->CodigoBarra = $i->CodigoBarra; $inv->Precio = $i->Precio; $inv->Descuento = $i->Descuento; $inv->Entrada = $i->Existencia; $inv->Existencia = $i->Existencia; $inv->DescuentoUfi = $i->DescuentoUfi; $inv->DescuentoEmpaque = $i->DescuentoEmpaque; $inv->UnidadEmpaque = $i->UnidadEmpaque; $inv->DescuentoComercial = $i->DescuentoComercial; $inv->DescuentoProntoPago = $i->DescuentoProntoPago; $inv->Lote = $i->Lote; $inv->Vencimiento = $i->Vencimiento; $inv->UnidadManejo = $i->UnidadManejo;
<?php include "IncluirClases.php"; //si hace click sobre un registro llene el form modal con datos if (isset($_GET['id'])) { $id = $_GET['id']; } //si hizo click en el envio if (isset($_POST['submit'])) { //captura de datos $idProveedor = $_POST['proveedor']; $idIngrediente = $_POST['ingrediente']; $cantidad = $_POST['cantidad']; //instancia de la identidad $InventarioE = new Inventario(); $InventarioE->setId($id); $InventarioE->setIngrediente($idIngrediente); $InventarioE->setProveedor($idProveedor); $InventarioE->setCantidad($cantidad); //$_SESSION['v']=$cantidad; //Actualiza los datos del inventario $inventarioBLL = new InventarioBLL(); $inventarioBLL->Agregar($InventarioE); if ($inventarioBLL->getHayError()) { $_SESSION['registrado'] = 'f1'; } else { $_SESSION['registrado'] = 't'; } //sea cual sea el caso lo retorna a mantenimientos header("location:../Mantenimiento_Inventario.php"); }