Beispiel #1
0
        private void Frm_ViewPDFs_Load(object sender, EventArgs e)
        {
            CLS_Entradas sel = new CLS_Entradas();

            sel.Folio_Entrada = Id_Entrada;
            sel.Serie_Entrada = serie;
            sel.MtdSeleccionarEntradaPDF();
            if (sel.Exito)
            {
                if (sel.Datos.Rows.Count > 0 && sel.Datos.Rows[0]["FacturaPDF"] != null)
                {
                    byte[] bytes = (byte[])sel.Datos.Rows[0]["FacturaPDF"];

                    System.IO.File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ViewPDF.pdf", bytes);
                    this.pdfViewer1.LoadDocument(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ViewPDF.pdf");
                }
            }
            else
            {
                if (ruta.Length > 0)
                {
                    this.pdfViewer1.LoadDocument(ruta);
                }
            }
        }
Beispiel #2
0
        private void CargarEntrada()
        {
            BloquearObjetos(false);
            CLS_Entradas sel = new CLS_Entradas();

            sel.EntradasMercanciaId = Convert.ToInt32(txtFolio.Text);
            sel.SucursalesId        = v_Sucursalnum;
            sel.MtdSeleccionarEntradaEncabezado();
            if (sel.Exito)
            {
                if (sel.Datos.Rows.Count > 0)
                {
                    CargarTipoEntradas(Convert.ToInt32(sel.Datos.Rows[0]["EntradaMercanciaTipoId"].ToString()));
                    dtFecha.EditValue = Convert.ToDateTime(sel.Datos.Rows[0]["EntradaMercanciaFecha"].ToString());
                    CargarSucursales(v_Sucursalnum);
                    txtResponsable.Text    = sel.Datos.Rows[0]["UsuariosNombre"].ToString();
                    txtTotalArticulos.Text = sel.Datos.Rows[0]["EntradaMercanciaUnidades"].ToString();
                    txtSubtotal0.Text      = sel.Datos.Rows[0]["EntradaMercanciaSub0"].ToString();
                    txtSubTotal16.Text     = sel.Datos.Rows[0]["EntradaMercanciaSub16"].ToString();
                    txtTotal.Text          = sel.Datos.Rows[0]["EntradaMercanciaTotal"].ToString();
                    txtObservaciones.Text  = sel.Datos.Rows[0]["Observaciones"].ToString();
                    txtReferencias.Text    = sel.Datos.Rows[0]["Referencias"].ToString();
                    CargarEntradaDetalles();
                }
            }
        }
Beispiel #3
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            DateTime     FInicio = Convert.ToDateTime(dtInicio.EditValue.ToString());
            DateTime     FFin    = Convert.ToDateTime(dtFin.EditValue.ToString());
            CLS_Entradas sel     = new CLS_Entradas();

            if (txtEntradaFolio.Text != string.Empty)
            {
                sel.EntradasMercanciaId = Convert.ToInt32(txtEntradaFolio.Text);
            }
            else
            {
                sel.EntradasMercanciaId = null;
            }
            sel.Registros   = Convert.ToInt32(cmbRegistros.EditValue.ToString());
            sel.FechaInicio = string.Format("{0}{1}{2} 00:00:00", FInicio.Year, DosCeros(FInicio.Month.ToString()), DosCeros(FInicio.Day.ToString()));
            sel.FechaFin    = string.Format("{0}{1}{2} 23:59:59", FFin.Year, DosCeros(FFin.Month.ToString()), DosCeros(FFin.Day.ToString()));
            sel.MtdSeleccionarEntradaBuscar();
            if (sel.Exito)
            {
                if (sel.Datos.Rows.Count > 0)
                {
                    dtgEntradas.DataSource = sel.Datos;
                }
            }
        }
Beispiel #4
0
        private void CargarExistencia()
        {
            CLS_Entradas sel = new CLS_Entradas();

            sel.MtdSeleccionarEntradaExistencia();
            if (sel.Exito)
            {
                dtgExistencia.DataSource = sel.Datos;
            }
        }
