Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (cmbCampos.SelectedIndex >= 0)
            {
                DataRowView row = (DataRowView)cmbCampos.SelectedItem;

                string tipo = row["X3_TIPO"].ToString().ToUpper();
                string len  = row["X3_TAMANHO"].ToString();
                string obj  = FormatScreen.getObjectFromSigaType(tipo).GetType().ToString();

                REPORT.Params.ParamsVo parm = new REPORT.Params.ParamsVo();
                parm.MAINID  = this.MAIN.ID;
                parm.TAMANHO = int.Parse(len);
                parm.TABELA  = this.MAIN.TABLE;
                parm.CAMPO   = this.cmbCampos.SelectedValue.ToString();
                parm.FORMATO = tipo;
                parm.OBJETO  = obj;
                this.MAIN.THISTABLE.PARAMS.Add(parm);

                dados.Rows.Add(0                                         //id
                               , this.MAIN.ID                            //id da ligação
                               , len                                     //tamanho de digitação
                               , this.MAIN.TABLE                         //nome da tabela
                               , this.cmbCampos.SelectedValue.ToString() //campo
                               , tipo                                    //formato
                               , obj                                     //objeto
                               );
            }
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
        private void linksPainel_AjustControls()
        {
            List <Control> controls = new List <Control>();

            foreach (Control c in linksPainel.Controls)
            {
                controls.Add(c);
                //(c as Table).THISTABLE.INDEX = linksPainel.Controls.IndexOf(c);
            }

            FormatScreen.Ajust2EqualsWidthControls(controls.ToArray(), linksPainel.Width, false);
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        private void CadContasAPagar_VisibleChanged(object sender, EventArgs e)
        {
            FormatScreen.setIcon(this);
            popScreen();

            if (this.readOnly ||
                conta.STATUS == 1 ||
                conta.STATUS == 4)
            {
                FormatScreen.lockControls(this, typeof(TextBox), typeof(Button), typeof(DateTimePicker), typeof(NumericUpDown));
            }

            FormatScreen.addEventTag(this, "*");
            FormatScreen.addEventTag(this, FormatScreen.TIPOS.MOEDA, "$");
        }
Ejemplo n.º 7
0
        private void cbFields_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbFields.SelectedIndex >= 0)
            {
                DataRow row  = (cbFields.DataSource as DataView).Table.Rows[cbFields.SelectedIndex];
                int     left = txtFilter.Left;
                int     top  = txtFilter.Top;

                panel1.Controls.Remove(txtFilter);
                txtFilter = FormatScreen.getObjectFromSigaType((string)row["X3_TIPO"]);
                txtFilter.Update();
                txtFilter.Left = left;
                txtFilter.Top  = top;
                panel1.Controls.Add(txtFilter);
            }
        }
Ejemplo n.º 8
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;
            }
        }
