Example #1
0
        //Concluir ou Excluir
        private void BtnOp_Click(object sender, EventArgs e)
        {
            if (BtnOp.Text == "C")
            {
                Ordem.Editar(Ordem.IDORDEM, "Concluído");

                foreach (BL_Boleta Bol in new BL_Boleta().DadosIDORDEM(Ordem.IDORDEM).Where(x => x.STATUS == "Boletado"))
                {
                    Bol.Editar(Bol.IDBOLETA, Bol.COTIZACAO, Bol.IMPACTO, "Concluído");
                }

                Ordem = new BL_Ordem().DadosPorIDORDEM(Ordem.IDORDEM);
                RefreshData();
            }
            else if (BtnOp.Text == "X")
            {
                List <BL_Boleta> BoletasControle = new BL_Boleta().DadosIDORDEM(Ordem.IDORDEM);

                if (BoletasControle.Count == BoletasControle.Where(x => x.STATUS != "Boletado" && x.STATUS != "Concluído").Count())
                {
                    foreach (BL_Boleta Bol in BoletasControle)
                    {
                        Bol.Deletar(Bol.IDBOLETA);
                        new BL_RegistroResgate().DeletarIDBOLETA(Bol.IDBOLETA);
                    }

                    Ordem.Deletar(Ordem.IDORDEM);
                    PainelControle.Controls.Remove(this);
                }
                else
                {
                    MessageBox.Show("Exitem boletas já processadas. Controle Atualizado.");
                }
            }
        }
Example #2
0
        private void MenuBoletaVerificar_Click(object sender, EventArgs e)
        {
            BL_Boleta Aux = new BL_Boleta().BoletaPorIDBOLETA(Convert.ToInt64(DataGridBoletas.SelectedRows[0].Cells[0].Value));

            Usuario = new BL_Usuario().DadosNome(WINDOWSNAME);
            if (Usuario != null && Usuario.USUARIO != "" && Usuario.SENHA != "")
            {
                if (Aux.VerificarCotista(Aux.CODCOT, Aux.CODFUND, Properties.Settings.Default.Usuario, Properties.Settings.Default.Senha) == "Liberado")
                {
                    Aux.Editar(Aux.IDBOLETA, Aux.COTIZACAO, Aux.IMPACTO, "Liberado");
                }
                else
                {
                    MessageBox.Show("Cadastro não liberado!");
                }
            }
            else
            {
                MessageBox.Show("Favor verificar usuário e senha nas Configurações.");
            }

            //Atualiza Boletas e o controle
            Ordem = Ordem.DadosPorIDORDEM(Ordem.IDORDEM);
            RefreshData();
        }
Example #3
0
        private void MenuBoletaCancelar_Click(object sender, EventArgs e)
        {
            BL_Boleta BoletaAux = new BL_Boleta().BoletaPorIDBOLETA(Convert.ToInt64(DataGridBoletas.SelectedRows[0].Cells[0].Value));

            if (BoletaAux.STATUS == "Liberado" || BoletaAux.STATUS == "Pendente" || BoletaAux.STATUS == "Cadastro Pendente" || BoletaAux.STATUS == "TCR Pendente")
            {
                BoletaAux.Editar(BoletaAux.IDBOLETA, BoletaAux.COTIZACAO, BoletaAux.IMPACTO, "Cancelado");
                new BL_RegistroResgate().EditarIDBOLETA(BoletaAux.IDBOLETA, "Cancelado");
            }

            //Atualiza Boletas e o controle
            Ordem = Ordem.DadosPorIDORDEM(Ordem.IDORDEM);
            RefreshData();
        }
