Example #1
0
        private void CantidadnumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            decimal cantidad = Convert.ToInt32(CantidadnumericUpDown.Value);
            decimal precio   = Convert.ToInt32(PrecionumericUpDown.Value);

            ImportetextBox.Text = FacturacionBLL.CalcularImporte(precio, cantidad).ToString();
        }
Example #2
0
        private void LlenarComboBox()
        {
            RepositoryBase <Factura> repositoryBase = new RepositoryBase <Factura>();

            DevueltatextBox.Text = "0";
            IDcomboBox.Items.Clear();
            CLienteIDcomboBox.Items.Clear();
            ProductoIdcomboBox.Items.Clear();


            RepositoryBase <Cliente> repositoryC = new RepositoryBase <Cliente>();

            foreach (var item in repositoryC.GetList(c => true))
            {
                CLienteIDcomboBox.Items.Add(item.ClieteID);
            }

            RepositoryBase <Producto> repositoryBaseA = new RepositoryBase <Producto>();

            foreach (var item in repositoryBaseA.GetList(c => true))
            {
                ProductoIdcomboBox.Items.Add(item.ProductoID);
            }

            foreach (var item in FacturacionBLL.GetList(x => true))
            {
                IDcomboBox.Items.Add(item.FacturaId);
            }
        }
Example #3
0
        private void EliminarDetalle_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Desea Eliminar el detalle seleccionado?", " ",
                                         MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (RowSelected >= 0)
                {
                    Monto            -= FacturacionBLL.RecalcularImporte(facturas.Detalle, RowSelected);
                    MontotextBox.Text = Monto.ToString();
                    Arreglar          = true;
                    FacturaDetalle factura = facturas.Detalle.ElementAt(RowSelected);
                    Detalle.Add(new FacturaDetalle(factura.Id, factura.FacturaId, factura.ProductoId, factura.Cantidad, factura.Precio, factura.Descripcion, factura.Importe));
                    facturas.Detalle.RemoveAt(RowSelected);
                    FacturadataGridView.DataSource = null;
                    FacturadataGridView.DataSource = facturas.Detalle;
                    RowSelected = -1;
                    if (paso)
                    {
                        AsignarDevuelta();
                    }
                    MessageBox.Show("Eliminado!");
                }
            }
        }
Example #4
0
        private void Consultabutton_Click(object sender, EventArgs e)
        {
            int id;

            switch (TipocomboBox.SelectedIndex)
            {
            //ID
            case 0:
                LimpiarError();
                if (SetError(1))
                {
                    MessageBox.Show("Introduce un numero");
                    return;
                }
                id      = int.Parse(CriteriotextBox.Text);
                filtrar = t => t.FacturaID == id && (t.Fecha.Day >= DesdedateTimePicker.Value.Day) && (t.Fecha.Month >= DesdedateTimePicker.Value.Month) && (t.Fecha.Year >= DesdedateTimePicker.Value.Year) &&
                          (t.Fecha.Day <= HastadateTimePicker.Value.Day) && (t.Fecha.Month <= HastadateTimePicker.Value.Month) && (t.Fecha.Year <= HastadateTimePicker.Value.Year);
                break;


            //Listar Todo
            case 1:
                filtrar = t => true;
                break;
            }


            ConsultadataGridView.DataSource = FacturacionBLL.GetList(filtrar);
            ConsultadataGridView.Columns["Detalle"].Visible = false;
        }
Example #5
0
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            LimpiarProvider();
            if (SetError(1))
            {
                MessageBox.Show("Llenar campos Vacios");
                return;
            }
            var result = MessageBox.Show("Seguro de  Eliminar?", " ",
                                         MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                FacturacionBLL.ArreglarProducto(FacturacionBLL.Buscar(Convert.ToInt32(IDcomboBox.Text)));
                if (FacturacionBLL.Eliminar(Convert.ToInt32(IDcomboBox.Text)))
                {
                    MessageBox.Show("Eliminado");
                    IDcomboBox.DataSource = null;
                    LlenarComboBox();
                    Clean();
                }
                else
                {
                    MessageBox.Show("No se pudo eliminar");
                }
            }
        }
