Esempio n. 1
0
 public static void ProximoAbastecimento()
 {
     if (Estruturas.BaixarDll("companytec.dll"))
     {
         Incrementa();
     }
 }
Esempio n. 2
0
 private void afterBusca()
 {
     TpBusca[] vBusca = new TpBusca[1];
     //Retirar Centro Resultado Cancelado
     vBusca[0].vNM_Campo = "isnull(b.st_registro, 'A')";
     vBusca[0].vOperador = "<>";
     vBusca[0].vVL_Busca = "'C'";
     Estruturas.CriarParametro(ref vBusca, "a.cd_empresa", "'" + cbEmpresa.SelectedValue.ToString().Trim() + "'");
     if (!string.IsNullOrEmpty(cd_ccusto.Text))
     {
         string[] linha = cd_ccusto.Text.Trim().Split(',');
         string   valor = string.Empty;
         for (int i = 0; i < linha.Count(); i++)
         {
             valor += "a.cd_centroresult like '" + linha[i].Trim() + "%'" + (linha.Count() > (i + 1) ? " or " : string.Empty);
         }
         Estruturas.CriarParametro(ref vBusca, string.Empty, valor, string.Empty);
     }
     if ((!string.IsNullOrEmpty(dt_ini.Text)) && (dt_ini.Text.Trim() != "/  /"))
     {
         Estruturas.CriarParametro(ref vBusca, "a.dt_lancto", "'" + Convert.ToDateTime(dt_ini.Text).ToString("yyyyMMdd").Trim() + "'", ">=");
     }
     if ((!string.IsNullOrEmpty(dt_fin.Text)) && (dt_fin.Text.Trim() != "/  /"))
     {
         Estruturas.CriarParametro(ref vBusca, "a.dt_lancto", "'" + Convert.ToDateTime(dt_fin.Text).ToString("yyyyMMdd").Trim() + "'", "<=");
     }
     bsCCustoLan.DataSource = new CamadaDados.Financeiro.CCustoLan.TCD_LanCCustoLancto().Select(vBusca, 0, string.Empty);
 }
Esempio n. 3
0
 public static void LimparSerial()
 {
     if (Estruturas.BaixarDll("companytec.dll"))
     {
         LimpaSerial();
     }
 }
