示例#1
0
 private void BotonActualizar_Click(object sender, EventArgs e)
 {
     this.ReporteAMostrar.ExpandGroups = EntradaExpandirGrupos.TextKey == "1";
     Lazaro.Pres.Spreadsheet.Sheet ReportSheet = this.ReporteAMostrar.ToWorkbookSheet();
     ReportSheet.Sort(2, false);
     ListViewReporte.FromSheet(ReportSheet);
 }
                public virtual Lazaro.Pres.Spreadsheet.Workbook ToWorkbook(Lazaro.Pres.FieldCollection useFields)
                {
                        Lazaro.Pres.Spreadsheet.Workbook Res = new Lazaro.Pres.Spreadsheet.Workbook();
                        Lazaro.Pres.Spreadsheet.Sheet Sheet = new Lazaro.Pres.Spreadsheet.Sheet(this.Text);
                        Res.Sheets.Add(Sheet);

                        // Exporto los encabezados de columna
                        if (this.Definicion.KeyColumn.Printable) {
                                Sheet.ColumnHeaders.Add(new Lazaro.Pres.Spreadsheet.ColumnHeader(this.Definicion.KeyColumn.Label, this.Definicion.KeyColumn.Width));
                                Sheet.ColumnHeaders[0].DataType = this.Definicion.KeyColumn.DataType;
                                Sheet.ColumnHeaders[0].Format = this.Definicion.KeyColumn.Format;
                                Sheet.ColumnHeaders[0].Printable = this.Definicion.KeyColumn.Printable;
                        }

                        int OrderColumn = -1;
                        if (useFields != null) {
                                for (int i = 0; i <= useFields.Count - 1; i++) {
                                        if (useFields[i].Printable) {
                                                Lazaro.Pres.Spreadsheet.ColumnHeader ColHead = new Lazaro.Pres.Spreadsheet.ColumnHeader(useFields[i].Label, useFields[i].Width);
                                                ColHead.Name = Lfx.Data.Field.GetNameOnly(useFields[i].Name);
                                                ColHead.TextAlignment = useFields[i].Alignment;
                                                ColHead.DataType = useFields[i].DataType;
                                                ColHead.Format = useFields[i].Format;
                                                ColHead.TotalFunction = useFields[i].TotalFunction;
                                                ColHead.Printable = useFields[i].Printable;
                                                Sheet.ColumnHeaders.Add(ColHead);

                                                if (ColHead.Name == this.Definicion.OrderBy)
                                                        OrderColumn = Sheet.ColumnHeaders.Count - 1;

                                                if (ColHead.Name == this.GroupingColumnName)
                                                        Sheet.ColumnHeaders.GroupingColumn = Sheet.ColumnHeaders.Count - 1;
                                        }
                                }
                        }

                        // Exporto los renglones
                        System.Data.DataTable Tabla = this.Connection.Select(this.SelectCommand());
                        foreach (System.Data.DataRow DtRow in Tabla.Rows) {
                                Lfx.Data.Row Registro = (Lfx.Data.Row)DtRow;

                                string NombreCampoId = Lfx.Data.Field.GetNameOnly(this.Definicion.KeyColumn.Name);
                                int ItemId = Registro.Fields[NombreCampoId].ValueInt;

                                Lazaro.Pres.Spreadsheet.Row Reng = this.FormatRow(ItemId, Registro, Sheet, useFields);

                                Sheet.Rows.Add(Reng);
                        }

                        if (OrderColumn >= 0) {
                                if (m_GroupingColumnName != null) {
                                        Sheet.SortByGroupAndColumn(OrderColumn, true);
                                } else {
                                        if (OrderColumn >= 0)
                                                Sheet.Sort(OrderColumn, true);
                                }
                        }

                        return Res;
                }