Example #4
0
        private void BtnGerarOrdem_Click(object sender, EventArgs e)
        {
            //Valida se possui boletas
            if (DataGridBoletas.Rows.Count == 0)
            {
                MessageBox.Show("Nenhuma boleta no DataGrid!"); return;
            }

            string IDORDEM = new BL_Ordem().Inserir(LabelEmail.Text, LabelAssunto.Text);

            foreach (DataGridViewRow DR in DataGridBoletas.Rows)
            {
                new BL_Boleta().Inserir(IDORDEM, Convert.ToInt64(DR.Cells[0].Value), Convert.ToInt64(DR.Cells[1].Value), DR.Cells[6].Value.ToString(), Convert.ToDateTime(DR.Cells[9].Value),
                                        Convert.ToDateTime(DR.Cells[10].Value), DR.Cells[5].Value.ToString(), Convert.ToDecimal(DR.Cells[7].Value), DR.Cells[8].Value.ToString(), Convert.ToInt64(DR.Cells[11].Value));
            }

            DataGridBoletas.Rows.Clear();

            //Criar Email de Recebimento.
            string HTML = new HTML().ConfirmaRecebimento(new BL_Boleta().DadosIDORDEM(IDORDEM));

            MailItem EmailReply = EmailRecebido.ReplyAll();

            EmailReply.Recipients.Add("*****@*****.**");
            EmailReply.HTMLBody = "<HTML><BODY>" + HTML + "</BODY></HTML>" + EmailReply.HTMLBody;
            if (CheckRecebimento.Checked)
            {
                EmailReply.Send();
            }
            else
            {
                EmailReply.Display();
            }

            Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
            NameSpace  nameSpace            = outlook.GetNamespace("MAPI");
            MAPIFolder mapiFolderPurchase   = nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Parent;
            MAPIFolder BoletadosFolder      = mapiFolderPurchase.Folders["Boletas do Dia"];
            MAPIFolder BoletadosRecebimento = mapiFolderPurchase.Folders["Boletas Recebidas"];

            //EmailRecebido.Move(BoletadosFolder);
            //EmailReply.Move(BoletadosRecebimento);

            MessageBox.Show("Ordem Gerada!");
        }
Example #5
0
        private void MenuBoletaBoletar_Click(object sender, EventArgs e)
        {
            BL_Boleta Aux = new BL_Boleta().BoletaPorIDBOLETA(Convert.ToInt64(DataGridBoletas.SelectedRows[0].Cells[0].Value));

            Usuario = new BL_Usuario().DadosNome(WINDOWSNAME);
            if (Usuario != null && Usuario.USUARIO != "" && Usuario.SENHA != "")
            {
                Aux.Boletar(Aux, Usuario.USUARIO, Usuario.SENHA);
            }
            else
            {
                MessageBox.Show("Favor verificar usuário e senha nas Configurações.");
            }

            //Atualiza Boletas e o controle
            Ordem = Ordem.DadosPorIDORDEM(Ordem.IDORDEM);
            RefreshData();
        }
Example #6
0
        //Métodos para Boletas
        #region
        private void MenuBoletaExcluir_Click(object sender, EventArgs e)
        {
            BL_Boleta BoletaAux = new BL_Boleta().BoletaPorIDBOLETA(Convert.ToInt64(DataGridBoletas.SelectedRows[0].Cells[0].Value));

            if (BoletaAux.STATUS == "Liberado" || BoletaAux.STATUS == "Pendente")
            {
                BoletaAux.Deletar(BoletaAux.IDBOLETA);
                new BL_RegistroResgate().DeletarIDBOLETA(BoletaAux.IDBOLETA);
            }
            else
            {
                MessageBox.Show("Boleta não estava Liberada ou Pendete");
            }

            //Atualiza Boletas e o controle
            Ordem = Ordem.DadosPorIDORDEM(Ordem.IDORDEM);
            RefreshData();
        }