Esempio n. 4
0
 public static bool LiberarBico(string bico)
 {
     if (Estruturas.BaixarDll("companytec.dll"))
     {
         string comando = "&M" + bico.Trim() + "L";
         comando = "(" + comando + CalcularChecksum(comando) + ")";
         if (EnviarComandoPlaca(comando) == 1)
         {
             LerRetornoPlaca(ref comando);
             if (comando.Length.Equals(5))
             {
                 return(comando.Substring(2, 2).Equals(bico));
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Esempio n. 5
0
 public static TList_Chopeira Buscar(string Id_chopeira,
                                     string Ds_chopeira,
                                     string Nr_chopeira,
                                     string Voltagem,
                                     string Qt_torneiras,
                                     BancoDados.TObjetoBanco banco)
 {
     TpBusca[] filtro = new TpBusca[0];
     if (!string.IsNullOrEmpty(Id_chopeira))
     {
         Estruturas.CriarParametro(ref filtro, "a.id_chopeira", Id_chopeira);
     }
     if (!string.IsNullOrEmpty(Ds_chopeira))
     {
         Estruturas.CriarParametro(ref filtro, "a.ds_chopeira", "'%" + Ds_chopeira.Trim() + "%'", "like");
     }
     if (!string.IsNullOrEmpty(Nr_chopeira))
     {
         Estruturas.CriarParametro(ref filtro, "a.nr_chopeira", "'%" + Nr_chopeira.Trim() + "%'", "like");
     }
     if (!string.IsNullOrEmpty(Voltagem))
     {
         Estruturas.CriarParametro(ref filtro, "a.voltagem", "'" + Voltagem.Trim() + "'");
     }
     if (!string.IsNullOrEmpty(Qt_torneiras))
     {
         Estruturas.CriarParametro(ref filtro, "a.qt_torneiras", "'" + Qt_torneiras.Trim() + "'");
     }
     return(new TCD_Chopeira(banco).Select(filtro, 0, string.Empty));
 }
Esempio n. 6
0
 private void BuscarProdutos()
 {
     if (cbEmpresa.SelectedItem != null &&
         cbTabPreco.SelectedItem != null)
     {
         TpBusca[] filtro = new TpBusca[0];
         if (!string.IsNullOrWhiteSpace(cd_grupo.Text))
         {
             Estruturas.CriarParametro(ref filtro, "a.cd_grupo", "'" + cd_grupo.Text.Trim() + "'");
         }
         if (!string.IsNullOrWhiteSpace(tp_produto.Text))
         {
             Estruturas.CriarParametro(ref filtro, "a.tp_produto", "'" + tp_produto.Text.Trim() + "'");
         }
         if (!string.IsNullOrWhiteSpace(cd_marcaBusca.Text))
         {
             Estruturas.CriarParametro(ref filtro, "isnull(a.cd_marca, 0)", cd_marcaBusca.Text);
         }
         if (!string.IsNullOrWhiteSpace(cd_prodbusca.Text))
         {
             Estruturas.CriarParametro(ref filtro, "a.cd_produto", "'" + cd_prodbusca.Text.Trim() + "'");
         }
         if (!string.IsNullOrWhiteSpace(cd_condfiscal.Text))
         {
             Estruturas.CriarParametro(ref filtro, "a.cd_condfiscal_produto", "'" + cd_condfiscal.Text.Trim() + "'");
         }
         if (!string.IsNullOrWhiteSpace(ds_produtobusca.Text) && string.IsNullOrWhiteSpace(cd_prodbusca.Text))
         {
             Estruturas.CriarParametro(ref filtro, "a.ds_produto", "'%" + ds_produtobusca.Text.Trim() + "%'", "like");
         }
         bsItens.DataSource = new CamadaDados.Estoque.TCD_LanPrecoItem().SelectProdutoPreco(cbEmpresa.SelectedValue.ToString(), cbTabPreco.SelectedValue.ToString(), filtro);
         bsItens_PositionChanged(this, new EventArgs());
     }
 }
Esempio n. 7
0
        public void TesteErro()
        {
            List <Magia> magias = new List <Magia>();

            magias.Add(new Magia(-1, 100000));
            magias.Add(new Magia(-100, -10));

            Goku.Goku goku = new Goku.Goku(magias);

            Monstro        monstro      = new Monstro(null, 100000);
            List <Monstro> listaMonstro = new List <Monstro>();

            listaMonstro.Add(monstro);
            int melhorKi = 0;

            CasoDeTeste casoDeTeste = new CasoDeTeste(3, 1, 0, 1);

            casoDeTeste.Goku = goku;
            casoDeTeste.Saloes.Add(new Salao(1, listaMonstro));

            int[,] tabela = Estruturas.PreencherTabelaDinamica(casoDeTeste);
            casoDeTeste.Saloes.ForEach(s =>
            {
                s.Monstros.ForEach(m =>
                {
                    m.CombaterMonstroDinamico(tabela, out melhorKi);
                });
            });

            Assert.AreEqual(melhorKi, 1);
        }
Esempio n. 8
0
        public void TesteSucesso3()
        {
            List <Magia> magias = new List <Magia>();

            magias.Add(new Magia(15, 20));
            magias.Add(new Magia(30, 35));
            magias.Add(new Magia(20, 25));
            magias.Add(new Magia(40, 45));
            magias.Add(new Magia(10, 10));
            magias.Add(new Magia(35, 40));
            magias.Add(new Magia(25, 30));
            magias.Add(new Magia(45, 50));
            magias.Add(new Magia(50, 55));
            magias.Add(new Magia(55, 60));
            magias.Add(new Magia(60, 65));
            magias.Add(new Magia(65, 70));
            magias.Add(new Magia(70, 75));
            magias.Add(new Magia(75, 80));
            magias.Add(new Magia(80, 85));
            magias.Add(new Magia(85, 90));
            magias.Add(new Magia(90, 95));
            magias.Add(new Magia(95, 100));
            magias.Add(new Magia(100, 105));
            magias.Add(new Magia(105, 110));
            magias.Add(new Magia(110, 115));
            magias.Add(new Magia(115, 120));
            magias.Add(new Magia(120, 125));
            magias.Add(new Magia(125, 130));
            magias.Add(new Magia(130, 135));
            magias.Add(new Magia(135, 140));
            magias.Add(new Magia(140, 145));
            magias.Add(new Magia(145, 150));
            magias.Add(new Magia(150, 155));
            magias.Add(new Magia(155, 160));
            magias.Add(new Magia(160, 165));

            Goku.Goku goku = new Goku.Goku(magias);

            Monstro        monstro      = new Monstro(null, 200);
            List <Monstro> listaMonstro = new List <Monstro>();

            listaMonstro.Add(monstro);
            int melhorKi = 0;

            CasoDeTeste casoDeTeste = new CasoDeTeste(3, 1, 0, 1);

            casoDeTeste.Goku = goku;
            casoDeTeste.Saloes.Add(new Salao(1, listaMonstro));

            int[,] tabela = Estruturas.PreencherTabelaDinamica(casoDeTeste);
            casoDeTeste.Saloes.ForEach(s =>
            {
                s.Monstros.ForEach(m =>
                {
                    m.CombaterMonstroDinamico(tabela, out melhorKi);
                });
            });

            Assert.AreEqual(melhorKi, 150);
        }
Esempio n. 9
0
        private void atualizaListagemCartao()
        {
            TpBusca[] filtro = new TpBusca[0];
            Estruturas.CriarParametro(ref filtro, "a.cd_empresa", lcfg[0].cd_empresa);
            Estruturas.CriarParametro(ref filtro, "a.nr_cartao", nr_cartao.Text);
            if (!string.IsNullOrEmpty(DT_Inicial.SoNumero()))
            {
                Estruturas.CriarParametro(ref filtro, "convert(datetime, floor(convert(decimal(30, 10), a.dt_abertura)))", "'" + DateTime.Parse(DT_Inicial.Text).ToString("yyyyMMdd") + "'", "<=");
            }
            Estruturas.CriarParametro(ref filtro, "isnull (a.st_registro, 'C')", cbAberto.Checked ? "'A'" : "'F'");
            Estruturas.CriarParametro(ref filtro, " ", "exists (select * from tb_res_prevenda p where a.id_cartao = p.id_cartao and p.ST_Registro = 'A' and p.ST_Delivery is null)", " ");
            if (!string.IsNullOrEmpty(Nm_clifor.Text.Trim()))
            {
                Estruturas.CriarParametro(ref filtro, "a.nm_clifor", "'%" + Nm_clifor.Text.Trim() + "%'", "like");
            }
            if (!string.IsNullOrEmpty(Nr_telefone.Text.Trim().SoNumero()))
            {
                Estruturas.CriarParametro(ref filtro, "dbo.FVALIDA_NUMEROS(d.Celular)", "'%" + Nr_telefone.Text.Trim().SoNumero() + "%'", "like");
            }

            bsCartoesAbertos.DataSource = new TCD_Cartao().Select(filtro, 0, "", "");

            if (bsCartoesAbertos.Count.Equals(0))
            {
                MessageBox.Show("Nenhum registro encontrado.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            afterValidacao();
        }
Esempio n. 10
0
        private void bsItens_PositionChanged(object sender, EventArgs e)
        {
            if (bsItens.Current != null)
            {
                if (bsItens.Current == null ? false : (bsItens.Current as TRegistro_VendaRapida_Item).Id_caracteristicaH.HasValue)
                {
                    tlpItens.ColumnStyles[1].Width = 230;

                    TpBusca[] tps = new TpBusca[0];
                    Estruturas.CriarParametro(ref tps, "a.id_caracteristica", (bsItens.Current as TRegistro_VendaRapida_Item).Id_caracteristicaH.ToString());
                    Estruturas.CriarParametro(ref tps, "", "(select 1 " +
                                              "from TB_PDV_CupomFiscal_Item_X_Estoque xxx " +
                                              "inner join tb_est_gradeestoque xx1 " +
                                              "on xxx.Id_LanctoEstoque = xx1.Id_LanctoEstoque " +
                                              "where xxx.Id_Cupom = " + (bsItens.Current as TRegistro_VendaRapida_Item).Id_vendarapida + " " +
                                              "and xx1.ID_Caracteristica = a.ID_Caracteristica " +
                                              "and xx1.ID_Item = a.ID_Item " +
                                              "and xxx.cd_produto = " + (bsItens.Current as TRegistro_VendaRapida_Item).Cd_produto + " " +
                                              "and xxx.CD_Empresa = " + (bsItens.Current as TRegistro_VendaRapida_Item).Cd_empresa + ") ", "exists");
                    new CamadaDados.Estoque.Cadastros.TCD_ValorCaracteristica()
                    .Select(tps, 0, string.Empty)
                    .ForEach(p => (bsItens.Current as TRegistro_VendaRapida_Item).lGrade.Add(p));
                }
                else
                {
                    tlpItens.ColumnStyles[1].Width = 0;
                }
            }
        }
Esempio n. 11
0
 public static TList_Retirada buscar(string Cd_empresa,
                                     string Id_retirada,
                                     string Cd_funcionario,
                                     string Dt_ini,
                                     string Dt_fin,
                                     BancoDados.TObjetoBanco banco)
 {
     TpBusca[] vBusca = new TpBusca[0];
     if (!string.IsNullOrWhiteSpace(Cd_empresa))
     {
         Estruturas.CriarParametro(ref vBusca, "a.cd_empresa", "'" + Cd_empresa.Trim() + "'");
     }
     if (!string.IsNullOrWhiteSpace(Id_retirada))
     {
         Estruturas.CriarParametro(ref vBusca, "a.id_retirada", Id_retirada);
     }
     if (!string.IsNullOrWhiteSpace(Cd_funcionario))
     {
         Estruturas.CriarParametro(ref vBusca, "a.cd_funcionario", "'" + Cd_funcionario.Trim() + "'");
     }
     if (Dt_ini.IsDateTime())
     {
         Estruturas.CriarParametro(ref vBusca, "convert(datetime, floor(convert(decimal(30,10), a.dt_retirada)))",
                                   "'" + Convert.ToDateTime(Dt_ini).ToString("yyyyMMdd") + "'", ">=");
     }
     if (Dt_fin.IsDateTime())
     {
         Estruturas.CriarParametro(ref vBusca, "convert(datetime, floor(convert(decimal(30,10), a.dt_retirada)))",
                                   "'" + Convert.ToDateTime(Dt_fin).ToString("yyyyMMdd") + "'", "<=");
     }
     return(new TCD_Retirada(banco).Select(vBusca, 0, string.Empty));
 }
Esempio n. 12
0
        public static TList_Mesa Buscar(string nr_mesa,
                                        string id_local,
                                        string ds_mesa,
                                        BancoDados.TObjetoBanco banco)
        {
            TpBusca[] filtro = new TpBusca[0];
            if (!string.IsNullOrEmpty(nr_mesa))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.nr_mesa";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + nr_mesa.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(id_local))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.id_local";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = id_local;
            }
            if (!string.IsNullOrEmpty(ds_mesa))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.ds_mesa";
                filtro[filtro.Length - 1].vOperador = "like";
                filtro[filtro.Length - 1].vVL_Busca = "'%" + ds_mesa.Trim() + "%'";
            }
            Estruturas.CriarParametro(ref filtro, "isnull(a.st_registro, 'A')", "'A'");

            return(new TCD_Mesa(banco).Select(filtro, 0, string.Empty));
        }
Esempio n. 13
0
 private void BuscarProduto()
 {
     if (cbEmpresa.SelectedItem == null)
     {
         MessageBox.Show("Obrigatório informar empresa!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     TpBusca[] filtro = new TpBusca[1];
     //Descartar produtos cancelados
     filtro[0].vNM_Campo = "isnull(a.st_registro, 'A')";
     filtro[0].vOperador = "<>";
     filtro[0].vVL_Busca = "'C'";
     CamadaDados.Estoque.Cadastros.TRegistro_CadProduto rProd = null;
     if (string.IsNullOrEmpty(cd_produto.Text))
     {
         rProd = UtilPesquisa.BuscarProduto(string.Empty,
                                            cbEmpresa.SelectedValue.ToString(),
                                            string.Empty,
                                            string.Empty,
                                            null,
                                            filtro);
     }
     else if (cd_produto.Text.SoNumero().Trim().Length != cd_produto.Text.Trim().Length)
     {
         rProd = UtilPesquisa.BuscarProduto(cd_produto.Text,
                                            cbEmpresa.SelectedValue.ToString(),
                                            string.Empty,
                                            string.Empty,
                                            null,
                                            filtro);
     }
     else
     {
         //Buscar Produto
         Estruturas.CriarParametro(ref filtro,
                                   string.Empty,
                                   "(a.cd_produto like '%" + cd_produto.Text.Trim() + "') or " +
                                   "(a.Codigo_Alternativo = '" + (cd_produto.TextOld != null ? cd_produto.TextOld.ToString() : cd_produto.Text.Trim()) + "') or " +
                                   "(exists(select 1 from tb_est_codbarra x " +
                                   "           where x.cd_produto = a.cd_produto " +
                                   "           and x.cd_codbarra = '" + cd_produto.Text.Trim() + "'))", string.Empty);
         CamadaDados.Estoque.Cadastros.TList_CadProduto lProd =
             new CamadaDados.Estoque.Cadastros.TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty);
         if (lProd.Count > 0)
         {
             rProd = lProd[0];
         }
     }
     if (rProd != null)
     {
         CdProduto.Text = rProd.CD_Produto;
         dsProduto.Text = rProd.DS_Produto;
         dtAbast.Focus();
     }
     else
     {
         cd_produto.Focus();
     }
     cd_produto.Clear();
 }
Esempio n. 14
0
        public static TList_Resposta Buscar(string Id_resposta,
                                            string Ds_resposta,
                                            BancoDados.TObjetoBanco banco,
                                            string Cancelado = "")
        {
            TpBusca[] tpBuscas = new TpBusca[0];
            if (!string.IsNullOrEmpty(Id_resposta))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.Id_pergunta", "'" + Id_resposta + "'");
            }
            if (!string.IsNullOrEmpty(Ds_resposta))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.Ds_resposta", "'" + Ds_resposta + "'");
            }
            if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("1"))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'1'");
            }
            else if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("0"))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'0'");
            }

            return(new TCD_Resposta(banco).Select(tpBuscas, 0, string.Empty));
        }