Example #6
0
        protected void PrecioVentaTextbox_TextChanged(object sender, EventArgs e)
        {
            int cantidad = Convert.ToInt32(CantidadTexbox.Text.ToString());
            int precio   = Convert.ToInt32(PrecioVentaTextbox.Text.ToString());
            int importe  = Utilities.Utils.ToInt(ImporteTextbox.Text.ToString());

            importe             = FacturacionBLL.CalcularImporte(precio, cantidad);
            ImporteTextbox.Text = importe.ToString();
        }
Example #7
0
        protected void ButtonBuscar_Click1(object sender, EventArgs e)
        {
            PrestamoGridView.DataBind();
            Expression <Func <Facturacion, bool> > filtro = x => true;
            FacturacionBLL facturacion = new FacturacionBLL();

            int id;

            DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
            DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);

            switch (TipodeFiltro.SelectedIndex)
            {
            case 0:    //ID

                id = Utilities.Utils.ToInt(TextCriterio.Text);
                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => x.FacturaID == id && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = c => c.FacturaID == id;
                }

                if (FacturacionBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, " Prestamo ID No Existe", "Fallido", "success");
                    return;
                }

                break;



            case 1:    //Todos

                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => true && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = x => true;
                }

                if (FacturacionBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, "No existen Dichas Cuentas", "Fallido", "success");
                }
                break;
            }

            PrestamoGridView.DataSource = FacturacionBLL.GetList(filtro);
            PrestamoGridView.DataBind();
        }
Example #8
0
        private void MontonumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            decimal total = Convert.ToDecimal(TotaltextBox.Text);
            decimal monto = Convert.ToDecimal(MontonumericUpDown.Value);

            /*if (monto < total)
             *  MessageBox.Show("le falta dinero para pagar el ariculo", "Page", MessageBoxButtons.OK, MessageBoxIcon.Information);
             * else if (monto >= total)*/
            DevueltanumericUpDown.Value = FacturacionBLL.CalcularDevuelta(monto, total);
        }
Example #9
0
        public void LlenarImporte()
        {
            int precio, cantidad;


            precio   = ToInt(PreciotextBox.Text);
            cantidad = ToInt(CantidadnumericUpDown.Value);

            importetextBox.Text = FacturacionBLL.CacularImporte(precio, cantidad).ToString();
        }
Example #10
0
 private void CantidadnumericUpDown_ValueChanged(object sender, EventArgs e)
 {
     LimpiarProvider();
     if (SetError(6))
     {
         MessageBox.Show("Debe Buscar Antes de poner una cantidad");
         CantidadnumericUpDown.Value = 0;
         return;
     }
     ImportetextBox.Text = FacturacionBLL.Importedemas(CantidadnumericUpDown.Value, Convert.ToDecimal(PreciotextBox.Text)).ToString();
 }
Example #11
0
        public void CalcularImporteTest()
        {
            bool        paso;
            Facturacion facturacion = new Facturacion();

            facturacion.FacturaID = 0;
            facturacion.Fecha     = DateTime.Now;
            facturacion.Subtotal  = 0;
            facturacion.Total     = 900;
            facturacion.ClienteID = 0;

            paso = FacturacionBLL.Guardar(facturacion);
            Assert.AreEqual(paso, true);
        }
Example #12
0
        protected void MontoTextBox_TextChanged(object sender, EventArgs e)
        {
            int     total    = Convert.ToInt32(TotalTextBox.Text);
            int     monto    = Convert.ToInt32(MontoTextBox.Text);
            decimal devuelta = Utilities.Utils.ToInt(DevueltaTextBox.Text);

            if (monto < total)
            {
                Utilities.Utils.ShowToastr(this, "le falta dinero para pagar el articulo", "Fallido", "error");
            }
            else if (monto >= total)
            {
                devuelta = FacturacionBLL.CalcularDevuelta(monto, total);
            }
        }
Example #13
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            Facturacion prestamo = FacturacionBLL.Buscar(Utilities.Utils.ToInt(FacturacionIDTextbox.Text));

            Limpiar();
            if (prestamo != null)
            {
                LlenarCampos(prestamo);

                Utilities.Utils.ShowToastr(this, "Se ha Encontrado su deposito", "Exito", "Exito");
            }
            else
            {
                Utilities.Utils.ShowToastr(this, "el ID registrado no existe", "Error", "error");
            }
        }
