Example #1
0
        private void initializer(REPORT.Report.ReportVo report, Table main, string table)
        {
            InitializeComponent();

            this.MAINREPORT = report;
            //if(this.MAINREPORT!=null)
            //    this.REPORTID   = this.MAINREPORT.ID;

            this.main  = main;
            this.TABLE = table;

            /// LIMPANDO AS ABAS
            this.tpFieldsReturn.Controls.Clear();
            this.linksPainel.Controls.Clear();
            this.tpGourp.Controls.Clear();
            this.tpFilter.Controls.Clear();
            this.tpOrder.Controls.Clear();
            this.tpParms.Controls.Clear();

            /// INICIALIZANDO OBJETOS
            //this.CHILDREN = new List<Table>();
            this.FIELDS  = new Fields(this);
            this.FILTERS = new Filters(this);
            this.ORDERBY = new OrderBy(this);
            this.PARAMS  = new Params(this);

            /// ADCIONANDO OBJETOS NAS ABAS
            FormatScreen.AddControl(tpFieldsReturn, this.FIELDS);
            //FormatScreen.AddControl(tpGourp       , this.GROUPBY);
            FormatScreen.AddControl(tpFilter, this.FILTERS);
            FormatScreen.AddControl(tpOrder, this.ORDERBY);
            FormatScreen.AddControl(tpParms, this.PARAMS);

            DataTable dtRelType   = new DataTable();
            string    typeDisplay = "display";
            string    typeValue   = "value";

            cbRelatedType.DisplayMember = typeDisplay;
            cbRelatedType.ValueMember   = typeValue;
            dtRelType.Columns.Add(typeDisplay);
            dtRelType.Columns.Add(typeValue);
            dtRelType.Rows.Add("AMBAS AS TABELAS      ", " INNER JOIN ");
            dtRelType.Rows.Add("SOMENTE NA RELACIONADA", "  LEFT JOIN ");
            dtRelType.Rows.Add("SOMENTE NESTA         ", " RIGHT JOIN ");
            cbRelatedType.DataSource = dtRelType.DefaultView;

            /*
             * cbRelatedTable.DisplayMember = SXManager.TableDisplayMember;
             * cbRelatedTable.ValueMember   = SXManager.TableValueMember;
             * //*/

            // -------------------------------
            dataRelatedTable = new DataTable();
            dataRelatedTable.Columns.Add("display");
            dataRelatedTable.Columns.Add("value");
            cbRelatedTable.DisplayMember = "display";
            cbRelatedTable.ValueMember   = "value";
            cbRelatedTable.DataSource    = dataRelatedTable.DefaultView;
        }
Example #2
0
 public void AddChildTable(Table child)
 {
     this.CHILDREN.Add(child);
     //this.RELATEDTABLES.Add(child.TABLE);
     FormatScreen.AddControl(linksPainel, child, true, 3, false, false);
     //foreach(Table tab in this.CHILDREN)
     //    tab.popRelatedtables(dataRelatedChild);
 }
Example #3
0
        private void popScreenFromRecursiveTables()
        {
            panelParams.Controls.Clear();

            REPORT.Table.TableVo tabela = new REPORT.Table.TableVo();
            new REPORT.Table.TableDao().load(tabela, this.RELATORIO.ID, 0);

            DataTable tabelas = new REPORT.Params.ParamsDao().getRecursiveTables(tabela, "userParms_" + sigaSession.LoggedUser.ID, tabela.ID);

            if (tabelas.DefaultView.Count == 0)
            {
                btnExec_Click(null, null); destroy = true;
            }

            foreach (DataRow row in tabelas.Rows)
            {
                string tagFormat    = "@$TAB$@.$CAMPO$ ?? '@?@'";
                string controle     = (string)row["formato"];
                string strNomeCampo = new SigaObjects
                                      .SXManager(sigaSession.EMPRESAS[0].CODIGO)
                                      .getFields((string)row["tabela"], SigaObjects.SXManager.FieldValueMember
                                                 + " = '"
                                                 + (string)row["campo"]
                                                 + "'"
                                                 , null)
                                      .Rows[0][SigaObjects.SXManager.FieldDisplayMember].ToString();
                //
                // CONTROLE DE
                Control cDE   = FormatScreen.getObjectFromSigaType(controle);
                string  lblDE = strNomeCampo + "\t\t Entre  \t\t";
                cDE.Tag = tagFormat
                          .Replace("$TAB$", (string)row["tabela"])
                          .Replace("$CAMPO$", (string)row["campo"])
                          .Replace("??", ">=");

                FormatScreen.AddControl(panelParams, new Label(lblDE), true, 3, false, false);
                FormatScreen.AddControl(panelParams, cDE, true, 3, false, false);

                //
                // CONTROLE ATE
                Control cATE   = FormatScreen.getObjectFromSigaType(controle);
                string  lblATE = string.Format("{0,50}", "e");
                cATE.Tag = tagFormat
                           .Replace("$TAB$", (string)row["tabela"])
                           .Replace("$CAMPO$", (string)row["campo"])
                           .Replace("??", "<=");

                //FormatScreen.AddControl(panelParams, new Label(lblATE),true, 4, false, false);
                FormatScreen.AddControl(panelParams, cATE, true, 3, false, false);
            }
        }
