Ejemplo n.º 1
0
        public DataBandMenu(Designer designer) : base(designer)
        {
            FSelection = Designer.SelectedObjects;

            miAddDetailDataBand             = CreateMenuItem(Res.Get("ComponentMenu,DataBand,AddDetailDataBand"), miAddDetailDataBand_Click);
            miKeepTogether                  = CreateMenuItem(Res.Get("ComponentMenu,DataBand,KeepTogether"), miKeepTogether_Click);
            miKeepTogether.BeginGroup       = true;
            miKeepTogether.AutoCheckOnClick = true;
            miKeepDetail = CreateMenuItem(Res.Get("ComponentMenu,DataBand,KeepDetail"), miKeepDetail_Click);
            miKeepDetail.AutoCheckOnClick = true;

            miStartNewPage.BeginGroup = false;

            int insertPos = Items.IndexOf(miAddChildBand);

            Items.Insert(insertPos + 1, miAddDetailDataBand);
            insertPos = Items.IndexOf(miStartNewPage);
            Items.Insert(insertPos, miKeepTogether);
            Items.Insert(insertPos + 1, miKeepDetail);

            DataBand band    = FSelection[0] as DataBand;
            bool     enabled = !band.HasRestriction(Restrictions.DontModify);

            miAddDetailDataBand.Enabled = enabled && band.Bands.Count == 0;
            miKeepTogether.Enabled      = enabled;
            miKeepDetail.Enabled        = enabled;
            miKeepTogether.Checked      = band.KeepTogether;
            miKeepDetail.Checked        = band.KeepDetail;
        }
Ejemplo n.º 2
0
        public void Print(bool isprint)
        {
            try
            {
                if (PrintData != null)
                {
                    for (int i = 0; i < PrintData.Tables.Count; i++)
                    {
                        PrintData.Tables[i].TableName = TableName[i];
                    }
                    Report report = new Report();
                    report.RegisterData(PrintData);
                    string filepath = "";
                    filepath = System.Windows.Forms.Application.StartupPath + @"\ReportFrx\" + FilePath;
                    report.Load(filepath);
                    report.SetParameterValue("Operator", Operator);
                    FastReport.DataBand data1 = report.FindObject("Data1") as FastReport.DataBand;
                    data1.DataSource = report.GetDataSource(TableName.Last());

                    if (isprint)
                    {
                        report.PrintSettings.ShowDialog = false;
                        report.Print();
                    }
                    else
                    {
                        report.Show();
                    }
                    report.Dispose();
                }
            }
            catch (Exception e) { throw e; }
            System.GC.Collect();
        }
Ejemplo n.º 3
0
        private void miAddDetailDataBand_Click(object sender, EventArgs e)
        {
            DataBand band       = FSelection[0] as DataBand;
            DataBand detailData = new DataBand();

            detailData.Parent = band;
            detailData.CreateUniqueName();
            detailData.Height = detailData.GetPreferredSize().Height;

            Change();
        }
Ejemplo n.º 4
0
        internal void FinalizeDataSource()
        {
            DataBand        dataBand = GroupDataBand;
            GroupHeaderBand group    = this;

            // remove group sort from the databand
            while (group != null)
            {
                if (group.SortOrder != SortOrder.None)
                {
                    dataBand.Sort.RemoveAt(0);
                }
                group = group.NestedGroup;
            }
        }
Ejemplo n.º 5
0
        internal void InitDataSource()
        {
            DataBand        dataBand = GroupDataBand;
            GroupHeaderBand group    = this;
            int             index    = 0;

            // insert group sort to the databand
            while (group != null)
            {
                if (group.SortOrder != SortOrder.None)
                {
                    dataBand.Sort.Insert(index, new Sort(group.Condition, group.SortOrder == SortOrder.Descending));
                    index++;
                }
                group = group.NestedGroup;
            }

            dataBand.InitDataSource();
        }
Ejemplo n.º 6
0
        /// <inheritdoc/>
        public override void SetDefaults()
        {
            switch (Config.ReportSettings.DefaultPaperSize)
            {
            case DefaultPaperSize.A4:
                PaperWidth  = 210;
                PaperHeight = 297;
                break;

            case DefaultPaperSize.Letter:
                PaperWidth  = 215.9f;
                PaperHeight = 279.4f;
                break;
            }

            float baseHeight = Units.Millimeters * 10;

            if (ReportWorkspace.Grid.GridUnits == PageUnits.Inches ||
                ReportWorkspace.Grid.GridUnits == PageUnits.HundrethsOfInch)
            {
                baseHeight = Units.Inches * 0.4f;
            }

            ReportTitle = new ReportTitleBand();
            ReportTitle.CreateUniqueName();
            ReportTitle.Height = baseHeight;

            PageHeader = new PageHeaderBand();
            PageHeader.CreateUniqueName();
            PageHeader.Height = baseHeight * 0.75f;

            DataBand data = new DataBand();

            Bands.Add(data);
            data.CreateUniqueName();
            data.Height = baseHeight * 2;

            PageFooter = new PageFooterBand();
            PageFooter.CreateUniqueName();
            PageFooter.Height = baseHeight * 0.5f;
        }
