Example #1
0
        /// <summary>
        /// Funcion que guarda los datos auxiliares del documento
        /// </summary>
        /// <param name="cn"></param>
        /// <param name="tr"></param>
        internal void GuardaDatosAux(ref MySqlConnection cn, ref MySqlTransaction tr)
        {
            PRODUCTOS.Productos auxL = PRODUCTOS.Productos.ObtenInstancia();
            string sql = _SQL_LINEAS_CADO;

            sql = sql.Replace("[IDELEM]", (this._datos["ID_ELEM"] != DBNull.Value ? this._datos["ID_ELEM"].ToString() : "0"));
            foreach (DataRow d in this._lineas.Rows)
            {
                d["ID_ELEM_CAB"] = this._datos["ID_ELEM"];
                if (d["ID_ELEM"].ToString() == "")
                {
                    Elemento auxe = new Elemento();
                    auxe.TIPO_ELEMENTO = "LID";
                    d["ID_ELEM"]       = auxe.ObtenIDNuevoElemento(ref cn, ref tr);
                    Thread.Sleep(10);
                    if (d["ID_ELEM_PROD"].ToString() != "")
                    {
                        try {
                            Int64    idelemprod = Convert.ToInt64(d["ID_ELEM_PROD"].ToString());
                            Producto auxp       = auxL.Buscar(idelemprod);
                            if (auxp != null)
                            {
                                //auxp.datos["EXISTENCIAS_PROD"] = Convert.ToInt32((auxp.datos["EXISTENCIAS_PROD"].ToString() != "" ? auxp.datos["EXISTENCIAS_PROD"].ToString() : "0")) - Convert.ToInt32((d["CANTIDAD_LIDO"].ToString() != "" ? d["CANTIDAD_LIDO"].ToString() : "0"));
                                auxp.ActualizaStock((-1) * Convert.ToInt32((d["CANTIDAD_LIDO"].ToString() != "" ? d["CANTIDAD_LIDO"].ToString() : "0")));
                                auxp.Guardar();
                            }
                        } catch (Exception err) {
                        }
                    }
                }
            }
            auxL.Guardar(ref cn, ref tr);
            IGlobal.guardar_datos(sql, ref this._lineas, ref cn, ref tr);
        }
Example #2
0
 private void GuardarDatosMovStock(ref MySqlConnection cn, ref MySqlTransaction tr)
 {
     foreach (DataRow dr in this._DTMovStock.Rows)
     {
         if (dr.RowState == DataRowState.Added)
         {
             Elemento aux = new Elemento();
             aux.TIPO_ELEMENTO  = "MSP";
             dr["ID_ELEM"]      = aux.ObtenIDNuevoElemento(ref cn, ref tr);
             dr["ID_ELEM_PROD"] = this._datos["ID_ELEM"];
         }
     }
     IGlobal.guardar_datos(_SQL_MSPR_MOV_STOCK_PROD.Replace("[IDELEM]", this._datos["ID_ELEM"].ToString()), ref this._DTMovStock, ref cn, ref tr);
 }
Example #3
0
        internal void GuardarDatosAux(ref MySqlConnection cn, ref MySqlTransaction tr)
        {
            PRODUCTOS.Productos auxL = PRODUCTOS.Productos.ObtenInstancia();
            string sql = _SQL_LINEAS_CARE;

            sql = sql.Replace("[IDELEM]", (this._datos["ID_ELEM"] != DBNull.Value ? this._datos["ID_ELEM"].ToString() : "0"));
            foreach (DataRow d in this._lineas.Rows)
            {
                d["ID_ELEM_CARE"] = this._datos["ID_ELEM"];
                if (d["ID_ELEM"].ToString() == "")
                {
                    Elemento auxe = new Elemento();
                    auxe.TIPO_ELEMENTO = "LRS";
                    d["ID_ELEM"]       = auxe.ObtenIDNuevoElemento(ref cn, ref tr);
                    Thread.Sleep(10);
                }
            }
            IGlobal.guardar_datos(sql, ref this._lineas, ref cn, ref tr);
        }
Example #4
0
        private void GuardaDatosPrecio(ref MySqlConnection cn, ref MySqlTransaction tr)
        {
            foreach (DataRow dr in this._DTPrecios.Rows)
            {
                dr["VIGENTE_PRECIO"] = "N";
            }
            Elemento aux = new Elemento();

            aux.TIPO_ELEMENTO = "PRE";
            DataRow nprecio = this._DTPrecios.NewRow();

            nprecio["ID_ELEM_PROD"]   = this._datos["ID_ELEM"];
            nprecio["ID_ELEM"]        = aux.ObtenIDNuevoElemento(ref cn, ref tr);
            nprecio["VIGENTE_PRECIO"] = "S";
            nprecio["PRECIO_COMPRA"]  = this._precio["PRECIO_COMPRA"];
            nprecio["PRECIO_BRUTO"]   = this._precio["PRECIO_BRUTO"];
            nprecio["COD_TIVA"]       = this._precio["COD_TIVA"];
            nprecio["PORC_IVA"]       = this._precio["PORC_IVA"];
            nprecio["PRECIO_VENTA"]   = this._precio["PRECIO_VENTA"];
            this._DTPrecios.Rows.Add(nprecio);
            IGlobal.guardar_datos(_SQL_PRPR_PRECIOS_PRODUCTO.Replace("[IDELEM]", this._datos["ID_ELEM"].ToString()), ref this._DTPrecios, ref cn, ref tr);
        }