示例#3
0
        public virtual Lazaro.Pres.Spreadsheet.Workbook ToWorkbookDetalle(int IDComprobante)
        {
            Lbl.Comprobantes.Factura selComprobante = new Lbl.Comprobantes.Factura(this.Connection, IDComprobante);

            Lazaro.Pres.Spreadsheet.Workbook Res   = new Lazaro.Pres.Spreadsheet.Workbook();
            Lazaro.Pres.Spreadsheet.Sheet    Sheet = new Lazaro.Pres.Spreadsheet.Sheet(this.Text + " Comprobante");
            Res.Sheets.Add(Sheet);


            int OrderColumn = -1;

            if (selComprobante != null)
            {
                for (int i = 0; i < 9; i++)
                {
                    ExcelReg nexc = new ExcelReg();
                    switch (i)
                    {
                    case 0:
                        nexc.name      = "id_articulo";
                        nexc.desc      = "Código";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 100;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Integer;
                        break;

                    case 1:
                        nexc.name      = "nombre";
                        nexc.desc      = "Nombre";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 300;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Text;
                        break;

                    case 2:
                        nexc.name      = "descripcion";
                        nexc.desc      = "Descripción";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 150;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Text;
                        break;

                    case 3:
                        nexc.name      = "cantidad";
                        nexc.desc      = "Cantidad";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 80;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Numeric;
                        break;

                    case 4:
                        nexc.name      = "costo";
                        nexc.desc      = "Costo";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 90;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Currency;
                        break;

                    case 5:
                        nexc.name      = "precio";
                        nexc.desc      = "Precio Uni.";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 120;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Currency;
                        break;

                    case 6:
                        nexc.name      = "importe";
                        nexc.desc      = "Importe";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 120;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Currency;
                        break;

                    case 7:
                        nexc.name      = "recargo";
                        nexc.desc      = "Recargo";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 100;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Currency;
                        break;

                    case 8:
                        nexc.name      = "total";
                        nexc.desc      = "Total";
                        nexc.alig      = Lfx.Types.StringAlignment.Near;
                        nexc.width     = 120;
                        nexc.fieldtype = Lfx.Data.InputFieldTypes.Currency;

                        break;
                    }
                    Lazaro.Pres.Spreadsheet.ColumnHeader ColHead = new Lazaro.Pres.Spreadsheet.ColumnHeader(nexc.desc, nexc.width);
                    ColHead.Name          = Lazaro.Orm.Data.ColumnValue.GetNameOnly(nexc.name);
                    ColHead.TextAlignment = nexc.alig; ColHead.DataType = nexc.fieldtype; ColHead.Format = nexc.format; ColHead.Printable = true;
                    if (i == 8)
                    {
                        ColHead.TotalFunction = Lazaro.Pres.Spreadsheet.QuickFunctions.Sum;
                    }
                    Sheet.ColumnHeaders.Add(ColHead);
                    excReg.Add(nexc);
                }
            }

            // Exporto los renglones
            Lbl.Comprobantes.ColeccionDetalleArticulos detArt = selComprobante.Articulos;
            foreach (Lbl.Comprobantes.DetalleArticulo DtRow in detArt)
            {
                Lazaro.Pres.Spreadsheet.Row Reng = this.FormatArt(Sheet, DtRow);
                Sheet.Rows.Add(Reng);
            }

            if (OrderColumn >= 0)
            {
                if (m_GroupingColumnName != null)
                {
                    Sheet.SortByGroupAndColumn(OrderColumn, true);
                }
                else
                {
                    if (OrderColumn >= 0)
                    {
                        Sheet.Sort(OrderColumn, true);
                    }
                }
            }

            return(Res);
        }
示例#4
0
        public override Lazaro.Pres.Spreadsheet.Workbook ToWorkbook(Lazaro.Pres.FieldCollection useFields)
        {
            Lazaro.Pres.Spreadsheet.Workbook Res   = new Lazaro.Pres.Spreadsheet.Workbook();
            Lazaro.Pres.Spreadsheet.Sheet    Sheet = new Lazaro.Pres.Spreadsheet.Sheet(this.Text);
            Res.Sheets.Add(Sheet);

            // Exporto los encabezados de columna
            if (this.Definicion.KeyColumn.Printable)
            {
                Sheet.ColumnHeaders.Add(new Lazaro.Pres.Spreadsheet.ColumnHeader(this.Definicion.KeyColumn.Label, this.Definicion.KeyColumn.Width));
                Sheet.ColumnHeaders[0].DataType  = this.Definicion.KeyColumn.DataType;
                Sheet.ColumnHeaders[0].Format    = this.Definicion.KeyColumn.Format;
                Sheet.ColumnHeaders[0].Printable = this.Definicion.KeyColumn.Printable;
            }

            int OrderColumn = -1;

            if (useFields != null)
            {
                for (int i = 0; i <= useFields.Count - 1; i++)
                {
                    if (useFields[i].Printable)
                    {
                        Lazaro.Pres.Spreadsheet.ColumnHeader ColHead = new Lazaro.Pres.Spreadsheet.ColumnHeader(useFields[i].Label, useFields[i].Width);
                        ColHead.Name          = Lazaro.Orm.Data.ColumnValue.GetNameOnly(useFields[i].Name);
                        ColHead.TextAlignment = useFields[i].Alignment;
                        ColHead.DataType      = useFields[i].DataType;
                        ColHead.Format        = useFields[i].Format;
                        ColHead.TotalFunction = useFields[i].TotalFunction;
                        ColHead.Printable     = useFields[i].Printable;
                        Sheet.ColumnHeaders.Add(ColHead);

                        if (ColHead.Name == this.Definicion.OrderBy)
                        {
                            OrderColumn = Sheet.ColumnHeaders.Count - 1;
                        }

                        if (ColHead.Name == this.GroupingColumnName)
                        {
                            Sheet.ColumnHeaders.GroupingColumn = Sheet.ColumnHeaders.Count - 1;
                        }
                    }
                }
            }

            // Exporto los renglones
            System.Data.DataTable Tabla = this.Connection.Select(this.SelectCommand());
            int lastItemId = -1;

            foreach (System.Data.DataRow DtRow in Tabla.Rows)
            {
                Lfx.Data.Row Registro = (Lfx.Data.Row)DtRow;

                string NombreCampoId = Lazaro.Orm.Data.ColumnValue.GetNameOnly(this.Definicion.KeyColumn.Name);
                int    ItemId        = Registro.Fields[NombreCampoId].ValueInt;
                lastItemId = ItemId;
                Lazaro.Pres.Spreadsheet.Row Reng = this.FormatRow(ItemId, Registro, Sheet, useFields);

                Sheet.Rows.Add(Reng);
            }

            Lazaro.Pres.Spreadsheet.Row RengSum = this.FormatRowSum(Sheet, useFields);

            Sheet.Rows.Add(RengSum);

            if (OrderColumn >= 0)
            {
                if (m_GroupingColumnName != null)
                {
                    Sheet.SortByGroupAndColumn(OrderColumn, true);
                }
                else
                {
                    if (OrderColumn >= 0)
                    {
                        Sheet.Sort(OrderColumn, true);
                    }
                }
            }
            //Sheet.Workbook.Sheets.Find("").Rows.tot

            return(Res);
        }