Ejemplo n.º 7
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            if (cmbNomeProduto.SelectedItem != null)
            {
                VendasClasse novaVenda = new VendasClasse();
                DataTable    dt        = new DataTable();
                dt = novaVenda.BuscaVendaBanco(listaBrinquedo[cmbNomeProduto.SelectedIndex].Cod_Brinquedo);

                Report report = new Report();

                report.Load("Relatorio.frx");

                report.RegisterData(dt, "Tabela_de_Dados");
                report.GetDataSource("Tabela_de_Dados").Enabled = true;
                FastReport.DataBand dados = (FastReport.DataBand)report.FindObject("Data1");
                dados.DataSource = report.GetDataSource("Tabela_de_Dados");



                FastReport.TextObject Nome_brinquedo = (FastReport.TextObject)report.FindObject("txtNomeBrinq");
                FastReport.TextObject Nome           = (FastReport.TextObject)report.FindObject("txtNomeCliente");
                FastReport.TextObject data_Venda     = (FastReport.TextObject)report.FindObject("txtdataVenda");
                FastReport.TextObject quantidade     = (FastReport.TextObject)report.FindObject("txtqtd");



                Nome_brinquedo.Text = "[Tabela_de_Dados.Nome_Brinquedo]";
                data_Venda.Text     = "[Tabela_de_Dados.data_Venda]";
                Nome.Text           = "[Tabela_de_Dados.Nome]";
                quantidade.Text     = "[Tabela_de_Dados.quantidade]";

                report.Show();
            }
            else
            {
                MessageBox.Show("Não há nenhum produto selecionado!");
            }
        }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public override void Assign(Base source)
        {
            base.Assign(source);

            DataBand src = source as DataBand;

            DataSource = src.DataSource;
            RowCount   = src.RowCount;
            MaxRows    = src.MaxRows;
            Relation   = src.Relation;
            Sort.Assign(src.Sort);
            Filter = src.Filter;
            Columns.Assign(src.Columns);
            PrintIfDetailEmpty     = src.PrintIfDetailEmpty;
            PrintIfDatasourceEmpty = src.PrintIfDatasourceEmpty;
            KeepTogether           = src.KeepTogether;
            KeepDetail             = src.KeepDetail;
            IdColumn         = src.IdColumn;
            ParentIdColumn   = src.ParentIdColumn;
            Indent           = src.Indent;
            CollectChildRows = src.CollectChildRows;
            ResetPageNumber  = src.ResetPageNumber;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets a root datasource for the object currently edited.
        /// </summary>
        /// <returns>The <b>DataSourceBase</b> object if found; <b>null</b> otherwise.</returns>
        protected virtual DataSourceBase FindRootDataSource()
        {
            DataSourceBase data = null;
            DataBand       band = (Obj as ReportComponentBase).DataBand;

            if (band != null)
            {
                data = band.DataSource;
            }
            if (data == null)
            {
                ObjectCollection allData = Obj.Report.Dictionary.AllObjects;
                foreach (Base c in allData)
                {
                    if (c is DataSourceBase && (c as DataSourceBase).Enabled)
                    {
                        data = c as DataSourceBase;
                        break;
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <b>BandColumns</b> class with default settings.
 /// </summary>
 public BandColumns(DataBand band)
 {
     FBand = band;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <b>BandColumns</b> class with default settings.
 /// </summary>
 public BandColumns(DataBand band)
 {
     this.band = band;
 }
Ejemplo n.º 12
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer)
        {
            DataBand c = writer.DiffObject as DataBand;

            base.Serialize(writer);
            if (writer.SerializeTo == SerializeTo.Preview)
            {
                return;
            }

            if (DataSource != c.DataSource)
            {
                writer.WriteRef("DataSource", DataSource);
            }
            if (RowCount != c.RowCount)
            {
                writer.WriteInt("RowCount", RowCount);
            }
            if (MaxRows != c.MaxRows)
            {
                writer.WriteInt("MaxRows", MaxRows);
            }
            if (Relation != c.Relation)
            {
                writer.WriteRef("Relation", Relation);
            }
            if (Sort.Count > 0)
            {
                writer.Write(Sort);
            }
            if (Filter != c.Filter)
            {
                writer.WriteStr("Filter", Filter);
            }
            Columns.Serialize(writer, c.Columns);
            if (PrintIfDetailEmpty != c.PrintIfDetailEmpty)
            {
                writer.WriteBool("PrintIfDetailEmpty", PrintIfDetailEmpty);
            }
            if (PrintIfDatasourceEmpty != c.PrintIfDatasourceEmpty)
            {
                writer.WriteBool("PrintIfDatasourceEmpty", PrintIfDatasourceEmpty);
            }
            if (KeepTogether != c.KeepTogether)
            {
                writer.WriteBool("KeepTogether", KeepTogether);
            }
            if (KeepDetail != c.KeepDetail)
            {
                writer.WriteBool("KeepDetail", KeepDetail);
            }
            if (IdColumn != c.IdColumn)
            {
                writer.WriteStr("IdColumn", IdColumn);
            }
            if (ParentIdColumn != c.ParentIdColumn)
            {
                writer.WriteStr("ParentIdColumn", ParentIdColumn);
            }
            if (FloatDiff(Indent, c.Indent))
            {
                writer.WriteFloat("Indent", Indent);
            }
            if (CollectChildRows != c.CollectChildRows)
            {
                writer.WriteBool("CollectChildRows", CollectChildRows);
            }
            if (ResetPageNumber != c.ResetPageNumber)
            {
                writer.WriteBool("ResetPageNumber", ResetPageNumber);
            }
        }