Esempio n. 15
0
        public static TList_Questionario Buscar(string Id_questionario,
                                                string Ds_questionario,
                                                BancoDados.TObjetoBanco banco,
                                                string Cancelado = "")
        {
            TpBusca[] tpBuscas = new TpBusca[0];
            if (!string.IsNullOrEmpty(Id_questionario))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.id_questionario", "'" + Id_questionario + "'");
            }
            if (!string.IsNullOrEmpty(Ds_questionario))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.ds_questionario", "'" + Ds_questionario + "'");
            }
            if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("1"))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'1'");
            }
            else if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("0"))
            {
                Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'0'");
            }

            return(new TCD_Questionario(banco).Select(tpBuscas, 0, string.Empty));
        }
Esempio n. 16
0
        public void TesteErro4()
        {
            var texto = MockArquivo.Arquivo7();

            Estruturas.LerArquivo(null, texto);
            Testar();
            Testar2();
        }
Esempio n. 17
0
        public void TesteSucesso2()
        {
            var texto = MockArquivo.Arquivo3();

            Estruturas.LerArquivo(null, texto);
            Testar();
            Testar2();
        }
Esempio n. 18
0
 public static void LerAbastecimentoMemoria(ref string st)
 {
     if (Estruturas.BaixarDll("companytec.dll"))
     {
         retorno2 aux = new retorno2();
         LeStringX(ref aux);
         st = aux.value;
     }
 }