Example #14
0
        private void ReporteButton_Click(object sender, EventArgs e)
        {
            Facturacion facturacionn = new Facturacion();

            if (ConsultadataGridView.Rows.Count > 0 && ConsultadataGridView.CurrentRow != null)
            {
                List <Facturacion> Detalle = (List <Facturacion>)ConsultadataGridView.DataSource;
                int id = Detalle.ElementAt(ConsultadataGridView.CurrentRow.Index).FacturaID;

                ReporteFacturacion abrir = new ReporteFacturacion(FacturacionBLL.GetList(x => x.FacturaID == id));
                abrir.Show();
            }
            else
            {
                MessageBox.Show("No existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Example #15
0
        private void IDcomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            LimpiarProvider();
            int idfactura = Convert.ToInt32(IDcomboBox.Text);

            facturas = FacturacionBLL.Buscar(Convert.ToInt32(IDcomboBox.Text));
            CLienteIDcomboBox.Text          = facturas.ClienteID.ToString();
            DescripciponFacturatextBox.Text = facturas.Descripcion;
            DevueltatextBox.Text            = facturas.Devuelta.ToString();
            MontotextBox.Text           = facturas.Monto.ToString();
            Monto                       = facturas.Monto;
            FechadateTimePicker.Value   = facturas.Fecha;
            EfectivonumericUpDown.Value = facturas.EfectivoRecibido;
            facturas.Detalle            = FacturaDetalleBLL.GetList(x => x.FacturaId == idfactura);
            LlenarDetalleComboBox();
            DetallecomboBox.Enabled = true;
            EliminarDetalle.Enabled = true;
            foreach (var item in facturas.Detalle)
            {
                item.Importe = FacturacionBLL.Importedemas(item.Cantidad, item.Precio);
            }
            FacturadataGridView.DataSource = facturas.Detalle;
            Detalle = new List <FacturaDetalle>();
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <FacturacionDetalle> prestamo = new List <FacturacionDetalle>();

            if (!Page.IsPostBack)
            {
                CuentaReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                CuentaReportViewer.Reset();

                CuentaReportViewer.LocalReport.ReportPath = Server.MapPath(@"../Reportes/ReciboFacturacion.rdlc");

                CuentaReportViewer.LocalReport.DataSources.Clear();

                CuentaReportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReciboFacturacion", FacturacionBLL.GetList(x => true).Last().Detalle));
                CuentaReportViewer.LocalReport.Refresh();
            }
        }
Example #17
0
        private void Agregarbutton_Click_1(object sender, EventArgs e)
        {
            LimpiarProvider();
            RepositoryBase <Producto> repositoryBase = new RepositoryBase <Producto>();

            if (SetError(6) || SetError(7))
            {
                MessageBox.Show("Debe de completar los campos marcados");
                return;
            }
            if (repositoryBase.Buscar(Convert.ToInt32(ProductoIdcomboBox.Text)).Cantidad - Convert.ToInt32(CantidadnumericUpDown.Value) < 0)
            {
                MessageBox.Show("Cantidad insuficiente del producto solicitado");
                MessageBox.Show("Disponibles " + repositoryBase.Buscar(Convert.ToInt32(ProductoIdcomboBox.Text)).Cantidad.ToString());
                return;
            }
            if (IDcomboBox.Text == string.Empty)
            {
                facturas.Detalle.Add(new FacturaDetalle(0, facturas.FacturaId, Convert.ToInt32(ProductoIdcomboBox.Text), Convert.ToInt32(CantidadnumericUpDown.Value), Convert.ToDecimal(PreciotextBox.Text), DescripcionProductotextBox.Text, Convert.ToDecimal(ImportetextBox.Text)));
            }
            else
            {
                int idfactura = Convert.ToInt32(IDcomboBox.Text);
                if (facturas.Detalle.Count == 0)
                {
                    facturas.Detalle = FacturaDetalleBLL.GetList(x => x.FacturaId == idfactura);
                }
                if (DetallecomboBox.Text == string.Empty)
                {
                    var Idproducto = Convert.ToInt32(ProductoIdcomboBox.Text);
                    if (facturas.Detalle.Exists(x => x.ProductoId == Idproducto))
                    {
                        foreach (var item in facturas.Detalle)
                        {
                            if (item.ProductoId == Idproducto)
                            {
                                item.Cantidad += Convert.ToInt32(CantidadnumericUpDown.Value);
                            }
                        }
                    }
                    else
                    {
                        facturas.Detalle.Add(new FacturaDetalle(0, Convert.ToInt32(IDcomboBox.Text), Convert.ToInt32(ProductoIdcomboBox.Text), Convert.ToInt32(CantidadnumericUpDown.Value), Convert.ToDecimal(PreciotextBox.Text), DescripcionProductotextBox.Text, Convert.ToDecimal(ImportetextBox.Text)));
                    }
                }
                else
                {
                    Monto -= FacturacionBLL.DescontarImporte(facturas.Detalle, Convert.ToInt32(DetallecomboBox.Text));

                    foreach (var item in facturas.Detalle)
                    {
                        item.Importe = FacturacionBLL.Importe(item.Cantidad, CantidadnumericUpDown.Value, item.Precio, Convert.ToInt32(ProductoIdcomboBox.Text), item.ProductoId);
                    }
                    facturas.Detalle = FacturacionBLL.Editar(facturas.Detalle, new FacturaDetalle(Convert.ToInt32(DetallecomboBox.Text), Convert.ToInt32(IDcomboBox.Text), Convert.ToInt32(ProductoIdcomboBox.Text), Convert.ToInt32(CantidadnumericUpDown.Value), Convert.ToDecimal(PreciotextBox.Text), DescripcionProductotextBox.Text, Convert.ToDecimal(ImportetextBox.Text)));
                }
            }
            Monto            += FacturacionBLL.CalcularMonto(Convert.ToDecimal(ImportetextBox.Text));
            MontotextBox.Text = Monto.ToString();
            if (paso)
            {
                AsignarDevuelta();
            }
            FacturadataGridView.DataSource = null;
            FacturadataGridView.DataSource = facturas.Detalle;
            LimpiarProducto();
            LlenarDetalleComboBox();
            EliminarDetalle.Enabled = true;
        }
Example #18
0
        private void Guardarbutton_Click_1(object sender, EventArgs e)
        {
            LimpiarProvider();
            if (SetError(2))
            {
                MessageBox.Show("Llenar Campos vacios");
                return;
            }
            Factura factura = LlenaClase();

            if (IDcomboBox.Text == string.Empty)
            {
                if (FacturacionBLL.Guardar(factura))
                {
                    MessageBox.Show("Guardado!!");
                    LlenarComboBox();
                    FacturacionBLL.DescontarProductos(facturas.Detalle);
                    var result = MessageBox.Show("Desea Imprimir un recibo?", " ",
                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        RepositoryBase <Cliente> repositorio = new RepositoryBase <Cliente>();
                        var            usuario = repositorio.Buscar(factura.ClienteID);
                        DetalleReporte reporte = new DetalleReporte(facturas.Detalle, UsuariotextBox.Text, usuario.Nombre);
                        reporte.Show();
                    }
                    Clean();
                }
                else
                {
                    MessageBox.Show("No se pudo Guardar!!");
                }
            }
            else
            {
                var result = MessageBox.Show("Seguro de Modificar?", " ",
                                             MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    if (FacturacionBLL.Modificar(LlenaClase()))
                    {
                        MessageBox.Show("Modificado !");
                        if (Detalle.Count != 0)
                        {
                            foreach (var item in Detalle)
                            {
                                FacturaDetalleBLL.Eliminar(item.Id);
                            }
                        }
                        if (Arreglar)
                        {
                            FacturacionBLL.ArreglarProductoList(Detalle);
                            Arreglar = false;
                        }
                        var resultado = MessageBox.Show("Desea Imprimir un recibo?", " ",
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (result == DialogResult.Yes)
                        {
                            Factura facturas = LlenaClase();
                            RepositoryBase <Cliente> repositorio = new RepositoryBase <Cliente>();
                            var            usuario = repositorio.Buscar(factura.ClienteID);
                            DetalleReporte reporte = new DetalleReporte(facturas.Detalle, UsuariotextBox.Text, usuario.Nombre);
                            reporte.Show();
                        }
                        Clean();
                    }
                    else
                    {
                        MessageBox.Show("No se pudo modificar!");
                    }
                }
            }
        }
Example #19
0
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            /*
             * List<FacturaDetalle> facturaDetalles = new List<FacturaDetalle>();
             * if (dataGridView1.DataSource != null)
             * {
             *  facturaDetalles = (List<FacturaDetalle>)dataGridView1.DataSource;
             * }
             * RepositoryBase<Articulos> repository = new RepositoryBase<Articulos>(new Contexto());
             * Articulos articulos = (Articulos)ArticuloscomboBox.SelectedItem;
             * //Articulos articulo = new Articulos();
             * /*   if ((int)CantidadnumericUpDown.Value > articulos.Cantidad)
             * {
             *  MessageBox.Show("Cantidad no Dispoble para la venta", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *
             * }
             * else
             *
             * {
             *  facturaDetalles.Add(
             *      new FacturaDetalle(facturaDetalleID: 0,
             *      factutaID: Convert.ToInt32(IDnumericUpDown.Value),
             *      iDArticulos: (int)IDProductonumericUpDown.Value,
             *     Articulos:(string)RetornarDescripcion(ArticuloscomboBox.Text),
             *     cantidad: Convert.ToInt32(CantidadnumericUpDown.Value),
             *     precio: Convert.ToInt32(PreciotextBox.Text),
             *     importe: Convert.ToInt32(importetextBox.Text)));
             *
             *
             *  dataGridView1.DataSource = null;
             *  dataGridView1.DataSource = facturaDetalles;
             *  QuitarCulumnas();
             *
             *
             * }
             * if (CantidadnumericUpDown.Value == 0)
             * {
             *  MessageBox.Show("Intrudusca una cantidad valida");
             *
             * }
             * int x = Convert.ToInt32(CantidadnumericUpDown.Value);
             * articulos.Cantidad -= x;
             *
             * decimal subtotal = 0;
             * foreach(var item in facturaDetalles)
             * {
             *  subtotal += item.Importe;
             * }
             * SubTotaltextBox.Text = subtotal.ToString();
             * itebis = FacturacionBLL.CacularItebis(Convert.ToDecimal(SubTotaltextBox.Text));
             * ITBtextBox.Text = itebis.ToString();
             * total = FacturacionBLL.CarcularTotal(Convert.ToDecimal(SubTotaltextBox.Text), Convert.ToDecimal(ITBtextBox.Text));
             * TotaltextBox.Text = total.ToString();
             */

            FacturaDetalle facturaDetalle = new FacturaDetalle();

            facturaDetalle.IDArticulos = ArticuloscomboBox.SelectedIndex;
            facturaDetalle.Cantidad    = (int)CantidadnumericUpDown.Value;
            facturaDetalle.FacturaID   = (int)IDnumericUpDown.Value;
            facturaDetalle.Importe     = Convert.ToInt32(importetextBox.Text);
            //facturaDetalle.precio = Convert.ToInt32(PreciotextBox.Text);

            detalles.Add(facturaDetalle);

            dataGridView1.DataSource = detalles.ToList();

            decimal subtotal = 0;

            foreach (var item in detalles)
            {
                subtotal += item.Importe;
            }
            SubTotaltextBox.Text = subtotal.ToString();
            itebis            = FacturacionBLL.CacularItebis(Convert.ToDecimal(SubTotaltextBox.Text));
            ITBtextBox.Text   = itebis.ToString();
            total             = FacturacionBLL.CarcularTotal(Convert.ToDecimal(SubTotaltextBox.Text), Convert.ToDecimal(ITBtextBox.Text));
            TotaltextBox.Text = total.ToString();
        }
Example #20
0
 private void AsignarDevuelta()
 {
     DevueltatextBox.Text = FacturacionBLL.RetornarDevuelta(EfectivonumericUpDown.Value, Convert.ToDecimal(MontotextBox.Text)).ToString();
 }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CuentaReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                CuentaReportViewer.Reset();

                CuentaReportViewer.LocalReport.ReportPath = Server.MapPath(@"../Reportes/Facturacion.rdlc");

                CuentaReportViewer.LocalReport.DataSources.Clear();

                CuentaReportViewer.LocalReport.DataSources.Add(new ReportDataSource("Facturacion", FacturacionBLL.GetList(filtro)));
                CuentaReportViewer.LocalReport.Refresh();
            }
        }