Ejemplo n.º 9
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string erro = FormatScreen.ValidateTextControls(this, typeof(TextBox));

            if (erro.Length > 0)
            {
                MessageBox.Show(erro, "ERRO DE PREENCHIMENTO");
            }
            else
            {
                conta.EMPRESA = empresa.CODIGO;
                conta.FILIAL  = empresa.CODIGO_FILIAL;

                conta.PREFIXO    = txtPREFIXO.Text;
                conta.NUMTITULO  = txtNUMTITULO.Text;
                conta.PARCELA    = txtPARCELA.Text;
                conta.NATUREZA   = txtNATUREZA.Text;
                conta.FORNECEDOR = txtFORNECEDOR.Text;
                conta.LOJA       = txtLOJA.Text;
                conta.EMISSAO    = dtpEMISSAO.Value;
                conta.VENCIMENTO = dtpVENCIMENTO.Value;
                conta.VALOR      = decimal.Parse(txtVALOR.Text, CultureInfo.InvariantCulture);
                conta.ISS        = decimal.Parse(txtISS.Text, CultureInfo.InvariantCulture);
                conta.IRRF       = decimal.Parse(txtIRRF.Text, CultureInfo.InvariantCulture);
                conta.HISTORICO  = txtHISTORICO.Text.Trim();
                conta.INSS       = decimal.Parse(txtINSS.Text, CultureInfo.InvariantCulture);
                conta.COFINS     = decimal.Parse(txtCOFINS.Text, CultureInfo.InvariantCulture);
                conta.PISPASEP   = decimal.Parse(txtPISPASEP.Text, CultureInfo.InvariantCulture);
                conta.CSLL       = decimal.Parse(txtCSLL.Text, CultureInfo.InvariantCulture);

                conta.STATUS         = 2;
                conta.ObsSolicitante = txtOBS_SOL.Text.Trim();

                conta.USERID = sigaSession.LoggedUser.ID;

                try
                {
                    new ContasAPagarDAO().save(conta);
                    MessageBox.Show("Cadastro feito com sucesso.");
                }
                catch (Exception EX)
                { MessageBox.Show(EX.Message); return; }

                string subject = "CONTAS A PAGAR / " + lblEmpresaFilial.Text + " / " + DateTime.Now.ToString("dddd dd/MM/yyyy hh:mm:ss");

                StringBuilder bodyMail = new StringBuilder(subject);
                bodyMail.AppendLine();
                bodyMail.AppendLine("EMPRESA / FILIAL\t\t: " + lblEmpresaFilial.Text);
                bodyMail.AppendLine("Prefixo - Numero do Titulo\t\t: " + conta.PREFIXO + " - " + conta.NUMTITULO);
                bodyMail.AppendLine("Parcela / Natureza\t\t: " + conta.PARCELA + " - " + conta.NATUREZA);
                bodyMail.AppendLine("Fornecedor / Loja : " + conta.FORNECEDOR + " - " + txtNOMEFORNECEDOR.Text + " / " + conta.LOJA);
                bodyMail.AppendLine(String.Format("{0,-11} : {1,-10}", "Emissao", conta.EMISSAO.ToString("dd/MM/yyyy")));
                bodyMail.AppendLine(String.Format("{0,-11} : {1,-10}", "Vencimento", conta.VENCIMENTO.ToString("dd/MM/yyyy")));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "Valor", conta.VALOR.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1,-10}", "Historico", conta.HISTORICO));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "ISS", conta.ISS.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "IRFF", conta.IRRF.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "INSS", conta.INSS.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "COFINS", conta.COFINS.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "PIS/PASEP", conta.PISPASEP.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine(String.Format("{0,-11} : {1, 10}", "CSLL", conta.CSLL.ToString("C", new CultureInfo("pt-BR"))));
                bodyMail.AppendLine();
                bodyMail.AppendLine("------------------------------");
                bodyMail.AppendLine("Obs Solicitante : " + sigaSession.LoggedUser.NAME);
                bodyMail.AppendLine(conta.ObsSolicitante);
                bodyMail.AppendLine("------------------------------");
                bodyMail.AppendLine();
                bodyMail.AppendLine("Obs Aprovador:");
                bodyMail.AppendLine(conta.ObsAprovador);

                SigaObjects.Session.SysUsers.SysUserVo mailSender = new SigaObjects.Session.SysUsers.SysUserVo();
                new SigaObjects.Session.SysUsers.SysUserDao().load(mailSender, "admin");

                try
                {
                    new Carralero.Net.Email(mailSender.MAILADDRESS
                                            , subject
                                            , bodyMail
                                            , mailSender.MAILADDRESS
                                            , mailSender.MAILUSER
                                            , mailSender.MAILPASSWD
                                            , mailSender.MAILSERVER
                                            , mailSender.MAILDOOR).Enviar();

                    MessageBox.Show("Email Enviado com sucesso!");
                    this.Form.Close();
                }
                catch (Exception EX)
                { MessageBox.Show(Carralero.ExceptionControler.getStrException(EX)); }

                //this.Form.Close();
            }
        }