Пример #1
0
        internal static void Ventas()
        {
            StiReport report = new StiReport();

            try
            {
                using (var form = new FrmParamData())
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        using (var db = new DymContext())
                        {
                            if (form.TodasLasFechas)
                            {
                                var q =
                                    from v in db.Venta
                                    join c in db.Cliente on v.ClienteId equals c.ClienteId
                                    where v.EstadoDocId.Equals("CON") && v.Anulada == false
                                    select new
                                {
                                    v.VentaId,
                                    c.RazonSocial,
                                    c.Negocio,
                                    v.CreatedAt,
                                    v.CreatedBy,
                                    v.SubTotal,
                                    v.Impuesto,
                                    v.Total,
                                    v.TipoDocId,
                                    v.NoRef
                                };
                                report.Load(FVentas);
                                report.Compile();
                                report["creador"] = Ambiente.LoggedUser.UsuarioId;
                                report["inicial"] = null;
                                // report["final"] = null;
                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("ventas", "ventas", q.ToList());
                                report.Dictionary.Synchronize();

                                //report.Design();
                                //report.Save(FVentas);
                                report.Show(true);
                            }
                            else
                            {
                                var q =
                                    from v in db.Venta
                                    join c in db.Cliente on v.ClienteId equals c.ClienteId
                                    where v.EstadoDocId.Equals("CON") && v.Anulada == false &&
                                    v.CreatedAt.Date >= FrmParamData.Inicial.Date && v.CreatedAt.Date <= FrmParamData.Final.Date
                                    select new
                                {
                                    v.VentaId,
                                    c.RazonSocial,
                                    c.Negocio,
                                    v.CreatedAt,
                                    v.CreatedBy,
                                    v.SubTotal,
                                    v.Impuesto,
                                    v.Total,
                                    v.TipoDocId,
                                    v.NoRef
                                };
                                report.Load(FVentas);
                                report.Compile();
                                report["creador"] = Ambiente.LoggedUser.UsuarioId;
                                report["inicial"] = FrmParamData.Inicial.Date;
                                report["final"]   = FrmParamData.Final.Date;
                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("ventas", "ventas", q.ToList());
                                report.Dictionary.Synchronize();

                                //report.Design();
                                //report.Save(FVentas);
                                report.Show(true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Ambiente.Mensaje(ex.Message);
            }
        }
Пример #2
0
        public static void Compras()
        {
            StiReport report = new StiReport();

            try
            {
                using (var form = new FrmParamData())
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        using (var db = new DymContext())
                        {
                            if (form.TodasLasFechas)
                            {
                                var q = from compra in db.Compra
                                        join comprap in db.Comprap on compra.CompraId equals comprap.CompraId
                                        where compra.EstadoDocId.Equals("CON")
                                        select new
                                {
                                    compra.CompraId,
                                    comprap.ProductoId,
                                    comprap.Descripcion,
                                    comprap.Cantidad,
                                    comprap.ImporteImpuesto1,
                                    comprap.ImporteImpuesto2,
                                    comprap.PrecioCompra,
                                    comprap.Total,
                                    compra.CreatedAt,
                                    compra.CreatedBy
                                };
                                report.Load(Reports.FCompras);
                                report.Compile();
                                report["inicial"] = null;
                                //report["final"] = null;
                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("partidas", "partidas", q.ToList());
                                report.Dictionary.Synchronize();
                                //report.Design();
                                //report.Save(Reports.FCompras);
                                report.Show(true);
                            }
                            else
                            {
                                var q = from compra in db.Compra
                                        join comprap in db.Comprap on compra.CompraId equals comprap.CompraId
                                        where compra.EstadoDocId.Equals("CON") && compra.CreatedAt.Date >= FrmParamData.Inicial.Date && compra.CreatedAt.Date <= FrmParamData.Final.Date
                                        select new
                                {
                                    compra.CompraId,
                                    comprap.ProductoId,
                                    comprap.Descripcion,
                                    comprap.Cantidad,
                                    comprap.ImporteImpuesto1,
                                    comprap.ImporteImpuesto2,
                                    comprap.Total,
                                    comprap.PrecioCompra,
                                    compra.CreatedAt,
                                    compra.CreatedBy
                                };
                                report.Load(Reports.FCompras);
                                report.Compile();
                                report["inicial"] = FrmParamData.Inicial.Date;
                                report["final"]   = FrmParamData.Final.Date;
                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("partidas", "partidas", q.ToList());
                                report.Dictionary.Synchronize();
                                //report.Design();
                                //report.Save(Reports.FCompras);
                                report.Show(true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Ambiente.Mensaje(ex.Message);
            }
        }
Пример #3
0
        internal static void VentasDetallada()
        {
            StiReport report = new StiReport();

            try
            {
                using (var form = new FrmParamData())
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        using (var db = new DymContext())
                        {
                            if (form.TodasLasFechas)
                            {
                                var q =
                                    from v in db.Venta
                                    join vp in db.Ventap on v.VentaId equals vp.VentaId
                                    join p in db.Producto on vp.ProductoId equals p.ProductoId
                                    where v.EstadoDocId.Equals("CON") && v.Anulada == false
                                    select new
                                {
                                    v.NoRef,
                                    vp.ProductoId,
                                    vp.Cantidad,
                                    vp.Descripcion,
                                    v.VentaId,
                                    v.CreatedAt,
                                    v.CreatedBy,
                                    vp.SubTotal,
                                    Impuesto = (vp.ImporteImpuesto1 + vp.ImporteImpuesto2),
                                    vp.Total
                                };
                                report.Load(FVentasDetallada);
                                report.Compile();
                                report["creador"] = Ambiente.LoggedUser.UsuarioId;

                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("ventas", "ventas", q.ToList());
                                report.Dictionary.Synchronize();

                                //report.Design();
                                //report.Save(FVentasDetallada);
                                report.Show(true);
                            }
                            else
                            {
                                var q =
                                    from v in db.Venta
                                    join vp in db.Ventap on v.VentaId equals vp.VentaId
                                    join p in db.Producto on vp.ProductoId equals p.ProductoId
                                    where v.EstadoDocId.Equals("CON") && v.Anulada == false
                                    select new
                                {
                                    v.NoRef,
                                    vp.ProductoId,
                                    vp.Cantidad,
                                    vp.Descripcion,
                                    v.VentaId,
                                    v.CreatedAt,
                                    v.CreatedBy,
                                    vp.SubTotal,
                                    Impuesto = (vp.ImporteImpuesto1 + vp.ImporteImpuesto2),
                                    vp.Total
                                };

                                report.Load(FVentasDetallada);
                                report.Compile();
                                report["creador"] = Ambiente.LoggedUser.UsuarioId;
                                report["inicial"] = FrmParamData.Inicial.Date;
                                report["final"]   = FrmParamData.Final.Date;
                                report.Dictionary.DataSources.Clear();
                                report.RegBusinessObject("ventas", "ventas", q.ToList());
                                report.Dictionary.Synchronize();

                                //report.Design();
                                //report.Save(FVentasDetallada);
                                report.Show(true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Ambiente.Mensaje(ex.Message);
            }
        }