Example #7
0
        //Gerar Emails Relacionados a Ordens Boletadas
        private void BtnGerarEmails_Click(object sender, RibbonControlEventArgs e)
        {
            List <BL_Ordem>  Ordens  = new BL_Ordem().DadosPorData(DateTime.Today).Where(x => x.STATUS == "Boletado").ToList();
            List <BL_Boleta> Boletas = new BL_Boleta().DadosDia(DateTime.Today);

            //Seleciona a pasta Boletas Recebidas
            Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
            NameSpace  nameSpace          = outlook.GetNamespace("MAPI");
            MAPIFolder mapiFolderPurchase = nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Parent;
            MAPIFolder BoletadosFolder    = mapiFolderPurchase.Folders["Boletas Recebidas"];

            foreach (MailItem Email in BoletadosFolder.Items.OfType <MailItem>())
            {
                if (Ordens.Where(x => Email.Body.Contains("ID ORDEM (" + x.IDORDEM + ")")).Count() == 1)
                {
                    BL_Ordem OrdemEmail = Ordens.FirstOrDefault(x => Email.Body.Contains("ID ORDEM (" + x.IDORDEM + ")"));

                    string HTML = "";

                    if (Boletas.Where(x => x.IDORDEM == OrdemEmail.IDORDEM).Count() > 2)
                    {
                        HTML = new HTML().ConfirmaTabela(Boletas.Where(x => x.IDORDEM == OrdemEmail.IDORDEM).ToList());
                    }
                    else
                    {
                        HTML = new HTML().ConfirmaIndividual(Boletas.Where(x => x.IDORDEM == OrdemEmail.IDORDEM).ToList());
                    }

                    MailItem EmailReply = Email.ReplyAll();
                    EmailReply.HTMLBody = HTML + EmailReply.HTMLBody;
                    EmailReply.Display();

                    //if (MessageBox.Show("Deseja enviar o Email gerado?", "Envio de Email", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    //{
                    //    //EmailReply.Send();
                    //    //OrdemEmail.Editar(OrdemEmail.IDORDEM, "Concluído");
                    //}
                    //else { EmailReply.Close(OlInspectorClose.olDiscard); }
                }
            }
        }