Example #4
0
        private void menu_Click(object objSource, ToolBarItemEventArgs objArgs)
        {
            Control        inControl = this.Parent;
            SxMakeRelatory rel;

            REPORT.ReportVo report;
            string          relname = "";

            switch (objArgs.ToolBarButton.Name.ToLower())
            {
            case "tbbadd":
                #region ADD
                this.Parent.Controls.Clear();
                rel      = new SxMakeRelatory();
                rel.Dock = DockStyle.Fill;
                FormatScreen.AddControl(inControl, rel, true, 1, true, false);
                rel.btnAddNew_Click(null, null);
                #endregion

                break;

            case "tbbver":
                #region VER
                if (dgvReports.SelectedRows.Count > 0)
                {
                    DataRow row = (DataRow)(dgvReports.DataSource as DataView).Table.Rows[dgvReports.SelectedRows[0].Index];

                    /*
                     * Report cReport = new Report();
                     * cReport.LOAD((string)row["nome"], false);
                     *
                     * gridWindow grid = new gridWindow(cReport.TABLE.QUERY.ToString(), null);
                     * grid.SetGridHeader(cReport.TABLE.FIELDS.TOGRID);
                     * grid.showWindow();
                     * //*/

                    ControlsConfig.formShow(new ViewReport(int.Parse(row["id"].ToString())), this.Form, ControlsConfig.showType.Dialog, null, true);
                }
                #endregion

                break;

            case "tbbedit":
                #region EDIT
                if (dgvReports.SelectedRows.Count > 0)
                {
                    this.Parent.Controls.Clear();

                    DataRow row = (DataRow)(dgvReports.DataSource as DataView).Table.Rows[dgvReports.SelectedRows[0].Index];

                    rel      = new SxMakeRelatory();
                    rel.Dock = DockStyle.Fill;
                    FormatScreen.AddControl(inControl, rel, true, 1, true, false);
                    relname = (string)row["nome"];
                    rel.btnAbrir_Click(new Label(relname), null);
                }
                #endregion

                break;

            case "tbbdel":
                #region DEL
                if (dgvReports.SelectedRows.Count > 0)
                {
                    DataRow row = (DataRow)(dgvReports.DataSource as DataView).Table.Rows[dgvReports.SelectedRows[0].Index];

                    report = new REPORT.ReportVo();

                    report.ID            = int.Parse(row["id"].ToString());
                    report.IDREPORTGROUP = int.Parse(row["idreportgroup"].ToString());

                    SigaObjects.Reports.Table.TableVo maintable = new SigaObjects.Reports.Table.TableVo();
                    new SigaObjects.Reports.Table.TableDao().load(maintable, report.ID, 0);

                    new SigaObjects.Reports.Report.ReportDao().DeleteRecursiveTables(maintable.ID);
                    new SigaObjects.Reports.Report.ReportDao().delete(report);
                }
                #endregion

                break;

            case "tbbexcel":
                #region EXCEL
                FormatScreen.showNotImplemented();
                #endregion

                break;

            case "tbbpdf":
                #region PDF
                FormatScreen.showNotImplemented();
                #endregion

                break;

            default:
                break;
            }
        }