Esempio n. 19
0
 public static void LerAbastecimentoOnLine(ref string Abast)
 {
     if (Estruturas.BaixarDll("companytec.dll"))
     {
         visualizacao aux = new visualizacao();
         CobLeVis(ref aux);
         Abast = aux.stfull;
     }
 }
Esempio n. 20
0
        private void afterBusca()
        {
            TpBusca[] filtro = new TpBusca[1];
            filtro[0].vNM_Campo = "a.st_registro";
            filtro[0].vOperador = "=";
            filtro[0].vVL_Busca = "'T'";

            if (!string.IsNullOrEmpty(cd_empresa.Text))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.cd_empresa";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + cd_empresa.Text.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(id_orcamento.Text))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.id_orc";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + id_orcamento.Text.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(nr_projeto.Text))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.id_orcamento";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + nr_projeto.Text.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(nr_versao.Text))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.nr_versao";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + nr_versao.Text.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(cd_clifor.Text))
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "a.cd_clifor";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'" + cd_clifor.Text.Trim() + "'";
            }
            if (!string.IsNullOrEmpty(dt_ini.Text.SoNumero()))
            {
                Estruturas.CriarParametro(ref filtro, "convert(datetime, floor(convert(decimal(30,10), " + (rbDtOrcamento.Checked ? "a.dt_orcamento" : "a.dt_entregaproposta") + ")))",
                                          "'" + DateTime.Parse(dt_ini.Text).ToString("yyyyMMdd") + "'", ">=");
            }
            if (!string.IsNullOrEmpty(dt_fin.Text.SoNumero()))
            {
                Estruturas.CriarParametro(ref filtro, "convert(datetime, floor(convert(decimal(30,10), " + (rbDtOrcamento.Checked ? "a.dt_orcamento" : "a.dt_entregaproposta") + ")))",
                                          "'" + DateTime.Parse(dt_fin.Text).ToString("yyyyMMdd") + "'", "<=");
            }

            bsOrcamento.DataSource = new TCD_Orcamento().Select(filtro, 100, string.Empty);
            bsOrcamento.ResetCurrentItem();
        }
Esempio n. 21
0
        private void TFCobrancaEmail_Load(object sender, EventArgs e)
        {
            TpBusca[] tpBuscas = new TpBusca[0];
            Estruturas.CriarParametro(ref tpBuscas, "a.id_config", "'" + rCfgBoleto.Id_config + "'");
            Estruturas.CriarParametro(ref tpBuscas, "b.st_registro", "('A', 'P')", "in");
            Estruturas.CriarParametro(ref tpBuscas, "cast(b.dt_vencto as date)", "cast(dateadd(day, -1, GETDATE())as date)");

            bsBloqueto.DataSource = new TCD_Titulo().Select(tpBuscas, 0, string.Empty);
            bsBloqueto.ResetBindings(true);
        }
Esempio n. 22
0
 public static TList_CFGVendasExterna Buscar(string Cd_empresa,
                                             TObjetoBanco banco)
 {
     TpBusca[] filtro = new TpBusca[0];
     if (!string.IsNullOrEmpty(Cd_empresa))
     {
         Estruturas.CriarParametro(ref filtro, "a.cd_empresa", "'" + Cd_empresa.Trim() + "'");
     }
     return(new TCD_CFGVendasExterna(banco).Select(filtro, 0, string.Empty));
 }
Esempio n. 23
0
        public static TList_PosVenda Buscar(string CD_Empresa,
                                            string ID_PosVenda,
                                            string Login,
                                            string CD_Clifor,
                                            string ID_Questionario,
                                            string DT_Abertura,
                                            string DT_Encerramento,
                                            string ST_Registro,
                                            BancoDados.TObjetoBanco banco)
        {
            TpBusca[] tpBusca = new TpBusca[0];
            if (!string.IsNullOrEmpty(CD_Empresa))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.cd_empresa", "'" + CD_Empresa + "'");
            }
            if (!string.IsNullOrEmpty(ID_PosVenda))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.ID_PosVenda", "'" + ID_PosVenda + "'");
            }
            if (!string.IsNullOrEmpty(Login))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.Login", "'" + Login + "'");
            }
            if (!string.IsNullOrEmpty(CD_Clifor))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.CD_Clifor", "'" + CD_Clifor + "'");
            }
            if (!string.IsNullOrEmpty(ID_Questionario))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.ID_Questionario", "'" + ID_Questionario + "'");
            }

            if ((!string.IsNullOrEmpty(DT_Abertura)) && (DT_Abertura.Trim() != "/  /"))
            {
                Array.Resize(ref tpBusca, tpBusca.Length + 1);
                tpBusca[tpBusca.Length - 1].vNM_Campo = "a.DT_Abertura";
                tpBusca[tpBusca.Length - 1].vOperador = ">=";
                tpBusca[tpBusca.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(DT_Abertura).ToString("yyyyMMdd")) + " 00:00:00'";
            }
            if ((!string.IsNullOrEmpty(DT_Encerramento)) && (DT_Encerramento.Trim() != "/  /"))
            {
                Array.Resize(ref tpBusca, tpBusca.Length + 1);
                tpBusca[tpBusca.Length - 1].vNM_Campo = "a.DT_Encerramento";
                tpBusca[tpBusca.Length - 1].vOperador = "<=";
                tpBusca[tpBusca.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(DT_Encerramento).ToString("yyyyMMdd")) + " 00:00:00'";
            }

            if (!string.IsNullOrEmpty(ST_Registro))
            {
                Estruturas.CriarParametro(ref tpBusca, "a.ST_Registro", "(" + ST_Registro + ")", "in");
            }


            return(new TCD_PosVenda(banco).Select(tpBusca, 0, string.Empty));
        }
