Beispiel #1
0
                public Inicio()
                {
                        ElementoTipo = typeof(Lbl.Pagos.FormaDePago);

                        TableName = "formaspago";
                        KeyColumn = new Lazaro.Pres.Field("formaspago.id_formapago", "Cód.", Lfx.Data.InputFieldTypes.Serial, 0);
                        Columns = new Lazaro.Pres.FieldCollection() 
			{
				new Lazaro.Pres.Field("formaspago.nombre", "Nombre", Lfx.Data.InputFieldTypes.Text, 320),
				new Lazaro.Pres.Field("formaspago.tipo", "Tipo", 240, new Dictionary<int, string>() {
                                        { 1, "Efectivo" },
                                        { 2, "Cheque (propio)" },
                                        { 3, "Cuenta corriente" },
                                        { 4, "Tarjeta" },
                                        { 6, "Caja" },
                                        { 7, "Otro" },
                                        { 8, "Cheque (terceros)" }
                                }),
				new Lazaro.Pres.Field("formaspago.id_caja", "Caja", Lfx.Data.InputFieldTypes.Relation, 320),
                                new Lazaro.Pres.Field("formaspago.descuento", "Desc./Recargo", Lfx.Data.InputFieldTypes.Numeric, 120),
                                new Lazaro.Pres.Field("formaspago.retencion", "Retención", Lfx.Data.InputFieldTypes.Numeric, 120),
                                new Lazaro.Pres.Field("formaspago.pagos", "Pagos", Lfx.Data.InputFieldTypes.Bool, 96),
                                new Lazaro.Pres.Field("formaspago.cobros", "Cobros", Lfx.Data.InputFieldTypes.Bool, 96),
			};
                        OrderBy = "formaspago.nombre";
                }
Beispiel #2
0
                public Inicio()
                {
                        ElementoTipo = typeof(Lbl.Bancos.Banco);

                        TableName = "bancos";
                        KeyColumn = new Lazaro.Pres.Field("bancos.id_banco", "Cód.", Lfx.Data.InputFieldTypes.Serial, 0);
                        Columns = new Lazaro.Pres.FieldCollection() 
			{
				new Lazaro.Pres.Field("bancos.nombre", "Nombre", Lfx.Data.InputFieldTypes.Text, 320),
				new Lazaro.Pres.Field("bancos.url", "Página", Lfx.Data.InputFieldTypes.Text, 320)
			};
                        OrderBy = "bancos.nombre";
                }
Beispiel #3
0
		public Inicio()
		{
                        ElementoTipo = typeof(Lbl.Impuestos.Alicuota);

                        TableName = "alicuotas";
                        OrderBy = "nombre";
                        KeyColumn = new Lazaro.Pres.Field("id_alicuota", "Cód.", Lfx.Data.InputFieldTypes.Serial, 0);
                        Columns = new Lazaro.Pres.FieldCollection()
			{
				new Lazaro.Pres.Field("nombre", "Nombre", Lfx.Data.InputFieldTypes.Text, 240),
				new Lazaro.Pres.Field("porcentaje", "Porcentaje", Lfx.Data.InputFieldTypes.Numeric, 160),
				new Lazaro.Pres.Field("importe_minimo", "Imp. Mín.", Lfx.Data.InputFieldTypes.Currency, 160)
			};
		}
Beispiel #4
0
                public Inicio()
                {
                        ElementoTipo = typeof(Lbl.Pagos.Plan);

                        TableName = "tarjetas_planes";
                        KeyColumn = new Lazaro.Pres.Field("tarjetas_planes.id_plan", "Cód.", Lfx.Data.InputFieldTypes.Serial, 0);
                        Columns = new Lazaro.Pres.FieldCollection() 
			{
				new Lazaro.Pres.Field("tarjetas_planes.nombre", "Nombre", Lfx.Data.InputFieldTypes.Text, 320),
                                new Lazaro.Pres.Field("tarjetas_planes.cuotas", "Cuotas", Lfx.Data.InputFieldTypes.Integer, 96),
                                new Lazaro.Pres.Field("tarjetas_planes.interes", "Desc./Recargo", Lfx.Data.InputFieldTypes.Numeric, 120),
                                new Lazaro.Pres.Field("tarjetas_planes.comision", "Retención", Lfx.Data.InputFieldTypes.Numeric, 120)
			};
                        OrderBy = "tarjetas_planes.nombre";
                }
Beispiel #5
0
        private Lazaro.Pres.Spreadsheet.Row FormatRowSum(Lazaro.Pres.Spreadsheet.Sheet sheet, Lazaro.Pres.FieldCollection useFields)
        {
            Lazaro.Pres.Spreadsheet.Row Reng = new Lazaro.Pres.Spreadsheet.Row(sheet);

            if (this.Definicion.KeyColumn != null && this.Definicion.KeyColumn.Printable)
            {
                Lazaro.Pres.Spreadsheet.Cell KeyCell = Reng.Cells.Add();
                KeyCell.Content = "-->";
            }

            for (int FieldNum = 0; FieldNum < useFields.Count; FieldNum++)
            {
                if (useFields[FieldNum].Printable)
                {
                    string FieldName = Lazaro.Orm.Data.ColumnValue.GetNameOnly(useFields[FieldNum].Name);

                    if (FieldNum >= 0)
                    {
                        Lazaro.Pres.Spreadsheet.Cell NewCell = Reng.Cells.Add();
                        if (FieldName == "total")
                        {
                            NewCell.Content = totalRenglon;
                        }
                        else
                        {
                            NewCell.Content = "";
                        }
                    }
                }
            }

            return(Reng);
        }
