Example #1
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (!ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text))
            {
                errorProvider1.SetError(msktDataInicial, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
            {
                errorProvider1.SetError(msktDataFinal, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #2
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (txtArquivoRemessa.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label27, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (mkDtPagto.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(mkDtPagto.Text))
            {
                errorProvider1.SetError(label2, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (TotalGeral == 0)
            {
                string msgerro = "Não Existem Duplicatas Selecionadas!";
                errorProvider1.SetError(label1, msgerro);
                Util.ExibirMSg(msgerro, "Red");
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }

            return(result);
        }
Example #3
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            //if (Convert.ToInt32(cbFuncionario.SelectedValue) < 0)
            //{
            //    errorProvider1.SetError(cbFuncionario, ConfigMessage.Default.CampoObrigatorio);
            //    Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
            //    result = false;
            //}
            //else
            if (!ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text))
            {
                errorProvider1.SetError(msktDataInicial, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
            {
                errorProvider1.SetError(msktDataFinal, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #4
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (msktDataPagto.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(msktDataPagto.Text))
            {
                errorProvider1.SetError(msktDataPagto, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                msktDataPagto.Focus();
                result = false;
            }
            else if (txtValorPago.Text.Trim().Length == 0 || txtValorPago.Text == "0,00" ||
                     !ValidacoesLibrary.ValidaTipoDecimal(txtValorPago.Text) || Convert.ToDecimal(txtValorPago.Text) < 0)
            {
                errorProvider1.SetError(txtValorPago, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                txtValorPago.Focus();
                result = false;
            }
            else if (Convert.ToInt32(cbContaCorrente.SelectedValue) > 0 && Convert.ToInt32(cbNomeMovimentacao.SelectedValue) < 1)
            {
                errorProvider1.SetError(cbContaCorrente, ConfigMessage.Default.FieldErro);
                errorProvider1.SetError(cbNomeMovimentacao, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #5
0
 private void msktDataEmissao_Validating(object sender, CancelEventArgs e)
 {
     errorProvider1.Clear();
     if (!ValidacoesLibrary.ValidaTipoDateTime(msktDataEntrega.Text))
     {
         MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
         errorProvider1.SetError(msktDataEntrega, ConfigMessage.Default.MsgDataInvalida);
     }
 }
Example #6
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (maskedtxtCPF.Text != "   .   .   -")
            {
                if (!ValidacoesLibrary.ValidaCPF(maskedtxtCPF.Text))
                {
                    MessageBox.Show(ConfigMessage.Default.CPFErro);
                    maskedtxtCPF.Focus();
                    result = false;
                }
            }


            if (txtNome.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(txtNome, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }

            if (maskedtxtDataAd.Text != "  /  /")
            {
                if (!ValidacoesLibrary.ValidaTipoDateTime(maskedtxtDataAd.Text))
                {
                    errorProvider1.SetError(maskedtxtDataAd, ConfigMessage.Default.MsgDataInvalida);
                    MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
                    result = false;
                }
            }

            if (maskedtxtComissao.Text != string.Empty)
            {
                if (!ValidacoesLibrary.ValidaTipoDecimal(maskedtxtComissao.Text))
                {
                    errorProvider1.SetError(maskedtxtComissao, ConfigMessage.Default.FieldErro);
                    MessageBox.Show(ConfigMessage.Default.FieldErro);
                    result = false;
                }
                else if (ValidacoesLibrary.ValidaTipoPorc(maskedtxtComissao.Text))
                {
                    errorProvider1.SetError(maskedtxtComissao, ConfigMessage.Default.FieldErro);
                    MessageBox.Show(ConfigMessage.Default.FieldErro);
                    result = false;
                }
            }

            else
            {
                errorProvider1.SetError(txtNome, "");
            }


            return(result);
        }
Example #7
0
        private void GerarBoletoCaixa2()
        {
            try
            {
                //Dados da Empresa Registro
                EMPRESAEntity EMPRESATy = EMPRESAP.Read(1);

                //Dados para emitir boleto
                //  string data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");// Data de Vencimento do Boleto
                string data_vencimento = VectoSuporte;
                if (!ValidacoesLibrary.ValidaTipoDateTime(data_vencimento))
                {
                    data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");                                             // Data de Vencimento do Boleto
                }
                string nosso_numero = Util.RetiraLetras(EMPRESATy.CNPJCPF.Substring(0, 5) + DateTime.Now.ToString("yyyy/MM/dd")); // Nosso Numero

                //==Os Campos Abaixo são Opcionais=================
                string instrucoes  = ""; //;//Instruçoes para o Cliente
                string instrucoes1 = ""; // "CAIXA NAO RECEBER APOS O VENCIMENTO"; // Por exemplo "Não receber apos o vencimento" ou "Cobrar Multa de 1% ao mês"
                string instrucoes2 = "APOS O VENCIMENTO MULTA DE R$ 5,90";
                string instrucoes3 = "E JUROS DE R$ 0,08 AO DIA";
                string instrucoes4 = "";

                string valor            = ValorSuporte.Replace(".", "").Replace(",", ".");
                string numero_documento = nosso_numero;// Numero do Pedido ou Nosso Numero

                //===Dados do seu Cliente (Opcional)===============
                string CPFCNPJ   = EMPRESATy.CNPJCPF;
                string sacado    = EMPRESATy.NOMEFANTASIA;
                string endereco1 = EMPRESATy.ENDERECO + " " + EMPRESATy.NUMERO;
                string endereco2 = EMPRESATy.CIDADE + " " + EMPRESATy.UF;

                // string arquivo = "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=D1D5DDDB110085CADEC57652A01F6FF3465B51FC2219775E2B9F2FE812CDF718&description=Renovação de suporte&amount=" + valor + "&payerName=" + sacado + "&payerCpfCnpj=" + CPFCNPJ + "&dueDate=" + data_vencimento;
                string arquivo = "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=3BCD01EBBE5A5ED816C48390E581FF1A3FF4F46D566B7609EE21440E5629F43B&description=Renovação de suporte&amount=" + valor + "&payerName=" + sacado + "&payerCpfCnpj=" + CPFCNPJ + "&dueDate=" + data_vencimento;

                string   json  = new System.Net.WebClient().DownloadString(arquivo);
                string[] words = json.Split(',');
                string   link  = "";
                foreach (string word in words)
                {
                    int Pos1 = word.IndexOf(":");
                    if (word.IndexOf("link") != -1)
                    {
                        link = word.Substring(Pos1 + 2);
                        link = link.Substring(0, link.Length - 1);
                        System.Diagnostics.Process Processo1 = System.Diagnostics.Process.Start(link);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao gerar boleto!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #8
0
        private Boolean ValidaDuplicatas()
        {
            errorProvider1.Clear();
            Boolean result = true;

            if (Convert.ToInt32(cbCliente.SelectedValue) < 1)
            {
                errorProvider1.SetError(cbCliente, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (txtDuplicata.Text.Trim().Length < 1)
            {
                errorProvider1.SetError(txtDuplicata, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDecimal(txtVlPedido.Text) || txtVlPedido.Text == "0,00")
            {
                errorProvider1.SetError(txtVlPedido, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoInt32(txtNParcelas.Text) || Convert.ToInt32(txtNParcelas.Text) < 1)
            {
                errorProvider1.SetError(txtNParcelas, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoInt32(txtDiasVencimento.Text))
            {
                errorProvider1.SetError(txtDiasVencimento, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(mkdataInicial.Text))
            {
                errorProvider1.SetError(mkdataInicial, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(mkDataVecto.Text))
            {
                errorProvider1.SetError(mkDataVecto, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #9
0
 private void txtData_Leave(object sender, EventArgs e)
 {
     if (!ValidacoesLibrary.ValidaTipoDateTime(txtData.Text))
     {
         MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
         errorProvider1.SetError(txtData, ConfigMessage.Default.MsgDataInvalida);
     }
     else
     {
         errorProvider1.SetError(txtData, "");
     }
 }
Example #10
0
 private void mkDataVecto_Validating(object sender, CancelEventArgs e)
 {
     if (!ValidacoesLibrary.ValidaTipoDateTime(mkDataVecto.Text))
     {
         MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
         errorProvider1.SetError(mkDataVecto, ConfigMessage.Default.MsgDataInvalida);
     }
     else
     {
         errorProvider1.SetError(mkDataVecto, "");
     }
 }
Example #11
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (txtNome.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label1, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");

                result = false;
            }
            if (txtEmail.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label8, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");

                result = false;
            }
            else if (maskedtxtDataAd.Text != "  /  /" && !ValidacoesLibrary.ValidaTipoDateTime(maskedtxtDataAd.Text))
            {
                errorProvider1.SetError(label14, ConfigMessage.Default.MsgDataInvalida);
                Util.ExibirMSg(ConfigMessage.Default.MsgDataInvalida, "Red");
                result = false;
            }
            else if (maskedtxtComissao.Text != string.Empty && !ValidacoesLibrary.ValidaTipoDecimal(maskedtxtComissao.Text))
            {
                errorProvider1.SetError(label5, ConfigMessage.Default.FieldErro);
                Util.ExibirMSg(ConfigMessage.Default.FieldErro, "Red");
                result = false;
            }

            if (maskedtxtSalario.Text != string.Empty && !ValidacoesLibrary.ValidaTipoDecimal(maskedtxtSalario.Text))
            {
                errorProvider1.SetError(label28, ConfigMessage.Default.FieldErro);
                Util.ExibirMSg(ConfigMessage.Default.FieldErro, "Red");
                result = false;
            }
            else if (!Util.Grava_Registro(this.Name, FrmLogin._IdNivel))
            {
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #12
0
 private void mdkDataFinal_Validating(object sender, CancelEventArgs e)
 {
     if (mdkDataFinal.Text != "  /  /")
     {
         if (!ValidacoesLibrary.ValidaTipoDateTime(mdkDataFinal.Text))
         {
             MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
             mdkDataFinal.Focus();
             errorProvider1.SetError(mdkDataFinal, ConfigMessage.Default.MsgDataInvalida);
         }
         else
         {
             errorProvider1.SetError(mdkDataFinal, "");
         }
     }
 }
Example #13
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (txtNotaFiscal.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label4, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (!Util.Grava_Registro(this.Name, FrmLogin._IdNivel))
            {
                result = false;
            }
            else if (txtNumeroLote.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label7, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (maskedtxtData.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(maskedtxtData.Text))
            {
                errorProvider1.SetError(label2, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (Convert.ToInt32(cbProduto.SelectedValue) < 1)
            {
                errorProvider1.SetError(label14, ConfigMessage.Default.CampoObrigatorio);
                MessageBox.Show(ConfigMessage.Default.CampoObrigatorio);
                result = false;
            }
            else if (!LoteExiste(txtNumeroLote.Text))
            {
                errorProvider1.SetError(label7, ConfigMessage.Default.CampoObrigatorio);
                MessageBox.Show(ConfigMessage.Default.CampoObrigatorio);
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #14
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (txtDescricao.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label1, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (!Util.Grava_Registro(this.Name, FrmLogin._IdNivel))
            {
                result = false;
            }
            if (txtCodigo.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(label5, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (mkDataFabricacao.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(mkDataFabricacao.Text))
            {
                errorProvider1.SetError(label6, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (maskedtxtData.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(maskedtxtData.Text))
            {
                errorProvider1.SetError(label2, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (VerificaExisteLote(txtCodigo.Text) && _IDLOTE == -1)
            {
                string Msgerro = "Lote já Cadastrado!";
                errorProvider1.SetError(label5, Msgerro);
                Util.ExibirMSg(Msgerro, "Red");
                result = false;
            }
            else
            {
                errorProvider1.SetError(txtDescricao, "");
            }

            return(result);
        }
Example #15
0
 private void maskDtaPrev_Validating(object sender, CancelEventArgs e)
 {
     if (maskDtaPrev.Text != "  /  /")
     {
         if (!ValidacoesLibrary.ValidaTipoDateTime(maskDtaPrev.Text))
         {
             MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
             maskDtaPrev.Focus();
             errorProvider1.SetError(maskDtaPrev, ConfigMessage.Default.MsgDataInvalida);
             e.Cancel = true;
             tabControlHelpDesk.SelectTab(0);
         }
         else
         {
             e.Cancel = false;
             errorProvider1.SetError(maskDtaPrev, "");
         }
     }
 }
Example #16
0
 private void maskedtxtAniv_Leave(object sender, EventArgs e)
 {
     if (maskedtxtAniv.Text != "  /  /")
     {
         if (!ValidacoesLibrary.ValidaTipoDateTime(maskedtxtAniv.Text))
         {
             MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
             errorProvider1.SetError(maskedtxtAniv, ConfigMessage.Default.MsgDataInvalida);
         }
         else
         {
             errorProvider1.SetError(maskedtxtAniv, "");
         }
     }
     else
     {
         errorProvider1.SetError(maskedtxtAniv, "");
     }
 }
Example #17
0
 private void btnPesquisa_Click(object sender, EventArgs e)
 {
     if (!ValidacoesLibrary.ValidaTipoDateTime(mkDtInicial.Text))
     {
         errorProvider1.SetError(mkDtInicial, ConfigMessage.Default.FieldErro);
         MessageBox.Show(ConfigMessage.Default.FieldErro);
     }
     else if (!ValidacoesLibrary.ValidaTipoDateTime(mkdatafinal.Text))
     {
         errorProvider1.SetError(mkdatafinal, ConfigMessage.Default.FieldErro);
         MessageBox.Show(ConfigMessage.Default.FieldErro);
     }
     else
     {
         PesquisaDuplicatasReceber();
         PesquisaDuplicatasPagar();
         JuntaCentroCusto();
     }
 }
Example #18
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (!ValidacoesLibrary.ValidaTipoDateTime(mkDtInicial.Text))
            {
                errorProvider1.SetError(mkDtInicial, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(mkdatafinal.Text))
            {
                errorProvider1.SetError(mkdatafinal, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
            }
            else
            {
                lblValorTotalReceber.Text = "0";
                lblValorTotalPagar.Text   = "0";
                PesquisaDuplicatasReceber();
                PesquisaDuplicatasPagar();

                lblValorSaldo.Text = (Convert.ToDecimal(lblValorTotalReceber.Text) - Convert.ToDecimal(lblValorTotalPagar.Text)).ToString("n2");
            }
        }
Example #19
0
 private void maskedtxtDataAd_Leave(object sender, EventArgs e)
 {
     if (maskedtxtDataAd.Text != "  /  /")
     {
         if (!ValidacoesLibrary.ValidaTipoDateTime(maskedtxtDataAd.Text))
         {
             MessageBox.Show(ConfigMessage.Default.MsgDataInvalida);
             maskedtxtDataAd.Focus();
             errorProvider1.SetError(maskedtxtDataAd, ConfigMessage.Default.MsgDataInvalida);
         }
         else
         {
             lblObsField.Text = string.Empty;
             errorProvider1.SetError(maskedtxtCPF, "");
         }
     }
     else
     {
         lblObsField.Text = string.Empty;
         errorProvider1.SetError(maskedtxtCPF, "");
     }
 }
Example #20
0
        private Boolean Validacoes()
        {
            Boolean result = true;

            errorProvider1.Clear();
            if (cbCliente.SelectedIndex == 0)
            {
                errorProvider1.SetError(cbCliente, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (txtValorRecibo.Text.Trim().Length == 0 || txtValorRecibo.Text == "0,00")
            {
                errorProvider1.SetError(txtValorRecibo, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDecimal(txtValorRecibo.Text))
            {
                errorProvider1.SetError(txtValorRecibo, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else if (msktDataEmissao.Text == "  /  /" || !ValidacoesLibrary.ValidaTipoDateTime(msktDataEmissao.Text))
            {
                errorProvider1.SetError(msktDataEmissao, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #21
0
        private void FilterList()
        {
            try
            {
                // Nome campo que sera filtrado
                string campo = cbCamposPesquisa.SelectedValue.ToString();

                //Necessario passar a coleção vazia para o grid, para pegar o tipo da coluna
                if (TransportadorColl.Count == 0)
                {
                    DataGriewDados.AutoGenerateColumns = false;
                    DataGriewDados.DataSource          = TransportadorColl;
                }

                // Retorna o tipo de campo para pesquisa Ex.: String, Integer, Date...
                string Tipo = DataGriewDados.Columns[cbCamposPesquisa.SelectedValue.ToString()].ValueType.FullName;

                if (Tipo.Length > 20)
                {
                    Tipo = Util.GetTypeCell(Tipo);//Retorna o texto resumido do tipo
                }
                string Valor = txtCriterioPesquisa.Text;

                //Verifica se o valor digitado e compativel com
                // o tipo de pesquisa
                if (ValidacoesLibrary.ValidaTipoPesquisa(Tipo, Valor))
                {
                    if (Tipo == "System.DateTime")//formata data para pesquisa.
                    {
                        Valor = Util.ConverStringDateSearch(txtCriterioPesquisa.Text);
                    }
                    else if (Tipo == "System.Decimal")//formata Numeric para pesquisa.
                    {
                        Valor = Util.ConverStringDecimalSearch(txtCriterioPesquisa.Text);
                    }

                    filtroProfile = new RowsFiltro(campo, Tipo, cbTipoPesquisa.SelectedValue.ToString(), Valor);

                    if (!chkBoxAcumulaPesquisa.Checked)//Acumular pesquisa
                    {
                        Filtro.Clear();
                    }

                    Filtro.Insert(Filtro.Count, filtroProfile);

                    if (msktDataInicial.Text != "  /  /" && msktDataFinal.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text) && ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
                    {
                        filtroProfile = new RowsFiltro("DATA", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                        filtroProfile = new RowsFiltro("DATA", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                    }


                    LIS_CONHECIMENTOTRANSPColl         = LIS_CONHECIMENTOTRANSP.ReadCollectionByParameter(Filtro, "DATA DESC");
                    DataGriewDados.AutoGenerateColumns = false;
                    DataGriewDados.DataSource          = LIS_CONHECIMENTOTRANSPColl;

                    lblTotalPesquisa.Text = TransportadorColl.Count.ToString();
                }
                else
                {
                    MessageBox.Show(ConfigMessage.Default.searchFieldType);
                    errorProvider1.SetError(txtCriterioPesquisa, ConfigMessage.Default.searchFieldType);
                    txtCriterioPesquisa.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro na pesquisa!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #22
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (cbTipoPesquisa.Text == "Todos")
            {
                Filtro.Clear();

                if (msktDataInicial.Text != "  /  /" && msktDataFinal.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text) && ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
                {
                    filtroProfile = new RowsFiltro("DATAMOVIMENTACAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                    filtroProfile = new RowsFiltro("DATAMOVIMENTACAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                }

                LIS_MOVCONTACORRENTEColl = LIS_MOVCONTACORRENTEP.ReadCollectionByParameter(Filtro, "DATAMOVIMENTACAO desc");
                lblTotalPesquisa.Text    = LIS_MOVCONTACORRENTEColl.Count.ToString();

                //Colocando somatorio no final da lista
                LIS_MOVCONTACORRENTEEntity LIS_MOVCONTACORRENTETy = new LIS_MOVCONTACORRENTEEntity();
                LIS_MOVCONTACORRENTETy.VALOR = SumTotalPesquisa("VALOR");
                LIS_MOVCONTACORRENTEColl.Add(LIS_MOVCONTACORRENTETy);


                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_MOVCONTACORRENTEColl;
            }
            else
            {
                PesquisaFiltro();
            }
        }
Example #23
0
        private Boolean ValidaDuplicatas()
        {
            errorProvider1.Clear();
            Boolean result = true;

            if (Convert.ToInt32(cbFornecedor.SelectedValue) < 1)
            {
                errorProvider1.SetError(cbFornecedor, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (txtDuplicata.Text.Trim().Length < 1)
            {
                errorProvider1.SetError(txtDuplicata, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDecimal(txtVlParcelas.Text) || txtVlParcelas.Text == "0,00")
            {
                errorProvider1.SetError(txtVlParcelas, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoInt32(txtNParcelas.Text))
            {
                errorProvider1.SetError(txtNParcelas, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoInt32(txtDiasVencimento.Text))
            {
                errorProvider1.SetError(txtDiasVencimento, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(mkdataInicial.Text))
            {
                errorProvider1.SetError(mkdataInicial, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(mkDataVecto.Text))
            {
                errorProvider1.SetError(mkDataVecto, ConfigMessage.Default.FieldErro);
                MessageBox.Show(ConfigMessage.Default.FieldErro);
                result = false;
            }
            else if (BmsSoftware.ConfigSistema1.Default.FlagCentroCustoObrigatorio == "S" && Convert.ToInt32(cbCentroCusto.SelectedValue) < 0)
            {
                errorProvider1.SetError(cbCentroCusto, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
                result = false;
            }
            else
            {
                errorProvider1.Clear();
            }


            return(result);
        }
Example #24
0
        private void button2_Click(object sender, EventArgs e)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            TotalProduto = 0;
            errorProvider1.Clear();
            if (!ValidacoesLibrary.ValidaTipoDateTime(maskedtxtData.Text))
            {
                errorProvider1.SetError(maskedtxtData, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
            }
            else if (!ValidacoesLibrary.ValidaTipoDateTime(maskedtxtDataProxManut.Text))
            {
                errorProvider1.SetError(maskedtxtDataProxManut, ConfigMessage.Default.CampoObrigatorio);
                Util.ExibirMSg(ConfigMessage.Default.CampoObrigatorio2, "Red");
            }
            else
            {
                RowRelatorio.Clear();
                if (Convert.ToInt32(cbEquipamento.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDEQUIPAMENTO", "System.Int32", "=", cbEquipamento.SelectedValue.ToString()));
                }

                if (Convert.ToInt32(cbTipoManutencao.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDTIPOMANUTENCAO", "System.Int32", "=", cbTipoManutencao.SelectedValue.ToString()));
                }


                RowRelatorio.Add(new RowsFiltro("DATAMANUT", "System.DateTime", ">=", Util.ConverStringDateSearch(maskedtxtData.Text)));
                RowRelatorio.Add(new RowsFiltro("DATAMANUT", "System.DateTime", "<=", Util.ConverStringDateSearch(maskedtxtDataProxManut.Text)));

                LIS_MANUTESQUIPAMENTOColl = LIS_MANUTESQUIPAMENTOP.ReadCollectionByParameter(RowRelatorio, "NOMEEQUIPAMENTO, DATAMANUT DESC");

                var booleanGroupQuery =
                    from MANUTESQUIPAMENTO in LIS_MANUTESQUIPAMENTOColl
                    group MANUTESQUIPAMENTO by MANUTESQUIPAMENTO.IDEQUIPAMENTO; //pass or fail!


                //limpa grid
                dataGridView1.Rows.Clear();

                // example of unbound items
                int     CodEqSelec  = 0;
                int     CodEqSelec2 = 0;
                decimal TotalGeral  = 0;

                foreach (var MANUTESQUIPAMENTOGroup in booleanGroupQuery)
                {
                    foreach (var MANUTESQUIPAMENTO in MANUTESQUIPAMENTOGroup)
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dataGridView1, MANUTESQUIPAMENTO.IDMANUTEESQUIPAMENTO.ToString(), Util.LimiterText(MANUTESQUIPAMENTO.NOMEEQUIPAMENTO, 40), Convert.ToDateTime(MANUTESQUIPAMENTO.DATAMANUT).ToString("dd/MM/yyyy"), Util.LimiterText(MANUTESQUIPAMENTO.NOMETIPOMANUTENCAO, 40), Convert.ToDecimal(MANUTESQUIPAMENTO.VALORMANUTENCAO).ToString("n2"));
                        dataGridView1.Rows.Add(row);
                        CodEqSelec  = Convert.ToInt32(MANUTESQUIPAMENTO.IDEQUIPAMENTO);
                        CodEqSelec2 = Convert.ToInt32(MANUTESQUIPAMENTO.IDMANUTEESQUIPAMENTO);

                        //Produtos usados
                        if (chkEmpresContrata.Checked)
                        {
                            DataGridViewRow row_1_3 = new DataGridViewRow();

                            //Empresa Contratada
                            row_1_3.DefaultCellStyle.Font = new Font("Arial", 9, FontStyle.Bold);
                            row_1_3.CreateCells(dataGridView1, "Empresa:", MANUTESQUIPAMENTO.NOMEFORNECEDOR, string.Empty, string.Empty, string.Empty);
                            dataGridView1.Rows.Add(row_1_3);
                        }

                        //Produtos usados
                        if (chkSomaProduto.Checked)
                        {
                            DataGridViewRow row_1_2 = new DataGridViewRow();
                            ListaItensProduto(Convert.ToInt32(MANUTESQUIPAMENTO.IDMANUTEESQUIPAMENTO));

                            //Cabeçalho dados do produto
                            row_1_2.DefaultCellStyle.Font = new Font("Arial", 9, FontStyle.Bold);
                            row_1_2.CreateCells(dataGridView1, string.Empty, "Nome Produto", "Quant. Prod.", string.Empty, "                 Total Produto");
                            dataGridView1.Rows.Add(row_1_2);
                            foreach (var itemProduto in LIS_PRODUTOSMANUTColl)
                            {
                                DataGridViewRow row_1             = new DataGridViewRow();
                                string          ValorTotalProduto = Convert.ToDecimal(itemProduto.VALORTOTAL).ToString("n2");
                                row_1.CreateCells(dataGridView1, string.Empty, itemProduto.NOMEPRODUTO, itemProduto.QUANTIDADE.ToString(), string.Empty, ValorTotalProduto);
                                dataGridView1.Rows.Add(row_1);
                            }
                        }
                    }


                    decimal TotalServico = CalculaTotalItem(CodEqSelec);
                    TotalGeral += TotalServico;

                    if (chkSomaProduto.Checked)
                    {
                        DataGridViewRow row2_1 = new DataGridViewRow();
                        row2_1.CreateCells(dataGridView1, "", "Total de Produtos Usados: " + TotalProduto.ToString("n2"), "", "Total Manut. :", TotalServico.ToString("n2"));
                        row2_1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        dataGridView1.Rows.Add(row2_1);
                        TotalGeral += TotalProduto;
                    }
                    else
                    {
                        DataGridViewRow row2 = new DataGridViewRow();
                        row2.CreateCells(dataGridView1, "", "", "", "Total Manut. : ", TotalServico.ToString("n2"));
                        row2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        dataGridView1.Rows.Add(row2);
                    }
                }

                DataGridViewRow row3 = new DataGridViewRow();
                row3.CreateCells(dataGridView1, "", "", "", "TOTAL GERAL: ", TotalGeral.ToString("n2"));
                row3.DefaultCellStyle.Font = new Font("Arial", 9, FontStyle.Bold);
                dataGridView1.Rows.Add(row3);
            }

            this.Cursor = Cursors.Default;
        }
Example #25
0
        private void GerarBoletoCaixa_()
        {
            try
            {
                //Dados da Empresa Registro
                EMPRESAEntity EMPRESATy = EMPRESAP.Read(1);

                //Dados para emitir boleto
                //  string data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");// Data de Vencimento do Boleto
                string data_vencimento = VectoSuporte;
                if (!ValidacoesLibrary.ValidaTipoDateTime(data_vencimento))
                {
                    data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");                                               // Data de Vencimento do Boleto
                }
                string agencia        = "0164";                                                                                     // Numero da Agência até 4 Digitos s/DAC
                string digito_agencia = "";                                                                                         // 1 Digito da Agência
                string conta          = "415192";                                                                                   // 1 Digito da Agência
                string codcedente     = "4151925";                                                                                  // CONFIGBOLETATy.CODCEDENTE.ToString(); // Numero do Convenio
                string dac_conta      = "5";                                                                                        // Digito da Conta Corrente 1 Digito
                string nosso_numero   = Util.RetiraLetras(EMPRESATy.CNPJCPF.Substring(0, 5) + DateTime.Now.ToString("yyyy/MM/dd")); // Nosso Numero
                string carteira       = "24";                                                                                       // Código da Carteira
                string data_documento = DateTime.Now.ToString("dd/MM/yyyy");                                                        // Data de Vencimento do Boleto // Data de emissão do Boleto dd/MM/yyyy

                //==Os Campos Abaixo são Opcionais=================
                string instrucoes  = ""; //;//Instruçoes para o Cliente
                string instrucoes1 = ""; // "CAIXA NAO RECEBER APOS O VENCIMENTO"; // Por exemplo "Não receber apos o vencimento" ou "Cobrar Multa de 1% ao mês"
                string instrucoes2 = "APOS O VENCIMENTO MULTA DE R$ 5,90";
                string instrucoes3 = "E JUROS DE R$ 0,08 AO DIA";
                string instrucoes4 = "";

                string valor = ValorSuporte;

                valor = Convert.ToDecimal(valor).ToString("n2");

                string numero_documento = nosso_numero;// Numero do Pedido ou Nosso Numero

                //=============Dados da Sua empresa===============
                string cpf_cnpj_cedente = "18.183.803/0001-94";
                string cn_pj            = Util.LimiterText(Util.RetiraLetras("18.183.803/0001-94"), 3);
                string endereco         = "Rua Doutor Milton Bandeira, 346 Sala 303 - Centro";
                string cidade           = "Viçosa / MG";
                string cedente          = "IMEX Sistemas";

                //===Dados do seu Cliente (Opcional)===============

                string CPFCNPJ = EMPRESATy.CNPJCPF;

                string sacado    = EMPRESATy.NOMEFANTASIA + " - " + CPFCNPJ;
                string endereco1 = EMPRESATy.ENDERECO + " " + EMPRESATy.NUMERO;
                string endereco2 = EMPRESATy.CIDADE + " " + EMPRESATy.UF;


                string arquivo = "http://boletocefphp.imexsistema.com.br/boleto-caixa.php?data_vencimento=" + data_vencimento + "&agencia=" +
                                 agencia + "&conta=" + conta + "&digito_agencia=" + digito_agencia + "&codcedente=" + codcedente + "&dac_conta=" + dac_conta +
                                 "&nosso_numero=" + nosso_numero + "&carteira=" + carteira + "&data_documento=" + data_documento + "&valor=" + valor + "&numero_documento=" + numero_documento +
                                 "&cpf_cnpj_cedente=" + cpf_cnpj_cedente + "&cn_pj=" + cn_pj +
                                 "&endereco=" + endereco + "&cidade=" + cidade + "&cedente=" + cedente + "&sacado=" + sacado + "&endereco1=" + endereco1 + "&endereco2=" + endereco2 + "&instrucoes=" + instrucoes +
                                 "&instrucoes1=" + instrucoes1 + "&instrucoes2=" + instrucoes2 + "&instrucoes3=" + instrucoes3 + "&instrucoes4=" + instrucoes4 + "&instrucoes5";



                using (FrmBoletaVisualiza frm = new FrmBoletaVisualiza())
                {
                    frm.BoletaPHP  = true;
                    frm.ArquivoPHP = arquivo;
                    frm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao gerar boleto!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #26
0
        private void FilterList()
        {
            /// referente ao tipo de campo
            string campo = cbCamposPesquisa.SelectedValue.ToString();

            //Necessario passar a coleção vazia para o grid, para pegar o tipo da coluna
            if (LIS_MOVCONTACORRENTEColl.Count == 0)
            {
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_MOVCONTACORRENTEColl;
            }

            // Retorna o tipo de campo para pesquisa Ex.: String, Integer, Date...
            string Tipo = DataGriewDados.Columns[cbCamposPesquisa.SelectedValue.ToString()].ValueType.FullName;

            if (Tipo.Length > 20)
            {
                Tipo = Util.GetTypeCell(Tipo);//Retorna o texto resumido do tipo
            }
            string Valor = txtCriterioPesquisa.Text;

            //Verifica se o valor digitado e compativel com
            // o tipo de pesquisa
            if (ValidacoesLibrary.ValidaTipoPesquisa(Tipo, Valor))
            {
                if (Tipo == "System.DateTime")//formata data para pesquisa.
                {
                    Valor = Util.ConverStringDateSearch(txtCriterioPesquisa.Text);
                }
                else if (Tipo == "System.Decimal")//formata Numeric para pesquisa.
                {
                    Valor = Util.ConverStringDecimalSearch(txtCriterioPesquisa.Text);
                }

                filtroProfile = new RowsFiltro(campo, Tipo, cbTipoPesquisa.SelectedValue.ToString(), Valor);

                if (!chkBoxAcumulaPesquisa.Checked)//Acumular pesquisa
                {
                    Filtro.Clear();
                }

                Filtro.Insert(Filtro.Count, filtroProfile);

                if (msktDataInicial.Text != "  /  /" && msktDataFinal.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text) && ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
                {
                    filtroProfile = new RowsFiltro("DATAMOVIMENTACAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                    filtroProfile = new RowsFiltro("DATAMOVIMENTACAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                }

                LIS_MOVCONTACORRENTEColl = LIS_MOVCONTACORRENTEP.ReadCollectionByParameter(Filtro, "DATAMOVIMENTACAO desc");
                lblTotalPesquisa.Text    = LIS_MOVCONTACORRENTEColl.Count.ToString();

                //Colocando somatorio no final da lista
                LIS_MOVCONTACORRENTEEntity LIS_MOVCONTACORRENTETy = new LIS_MOVCONTACORRENTEEntity();
                LIS_MOVCONTACORRENTETy.VALOR = SumTotalPesquisa("VALOR");
                LIS_MOVCONTACORRENTEColl.Add(LIS_MOVCONTACORRENTETy);

                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_MOVCONTACORRENTEColl;
            }
            else
            {
                MessageBox.Show(ConfigMessage.Default.searchFieldType);
                errorProvider1.SetError(txtCriterioPesquisa, ConfigMessage.Default.searchFieldType);
                txtCriterioPesquisa.Focus();
            }
        }
Example #27
0
        private void FilterList()
        {
            /// referente ao tipo de campo
            string campo = cbCamposPesquisa.SelectedValue.ToString();

            //Necessario passar a coleção vazia para o grid, para pegar o tipo da coluna
            if (LIS_RESERVAColl.Count == 0)
            {
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_RESERVAColl;
            }

            // Retorna o tipo de campo para pesquisa Ex.: String, Integer, Date...
            string Tipo = DataGriewDados.Columns[cbCamposPesquisa.SelectedValue.ToString()].ValueType.FullName;

            if (Tipo.Length > 20)
            {
                Tipo = Util.GetTypeCell(Tipo);//Retorna o texto resumido do tipo
            }
            string Valor = txtCriterioPesquisa.Text;

            //Verifica se o valor digitado e compativel com
            // o tipo de pesquisa
            if (ValidacoesLibrary.ValidaTipoPesquisa(Tipo, Valor))
            {
                if (Tipo == "System.DateTime")//formata data para pesquisa.
                {
                    Valor = Util.ConverStringDateSearch(txtCriterioPesquisa.Text);
                }
                else if (Tipo == "System.Decimal")//formata Numeric para pesquisa.
                {
                    Valor = Util.ConverStringDecimalSearch(txtCriterioPesquisa.Text);
                }

                filtroProfile = new RowsFiltro(campo, Tipo, cbTipoPesquisa.SelectedValue.ToString(), Valor);

                if (!chkBoxAcumulaPesquisa.Checked)//Acumular pesquisa
                {
                    Filtro.Clear();
                }

                Filtro.Insert(Filtro.Count, filtroProfile);

                if (!chkpesquisaperiodo.Checked)
                {
                    if (dateTimePickerEntradaFiltro.Text != "  /  /" && dateTimePickerSaidaFiltro.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(dateTimePickerEntradaFiltro.Text) && ValidacoesLibrary.ValidaTipoDateTime(dateTimePickerSaidaFiltro.Text))
                    {
                        filtroProfile = new RowsFiltro("DATARETIRADA", "System.DateTime", ">=", Util.ConverStringDateSearch(dateTimePickerEntradaFiltro.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                        filtroProfile = new RowsFiltro("DATAENTREGA", "System.DateTime", "<=", Util.ConverStringDateSearch(dateTimePickerSaidaFiltro.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                    }
                }

                if (Convert.ToInt32(cbStatus2.SelectedValue) > 0)
                {
                    filtroProfile = new RowsFiltro("IDSTATUS", "System.Int32", "=", cbStatus2.SelectedValue.ToString());
                    Filtro.Insert(Filtro.Count, filtroProfile);
                }


                LIS_RESERVAColl = LIS_RESERVAP.ReadCollectionByParameter(Filtro, "IDRESERVA DESC");

                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_RESERVAColl;

                lblTotalPesquisa.Text = LIS_RESERVAColl.Count.ToString();
            }
            else
            {
                MessageBox.Show(ConfigMessage.Default.searchFieldType);
                errorProvider1.SetError(txtCriterioPesquisa, ConfigMessage.Default.searchFieldType);
                txtCriterioPesquisa.Focus();
            }
        }
Example #28
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            if (cbTipoPesquisa.Text == "Todos")
            {
                Filtro.Clear();

                if (msktDataInicial.Text != "  /  /" && msktDataFinal.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(msktDataInicial.Text) && ValidacoesLibrary.ValidaTipoDateTime(msktDataFinal.Text))
                {
                    filtroProfile = new RowsFiltro("DATA", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                    filtroProfile = new RowsFiltro("DATA", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text));
                    Filtro.Insert(Filtro.Count, filtroProfile);
                }

                LIS_CONHECIMENTOTRANSPColl         = LIS_CONHECIMENTOTRANSP.ReadCollectionByParameter(Filtro, "DATA DESC");
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_CONHECIMENTOTRANSPColl;

                lblTotalPesquisa.Text = TransportadorColl.Count.ToString();
            }
            else
            {
                PesquisaFiltro();
            }

            this.Cursor = Cursors.Default;
        }
Example #29
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                BmsSoftware.ConfigSistema1.Default.TituloRelatorio = txtTitulo.Text;
                BmsSoftware.ConfigSistema1.Default.Save();

                SalveConfig(NometelaSelec, NomeGridSelec);

                int i           = 0;
                int TotalColuna = 0;
                foreach (DataGridViewColumn col in DataGridExport.Columns)
                {
                    if (ctlColumnsToPrintCHKLBX.GetItemCheckState(i) == CheckState.Checked)
                    {
                        col.Visible = true;
                        TotalColuna++;
                    }
                    else
                    {
                        col.Visible = false;
                    }

                    i++;
                }

                //Creating iTextSharp Table from the DataTable data
                PdfPTable pdfTable = new PdfPTable(TotalColuna);
                pdfTable.WidthPercentage = 90;


                //pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
                pdfTable.DefaultCell.BorderWidth = 1;
                float[] widths = new float[TotalColuna];

                //Adding Header row
                int x = 0;
                foreach (DataGridViewColumn column in DataGridExport.Columns)
                {
                    if (column.Visible)
                    {
                        var      FontColour = new BaseColor(35, 31, 32);
                        var      Calibri8   = FontFactory.GetFont("HELVETICA", 16, FontColour);
                        PdfPCell cell       = new PdfPCell(new Phrase(column.HeaderText, Calibri8));
                        //pdfTable.WidthPercentage = 100;
                        // pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
                        //pdfTable.HeaderHeight = column.Width;
                        cell.HorizontalAlignment = 1;  //0=Left, 1=Center, 2=Right

                        widths[x] = column.Width;
                        x++;

                        pdfTable.SpacingAfter = 10;
                        cell.BackgroundColor  = new iTextSharp.text.BaseColor(240, 240, 240);
                        pdfTable.AddCell(cell);
                    }
                }

                pdfTable.SetWidths(widths);

                //Adding DataRow
                foreach (DataGridViewRow row in DataGridExport.Rows)
                {
                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        if (cell.Visible && row.Visible)
                        {
                            if (cell.Value != null)
                            {
                                var      FontColour = new BaseColor(35, 31, 32);
                                var      Calibri8   = FontFactory.GetFont("HELVETICA", 16, FontColour);
                                PdfPCell cell_Pdf   = new PdfPCell(new Phrase(cell.EditedFormattedValue.ToString(), Calibri8));
                                String   CelulaGrid = string.Empty;

                                if (cell.EditedFormattedValue.ToString().IndexOf(",") != -1 && ValidacoesLibrary.ValidaTipoDecimal(cell.EditedFormattedValue.ToString()))
                                {
                                    CelulaGrid = Convert.ToDecimal(cell.EditedFormattedValue.ToString()).ToString("n2");
                                    PdfPCell cell_Pdf_TipoMoeda = new PdfPCell(new Phrase(CelulaGrid, Calibri8));
                                    cell_Pdf_TipoMoeda.HorizontalAlignment = 2; //0=Left, 1=Center, 2=Right
                                    pdfTable.AddCell(cell_Pdf_TipoMoeda);
                                }
                                //else if (ValidacoesLibrary.ValidaTipoInt32(cell.EditedFormattedValue.ToString()))
                                //{
                                //    CelulaGrid = Convert.ToDecimal(cell.EditedFormattedValue.ToString()).ToString();
                                //    PdfPCell cell_Pdf_Int = new PdfPCell(new Phrase(CelulaGrid));
                                //    cell_Pdf_Int.HorizontalAlignment = 2; //0=Left, 1=Center, 2=Right
                                //    pdfTable.AddCell(cell_Pdf_Int);
                                //}
                                else if (cell.EditedFormattedValue.ToString().Length == 10 && ValidacoesLibrary.ValidaTipoDateTime(cell.EditedFormattedValue.ToString()))
                                {
                                    CelulaGrid = Convert.ToDateTime(cell.EditedFormattedValue.ToString()).ToString("dd/MM/yyyy");
                                    PdfPCell cell_Pdf_Date = new PdfPCell(new Phrase(CelulaGrid, Calibri8));
                                    cell_Pdf_Date.HorizontalAlignment = 2; //0=Left, 1=Center, 2=Right
                                    pdfTable.AddCell(cell_Pdf_Date);
                                }
                                else
                                {
                                    cell_Pdf.HorizontalAlignment = 0; //0=Left, 1=Center, 2=Right
                                    pdfTable.AddCell(cell_Pdf);
                                }
                            }
                            else
                            {
                                pdfTable.AddCell("");
                            }
                        }
                    }
                }



                if (txtNomeArquivo.Text.Trim() == string.Empty)
                {
                    txtNomeArquivo.Text = "ListadaPesquisa";
                }

                //Exporting to PDF
                // string folderPath = "C:\\PDFs\\";
                string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }
                using (FileStream stream = new FileStream(folderPath + @"\" + txtNomeArquivo.Text + ".pdf", FileMode.Create))
                {
                    //cb.SetFontAndSize(FontFactory.GetFont(FontFactory.HELVETICA).BaseFont, 14);
                    Document pdfDoc = new Document(PageSize.A2, 20f, 10f, 80f, 10f);
                    pdfDoc.AddTitle(txtTitulo.Text);

                    PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);

                    PageEventHelper pageEventHelper = new PageEventHelper();
                    writer.PageEvent = pageEventHelper;

                    pdfDoc.Open();
                    pdfDoc.Add(pdfTable);
                    pdfDoc.Close();
                    stream.Close();
                }

                foreach (DataGridViewColumn col in DataGridExport.Columns)
                {
                    col.Visible = true;
                }

                MessageBox.Show("Arquivo " + txtNomeArquivo.Text + ".pdf gerado com sucesso!");

                System.Diagnostics.Process Processo1 = null;
                if (File.Exists(folderPath + @"\" + txtNomeArquivo.Text + ".pdf"))
                {
                    Processo1 = System.Diagnostics.Process.Start(folderPath + @"\" + txtNomeArquivo.Text + ".pdf");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao exportar o arquivo PDF!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #30
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            if (cbTipoPesquisa.Text == "Todos")
            {
                Filtro.Clear();

                if (!chkpesquisaperiodo.Checked)
                {
                    if (dateTimePickerEntradaFiltro.Text != "  /  /" && dateTimePickerSaidaFiltro.Text != "  /  /" && ValidacoesLibrary.ValidaTipoDateTime(dateTimePickerEntradaFiltro.Text) && ValidacoesLibrary.ValidaTipoDateTime(dateTimePickerSaidaFiltro.Text))
                    {
                        filtroProfile = new RowsFiltro("DATARETIRADA", "System.DateTime", ">=", Util.ConverStringDateSearch(dateTimePickerEntradaFiltro.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                        filtroProfile = new RowsFiltro("DATAENTREGA", "System.DateTime", "<=", Util.ConverStringDateSearch(dateTimePickerSaidaFiltro.Text));
                        Filtro.Insert(Filtro.Count, filtroProfile);
                    }
                }

                if (Convert.ToInt32(cbStatus2.SelectedValue) > 0)
                {
                    filtroProfile = new RowsFiltro("IDSTATUS", "System.Int32", "=", cbStatus2.SelectedValue.ToString());
                    Filtro.Insert(Filtro.Count, filtroProfile);
                }


                LIS_RESERVAColl = LIS_RESERVAP.ReadCollectionByParameter(Filtro, "IDRESERVA DESC");

                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_RESERVAColl;

                lblTotalPesquisa.Text = LIS_RESERVAColl.Count.ToString();
            }
            else
            {
                PesquisaFiltro();
            }

            this.Cursor = Cursors.Default;
        }