Esempio n. 24
0
        /*
         * public static string GerarQRCode(CamadaDados.Faturamento.PDV.TRegistro_NFCe rNFCe)
         * {
         *  if (rNFCe.St_contingencia)
         *  {
         *      System.Collections.Hashtable hs = new System.Collections.Hashtable();
         *      rNFCe.Chave_acesso = NFCe.GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim();
         *      hs.Add("@P_CHAVE", rNFCe.Chave_acesso);
         *      hs.Add("@P_EMPRESA", rNFCe.Cd_empresa);
         *      hs.Add("@P_ID_NFCE", rNFCe.Id_nfcestr);
         *      new CamadaDados.TDataQuery().executarSql("update tb_pdv_nfce set chave_acesso = @P_CHAVE, dt_alt = getdate() " +
         *                                                "where cd_empresa = @P_EMPRESA and id_nfce = @P_ID_NFCE", hs);
         *  }
         *  string dest = string.Empty;
         *  if(rNFCe.rCliente == null ? false : !string.IsNullOrEmpty((rNFCe.rCliente.Nr_cgc + rNFCe.rCliente.Nr_cpf).SoNumero()))
         *  {
         *      if (rNFCe.rCliente.Tp_pessoa.Trim().ToUpper().Equals("F") && !string.IsNullOrEmpty(rNFCe.rCliente.Nr_cpf.SoNumero()))
         *          dest = rNFCe.rCliente.Nr_cpf.SoNumero();
         *      else if (rNFCe.rCliente.Tp_pessoa.Trim().ToUpper().Equals("J") && !string.IsNullOrEmpty(rNFCe.rCliente.Nr_cgc.SoNumero()))
         *          dest = rNFCe.rCliente.Nr_cgc.SoNumero();
         *  }
         *  else if (!string.IsNullOrEmpty(rNFCe.Nr_cgc_cpf.SoNumero()) &&
         *           (rNFCe.Nr_cgc_cpf.SoNumero().Length.Equals(14) ||
         *            rNFCe.Nr_cgc_cpf.SoNumero().Length.Equals(11)))
         *      dest = rNFCe.Nr_cgc_cpf.SoNumero();
         *  string str = "chNFe=" + GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "&" +
         *                "nVersao=100&" +
         *                "tpAmb=" + rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "&" +
         *                (string.IsNullOrEmpty(dest) ? string.Empty : "cDest=" + dest.Trim() + "&") +
         *                "dhEmi=" + rNFCe.Dt_emissao.Value.ToString("yyyy-MM-ddTHH:mm:sszzz").ConvertHexaDecimal().ToLower() + "&" +
         *                "vNF=" + Convert.ToDecimal(string.Format("{0:N2}", rNFCe.Vl_cupom)).ToString(new System.Globalization.CultureInfo("en-US", true)) + "&" +
         *                "vICMS=" + Convert.ToDecimal(string.Format("{0:N2}", rNFCe.lItem.Sum(v => v.Vl_icms))).ToString(new System.Globalization.CultureInfo("en-US", true)) + "&" +
         *                "digVal=" + rNFCe.Digval.ConvertHexaDecimal().ToLower() + "&" +
         *                "cIdToken=" + rNFCe.rCfgNFCe.Id_tokencsc.Trim() + rNFCe.rCfgNFCe.Nr_csc.Trim();
         *  string strQRCode = rNFCe.rCfgNFCe.Url_nfce.Trim() +
         *                     "chNFe=" + GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "&" +
         *                     "nVersao=100&" +
         *                     "tpAmb=" + rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "&" +
         *                     (string.IsNullOrEmpty(dest) ? string.Empty : "cDest=" + dest.Trim() + "&") +
         *                     "dhEmi=" + rNFCe.Dt_emissao.Value.ToString("yyyy-MM-ddTHH:mm:sszzz").ConvertHexaDecimal().ToLower() + "&" +
         *                     "vNF=" + Convert.ToDecimal(string.Format("{0:N2}", rNFCe.Vl_cupom)).ToString(new System.Globalization.CultureInfo("en-US", true)) + "&" +
         *                     "vICMS=" + Convert.ToDecimal(string.Format("{0:N2}", rNFCe.lItem.Sum(v => v.Vl_icms))).ToString(new System.Globalization.CultureInfo("en-US", true)) + "&" +
         *                     "digVal=" + rNFCe.Digval.ConvertHexaDecimal().ToLower() + "&" +
         *                     "cIdToken=" + rNFCe.rCfgNFCe.Id_tokencsc.Trim() + "&" +
         *                     "cHashQRCode=" + Utils.Estruturas.SHA1(str).ToLower().Trim();
         *  //Gerar Imagem QR Code
         *  Gma.QrCodeNet.Encoding.QrCode code = new Gma.QrCodeNet.Encoding.QrCode();
         *  Gma.QrCodeNet.Encoding.QrEncoder encoder = new Gma.QrCodeNet.Encoding.QrEncoder(Gma.QrCodeNet.Encoding.ErrorCorrectionLevel.M);
         *  code = encoder.Encode(strQRCode);
         *  Gma.QrCodeNet.Encoding.Windows.Render.GraphicsRenderer gRender =
         *      new Gma.QrCodeNet.Encoding.Windows.Render.GraphicsRenderer(new Gma.QrCodeNet.Encoding.Windows.Render.FixedModuleSize(4, Gma.QrCodeNet.Encoding.Windows.Render.QuietZoneModules.Zero),
         *                                                                 System.Drawing.Brushes.Black, System.Drawing.Brushes.White);
         *  System.IO.MemoryStream ms = new System.IO.MemoryStream();
         *  gRender.WriteToStream(code.Matrix, System.Drawing.Imaging.ImageFormat.Jpeg, ms);
         *  rNFCe.QR_Code = System.Drawing.Image.FromStream(ms);
         *  return strQRCode;
         * }
         */
        public static string GerarQRCode2(CamadaDados.Faturamento.PDV.TRegistro_NFCe rNFCe)
        {
            string strQRCode = string.Empty;

            if (rNFCe.St_contingencia)
            {
                System.Collections.Hashtable hs = new System.Collections.Hashtable();
                rNFCe.Chave_acesso = NFCe.GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim();
                hs.Add("@P_CHAVE", rNFCe.Chave_acesso);
                hs.Add("@P_EMPRESA", rNFCe.Cd_empresa);
                hs.Add("@P_ID_NFCE", rNFCe.Id_nfcestr);
                new CamadaDados.TDataQuery().executarSql("update tb_pdv_nfce set chave_acesso = @P_CHAVE, dt_alt = getdate() " +
                                                         "where cd_empresa = @P_EMPRESA and id_nfce = @P_ID_NFCE", hs);
                string str = GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "|" +
                             "2|" +
                             rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "|" +
                             rNFCe.Dt_emissao.Value.ToString("dd/MM/yyyy").Substring(0, 2) + "|" +
                             Convert.ToDecimal(string.Format("{0:N2}", rNFCe.Vl_cupom)).ToString(new System.Globalization.CultureInfo("en-US", true)) + "|" +
                             rNFCe.Digval.ConvertHexaDecimal() + "|" +
                             int.Parse(rNFCe.rCfgNFCe.Id_tokencsc) + rNFCe.rCfgNFCe.Nr_csc.Trim();
                strQRCode = rNFCe.rCfgNFCe.Url_nfce.Trim() + "?p=" +
                            GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "|" +
                            "2|" +
                            rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "|" +
                            rNFCe.Dt_emissao.Value.ToString("dd/MM/yyyy").Substring(0, 2) + "|" +
                            Convert.ToDecimal(string.Format("{0:N2}", rNFCe.Vl_cupom)).ToString(new System.Globalization.CultureInfo("en-US", true)) + "|" +
                            rNFCe.Digval.ConvertHexaDecimal() + "|" +
                            int.Parse(rNFCe.rCfgNFCe.Id_tokencsc) + "|" +
                            Estruturas.SHA1(str).Trim();
            }
            else
            {
                string str = GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "|" +
                             "2|" +
                             rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "|" +
                             int.Parse(rNFCe.rCfgNFCe.Id_tokencsc) + rNFCe.rCfgNFCe.Nr_csc.Trim();
                strQRCode = rNFCe.rCfgNFCe.Url_nfce.Trim() + "?p=" +
                            GerarXML.TGerarXML.MontarChaveAcessoNfe(rNFCe, true).Trim() + "|" +
                            "2|" + //Versão do QRCode
                            rNFCe.rCfgNFCe.Tp_ambiente_nfce.Trim() + "|" +
                            int.Parse(rNFCe.rCfgNFCe.Id_tokencsc) + "|" +
                            Estruturas.SHA1(str).Trim();
            }
            //Gerar Imagem QR Code
            Gma.QrCodeNet.Encoding.QrCode    code    = new Gma.QrCodeNet.Encoding.QrCode();
            Gma.QrCodeNet.Encoding.QrEncoder encoder = new Gma.QrCodeNet.Encoding.QrEncoder(Gma.QrCodeNet.Encoding.ErrorCorrectionLevel.M);
            code = encoder.Encode(strQRCode);
            Gma.QrCodeNet.Encoding.Windows.Render.GraphicsRenderer gRender =
                new Gma.QrCodeNet.Encoding.Windows.Render.GraphicsRenderer(new Gma.QrCodeNet.Encoding.Windows.Render.FixedModuleSize(4, Gma.QrCodeNet.Encoding.Windows.Render.QuietZoneModules.Zero),
                                                                           System.Drawing.Brushes.Black, System.Drawing.Brushes.White);
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            gRender.WriteToStream(code.Matrix, System.Drawing.Imaging.ImageFormat.Jpeg, ms);
            rNFCe.QR_Code = System.Drawing.Image.FromStream(ms);
            return(strQRCode);
        }