Beispiel #5
0
        private void CargarEntradas()
        {
            gridControl1.DataSource = null;
            CLS_Entradas Clase = new CLS_Entradas();

            Clase.MtdSeleccionarEntradaEncabezado();
            if (Clase.Exito)
            {
                gridControl1.DataSource = Clase.Datos;
            }
        }
Beispiel #6
0
        private void CargarTipoEntradas(int?Valor)
        {
            CLS_Entradas conTEntrada = new CLS_Entradas();

            conTEntrada.MtdSeleccionarTipoEntrada();
            if (conTEntrada.Exito)
            {
                cboTipoMovimiento.Properties.DisplayMember = "TipoDescripcion";
                cboTipoMovimiento.Properties.ValueMember   = "TipoId";
                cboTipoMovimiento.EditValue             = Valor;
                cboTipoMovimiento.Properties.DataSource = conTEntrada.Datos;
            }
        }
Beispiel #7
0
        private void CargarEntradasDetalles()
        {
            dtgEntradas.DataSource = null;
            CLS_Entradas Clase = new CLS_Entradas();

            Clase.Folio_Entrada = txtFolio.Text;
            Clase.Serie_Entrada = cboSerie.EditValue.ToString();
            Clase.MtdSeleccionarEntradaDetalles();
            if (Clase.Exito)
            {
                dtgEntradas.DataSource = Clase.Datos;
            }
        }
Beispiel #8
0
        private void CargarEntradaDetalles()
        {
            CLS_Entradas selart = new CLS_Entradas();

            selart.EntradasMercanciaId = Convert.ToInt32(txtFolio.Text);
            selart.SucursalesId        = v_Sucursalnum;
            selart.MtdSeleccionarEntradaDetalles();
            if (selart.Exito)
            {
                if (selart.Datos.Rows.Count > 0)
                {
                    dtgArticulosEntrada.DataSource = selart.Datos;
                }
            }
        }
Beispiel #9
0
        private void CargarResponsable(string vUsuariosLogin)
        {
            CLS_Entradas sel = new CLS_Entradas();

            sel.UsuariosLogin = vUsuariosLogin;
            sel.MtdSeleccionarResponsable();
            if (sel.Exito)
            {
                if (sel.Datos.Rows.Count > 0)
                {
                    txtResponsable.Text = sel.Datos.Rows[0]["UsuariosNombre"].ToString();
                    txtResponsable.Tag  = sel.Datos.Rows[0]["UsuariosId"].ToString();
                }
            }
        }
Beispiel #10
0
        private Boolean AfectarEntradaDetalle(string Serie_Entrada, string Folio_Entrada, string Id_Producto, int Cantidad_EntradaDetalles)
        {
            CLS_Entradas Clase = new CLS_Entradas();

            Clase.Serie_Entrada            = Serie_Entrada;
            Clase.Folio_Entrada            = Folio_Entrada;
            Clase.Id_Producto              = Id_Producto;
            Clase.Cantidad_EntradaDetalles = Cantidad_EntradaDetalles;
            Clase.MtdAfectarInventario();
            if (Clase.Exito)
            {
                return(true);
            }
            else
            {
                XtraMessageBox.Show(Clase.Mensaje);
                return(false);
            }
        }
