コード例 #1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string          strListZonas     = Cadenas.ListToString(this.chkListProductos.CheckedItems, "");
            string          strListProductos = Cadenas.ListToString(this.chkListZonas.CheckedItems, "");
            BEFiltroTablero filtro           = new BEFiltroTablero();
            DSRptTablero    oDSRptTablero    = new DSRptTablero();

            filtro.strListZonas     = strListZonas;
            filtro.strListProductos = strListProductos;

            filtro.dtFechaInicio = this.dtpFechaInicial.Value.Date;
            filtro.dtFechaFinal  = this.dtpFechaFinal.Value.Date;

            oDSRptTablero = new BLVenta().ReporteHojaTablero(filtro);

            CRptHojaTablero oCRptReporteTablero = new CRptHojaTablero();

            oCRptReporteTablero.Refresh();
            oCRptReporteTablero.SetDataSource(oDSRptTablero);
            oCRptReporteTablero.SetParameterValue("fecha", DateTime.Now.Date);
            frmReporteViewer ofrmReporteViewer = new frmReporteViewer(oCRptReporteTablero);

            ofrmReporteViewer.MdiParent = this.ParentForm;
            ofrmReporteViewer.Visible   = true;
            ofrmReporteViewer.Show();
        }
コード例 #2
0
        private void btnAplicar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Se modificaran los precios. Desea Continuar?", "Modificar Precios", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }
                List <int> ListaClientes = new List <int>();

                foreach (DataGridViewRow item in this.dgrvVentas.Rows)
                {
                    if (item.Cells["idVenta"].Value == null || item.Cells["NuevoPrecio"].Value == null)
                    {
                        continue;
                    }
                    ////obtenemos los Id de los clientes a los q se les ha modificado el precio
                    int tmpIdCliente = (item.Cells["IdCliente"].Value == null) ? 0 : int.Parse(item.Cells["IdCliente"].Value.ToString());
                    if (!ListaClientes.Exists(t => t == tmpIdCliente))
                    {
                        ListaClientes.Add(tmpIdCliente);
                    }
                    bool    bok = false;
                    int     idVenta;
                    decimal precio;
                    bok = int.TryParse(item.Cells["idVenta"].Value.ToString(), out idVenta);
                    if (!bok)
                    {
                        continue;
                    }
                    bok = decimal.TryParse(item.Cells["NuevoPrecio"].Value.ToString(), out precio);
                    if (!bok)
                    {
                        continue;
                    }

                    BLVenta blVenta = new BLVenta();
                    blVenta.ActualizarPrecio(idVenta, precio);
                    // List<BEVenta> listaVenta = blVenta.ListarVenta(idVenta, 0);
                }
                foreach (var item in ListaClientes)
                {
                    if (item == 0)
                    {
                        continue;
                    }
                    new BLAmortizacionVenta().ReaplicarAmortizacion(new BEVenta()
                    {
                        IdCliente = item, BEUsuarioLogin = VariablesSession.BEUsuarioSession
                    });
                }


                CargarGrilla();
            }
            catch (Exception ex)
            {
                this.MostrarMensaje(ex.Message, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string          strListZonas     = Cadenas.ListToString(this.chkListProductos.CheckedItems, "");
            string          strListProductos = Cadenas.ListToString(this.chkListZonas.CheckedItems, "");
            BEFiltroTablero filtro           = new BEFiltroTablero();
            DSRptTablero    oDSRptTablero    = new DSRptTablero();

            filtro.strListZonas     = strListZonas;
            filtro.strListProductos = strListProductos;

            filtro.dtFechaInicio = this.dtpFechaInicial.Value.Date;
            filtro.dtFechaFinal  = this.dtpFechaFinal.Value.Date;
            filtro.IdCaja        = VariablesSession.BEUsuarioSession.IdCaja;
            filtro.IdModoReporte = this.chkResumido.Checked.GetHashCode();
            oDSRptTablero        = new BLVenta().ReporteCobranzaCobrador(filtro);

            CRRendicion oCRptReporteTablero = new CRRendicion();

            oCRptReporteTablero.Refresh();
            oCRptReporteTablero.SetDataSource(oDSRptTablero);
            //oCRptReporteTablero.SetParameterValue("fecha" ,DateTime.Now.Date );
            frmReporteViewer ofrmReporteViewer = new frmReporteViewer(oCRptReporteTablero);

            ofrmReporteViewer.MdiParent = this.ParentForm;
            ofrmReporteViewer.Visible   = true;
            ofrmReporteViewer.Show();
        }
コード例 #4
0
        private void reporteSaldosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                bool canInfoCompra = VariablesSession.Privilegios.Find(x => x.IdPrivilegio == DGP.Entities.Seguridad.BEPrivilegio.Visualizar_Precios_compra) != null;

                DSReporteCuentasPorCobrar oDSRpt = new BLVenta().ReporteSaldos();

                DGP.Entities.Reportes.CRSaldos CRSaldos = new DGP.Entities.Reportes.CRSaldos();

                CRSaldos.Refresh();
                CRSaldos.SetDataSource(oDSRpt);
                //CRSaldos.ReportSource = oCRptEstadoCuentaCliente;
                //this.CRptEstadoCuentaCliente.Refresh();


                frmReporteViewer formulario = new frmReporteViewer(CRSaldos);
                formulario.MdiParent = this;
                formulario.Show();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #5
0
ファイル: frmAmortizacion.cs プロジェクト: carlosaban/DGP
        private void CargarProductoCliente(int pIdCliente)
        {
            List <BEProducto> vLista = new List <BEProducto>();

            vLista = new BLVenta().ListarProductoCliente(pIdCliente);
            vLista.Insert(0, new BEProducto(0, "Todos"));
            cbProducto.DataSource    = vLista;
            cbProducto.DisplayMember = "Nombre";
            cbProducto.ValueMember   = "IdProducto";
        }
コード例 #6
0
        private void CargarReporteCobranza()
        {
            DSReporteCuentasPorCobrar oDSHojaCobranza = new DSReporteCuentasPorCobrar();

            oDSHojaCobranza = new BLVenta().ReporteHojaCobranzaV2();
            CRHojaCobranzaV2 oCRHojaCobranza = new CRHojaCobranzaV2();

            oCRHojaCobranza.Refresh();
            oCRHojaCobranza.SetDataSource(oDSHojaCobranza);

            crvCobranza.ReportSource = oCRHojaCobranza;
            crvCobranza.RefreshReport();
        }
コード例 #7
0
        private void CargarReporteCobranza()
        {
            DSHojaCobranza oDSHojaCobranza = new DSHojaCobranza();
            VistaVenta     oEntidad        = new VistaVenta();

            oEntidad.Fecha  = DateTime.MinValue;
            oDSHojaCobranza = new BLVenta().ReporteCobranza(oEntidad);
            CRHojaCobranza oCRHojaCobranza = new CRHojaCobranza();

            oCRHojaCobranza.Refresh();
            oCRHojaCobranza.SetDataSource(oDSHojaCobranza);
            crvCobranza.ReportSource = oCRHojaCobranza;
            crvCobranza.RefreshReport();
        }
コード例 #8
0
        private void CargarVentaCliente(bool pValor, int pIdCliente)
        {
            List <BEVenta> vLista = new List <BEVenta>();

            if (pValor)
            {
                BEVenta oBEVenta = new BEVenta();
                oBEVenta.IdCliente = pIdCliente;
                oBEVenta.IdCaja    = VariablesSession.BEUsuarioSession.IdCaja;
                vLista             = new BLVenta().ListarVentaCliente(oBEVenta);
            }
            vLista.Insert(0, new BEVenta(-1, (vLista.Count == 0) ? string.Empty : "----Seleccione----"));
            cbVenta.DataSource    = vLista;
            cbVenta.DisplayMember = "NombreVenta";
            cbVenta.ValueMember   = "IdVenta";
        }
コード例 #9
0
 private void cbVenta_SelectedIndexChanged(object sender, EventArgs e)
 {
     try {
         // Validar si eligio una Ventas
         if (cbVenta.SelectedIndex > 0)
         {
             int.TryParse(cbVenta.SelectedValue.ToString(), out vg_intIdVenta);
             // Obtener datos de la Venta
             BEVenta oBEVenta = new BLVenta().ObtenerVenta(vg_intIdVenta);
             if (oBEVenta != null)
             {
                 BEProductoCliente oBEProductoCliente = new BEProductoCliente();
                 oBEProductoCliente.IdCliente  = oBEVenta.IdCliente;
                 oBEProductoCliente.IdProducto = oBEVenta.IdProducto;
                 vg_decTara = new BLProductoCliente().ObtenerTara(oBEProductoCliente);
                 // Establecer los datos
                 vg_intIdProducto   = oBEVenta.IdProducto;
                 lblProducto.Text   = oBEVenta.Producto;
                 lblPrecio.Text     = oBEVenta.Precio.ToString("#.00");;
                 lblTotalBruto.Text = oBEVenta.TotalPesoBruto.ToString();
                 lblTotalTara.Text  = oBEVenta.TotalPesoTara.ToString();
                 lblTotalNeto.Text  = oBEVenta.TotalPesoNeto.ToString();
                 DGP_Util.LiberarGridView(dgrvDevolucion);
                 DGP_Util.EnableControl(dgrvDevolucion, true);
                 dgrvDevolucion.AllowUserToAddRows = true;
                 DGP_Util.EnableControl(btnAceptarDevolucion, true);
             }
         }
         else
         {
             vg_decTara       = decimal.Zero;
             vg_intIdVenta    = int.MinValue;
             vg_intIdProducto = int.MinValue;
             lblProducto.ResetText();
             lblPrecio.ResetText();
             lblTotalBruto.ResetText();
             lblTotalTara.ResetText();
             lblTotalNeto.ResetText();
             DGP_Util.EnableControl(dgrvDevolucion, false);
             dgrvDevolucion.AllowUserToAddRows = false;
             DGP_Util.LiberarGridView(dgrvDevolucion);
             DGP_Util.EnableControl(btnAceptarDevolucion, false);
         }
     } catch (Exception ex) {
         MostrarMensaje(ex.Message, MessageBoxIcon.Error);
     }
 }
コード例 #10
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                bool          canInfoCompra  = VariablesSession.Privilegios.Find(x => x.IdPrivilegio == DGP.Entities.Seguridad.BEPrivilegio.Visualizar_Precios_compra) != null;
                DSRptClientes oDSRptClientes = new BLVenta().ReporteEstadoCuentaCliente(dtpFechaInicial.Value.Date, getClientesList(this.lbClientes), canInfoCompra);

                DGP.Entities.Reportes.CRptEstadoCuentaCliente oCRptEstadoCuentaCliente = new DGP.Entities.Reportes.CRptEstadoCuentaCliente();
                oCRptEstadoCuentaCliente.Refresh();
                oCRptEstadoCuentaCliente.SetDataSource(oDSRptClientes);
                this.CRptEstadoCuentaCliente.ReportSource = oCRptEstadoCuentaCliente;
                this.CRptEstadoCuentaCliente.Refresh();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #11
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                //lbClientes.Items.to

                // bool canInfoCompra = VariablesSession.Privilegios.Find(x => x.IdPrivilegio == DGP.Entities.Seguridad.BEPrivilegio.Visualizar_Precios_compra)!= null;
                DSRptClientes oDSRptClientes = new BLVenta().ReporteListaProveedor(dtpFechaInicial.Value.Date, dtpFechaFinal.Value.Date);

                DGP.Entities.Reportes.CRptHojaPreciosProveedor oCRptHojaPreciosProveedor = new DGP.Entities.Reportes.CRptHojaPreciosProveedor();
                oCRptHojaPreciosProveedor.Refresh();
                oCRptHojaPreciosProveedor.SetDataSource(oDSRptClientes);
                this.CRpt.ReportSource = oCRptHojaPreciosProveedor;
                this.CRpt.Refresh();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #12
0
 private void btnAceptarDevolucion_Click(object sender, EventArgs e)
 {
     try {
         BEVenta oBEVenta     = ObtenerVentaFormulario();
         int     intResultado = 0;
         intResultado = new BLVenta().RegistrarVentaDevolucionDependiente(oBEVenta);
         if (intResultado == 2)
         {
             MostrarMensaje("Se registro la amortización correctamente", MessageBoxIcon.Exclamation);
             ResetearFormulario();
             InicializarFormulario();
         }
         else
         {
             MostrarMensaje("No se pudo registrar la amortización, intentelo de nuevo", MessageBoxIcon.Exclamation);
         }
     } catch (Exception ex) {
         MostrarMensaje(ex.Message, MessageBoxIcon.Error);
     }
 }
コード例 #13
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                //lbClientes.Items.to

                DSRptClientes oDSRptClientes = new BLVenta().ReporteEstadoCuentaCliente(dtpFechaInicial.Value.Date, getClientesList(this.lbClientes));
                //this.MostrarMensaje(getClientesList(this.lbClientes), MessageBoxIcon.Information);

                DGP.Entities.Reportes.CRptEstadoCuentaCliente oCRptEstadoCuentaCliente = new DGP.Entities.Reportes.CRptEstadoCuentaCliente();
                oCRptEstadoCuentaCliente.Refresh();
                oCRptEstadoCuentaCliente.SetDataSource(oDSRptClientes);
                this.CRptEstadoCuentaCliente.ReportSource = oCRptEstadoCuentaCliente;
                this.CRptEstadoCuentaCliente.Refresh();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #14
0
ファイル: FormVentas.cs プロジェクト: jpinell/Ventas2019
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            // OBTENEMOS LOS DATOS PARA GUARDARLOS EN LA TABLA COMPRAS
            ENTVenta venta = new ENTVenta
            {
                Fecha     = FechaDateTimePicker.Value,
                NoFactura = FacturaTextBox.Text
            };

            using (TransactionScope scope = new TransactionScope())
            {
                //INSERTA LA COMPRA Y RETORNA EL ID
                try
                {
                    IDVenta = BLVenta.InsertVentasGetIDVenta(venta);
                }
                catch (SqlException ex)
                {
                    if (ex.Message.Contains("IX_Ventas"))
                    {
                        errorProvider1.SetError(FacturaTextBox, "Número de Factura ya Existe...!");
                        FacturaTextBox.Focus();
                        return;
                    }
                    errorProvider1.Clear();
                }

                //RECORRE EL DATAGRID Y LO INSERTA EN LA TABLA COMPRADETALLE
                ENTVentaDetalle Registros = new ENTVentaDetalle();

                foreach (DataGridViewRow filas in DetallesDataGridView.Rows)
                {
                    Registros.Cantidad    = float.Parse(filas.Cells["Cantidad"].Value.ToString());
                    Registros.Precio      = decimal.Parse(filas.Cells["Precio"].Value.ToString());
                    Registros.Descripcion = filas.Cells["Descripcion"].Value.ToString();
                    Registros.IDProducto  = int.Parse(filas.Cells["IDProducto"].Value.ToString());
                    Registros.IDVenta     = IDVenta;

                    misDetalles.Add(Registros);

                    BLVentaDetalle.InsertVentaDetalle(Registros);

                    //GUARDAR EN KARDEX
                    ENTKardex miKardex      = BLKardex.SelectKardexByIDProducto(Registros.IDProducto);
                    float     Existencia    = miKardex.Existencia;
                    decimal   Saldo         = miKardex.Saldo;
                    decimal   CostoPromedio = miKardex.CostoPromedio;

                    //GRABAR EN KARDEX
                    ENTKardex kardex = new ENTKardex
                    {
                        Fecha      = FechaDateTimePicker.Value,
                        Concepto   = "VE-" + IDVenta,
                        Salida     = Registros.Cantidad,
                        Existencia = Existencia - Registros.Cantidad
                    };
                    //kardex.CostoUnitario = Registros.CostoUnitario; //POR AQUI
                    kardex.Haber = Convert.ToDecimal(kardex.Salida) * CostoPromedio;
                    kardex.Saldo = Saldo - kardex.Haber;
                    try
                    {
                        kardex.CostoPromedio = kardex.Saldo / (decimal)kardex.Existencia;
                    }
                    catch (DivideByZeroException ex)
                    {
                        kardex.CostoPromedio = 0;
                    }

                    kardex.IDProducto = Registros.IDProducto;

                    BLKardex.InsertKardex(kardex);

                    ////Obtiene un último costo para agregarlo al precio del producto
                    //decimal UltimoCosto = BLKardex.GetUltimoCosto(Registros.IDProducto);

                    // ACTUALIZAR LA TABLA PRODUCTOS
                    BLProducto.UpdateCantidadVenta(kardex.Existencia, kardex.IDProducto);
                }

                scope.Complete();

                MessageBox.Show(string.Format("La venta: {0}, fue grabada de forma exitosa", IDVenta),
                                "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }