Exemple #1
0
 public override string ToString()
 {
     return(VALOR.ToString("Valor: " + VALOR));
 }
Exemple #2
0
        private void BtnIncluir_Click(object sender, EventArgs e)
        {
            //Valida COD
            if (TextBoxCOD.Text.Length == 0)
            {
                MessageBox.Show("Favor informar o código"); TextBoxCOD.Focus(); return;
            }

            //Valida Operação
            if (CmbBoxOp.SelectedIndex == -1)
            {
                MessageBox.Show("Favor informar a operação"); CmbBoxOp.Focus(); return;
            }

            //Valida Valor
            if (TextBoxValor.Text.Length == 0 && CmbBoxOp.Text != "Resgate Total")
            {
                MessageBox.Show("Favor informar o valor da operação"); TextBoxValor.Focus(); return;
            }

            //Valida Conta se for Resgate
            if (TextBoxBanco.Text.Length == 0 && CmbBoxOp.Text != "Aplicação")
            {
                MessageBox.Show("Favor informar o banco"); TextBoxBanco.Focus(); return;
            }
            if (TextBoxAg.Text.Length == 0 && CmbBoxOp.Text != "Aplicação")
            {
                MessageBox.Show("Favor informar a Agencia"); TextBoxAg.Focus(); return;
            }
            if (TextBoxConta.Text.Length == 0 && CmbBoxOp.Text != "Aplicação")
            {
                MessageBox.Show("Favor informar a Conta"); TextBoxConta.Focus(); return;
            }
            if (TextBoxDCC.Text.Length == 0 && CmbBoxOp.Text != "Aplicação")
            {
                MessageBox.Show("Favor informar o Digito"); TextBoxDCC.Focus(); return;
            }

            DistribuidorAux = Distribuidores.FirstOrDefault(x => x.CNPJ.ToString() == CmbBoxDistribuidor.SelectedValue.ToString());

            string  NOME    = DistribuidorAux.PREFIXOCEO + " " + TextBoxCOD.Text;
            long    CPFCNPJ = DistribuidorAux.CNPJ;
            string  OP;
            long    CODFUND = Convert.ToInt64(CmbBoxFIQ.SelectedValue);
            decimal VALOR;
            string  STATUS = "Pendente";
            string  CONTA;

            if (CmbBoxOp.Text == "Aplicação")
            {
                OP = "AP"; VALOR = Convert.ToDecimal(TextBoxValor.Text);
            }
            else if (CmbBoxOp.Text == "Resgate")
            {
                OP = "R"; VALOR = Convert.ToDecimal(TextBoxValor.Text);
            }
            else if (CmbBoxOp.Text == "Resgate por Cotas")
            {
                OP = "RC"; VALOR = Convert.ToDecimal(TextBoxValor.Text);
            }
            else
            {
                OP = "RT"; VALOR = 0;
            }

            if (OP != "AP")
            {
                long BANCO   = Convert.ToInt16(TextBoxBanco.Text);
                long AGENCIA = Convert.ToInt64(TextBoxAg.Text);
                long CC      = Convert.ToInt64(TextBoxConta.Text);
                long DIGITO  = Convert.ToInt64(TextBoxDCC.Text);

                CONTA = BANCO.ToString() + " - " + AGENCIA.ToString() + " - " + CC.ToString() + " - " + DIGITO.ToString();
            }
            else
            {
                CONTA = "VIA TED";
            }

            DataGridBoletas.Rows.Add(new string[] { NOME, CPFCNPJ.ToString(), "", OP, Fundos.FirstOrDefault(x => x.CODFUND == CODFUND).NOME, CODFUND.ToString(), VALOR.ToString(), CONTA, STATUS });

            //Limpar Dados do DataGrid
            CmbBoxFIQ.SelectedIndex = -1; CmbBoxFIQ.Text = "";

            //Limpa
            CmbBoxOp.SelectedIndex = -1;

            //limpa dados boleta
            TextBoxCOD.Text = ""; TextBoxValor.Text = "";

            //Limpa dados conta credito
            TextBoxBanco.Text = ""; TextBoxAg.Text = ""; TextBoxConta.Text = "";
        }
Exemple #3
0
 public void SetValor(VALOR rango)
 {
     this.valor = (int)rango;
 }
Exemple #4
0
        private void BtnImportar_Click(object sender, EventArgs e)
        {
            //Valida se todos CNPJS são iguais
            //Valida Linha a Linha
            string CNPJ = TextImporta.Lines[0].Split(';')[21];

            //Se posssuir CNPJs Diferentes
            foreach (string Line in TextImporta.Lines)
            {
                if (CNPJ != Line.Split(';')[21])
                {
                    MessageBox.Show("CNPJs Diferentes!"); return;
                }
            }

            for (int i = 0; i < Distribuidores.Count; i++)
            {
                if (Distribuidores[i].CNPJ == Convert.ToInt64(new Regex(@"[^\d]").Replace(CNPJ, "")))
                {
                    CmbBoxDistribuidor.SelectedIndex = i;
                }
            }

            if (CmbBoxDistribuidor.SelectedIndex == -1)
            {
                MessageBox.Show("CNPJ não reconhecido!");
            }

            PanelOrdem.Enabled         = true;
            CmbBoxDistribuidor.Enabled = false;

            //Valida Dados
            foreach (string Line in TextImporta.Lines)
            {
                if (Line.Split(';').Count() != 23)
                {
                    TextImporta.Text = ""; MessageBox.Show("Importação inválida!");  return;
                }
            }

            //Valida Linha a Linha
            foreach (string Line in TextImporta.Lines)
            {
                try
                {
                    if (Line.Substring(0, 2) == "ID")
                    {
                        continue;
                    }

                    string  NOME;
                    long    CPFCNPJ;
                    string  OP;
                    long    CODFUND;
                    decimal VALOR;
                    string  STATUS;
                    string  CONTA;

                    BL_FIQ FundoAux = Fundos.FirstOrDefault(x => x.CNPJ == Convert.ToInt64(new Regex(@"[^\d]").Replace(Line.Split(';')[3], "")));

                    CPFCNPJ = Convert.ToInt64(new Regex(@"[^\d]").Replace(Line.Split(';')[21], ""));

                    if (Line.Split(';')[4] == "A")
                    {
                        OP = "AP"; VALOR = Convert.ToDecimal(Line.Split(';')[6]);
                    }
                    else if (Line.Split(';')[4] == "RP")
                    {
                        OP = "R"; VALOR = Convert.ToDecimal(Line.Split(';')[6]);
                    }
                    else if (Line.Split(';')[4] == "RC")
                    {
                        OP = "RC"; VALOR = Convert.ToDecimal(Line.Split(';')[5]);
                    }
                    else
                    {
                        OP = "RT"; VALOR = 0;
                    }

                    NOME    = Line.Split(';')[2];
                    CODFUND = FundoAux.CODFUND;
                    STATUS  = "Pendente";

                    if (OP != "AP")
                    {
                        long BANCO;
                        long AGENCIA;
                        long CC;
                        long DIGITO;

                        BANCO   = Convert.ToInt16(Line.Split(';')[9]);
                        AGENCIA = Convert.ToInt16(Line.Split(';')[10]);

                        //Se não tiver digito, converte ultimo digito da  conta em digito verificador
                        if (Line.Split(';')[12].Length == 0)
                        {
                            CC     = Convert.ToInt32(Line.Split(';')[11].Substring(0, Line.Split(';')[11].Length - 1));
                            DIGITO = Convert.ToInt16(Line.Split(';')[11].Substring(Line.Split(';')[11].Length - 1, 1));
                        }
                        else
                        {
                            CC     = Convert.ToInt32(Line.Split(';')[11]);
                            DIGITO = Convert.ToInt16(Line.Split(';')[12]);
                        }

                        CONTA = BANCO + " - " + AGENCIA + " - " + CC + " - " + DIGITO;
                    }
                    else
                    {
                        CONTA = "VIA TED";
                    }

                    DataGridBoletas.Rows.Add(new string[] { NOME, CPFCNPJ.ToString(), "", OP, FundoAux.NOME, FundoAux.CODFUND.ToString(), VALOR.ToString(), CONTA, STATUS });
                }
                catch { MessageBox.Show("Linha não processada: " + Line); }
            }

            TextImporta.Text = "";
        }