Beispiel #11
0
        private Boolean GuardarEntradaDetalle(string Serie_Entrada, string Folio_Entrada, int Registro_EntradaDetalles, string Id_Producto, string Nombre_Producto, string Nombre_UnidadMedida, int Cantidad_EntradaDetalles, decimal Precio_EntradaDetalles, decimal Total_EntradaDetalles, string Observaciones_EntradaDetalles, string Lote, string Fecha_Caducidad)
        {
            CLS_Entradas Clase = new CLS_Entradas();

            Clase.Serie_Entrada            = Serie_Entrada;
            Clase.Folio_Entrada            = Folio_Entrada;
            Clase.Registro_EntradaDetalles = Registro_EntradaDetalles;
            Clase.Id_Producto                   = Id_Producto;
            Clase.Nombre_Producto               = Nombre_Producto;
            Clase.Nombre_UnidadMedida           = Nombre_UnidadMedida;
            Clase.Cantidad_EntradaDetalles      = Cantidad_EntradaDetalles;
            Clase.Precio_EntradaDetalles        = Precio_EntradaDetalles;
            Clase.Total_EntradaDetalles         = Total_EntradaDetalles;
            Clase.Observaciones_EntradaDetalles = Observaciones_EntradaDetalles;
            Clase.Lote = Lote;

            string tempf = Fecha_Caducidad;

            if (Fecha_Caducidad.Length > 0)
            {
                DateTime Fecha = Convert.ToDateTime(Fecha_Caducidad.Trim());
                Clase.Fecha_Caducidad = Fecha.Year.ToString() + DosCero(Fecha.Month.ToString()) + DosCero(Fecha.Day.ToString());
            }
            else
            {
                Clase.Fecha_Caducidad = string.Empty;
            }

            Clase.MtdInsertarEntradaDetalles();
            if (Clase.Exito)
            {
                return(true);
            }
            else
            {
                XtraMessageBox.Show(Clase.Mensaje);
                return(false);
            }
        }
