Esempio n. 1
0
        private void btnComprobante_Click(object sender, EventArgs e)
        {
            //Para generar el comprobante valido que existan filas en el datagrid
            if (dataGridView1.Rows.Count > 0)
            {
                //Parametro del procedimiento almacenado
                string nombreParametro = "p_comprobante";
                string comprobante     = dataGridView1.CurrentRow.Cells[1].Value.ToString();

                ReporteForm            form = new ReporteForm();
                ReporteVenta           oRep = new ReporteVenta();
                ParameterField         pf   = new ParameterField();
                ParameterFields        pfs  = new ParameterFields();
                ParameterDiscreteValue pdv  = new ParameterDiscreteValue();
                pf.Name   = nombreParametro;
                pdv.Value = comprobante;
                pf.CurrentValues.Add(pdv);
                pfs.Add(pf);
                form.crystalReportViewer1.ParameterFieldInfo = pfs;
                oRep.SetParameterValue(nombreParametro, comprobante, oRep.Subreports[0].Name.ToString());
                form.crystalReportViewer1.ReportSource = oRep;
                form.Show();
            }
            else
            {
                MessageBox.Show("No existen ventas para generar el comprobante");
            }
        }
Esempio n. 2
0
        public IHttpActionResult PutReporteVenta(string id, ReporteVenta reporteVenta)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reporteVenta.id_producto)
            {
                return(BadRequest());
            }

            db.Entry(reporteVenta).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReporteVentaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 3
0
        public IHttpActionResult PostReporteVenta(ReporteVenta reporteVenta)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ReporteVenta.Add(reporteVenta);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ReporteVentaExists(reporteVenta.id_producto))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = reporteVenta.id_producto }, reporteVenta));
        }
Esempio n. 4
0
        public IHttpActionResult GetReporteVenta(string id)
        {
            ReporteVenta reporteVenta = db.ReporteVenta.Find(id);

            if (reporteVenta == null)
            {
                return(NotFound());
            }

            return(Ok(reporteVenta));
        }
Esempio n. 5
0
        public IHttpActionResult DeleteReporteVenta(string id)
        {
            ReporteVenta reporteVenta = db.ReporteVenta.Find(id);

            if (reporteVenta == null)
            {
                return(NotFound());
            }

            db.ReporteVenta.Remove(reporteVenta);
            db.SaveChanges();

            return(Ok(reporteVenta));
        }
Esempio n. 6
0
        private Row CrearFilaReporte(ReporteVenta venta, int index)
        {
            Row row = new Row();

            row.RowIndex = (UInt32)index;
            row.Append(new Cell()
            {
                CellValue = new CellValue("" + venta.VentaId),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue("" + venta.Asesor),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue("" + venta.Cedula),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue("" + venta.Codigo),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue("" + venta.Tienda),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue(venta.SKUElectrodomestico),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue(venta.FechaRegistro.ToString("yyyy-MM-dd HH:mm:ss")),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue(venta.CedulaCliente),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue(venta.SKU),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            }, new Cell()
            {
                CellValue = new CellValue(venta.ValorComision.ToString()),
                DataType  = new EnumValue <CellValues>(CellValues.String)
            });
            return(row);
        }
Esempio n. 7
0
        public static ReporteVenta generar_reporte(int tienda_id, int trabajador_id, ICollection <objeto_venta> Articulos, DateTime Fecha)
        {
            var reporte = new ReporteVenta {
                ShopId = tienda_id, TrabajadorId = trabajador_id, Fecha = Fecha, Articulos = new List <ArticuloVenta>()
            };

            using (var db = new TiendaDbContext())
            {
                db.ReporteVentas.Add(reporte);
                db.SaveChanges();
                double pagado = 0;
                foreach (var art in Articulos)
                {
                    var art_venta = art.genera_articulo(art);
                    reporte.Articulos.Add(art_venta);
                    pagado += art_venta.Costo;
                }
                reporte.Pagado          = pagado;
                db.Entry(reporte).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(reporte);
        }
Esempio n. 8
0
 public static InformeLiquidacion genera_informe(int tienda_id, ReporteDeuda deuda, ReporteDevolucion devolucion, ReporteVenta venta, DateTime Fecha)
 {
     using (var db = new TiendaDbContext())
     {
         var informe = new InformeLiquidacion
         {
             Fecha               = Fecha,
             ShopId              = tienda_id,
             ReporteDeudaId      = deuda.ReporteDeudaId,
             ReporteDevolucionId = devolucion.ReporteDevolucionId,
             ReporteVentaId      = venta.ReporteVentaId
         };
         db.InformeLiquidaciones.Add(informe);
         db.SaveChanges();
         return(informe);
     }
 }