Beispiel #6
0
        protected override Lazaro.Pres.Spreadsheet.Row FormatRow(int itemId, Lfx.Data.Row row, Lazaro.Pres.Spreadsheet.Sheet sheet, Lazaro.Pres.FieldCollection useFields)
        {
            Lazaro.Pres.Spreadsheet.Row Reng = new Lazaro.Pres.Spreadsheet.Row(sheet);

            if (this.Definicion.KeyColumn != null && this.Definicion.KeyColumn.Printable)
            {
                Lazaro.Pres.Spreadsheet.Cell KeyCell = Reng.Cells.Add();
                KeyCell.Content = itemId;
            }

            for (int FieldNum = 0; FieldNum < useFields.Count; FieldNum++)
            {
                if (useFields[FieldNum].Printable)
                {
                    string FieldName = Lazaro.Orm.Data.ColumnValue.GetNameOnly(useFields[FieldNum].Name);

                    if (FieldNum >= 0)
                    {
                        Lazaro.Pres.Spreadsheet.Cell NewCell = Reng.Cells.Add();

                        switch (useFields[FieldNum].DataType)
                        {
                        case Lfx.Data.InputFieldTypes.Integer:
                        case Lfx.Data.InputFieldTypes.Serial:
                            if (row[FieldName] == null || row[FieldName] is DBNull)
                            {
                                NewCell.Content = null;
                            }
                            else if (useFields[FieldNum].Format != null)
                            {
                                NewCell.Content = System.Convert.ToInt32(row[FieldName]).ToString(useFields[FieldNum].Format);
                            }
                            else
                            {
                                NewCell.Content = row[FieldName].ToString();
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.Relation:
                        case Lfx.Data.InputFieldTypes.Text:
                        case Lfx.Data.InputFieldTypes.Memo:
                            if (row[FieldName] == null)
                            {
                                NewCell.Content = null;
                            }
                            else if (FieldName == "comprob.id_formapago")
                            {
                                Lfx.Data.Row formPago = Lfx.Workspace.Master.Tables["formaspago"].FastRows[System.Convert.ToInt32(row[FieldName])];
                                if (formPago != null)
                                {
                                    NewCell.Content = formPago.Fields["nombre"].Value.ToString();
                                }
                                else
                                {
                                    NewCell.Content = row.Fields[FieldName].Value.ToString();
                                }
                            }
                            else if (row[FieldName] is System.Byte[])
                            {
                                NewCell.Content = System.Text.Encoding.Default.GetString(((System.Byte[])(row[FieldName])));
                            }
                            else
                            {
                                NewCell.Content = row.Fields[FieldName].Value.ToString();
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.Currency:
                            double ValorCur = (row[FieldName] == null || row[FieldName] is DBNull) ? 0 : System.Convert.ToDouble(row[FieldName]);
                            NewCell.Content = ValorCur;
                            if (FieldName == "total")
                            {
                                totalRenglon += ValorCur;
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.Numeric:
                            if (row[FieldName] == null || row[FieldName] is DBNull)
                            {
                                NewCell.Content = null;
                            }
                            else
                            {
                                NewCell.Content = System.Convert.ToDouble(row[FieldName]);
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.Date:
                            if (row.Fields[FieldName].Value != null)
                            {
                                NewCell.Content = row.Fields[FieldName].ValueDateTime;
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.DateTime:
                            NewCell.Content = row[FieldName];
                            break;

                        case Lfx.Data.InputFieldTypes.Bool:
                            if (System.Convert.ToBoolean(row[FieldName]))
                            {
                                NewCell.Content = "Sí";
                            }
                            else
                            {
                                NewCell.Content = "No";
                            }
                            break;

                        case Lfx.Data.InputFieldTypes.Set:
                            int SetValue = System.Convert.ToInt32(row[FieldName]);
                            if (useFields[FieldNum] != null && useFields[FieldNum].SetValues != null & useFields[FieldNum].SetValues.ContainsKey(SetValue))
                            {
                                NewCell.Content = useFields[FieldNum].SetValues[SetValue];
                            }
                            else
                            {
                                NewCell.Content = "???";
                            }
                            break;

                        default:
                            NewCell.Content = row[FieldName];
                            break;
                        }
                    }
                }
            }

            return(Reng);
        }
Beispiel #7
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);
        }
Beispiel #8
0
        protected override Lazaro.Pres.Spreadsheet.Row FormatRow(int itemId, Lfx.Data.Row row, Lazaro.Pres.Spreadsheet.Sheet sheet, Lazaro.Pres.FieldCollection useFields)
        {
            Lazaro.Pres.Spreadsheet.Row Res = base.FormatRow(itemId, row, sheet, useFields);

            switch (row.Fields["tipo_fac"].ValueString)
            {
            case "NCA":
            case "NCB":
            case "NCC":
            case "NCE":
            case "NCM":
                row.Fields["gravado"].Value = -row.Fields["gravado"].ValueDecimal;
                row.Fields["total"].Value   = -row.Fields["total"].ValueDecimal;
                break;
            }

            if (row.Fields["anulada"].ValueInt != 0)
            {
                Res.Cells[4].Content = "ANULADA";
            }

            return(Res);
        }