Esempio n. 25
0
        private void bb_enviar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ds_assunto.Text.Trim()) || string.IsNullOrEmpty(ds_corpo.Text.Trim()))
            {
                MessageBox.Show("Obrigatório informar assunto e corpo para enviar e-mail.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if ((bsBloqueto.List as blListaTitulo).Where(p => p.St_processar).ToList().Count.Equals(0))
            {
                MessageBox.Show("Obrigatório selecionar algum bloqueto pela opção de enviar para finalizar o processo.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            (bsBloqueto.List as blListaTitulo).Where(p => p.St_processar).ToList().ForEach(r =>
            {
                if (cbxAnexarBloqueto.Checked)
                {
                    reprocessarBloqueto(r);
                    TpBusca[] tpBuscas = new TpBusca[0];
                    Estruturas.CriarParametro(ref tpBuscas, "a.Nr_Lancto", "'" + r.Nr_lancto + "'");
                    Estruturas.CriarParametro(ref tpBuscas, "a.cd_empresa", "'" + r.Cd_empresa + "'");
                    Estruturas.CriarParametro(ref tpBuscas, "a.cd_parcela", "'" + r.Cd_parcela + "'");
                    blTitulo p = new TCD_Titulo().Select(tpBuscas, 1, string.Empty)[0];
                    TCN_LayoutBloqueto.Imprime_Bloqueto(false,
                                                        new List <blTitulo>()
                    {
                        p
                    },
                                                        false,
                                                        false,
                                                        true,
                                                        false,
                                                        string.Empty,
                                                        new List <string>()
                    {
                        r.Email
                    },
                                                        ds_assunto.Text.Trim(),
                                                        ds_corpo.Text.Trim(),
                                                        false);
                }
                else
                {
                    new Email(new List <string>()
                    {
                        r.Email
                    }, ds_assunto.Text.Trim(), ds_corpo.Text.Trim(), new List <string>()).EnviarEmail();
                }
            });

            MessageBox.Show("Processo finalizado com sucesso.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            (bsBloqueto.List as blListaTitulo).RemoveAll(r => r.St_processar);
            bsBloqueto.ResetBindings(true);
        }
Esempio n. 26
0
        private void BuscarAbastecidas()
        {
            if (cbEmpresa.SelectedItem != null &&
                dt_retirada.Text.IsDateTime())
            {
                TpBusca[] filtro = new TpBusca[2];
                filtro[0].vNM_Campo = "a.cd_empresa";
                filtro[0].vOperador = "=";
                filtro[0].vVL_Busca = "'" + (cbEmpresa.SelectedItem as CamadaDados.Diversos.TRegistro_CadEmpresa).Cd_empresa.Trim() + "'";
                filtro[1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), a.DT_Abast)))";
                filtro[1].vOperador = "<=";
                filtro[1].vVL_Busca = "'" + DateTime.Parse(dt_retirada.Text).ToString("yyyyMMdd") + "'";
                if (dtUltimaRetirada.Text.IsDateTime())
                {
                    Estruturas.CriarParametro(ref filtro, "convert(datetime, floor(convert(decimal(30,10), a.DT_Abast)))",
                                              "'" + DateTime.Parse(dtUltimaRetirada.Text).ToString("yyyyMMdd") + "'", ">");
                }
                TList_AbastItens lAbast = new TCD_AbastItens().Select(filtro, 0, string.Empty);
                if (lAbast.Count > 0)
                {
                    vlAbast.Text            = lAbast.Sum(x => x.Vl_subtotal).ToString("C");
                    bsAbastItens.DataSource = lAbast;
                }
                else
                {
                    bsAbastItens.Clear();
                    vlAbast.Clear();
                }

                filtro = new TpBusca[2];
                filtro[0].vNM_Campo = "a.cd_empresa";
                filtro[0].vOperador = "=";
                filtro[0].vVL_Busca = "'" + (cbEmpresa.SelectedItem as CamadaDados.Diversos.TRegistro_CadEmpresa).Cd_empresa.Trim() + "'";
                filtro[1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), a.DT_Medicao)))";
                filtro[1].vOperador = "<=";
                filtro[1].vVL_Busca = "'" + DateTime.Parse(dt_retirada.Text).ToString("yyyyMMdd") + "'";
                if (dtUltimaRetirada.IsDateTime())
                {
                    Estruturas.CriarParametro(ref filtro, "convert(datetime, floor(convert(decimal(30,10), a.DT_Medicao)))",
                                              "'" + DateTime.Parse(dtUltimaRetirada.Text).ToString("yyyyMMdd") + "'", ">");
                }
                TList_MedicaoProdutoItens lMedicao = new TCD_MedicaoProdutoItens().Select(filtro, 0, string.Empty);
                if (lMedicao.Count > 0)
                {
                    vlMedicao.Text       = lMedicao.Sum(x => x.Vl_subtotal).ToString("C");
                    bsMedicao.DataSource = lMedicao;
                }
                else
                {
                    vlMedicao.Clear();
                    bsMedicao.Clear();
                }
            }
        }
Esempio n. 27
0
 public static int ApagaAbastecimentoMemoria(int nIdAbast)
 {
     if (Estruturas.BaixarDll("ControlTech32.dll"))
     {
         return(ApagaAbastecimento(nIdAbast));
     }
     else
     {
         return(255);//Erro
     }
 }
Esempio n. 28
0
 public static int AlterarPreco(int nBico, string sPreco)
 {
     if (Estruturas.BaixarDll("ControlTech32.dll"))
     {
         return(AlteraPreco(nBico, sPreco));
     }
     else
     {
         return(255);//Erro
     }
 }
Esempio n. 29
0
 public static int StatusPorta()
 {
     if (Estruturas.BaixarDll("ControlTech32.dll"))
     {
         return(StatusCom());
     }
     else
     {
         return(255);//Erro
     }
 }
Esempio n. 30
0
 public static int FecharPorta()
 {
     if (Estruturas.BaixarDll("ControlTech32.dll"))
     {
         return(FinalizaCom());
     }
     else
     {
         return(255);//Erro
     }
 }