public static TList_LoteRPS_X_NFES Buscar(string Id_lote, string Cd_empresa, string Nr_lanctofiscal, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_lote)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lote"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lote; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_lanctofiscal)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lanctofiscal"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lanctofiscal; } return(new TCD_LoteRPS_X_NFES(banco).Select(filtro, 0, string.Empty)); }
public static TList_LanServico_X_Duplicata Buscar(string Id_os, string Cd_empresa, string Nr_lancto, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_os)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_os"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_os; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_lancto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lancto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lancto; } return(new TCD_LanServico_X_Duplicata(banco).Select(filtro, 0, string.Empty)); }
public static TList_ItensGuardaVolume Buscar(string Cd_empresa, string ID_GuardaVol, string ID_ItemGuardaVol, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(ID_GuardaVol)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_GuardaVol"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = ID_GuardaVol; } if (!string.IsNullOrEmpty(ID_ItemGuardaVol)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_ItemGuardaVol"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = ID_ItemGuardaVol; } return(new TCD_ItensGuardaVolume(banco).Select(filtro, 0, string.Empty)); }
public static TList_CadAlmox_X_Empresa Busca(string vId_almox, string vCd_empresa, TObjetoBanco banco) { TpBusca[] vBusca = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(vId_almox)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.id_almox"; vBusca[vBusca.Length - 1].vVL_Busca = vId_almox; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.cd_empresa"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCd_empresa.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } TCD_CadAlmox_X_Empresa cd = new TCD_CadAlmox_X_Empresa(); return(new TCD_CadAlmox_X_Empresa(banco).Select(vBusca, 0, string.Empty)); }
public static TList_ParcelaContrato Buscar(string Nr_contrato, string Cd_empresa, string Id_parcela, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Nr_contrato)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_contrato"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_contrato; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_parcela)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_parcela"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_parcela; } return(new TCD_ParcelaContrato(banco).Select(filtro, 0, string.Empty)); }
private void Produtos() { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[0].vOperador = "<>"; filtro[0].vVL_Busca = "'C'"; if (!string.IsNullOrEmpty(edt_produto.Text)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + edt_produto.Text.Trim() + "') or " + "(a.ds_produto like " + (Utils.Parametros.ST_UtilizarCoringaEsq ? "'%" : "'") + edt_produto.Text.Trim() + "%') or " + "(a.codigo_alternativo like '%" + edt_produto.Text.Trim() + "%') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + edt_produto.Text.Trim() + "')) or " + "(exists(select 1 from tb_est_patrimonio x " + " where x.CD_Patrimonio = a.cd_produto " + " and x.NR_Patrimonio = '" + edt_produto.Text.Trim() + "'))"; } System.Collections.Hashtable vParametros = new System.Collections.Hashtable(); vParametros.Add("@CD_TABELAPRECO", _Cfg.cd_tabelapreco); vParametros.Add("@CD_EMPRESA", _Cfg.cd_empresa); bsProduto.DataSource = new TCD_CadProduto().Select(filtro, 100, string.Empty, string.Empty, "a.ds_produto", vParametros); bsProduto_PositionChanged(this, new EventArgs()); }
public static TList_Usuario_RegraEspecial Buscar(string Login, string Id_regra, string Ds_regra, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Login)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.login"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Login.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_regra)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_regra"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_regra; } if (!string.IsNullOrEmpty(Ds_regra)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_regra"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "('%" + Ds_regra.Trim() + "%')"; } return(new TCD_Usuario_RegraEspecial(banco).Select(filtro, 0, string.Empty)); }
public static string Gravar(TRegistro_CTB_CFGProvisao_Estoque val, TObjetoBanco banco) { bool st_transacao = false; TCD_CTB_CFGProvisao_Estoque qtb_CTB_CFGProvisao_Estoque = new TCD_CTB_CFGProvisao_Estoque(); try { if (banco == null) { st_transacao = qtb_CTB_CFGProvisao_Estoque.CriarBanco_Dados(true); } else { qtb_CTB_CFGProvisao_Estoque.Banco_Dados = banco; } if (!val.ID_CFGCTB.HasValue) { Utils.TpBusca[] filtro = new Utils.TpBusca[3]; filtro[0].vNM_Campo = "a.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + val.Cd_empresa.Trim() + "'"; filtro[1].vNM_Campo = "a.cd_produto"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'" + val.CD_Produto.Trim() + "'"; filtro[2].vNM_Campo = "a.tp_movimento"; filtro[2].vOperador = "="; filtro[2].vVL_Busca = "'" + val.Tp_movimento.Trim() + "'"; object obj = qtb_CTB_CFGProvisao_Estoque.BuscarEscalar(filtro, "a.id_cfgctb"); if (obj != null) { val.ID_CFGCTB = decimal.Parse(obj.ToString()); } } val.ID_CFGCTB_String = CamadaDados.TDataQuery.getPubVariavel(qtb_CTB_CFGProvisao_Estoque.Grava(val), "@P_ID_CFGCTB"); if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.Banco_Dados.Commit_Tran(); } return(val.ID_CFGCTB_String); } catch (Exception ex) { if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar registro: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.deletarBanco_Dados(); } } }
private void BuscarProduto() { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = "isnull(e.ST_Servico, 'N')"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'S'"; CamadaDados.Estoque.Cadastros.TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(CD_Produto.Text)) { rProd = FormBusca.UtilPesquisa.BuscarProduto(string.Empty, CD_Empresa, Nm_empresa, CD_TabelaPreco, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { rProd = FormBusca.UtilPesquisa.BuscarProduto(CD_Produto.Text, CD_Empresa, Nm_empresa, CD_TabelaPreco, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 2].vOperador = "<>"; filtro[filtro.Length - 2].vVL_Busca = "'C'"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(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() + "'))"; 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) { CD_Produto.Text = rProd.CD_Produto; DS_Produto.Text = rProd.DS_Produto; DS_Observacao.Text = rProd.DS_Tecnica; } this.ConsultaPreco(); }
private void BuscarProduto() { if (bsItens.Current != null) { decimal tot_faturado = decimal.Zero; if (bsItensFat.Count > 0) { tot_faturado = (bsItensFat.List as CamadaDados.Faturamento.Pedido.TList_RegLanPedido_Item).Sum(p => p.Vl_subtotal); } if ((bsItens.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento_Item).Vl_faturar - tot_faturado > decimal.Zero) { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = "isnull(e.st_servico, 'N')"; filtro[0].vOperador = (bsItens.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento_Item).St_servicobool ? "=" : "<>"; filtro[0].vVL_Busca = "'S'"; if (string.IsNullOrEmpty(CD_Produto.Text)) { FormBusca.UtilPesquisa.BuscarProduto(string.Empty, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Nm_empresa, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Cd_tabelapreco, new Componentes.EditDefault[] { CD_Produto }, filtro); } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { FormBusca.UtilPesquisa.BuscarProduto(CD_Produto.Text, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Nm_empresa, (bsOrcamento.Current as CamadaDados.Faturamento.Orcamento.TRegistro_Orcamento).Cd_tabelapreco, new Componentes.EditDefault[] { CD_Produto }, null); } } else { MessageBox.Show("Item orçamento não possui mais saldo disponivel para faturar.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (BuscarItens()) { CD_Produto.Clear(); Quantidade.Focus(); } else { MessageBox.Show("Produto inexistente.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); CD_Produto.Clear(); CD_Produto.Focus(); } } }
private void BuscarProduto() { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = "isnull(e.ST_ConsumoInterno, 'N')"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'S'"; CamadaDados.Estoque.Cadastros.TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(CD_Produto.Text)) { rProd = FormBusca.UtilPesquisa.BuscarProduto(string.Empty, Cd_empresa, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { rProd = FormBusca.UtilPesquisa.BuscarProduto(CD_Produto.Text, Cd_empresa, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 2].vOperador = "<>"; filtro[filtro.Length - 2].vVL_Busca = "'C'"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "')"; 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) { CD_Produto.Text = rProd.CD_Produto; DS_Produto.Text = rProd.DS_Produto; sigla_unidade.Text = rProd.Sigla_unidade; } this.ConsultaSaldo_CustoAlmox(); }
public static TList_GradeEstoque Buscar(string Cd_empresa, string Cd_produto, string Id_lanctoestoque, string Id_caracteristica, string Id_item, int vTop, string vNm_campo, TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa.Trim())) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_produto.Trim())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_produto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_produto.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_lanctoestoque.Trim())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lanctoestoque"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lanctoestoque; } if (!string.IsNullOrEmpty(Id_caracteristica.Trim())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_caracteristica"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_caracteristica; } if (!string.IsNullOrEmpty(Id_item.Trim())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_item"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_item; } return(new TCD_GradeEstoque(banco).Select(filtro, vTop, vNm_campo)); }
public static TList_Lote_X_Titulo Buscar(decimal?id_lote, string cd_empresa, decimal?nr_lancto, decimal?id_parcela, decimal?id_cobranca, int vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (id_lote != null) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lote"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = id_lote.Value.ToString(); } if (cd_empresa.Trim() != string.Empty) { 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.Trim() + "'"; } if (nr_lancto != null) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lancto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = nr_lancto.Value.ToString(); } if (id_parcela != null) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_parcela"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = id_parcela.Value.ToString(); } if (id_cobranca != null) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_cobranca"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = id_cobranca.Value.ToString(); } return(new TCD_Lote_X_Titulo(banco).Select(filtro, vTop, vNm_campo)); }
public static TList_Mov_X_CFOP Buscar(string Cd_movimentacao, string Cd_condfiscal_produto, string Cd_cfop_dentroestado, string Cd_cfop_foraestado, string Cd_cfop_internacional, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_movimentacao)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_movimentacao"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Cd_movimentacao; } if (!string.IsNullOrEmpty(Cd_condfiscal_produto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_condfiscal_produto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_condfiscal_produto.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_cfop_dentroestado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_cfop_dentroestado"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_cfop_dentroestado.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_cfop_foraestado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_cfop_foraestado"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_cfop_foraestado.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_cfop_internacional)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_cfop_internacional"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_cfop_internacional.Trim() + "'"; } return(new TCD_Mov_X_CFOP(banco).Select(filtro, 0, string.Empty)); }
public static TList_MovPneu Buscar(string Cd_empresa, string Id_pneu, string Id_veiculo, string Id_rodado, BancoDados.TObjetoBanco banco, string St_registro = "") { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_pneu)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_pneu"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_pneu; } if (!string.IsNullOrEmpty(Id_veiculo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_veiculo"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_veiculo; } if (!string.IsNullOrEmpty(Id_rodado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_rodado"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_rodado; } if (!string.IsNullOrEmpty(St_registro.Trim())) { Estruturas.CriarParametro(ref filtro, "isnull(a.st_rodando, 'N')", "'" + St_registro.Trim() + "'"); } return(new TCD_MovPneu(banco).Select(filtro, 0, string.Empty, string.Empty)); }
public static TList_Servico_X_Pedidos Buscar(string Id_OS, string CD_Empresa, string NR_Pedido, string TP_Pedido, int vTop, string vNm_campo) { TpBusca[] filtro = new Utils.TpBusca[0]; if (Id_OS.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_OS"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_OS.Trim(); } if (CD_Empresa.Trim() != string.Empty) { 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.Trim() + "'"; } if (NR_Pedido.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.NR_PEDIDO"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = NR_Pedido.Trim(); } if (TP_Pedido.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.TP_Pedido"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + TP_Pedido.Trim() + "'"; } return(new TCD_Servico_X_Pedidos().Select(filtro, vTop, vNm_campo)); }
public static TList_RodadoVeic Buscar(string Id_rodado, string Id_veiculo, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_rodado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_rodado"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_rodado; } if (!string.IsNullOrEmpty(Id_veiculo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_veiculo"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_veiculo; } return(new TCD_RodadoVeic(banco).Select(filtro, 0, string.Empty)); }
public static CamadaDados.Financeiro.Caixa.TList_LanCaixa BuscarCaixa(decimal Id_lote, int vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { if (Id_lote > 0) { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = string.Empty; filtro[0].vOperador = "exists"; filtro[0].vVL_Busca = "(select 1 from tb_cob_lote_x_caixa x " + "where x.cd_contager = a.cd_contager " + "and x.cd_lanctocaixa = a.cd_lanctocaixa " + "and x.id_lote = " + Id_lote.ToString() + ")"; return(new CamadaDados.Financeiro.Caixa.TCD_LanCaixa(banco).Select(filtro, vTop, vNm_campo)); } else { return(new CamadaDados.Financeiro.Caixa.TList_LanCaixa()); } }
public static TList_Rodado Buscar(string Id_rodado, string Ds_rodado, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_rodado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_rodado"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_rodado; } if (!string.IsNullOrEmpty(Ds_rodado)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_rodado"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "'%" + Ds_rodado.Trim() + "%'"; } return(new TCD_Rodado(banco).Select(filtro, 0, string.Empty)); }
public static TList_DevolucaoCheque Buscar(string Id_devolucao, string Cd_empresa, string Nr_lanctocheque, string Cd_banco, int vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (Id_devolucao.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_devolucao"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_devolucao; } if (Cd_empresa.Trim() != string.Empty) { 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.Trim() + "'"; } if (Nr_lanctocheque.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lanctocheque"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lanctocheque; } if (Cd_banco.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_banco"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_banco.Trim() + "'"; } return(new TCD_DevolucaoCheque(banco).Select(filtro, vTop, vNm_campo, string.Empty)); }
public static blListaTitulo BuscarBloquetos(decimal?Id_lote, int vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { if (Id_lote != null) { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; filtro[0].vNM_Campo = string.Empty; filtro[0].vOperador = "exists"; filtro[0].vVL_Busca = "(select 1 from tb_cob_lote_x_titulo x " + "where x.cd_empresa = a.cd_empresa " + "and x.nr_lancto = a.nr_lancto " + "and x.cd_parcela = a.cd_parcela " + "and x.id_cobranca = a.id_cobranca " + "and x.id_lote = " + Id_lote.Value.ToString() + ")"; return(new TCD_Titulo(banco).Select(filtro, vTop, vNm_campo)); } else { return(new blListaTitulo()); } }
public static TList_ItensCargaAvulsa Buscar(string Cd_empresa, string Id_carga, string Id_item, string Cd_produto, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_carga)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_carga"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_carga; } if (!string.IsNullOrEmpty(Id_item)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_item"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_item; } if (!string.IsNullOrEmpty(Cd_produto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Cd_produto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_produto.Trim() + "'"; } return(new TCD_ItensCargaAvulsa(banco).Select(filtro, 0, string.Empty)); }
public static TList_DespViagem_X_CCusto Buscar(string Id_landespesa, string Id_viagem, string Cd_empresa, string Nr_lancto, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_landespesa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_landespesa"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_landespesa; } if (!string.IsNullOrEmpty(Id_viagem)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_viagem"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_viagem; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_lancto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lancto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lancto; } return(new TCD_DespViagem_X_CCusto(banco).Select(filtro, 0, string.Empty)); }
public static TList_ImpostosNF Buscar(string Id_lancto, string Cd_empresa, string Nr_lanctofiscal, string Id_nfitem, string Nr_lanctoctr, string Cd_imposto, string Cd_historico, string Tp_movimento, string Dt_inicial, string Dt_final, string Tp_registro, bool St_aprocessar, string Id_lotefis, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_lancto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lancto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lancto; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_lanctofiscal)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lanctofiscal"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lanctofiscal; } if (!string.IsNullOrEmpty(Id_nfitem)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_nfitem"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_nfitem; } if (!string.IsNullOrEmpty(Nr_lanctoctr)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_lanctoctr"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Nr_lanctoctr; } if (!string.IsNullOrEmpty(Cd_imposto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_imposto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Cd_imposto; } if (!string.IsNullOrEmpty(Cd_historico)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_historico"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_historico.Trim() + "'"; } if (!string.IsNullOrEmpty(Tp_movimento)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "nf.tp_movimento"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Tp_movimento.Trim() + "'"; } if ((!string.IsNullOrEmpty(Dt_inicial)) && (Dt_inicial.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "((case when nf.tp_movimento = 'E' then nf.dt_saient else nf.dt_emissao end) >= '" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_inicial).ToString("yyyyMMdd")) + " 00:00:00') or" + "((case when ctrc.tp_movimento = 'E' then ctrc.DT_SaiEnt else ctrc.DT_Emissao end) >= '" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_inicial).ToString("yyyyMMdd")) + " 00:00:00')"; } if ((!string.IsNullOrEmpty(Dt_final)) && (Dt_final.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "((case when nf.tp_movimento = 'E' then nf.dt_saient else nf.dt_emissao end) <= '" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_final).ToString("yyyyMMdd")) + " 23:59:59') or" + "((case when ctrc.tp_movimento = 'E' then ctrc.DT_SaiEnt else ctrc.DT_Emissao end) <= '" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_final).ToString("yyyyMMdd")) + " 23:59:59')"; } if (!string.IsNullOrEmpty(Tp_registro)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "isnull(a.tp_registro, 'A')"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Tp_registro.Trim() + "'"; } if (St_aprocessar) { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "a.id_lotefis"; filtro[filtro.Length - 2].vOperador = "is"; filtro[filtro.Length - 2].vVL_Busca = "null"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(exists(select 1 from tb_fat_serienf serie " + " where nf.nr_serie = serie.nr_serie " + " and nf.cd_modelo = serie.cd_modelo " + " and isnull(serie.st_gerasintegra, 'N') = 'S') or " + " exists(select 1 from tb_fat_serienf serie " + " where ctrc.nr_serie = serie.nr_serie " + " and ctrc.cd_modelo = serie.cd_modelo " + " and isnull(serie.st_gerasintegra, 'N') = 'S'))"; } if (!string.IsNullOrEmpty(Id_lotefis)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lotefis"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lotefis; } return(new TCD_ImpostosNF(banco).Select(filtro, 0, string.Empty)); }
public static TList_PesagemDiversas Buscar(string Cd_empresa, string Tp_pesagem, string Id_ticket, string Placacarreta, string Cd_tpveiculo, string Ds_observacao, string Dt_ini, string Dt_fin, string St_registro, short vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Tp_pesagem)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.tp_pesagem"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Tp_pesagem.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_ticket)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_ticket"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_ticket; } if (!string.IsNullOrEmpty(Placacarreta)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.placacarreta"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Placacarreta.Trim() + "'"; } //if (!string.IsNullOrEmpty(Nr_pedido)) //{ // Array.Resize(ref filtro, filtro.Length + 1); // filtro[filtro.Length - 1].vNM_Campo = "a.nr_pedido"; // filtro[filtro.Length - 1].vOperador = "="; // filtro[filtro.Length - 1].vVL_Busca = Nr_pedido; //} //if (!string.IsNullOrEmpty(Nr_lanctoFiscal)) //{ // Array.Resize(ref filtro, filtro.Length + 1); // filtro[filtro.Length - 1].vNM_Campo = "a.nr_lanctofiscal"; // filtro[filtro.Length - 1].vOperador = "="; // filtro[filtro.Length - 1].vVL_Busca = Nr_lanctoFiscal; //} //if (!string.IsNullOrEmpty(Cd_produto)) //{ // Array.Resize(ref filtro, filtro.Length + 1); // filtro[filtro.Length - 1].vNM_Campo = "a.cd_produto"; // filtro[filtro.Length - 1].vOperador = "="; // filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_produto.Trim() + "'"; //} if (!string.IsNullOrEmpty(Cd_tpveiculo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_tpveiculo"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_tpveiculo.Trim() + "'"; } if (!string.IsNullOrEmpty(Ds_observacao)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_observacao"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "('%" + Ds_observacao.Trim() + "%')"; } if ((Dt_ini.Trim() != string.Empty) && (Dt_ini.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_bruto"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_ini).ToString("yyyyMMdd")) + " 00:00:00'"; } if ((Dt_fin.Trim() != string.Empty) && (Dt_fin.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_bruto"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_fin).ToString("yyyyMMdd")) + " 23:59:59'"; } if (!string.IsNullOrEmpty(St_registro)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 1].vOperador = "in"; filtro[filtro.Length - 1].vVL_Busca = "(" + St_registro.Trim() + ")"; } return(new TCD_PesagemDiversas(banco).Select(filtro, vTop, vNm_campo)); }
private void afterBusca() { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; //Buscar~somente fornecedores das requisições aguardando cotação ou renegociar filtro[0].vNM_Campo = string.Empty; filtro[0].vOperador = "exists"; filtro[0].vVL_Busca = "(select 1 from TB_CMP_Fornec_X_GrupoItem x " + "inner join TB_EST_GrupoProduto y " + "on x.cd_grupo = y.cd_grupo " + "inner join TB_EST_Produto k " + "on k.cd_grupo = y.cd_grupo " + "inner join TB_CMP_Requisicao l " + "on l.cd_produto = k.cd_produto " + "where x.CD_Clifor = a.CD_Clifor " + "and l.ST_Requisicao in ('AC', 'RN'))"; if (!string.IsNullOrEmpty(cd_fornecedor.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_fornecedor.Text + "'"; } if (!string.IsNullOrEmpty(cd_produto.Text)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_CMP_Fornec_X_GrupoItem x " + "inner join TB_EST_GrupoProduto y " + "on x.cd_grupo = y.cd_grupo " + "inner join TB_EST_Produto k " + "on k.cd_grupo = y.cd_grupo " + "inner join TB_CMP_Requisicao l " + "on l.cd_produto = k.cd_produto " + "where x.CD_Clifor = a.CD_Clifor " + "and l.cd_produto = '" + cd_produto.Text + "'" + "and l.ST_Requisicao in ('AC', 'RN'))"; } if (cbCotacao.Checked) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_CMP_Cotacao x " + "where x.cd_fornecedor = a.cd_clifor )"; } if (cbCompras.Checked) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from tb_fat_notafiscal x " + "where x.cd_clifor = a.cd_clifor " + "and x.tp_movimento = 'E' " + "and isnull(x.st_registro, 'A') <> 'C' )"; } //Buscar Fornecedores bsClifor.DataSource = new CamadaDados.Financeiro.Cadastros.TCD_CadClifor().Select(filtro, 0, string.Empty); bsClifor.ResetCurrentItem(); }
public static TList_Agendamento Buscar(string Cd_empresa, string Id_agenda, string Cd_clifor, string Cd_tecnico, string Cd_servico, string Dt_ini, string Dt_fin, string Status, string vOrder, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_agenda)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_agenda"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_agenda; } if (!string.IsNullOrEmpty(Cd_clifor)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_tecnico)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_tecnico"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_tecnico.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_servico)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_servico"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_servico.Trim() + "'"; } if (!string.IsNullOrEmpty(Dt_ini.SoNumero())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), a.dt_agendamento)))"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + DateTime.Parse(Dt_ini).ToString("yyyyMMdd") + "'"; } if (!string.IsNullOrEmpty(Dt_fin.SoNumero())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), a.dt_agendamento)))"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + DateTime.Parse(Dt_fin).ToString("yyyyMMdd") + "'"; } if (!string.IsNullOrEmpty(Status)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 1].vOperador = "in"; filtro[filtro.Length - 1].vVL_Busca = "(" + Status.Trim() + ")"; } return(new TCD_Agendamento(banco).Select(filtro, 0, string.Empty, vOrder)); }
public static string Gravar(TRegistro_CTB_CFGCaixa val, TObjetoBanco banco) { bool st_transacao = false; TCD_CTB_CFGCaixa qtb_CTB_CFGCaixa = new TCD_CTB_CFGCaixa(); try { if (banco == null) { st_transacao = qtb_CTB_CFGCaixa.CriarBanco_Dados(true); } else { qtb_CTB_CFGCaixa.Banco_Dados = banco; } if (!val.ID_CFGCTB.HasValue) { Utils.TpBusca[] filtro = new Utils.TpBusca[4]; filtro[0].vNM_Campo = "a.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + val.CD_Empresa.Trim() + "'"; filtro[1].vNM_Campo = "a.cd_contager"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'" + val.CD_ContaGer.Trim() + "'"; filtro[2].vNM_Campo = "a.cd_historico"; filtro[2].vOperador = "="; filtro[2].vVL_Busca = "'" + val.CD_Historico.Trim() + "'"; filtro[3].vNM_Campo = "a.tp_movimento"; filtro[3].vOperador = "="; filtro[3].vVL_Busca = "'" + val.TP_Movimento.Trim() + "'"; object obj = qtb_CTB_CFGCaixa.BuscarEscalar(filtro, "a.id_cfgctb"); if (obj != null) { val.ID_CFGCTB = decimal.Parse(obj.ToString()); } } string retorno = qtb_CTB_CFGCaixa.Grava(val); if (st_transacao) { qtb_CTB_CFGCaixa.Banco_Dados.Commit_Tran(); } return(retorno); } catch (Exception ex) { if (st_transacao) { qtb_CTB_CFGCaixa.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar registro: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_CTB_CFGCaixa.deletarBanco_Dados(); } } }
private void BuscarProduto() { if (bsItens.Current != null) { Utils.TpBusca[] filtro = new Utils.TpBusca[1]; //Valor filtro[0].vNM_Campo = "dbo.F_PRECO_VENDA('" + (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_empresa.Trim() + "'," + "a.cd_produto, '" + (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_tabelapreco.Trim() + "')"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = (bsItens.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida_Item).Vl_unitario.ToString().Replace(',', '.'); CamadaDados.Estoque.Cadastros.TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(cd_produtobusca.Text)) { rProd = FormBusca.UtilPesquisa.BuscarProduto(string.Empty, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_empresa, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Nm_empresa, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_tabelapreco, new Componentes.EditDefault[] { cd_produtobusca, ds_produtobusca }, filtro); } else if (cd_produtobusca.Text.SoNumero().Trim().Length != cd_produtobusca.Text.Trim().Length) { rProd = FormBusca.UtilPesquisa.BuscarProduto(cd_produtobusca.Text, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_empresa, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Nm_empresa, (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_tabelapreco, new Componentes.EditDefault[] { cd_produtobusca, ds_produtobusca }, filtro); } else { System.Collections.Hashtable vParametros = new System.Collections.Hashtable(); vParametros.Add("@CD_EMPRESA", string.IsNullOrEmpty((bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_empresa) ? "null" : (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_empresa); vParametros.Add("@CD_TABELAPRECO", string.IsNullOrEmpty((bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_tabelapreco) ? "null" : (bsVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida).Cd_tabelapreco); CamadaDados.Estoque.Cadastros.TList_CadProduto lProd = new CamadaDados.Estoque.Cadastros.TCD_CadProduto().Select( new TpBusca[] { new TpBusca() { vNM_Campo = "isnull(a.st_registro, 'A')", vOperador = "<>", vVL_Busca = "'C'" }, new TpBusca() { vNM_Campo = string.Empty, vOperador = string.Empty, vVL_Busca = "(a.cd_produto like '%" + cd_produtobusca.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (cd_produtobusca.TextOld != null ? cd_produtobusca.TextOld.ToString() : cd_produtobusca.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + cd_produtobusca.Text.Trim() + "'))" } }, 0, string.Empty, string.Empty, string.Empty, vParametros); if (lProd.Count > 0) { rProd = lProd[0]; } } if (rProd != null) { cd_produtobusca.Text = rProd.CD_Produto; ds_produtobusca.Text = rProd.DS_Produto; Id_caracteristica = rProd.Id_caracteristicaH; vl_venda.Text = rProd.Vl_precovenda.ToString("N2", new System.Globalization.CultureInfo("pt-BR")); if (rProd.Vl_precovenda != (bsItens.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida_Item).Vl_unitario) { MessageBox.Show("Produto não pode ser trocado!\r\n" + "Selecione um item com valor de venda igual!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); cd_produtobusca.Text = string.Empty; ds_produtobusca.Text = string.Empty; vl_venda.Text = string.Empty; Id_caracteristica = null; return; } if ((!new CamadaDados.Estoque.Cadastros.TCD_CadProduto().ItemServico(rProd.CD_Produto)) && (!new CamadaDados.Estoque.Cadastros.TCD_CadProduto().ProdutoConsumoInterno(rProd.CD_Produto))) { if (!new CamadaDados.Estoque.Cadastros.TCD_CadProduto().ProdutoComposto(rProd.CD_Produto) && !new CamadaDados.Estoque.Cadastros.TCD_CadProduto().ProdutoPatrimonio(rProd.CD_Produto)) { decimal saldo = BuscarSaldoLocal(lCfg[0].Cd_empresa, rProd.CD_Produto); if (saldo < (bsItens.Current as CamadaDados.Faturamento.PDV.TRegistro_VendaRapida_Item).Quantidade) { MessageBox.Show("Não existe saldo disponivel no estoque.\r\n" + "Empresa.........: " + lCfg[0].Cd_empresa.Trim() + "-" + lCfg[0].Nm_empresa.Trim() + "\r\n" + "Produto.........: " + rProd.CD_Produto.Trim() + "-" + rProd.DS_Produto.Trim() + "\r\n" + "Local Arm.......: " + lCfg[0].Cd_local.Trim() + "-" + lCfg[0].Ds_local + "\r\n" + "Saldo Disponivel: " + saldo.ToString("N3", new System.Globalization.CultureInfo("pt-BR", true)), "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); cd_produtobusca.Text = string.Empty; ds_produtobusca.Text = string.Empty; vl_venda.Text = string.Empty; Id_caracteristica = null; return; } } else { cd_produtobusca.Text = string.Empty; ds_produtobusca.Text = string.Empty; vl_venda.Text = string.Empty; Id_caracteristica = null; } } } else { cd_produtobusca.Clear(); cd_produtobusca.Focus(); } } else { cd_produtobusca.Clear(); cd_produtobusca.Focus(); } }
public static TList_LoteRPS Buscar(string Id_lote, string Cd_empresa, string Nr_notafiscal, string Cd_clifor, string Dt_ini, string Dt_fin, string Nr_protocolo, string Tp_ambiente, string St_lote, BancoDados.TObjetoBanco banco) { Utils.TpBusca[] filtro = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(Id_lote)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lote"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lote; } if (!string.IsNullOrEmpty(Cd_empresa)) { 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.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_notafiscal)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_FAT_LoteRPS_X_NFES x " + "inner join TB_FAT_NotaFiscal y " + "on x.cd_empresa = y.cd_empresa " + "and x.nr_lanctofiscal = y.nr_lanctofiscal " + "where x.cd_empresa = a.cd_empresa " + "and x.id_lote = a.id_lote " + "and y.nr_notafiscal = " + Nr_notafiscal + ")"; } if (!string.IsNullOrEmpty(Cd_clifor)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_FAT_LoteRPS_X_NFES x " + "inner join TB_FAT_NotaFiscal y " + "on x.cd_empresa = y.cd_empresa " + "and x.nr_lanctofiscal = y.nr_lanctofiscal " + "where x.cd_empresa = a.cd_empresa " + "and x.id_lote = a.id_lote " + "and y.cd_clifor = '" + Cd_clifor.Trim() + "')"; } if ((!string.IsNullOrEmpty(Dt_ini)) && (Dt_ini.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_lote"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_ini).ToString("yyyyMMdd")) + " 00:00:00'"; } if ((!string.IsNullOrEmpty(Dt_fin)) && (Dt_fin.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_lote"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(Dt_fin).ToString("yyyyMMdd")) + " 23:59:59'"; } if (!string.IsNullOrEmpty(Nr_protocolo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_protocolo"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "('%" + Nr_protocolo.Trim() + "'%)"; } if (!string.IsNullOrEmpty(Tp_ambiente)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.tp_ambiente"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Tp_ambiente.Trim() + "'"; } if (!string.IsNullOrEmpty(St_lote)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.st_lote"; filtro[filtro.Length - 1].vOperador = "in"; filtro[filtro.Length - 1].vVL_Busca = "(" + St_lote.Trim() + ")"; } return(new TCD_LoteRPS(banco).Select(filtro, 0, string.Empty)); }