Example #8
0
        //Btns Clicks
        #region
        private void BtnGerarOrdem_Click(object sender, EventArgs e)
        {
            //Verificar se todos cotistas estão liberados
            if (DataGridBoletas.Rows.OfType <DataGridViewRow>().Where(r => r.Cells[8].Value.ToString() != "Liberado").Count() > 0)
            {
                MessageBox.Show("Verificar Cotistas não Liberados!"); return;
            }

            string IDORDEM = new BL_Ordem().Inserir("C&O", "C&O");

            foreach (DataGridViewRow DR in DataGridBoletas.Rows)
            {
                new BL_Boleta().Inserir(IDORDEM, Convert.ToInt64(DR.Cells[2].Value), Convert.ToInt64(DR.Cells[5].Value), DR.Cells[8].Value.ToString(),
                                        DateTime.Today, DateTime.Today, DR.Cells[3].Value.ToString(), Convert.ToDecimal(DR.Cells[6].Value), DR.Cells[7].Value.ToString());
            }

            //Limpa Formulário
            {
                //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 = "";

                //Limpa DataGrid
                DataGridBoletas.Rows.Clear();

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

            MessageBox.Show("Ordem Gerada!");
        }
Example #9
0
        private void BtnGerarOrdem_Click(object sender, EventArgs e)
        {
            string IDORDEM;

            //Valida se possui boletas
            if (DataGridBoletas.Rows.Count == 0)
            {
                MessageBox.Show("Nenhuma boleta no DataGrid!"); return;
            }

            //Valida se o metodo for de incluir Ordem, se possui ordem selecionada.
            if (CheckIncluirAOrdem.Checked && CmbOrdem.SelectedIndex == -1)
            {
                MessageBox.Show("Nenhuma ordem selecionada!"); CmbOrdem.Focus(); return;
            }
            //inserre a ordem na base e retorna a id criptografada da ordem
            else if (!CheckIncluirAOrdem.Checked)
            {
                IDORDEM = new BL_Ordem().Inserir("Manual", "Manual");
            }
            else
            { //recupera a id da ordem selecionada e limpa o formulário
                IDORDEM                    = CmbOrdem.Text;
                CmbOrdem.Enabled           = false;
                CmbOrdem.SelectedIndex     = -1;
                CheckIncluirAOrdem.Checked = false;
            }

            foreach (DataGridViewRow DR in DataGridBoletas.Rows)
            {
                new BL_Boleta().Inserir(IDORDEM, Convert.ToInt64(DR.Cells[0].Value), Convert.ToInt64(DR.Cells[1].Value), DR.Cells[6].Value.ToString(), Convert.ToDateTime(DR.Cells[9].Value),
                                        Convert.ToDateTime(DR.Cells[10].Value), DR.Cells[5].Value.ToString(), Convert.ToDecimal(DR.Cells[7].Value), DR.Cells[8].Value.ToString(), Convert.ToInt64(DR.Cells[11].Value));
            }

            DataGridBoletas.Rows.Clear();
            DataGridBoletas.Columns["Cautela"].Visible = false;
        }
Example #10
0
        //Atualizar Dados Movimentações ou Ordens
        private void AtualizarDados()
        {
            if (CmbBoxVisualiza.Text == "Ordens")
            {
                List <BL_Ordem> Ordens = new BL_Ordem().DadosPorData(DateTime.Today);

                PanelOrdens.Controls.Clear();

                //Dicionario Auxiliar
                Dictionary <string, Int64> StatusCheck = new Dictionary <string, Int64>();

                foreach (BL_Ordem Ordem in Ordens)
                {
                    if (!StatusCheck.ContainsKey(Ordem.STATUS))
                    {
                        StatusCheck.Add(Ordem.STATUS, 1);
                    }
                    else
                    {
                        StatusCheck[Ordem.STATUS]++;
                    }

                    PanelOrdens.Controls.Add(new OrdemControl(PanelOrdens)
                    {
                        SetOrdem = Ordem
                    });
                }

                DataGridOrdens.Visible = false;
                PanelOrdens.Visible    = true;

                //Limpa DataGridStatus
                DataGridStatus.Rows.Clear();

                //Adiciona Linhas ao StatusGrid
                foreach (var Item in StatusCheck)
                {
                    DataGridStatus.Rows.Add(new string[] { "true", Item.Key, Item.Value.ToString() });
                }
            }
            else
            {
                DataGridOrdens.Rows.Clear();

                List <BL_Boleta> Boletas = new List <BL_Boleta>();
                Boletas = Boletas.Concat(new BL_Boleta().DadosDia(DateTime.Today)).ToList();
                Boletas = Boletas.Concat(new BL_Boleta().DadosZeragemDia(DateTime.Today)).ToList();

                foreach (BL_Boleta BL in Boletas)
                {
                    string status = BL.STATUS;
                    //if (BL.STATUS.Length>=12)
                    //    status = BL.STATUS.Substring(0, 12);
                    DataGridOrdens.Rows.Add(new string[] { BL.IDBOLETA.ToString(), BL.IDORDEM.ToString(), BL.CODCOT.ToString(), BL.CPFCNPJ.ToString(), BL.NOME, BL.FUNDO, BL.OPERACAO, BL.VALOR.ToString(), BL.CONTA, status });
                }

                PanelOrdens.Visible    = false;
                DataGridOrdens.Visible = true;
                DataGridOrdens.ClearSelection();

                //Limpa DataGridStatus
                DataGridStatus.Rows.Clear();

                //Dicionario Auxiliar
                Dictionary <string, Int64> StatusCheck = new Dictionary <string, Int64>();

                //ColumnIndex
                int ColumnAux = new int();
                foreach (DataGridViewColumn Col in DataGridOrdens.Columns)
                {
                    if (Col.Name == "STATUS_")
                    {
                        ColumnAux = Col.Index;
                    }
                }

                //Adicionar Status ao DataGridStatus
                foreach (DataGridViewRow DR in DataGridOrdens.Rows)
                {
                    string Status = DR.Cells[ColumnAux].Value.ToString();
                    if (!StatusCheck.ContainsKey(Status))
                    {
                        StatusCheck.Add(Status, 1);
                    }
                    else
                    {
                        StatusCheck[Status]++;
                    }
                }

                //Adiciona Linhas ao StatusGrid
                foreach (var Item in StatusCheck)
                {
                    DataGridStatus.Rows.Add(new string[] { "true", Item.Key, Item.Value.ToString() });
                }
            }
        }