Beispiel #12
0
        private void Frm_BusqEntradas_Load(object sender, EventArgs e)
        {
            CLS_Entradas sel = new CLS_Entradas();

            sel.MtdSeleccionarEntradas();
            if (sel.Exito)
            {
                dtgRutas.DataSource = sel.Datos;
            }
            else
            {
                XtraMessageBox.Show(sel.Mensaje);
            }

            try
            {
                foreach (int i in this.dtgValRutas.GetSelectedRows())
                {
                    DataRow row = this.dtgValRutas.GetDataRow(i);
                    vId_Entrada      = row["Id_Entrada"].ToString();
                    vId_Salida       = row["Id_Salida"].ToString();
                    vFecha_Entrada   = row["Fecha_Entrada"].ToString();
                    vFecha_Cruce     = row["Fecha_Cruce"].ToString();
                    vId_Activo_P     = row["Id_Activo_P"].ToString();
                    vNombre_Activo_P = row["Nombre_Activo_P"].ToString();
                    vId_Activo_1     = row["Id_Activo_1"].ToString();
                    vNombre_Activo_1 = row["Nombre_Activo_1"].ToString();
                    vId_Activo_2     = row["Id_Activo_2"].ToString();
                    vNombre_Activo_2 = row["Nombre_Activo_2"].ToString();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
Beispiel #13
0
        private void GuardarEntrada()
        {
            CLS_Entradas ins = new CLS_Entradas();

            ins.SucursalesId             = Convert.ToInt32(cboSucursales.EditValue.ToString());
            ins.UsuariosId               = Convert.ToInt32(txtResponsable.Tag.ToString());
            ins.EntradaMercanciaTipoId   = Convert.ToInt32(cboTipoMovimiento.EditValue.ToString());
            ins.EntradaMercanciaUnidades = Convert.ToInt32(txtCantidad.Text);
            ins.EntradaMercanciaSub0     = Convert.ToDecimal(txtSubtotal0.Text);
            ins.EntradaMercanciaSub16    = Convert.ToDecimal(txtSubTotal16.Text);
            decimal vIva = Convert.ToDecimal(txtTotal.Text) - (Convert.ToDecimal(txtSubtotal0.Text) + Convert.ToDecimal(txtSubTotal16.Text));

            ins.EntradaMercanciaIva   = vIva;
            ins.EntradaMercanciaTotal = Convert.ToDecimal(txtTotal.Text);
            ins.Observaciones         = txtObservaciones.Text;
            ins.Referencias           = txtReferencias.Text;
            ins.MtdInsertarEntrada();
            if (ins.Exito)
            {
                if (ins.Datos.Rows.Count > 0)
                {
                    txtFolio.Text = ins.Datos.Rows[0]["EntradaMercanciaId"].ToString();
                    for (int i = 0; i < dtgValArticuloEntrada.RowCount; i++)
                    {
                        int xRow = dtgValArticuloEntrada.GetVisibleRowHandle(i);
                        //Inserta Detalles
                        CLS_Entradas det = new CLS_Entradas();
                        det.EntradasMercanciaId = Convert.ToInt32(ins.Datos.Rows[0]["EntradaMercanciaId"].ToString());
                        det.SucursalesId        = Convert.ToInt32(cboSucursales.EditValue.ToString());
                        det.ArticuloCodigo      = dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCodigo"]).ToString();
                        det.EntradasMercanciaArticuloUltimoIde = Convert.ToInt32(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["Numero"]).ToString());
                        det.EntradasMercanciaArticuloCantidad  = Convert.ToInt32(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCantidad"]).ToString());
                        decimal ArticuloSub0 = 0;
                        decimal.TryParse(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloSub0"]).ToString(), style, culture, out ArticuloSub0);
                        det.EntradasMercanciaArticuloSub0 = ArticuloSub0;
                        decimal ArticuloSub16 = 0;
                        decimal.TryParse(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloSub16"]).ToString(), style, culture, out ArticuloSub16);
                        det.EntradasMercanciaArticuloSub16 = ArticuloSub16;
                        decimal ArticuloTotal = 0;
                        decimal.TryParse(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloTotal"]).ToString(), style, culture, out ArticuloTotal);
                        det.EntradasMercanciaArticuloTotal = ArticuloTotal;
                        det.EntradasMercanciaArticuloIva   = ArticuloTotal - (ArticuloSub0 + ArticuloSub16);
                        det.MtdInsertarEntradaDetalles();
                        //inserta Costeo
                        CLS_Entradas cos = new CLS_Entradas();
                        cos.EntradasMercanciaId = Convert.ToInt32(ins.Datos.Rows[0]["EntradaMercanciaId"].ToString());
                        cos.ArticuloCodigo      = dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCodigo"]).ToString();
                        cos.EntradasMercanciaArticuloUltimoIde = Convert.ToInt32(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["Numero"]).ToString());
                        cos.EntradasMercanciaArticuloCantidad  = Convert.ToInt32(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCantidad"]).ToString());
                        decimal ArticuloCosto = 0;
                        decimal.TryParse(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCosto"]).ToString(), style, culture, out ArticuloCosto);
                        cos.ArticuloCostoReposicion = ArticuloCosto;
                        decimal ArticuloCostoAdquisicion = 0;
                        decimal.TryParse(dtgValArticuloEntrada.GetRowCellValue(xRow, dtgValArticuloEntrada.Columns["ArticuloCostoAdquisicion"]).ToString(), style, culture, out ArticuloCostoAdquisicion);
                        cos.ArticuloCostoAdquisicion = ArticuloCostoAdquisicion;
                        cos.MtdInsertarEntradaCosteo();
                    }
                    XtraMessageBox.Show("Se ha guardado la Entrada con Exito");
                }
            }
        }
Beispiel #14
0
        private Boolean GuardarEntrada()
        {
            CLS_Entradas Clase = new CLS_Entradas();

            Clase.Folio_Entrada  = txtFolio.Text.Trim();
            Clase.Serie_Entrada  = cboSerie.EditValue.ToString().Trim();
            Clase.Id_Proveedor   = txtNombreProveedor.Tag.ToString().Trim();
            Clase.Id_TipoEntrada = cboTipoEntrada.EditValue.ToString().Trim();
            DateTime Fecha = Convert.ToDateTime(dtFecha.Text.Trim());

            Clase.Fecha_Entrada           = Fecha.Year.ToString() + DosCero(Fecha.Month.ToString()) + DosCero(Fecha.Day.ToString());
            Clase.Numero_ArticulosEntrada = SumarCantidadArticulos();
            Clase.Orden_Compra            = textOrdenCompra.Text;
            Clase.FacturaPDFNombre        = textNomFactura.Text;

            Byte[] ArchivoPDF = null;


            FileStream fsPDF = null;


            Boolean noentroPDF = true;

            if (RutaPDF.Length > 0)
            {
                //txtNombreArchivoPDF.Text = result2;
                //string ar = OpenDialog.FileName;
                fsPDF = new FileStream(RutaPDF, FileMode.Open, FileAccess.Read);
                //Creamos un array de bytes para almacenar los datos leídos por fs.
                ArchivoPDF = new byte[fsPDF.Length];
                //Y guardamos los datos en el array data
                fsPDF.Read(ArchivoPDF, 0, (int)fsPDF.Length);
            }
            else
            {
                ArchivoPDF = ArchivoPDFGlobal;
                noentroPDF = false;
            }
            if (ArchivoPDF != null)
            {
                Clase.FacturaPDF = ArchivoPDF;
            }
            else
            {
                Clase.FacturaPDF = Encoding.UTF8.GetBytes("");
            }
            Clase.Id_Empleado = textEmpleado.Tag.ToString();
            Clase.Usuario     = UsuariosLogin.Trim();
            Clase.MtdInsertarEntradaEncabezado();
            if (Clase.Exito)
            {
                progressBarControl1.Properties.Maximum = dtgValEntradas.RowCount;
                txtFolio.Text  = Clase.Datos.Rows[0][0].ToString();
                lblStatus.Text = "Guardando Entrada";
                for (int x = 0; x < dtgValEntradas.RowCount; x++)
                {
                    Application.DoEvents();
                    int xRow = dtgValEntradas.GetVisibleRowHandle(x);
                    if (GuardarEntradaDetalle(
                            cboSerie.EditValue.ToString().Trim(),
                            txtFolio.Text,
                            Convert.ToInt32(dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Registro_EntradaDetalles"])),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Id_Producto"]).ToString(),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Nombre_Producto"]).ToString(),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Nombre_UnidadMedida"]).ToString(),
                            Convert.ToInt32(dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Cantidad_EntradaDetalles"])),
                            Convert.ToDecimal(dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Precio_EntradaDetalles"])),
                            Convert.ToDecimal(dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Total_EntradaDetalles"])),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Observaciones_EntradaDetalles"]).ToString(),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Lote"]).ToString(),
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Fecha_Caducidad"]).ToString()
                            ))
                    {
                        progressBarControl1.Position = x + 1;
                        dtgValEntradas.SetRowCellValue(xRow, dtgValEntradas.Columns["Guardado"], true);
                    }
                    else
                    {
                        lblStatus.Text = "Problema al intentar guardar el producto: " + dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Id_Producto"]).ToString();
                        return(false);
                    }
                }

                progressBarControl1.Position           = 0;
                progressBarControl1.Properties.Maximum = dtgValEntradas.RowCount;
                lblStatus.Text = "Afectando Inventario";
                for (int x = 0; x < dtgValEntradas.RowCount; x++)
                {
                    Application.DoEvents();
                    int xRow = dtgValEntradas.GetVisibleRowHandle(x);
                    if (AfectarEntradaDetalle(
                            cboSerie.EditValue.ToString().Trim(),
                            txtFolio.Text,
                            dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Id_Producto"]).ToString(),
                            Convert.ToInt32(dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Cantidad_EntradaDetalles"]))
                            ))
                    {
                        progressBarControl1.Position = x + 1;
                        dtgValEntradas.SetRowCellValue(xRow, dtgValEntradas.Columns["AplicadoInventario"], true);
                    }
                    else
                    {
                        lblStatus.Text = "Problema al afectar inventario en el producto: " + dtgValEntradas.GetRowCellValue(xRow, dtgValEntradas.Columns["Id_Producto"]).ToString() + " . Intente realizar el proceso de forma manual";
                        return(false);
                    }
                }


                XtraMessageBox.Show("Se ha Insertado el registro con exito");
                LimpiarCampos();
                return(true);
            }
            else
            {
                XtraMessageBox.Show(Clase.Mensaje);
                return(false);
            }
            if (noentroPDF)
            {
                fsPDF.Close();
            }
        }