private void nr_pedido_Leave(object sender, EventArgs e) { string vColunas = "a.nr_pedido|=|" + nr_pedido.Text + ";" + "||(isnull(a.st_pedido, 'A') in ('F', 'P'));" + "a.cd_clifor|=|'" + Cd_clifor.Trim() + "';" + "a.tp_movimento|=|'" + Tp_movimento.Trim().ToUpper() + "';" + "|EXISTS|(select 1 from tb_div_usuario_x_cfgpedido x " + "where x.cfg_pedido = a.cfg_pedido " + "and ((x.login = '******') or " + "(exists(select 1 from tb_div_usuario_x_grupos y " + " where y.logingrp = x.login and y.loginusr = '******'))))"; UtilPesquisa.EDIT_LEAVE(vColunas, new Componentes.EditDefault[] { nr_pedido }, new CamadaDados.Faturamento.Pedido.TCD_Pedido()); }
private void bb_pedido_Click(object sender, EventArgs e) { string vParam = "||(isnull(a.st_pedido, 'A') in ('F', 'P'));" + "a.cd_clifor|=|'" + Cd_clifor.Trim() + "';" + "a.tp_movimento|=|'" + Tp_movimento.Trim().ToUpper() + "';" + "|EXISTS|(select 1 from tb_div_usuario_x_cfgpedido x " + "where x.cfg_pedido = a.cfg_pedido " + "and ((x.login = '******') or " + "(exists(select 1 from tb_div_usuario_x_grupos y " + " where y.logingrp = x.login and y.loginusr = '******'))))"; UtilPesquisa.BTN_BUSCA("a.NR_Pedido|Nº Pedido|100;f.NM_Clifor|Nome|120;a.CD_Clifor|CódClifor|80" , new Componentes.EditDefault[] { nr_pedido } , new CamadaDados.Faturamento.Pedido.TCD_Pedido(), vParam); }
private void TFLanNotasFrete_Load(object sender, EventArgs e) { Utils.ShapeGrid.RestoreShape(this, gNotaFiscal); panelDados3.BackColor = Utils.SettingsUtils.Default.COLOR_1; panelDados8.BackColor = Utils.SettingsUtils.Default.COLOR_2; if (!string.IsNullOrEmpty(Utils.Parametros.pubCultura)) { Idioma.TIdioma.AjustaCultura(this); } this.Icon = Utils.ResourcesUtils.TecnoAliance_ICO; cd_empresa.Text = Cd_empresa; nm_empresa.Text = Nm_empresa; cd_clifor.Text = Cd_clifor; nm_clifor.Text = Nm_clifor; tp_movimento.Text = Tp_movimento.Trim().Equals("E") ? "ENTRADA" : "SAIDA"; }
private void TFCondicional_Load(object sender, EventArgs e) { ShapeGrid.RestoreShape(this, gItens); Icon = ResourcesUtils.TecnoAliance_ICO; pDados.set_FormatZero(); //Buscar config pdv para a empresa lCfg = CamadaNegocio.Faturamento.Cadastros.TCN_CFGCupomFiscal.Buscar(Cd_empresa, null); if (lCfg.Count > 0) { if (rcond == null) { bsCondicional.AddNew(); if (Tp_movimento.Trim().ToUpper().Equals("E")) { tp_movimento.SelectedIndex = 0; } else if (Tp_movimento.Trim().ToUpper().Equals("S")) { tp_movimento.SelectedIndex = 1; } cd_empresa.Text = Cd_empresa; nm_empresa.Text = Nm_empresa; cd_clifor.Text = lCfg[0].Cd_clifor; nm_clifor.Text = lCfg[0].Nm_clifor; cd_endereco.Text = lCfg[0].Cd_endereco; ds_endereco.Text = lCfg[0].Ds_endereco; } else { bsCondicional.DataSource = new TList_Condicional() { rcond }; cd_clifor.Enabled = false; bb_clifor.Enabled = false; cd_endereco.Enabled = false; bb_endereco.Enabled = false; } CD_TabelaPreco.Text = lCfg[0].Cd_tabelapreco; } else { MessageBox.Show("Não existe configuração de PDV para a empresa " + Cd_empresa.Trim(), "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } }
private void BuscarNfDevolver() { //Buscar notas com saldo fiscal devolver bsNfItemDevolver.DataSource = new CamadaDados.Faturamento.NotaFiscal.TCD_LanFaturamento_Item().Select( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = "a.cd_empresa", vOperador = "=", vVL_Busca = "'" + Cd_empresa.Trim() + "'" }, new Utils.TpBusca() { vNM_Campo = "a.nr_pedido", vOperador = "=", vVL_Busca = Nr_pedido }, new Utils.TpBusca() { vNM_Campo = "nf.tp_movimento", vOperador = "=", vVL_Busca = "'" + Tp_movimento.Trim().ToUpper() + "'" }, new Utils.TpBusca() { vNM_Campo = "isnull(nf.st_registro, 'A')", vOperador = "<>", vVL_Busca = "'C'" }, new Utils.TpBusca() { vNM_Campo = string.Empty, vOperador = string.Empty, vVL_Busca = "((a.qtd_fiscaldevolver - a.qtd_fiscaldevolvido) > 0) or " + "((a.vl_fiscaldevolver - a.vl_fiscaldevolvido) > 0)" }, new Utils.TpBusca() { vNM_Campo = "CONVERT(DATETIME,FLOOR(CONVERT(NUMERIC(30,10), nf.dt_emissao)))", vOperador = "=", vVL_Busca = dt_dev.Text.Trim() != "/ /" ? "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(dt_dev.Text).ToString("yyyyMMdd")) + "'" : "CONVERT(DATETIME,FLOOR(CONVERT(NUMERIC(30,10), nf.dt_emissao)))" } }, 0, string.Empty, string.Empty, "a.id_nfitem"); }
private void afterBusca() { TpBusca[] filtro = new TpBusca[3]; filtro[0].vNM_Campo = "n.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + Cd_empresa.Trim() + "'"; filtro[1].vNM_Campo = "n.tp_movimento"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'" + Tp_movimento.Trim() + "'"; filtro[2].vNM_Campo = "isnull(n.st_pedido, 'A')"; filtro[2].vOperador = "="; filtro[2].vVL_Busca = "'F'"; if (nr_notafiscal.Text.Trim() != string.Empty) { 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 " + "inner join tb_fat_notafiscal_item y " + "on x.cd_empresa = y.cd_empresa " + "and x.nr_lanctofiscal = y.nr_lanctofiscal " + "where y.nr_pedido = a.nr_pedido " + "and x.nr_notafiscal = " + nr_notafiscal.Text + ")"; } if (pCd_produto.Trim() != string.Empty) { 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 = "'" + pCd_produto.Trim() + "'"; } if (pCd_clifor.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "n.cd_clifor"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + pCd_clifor.Trim() + "'"; } BS_Itens.DataSource = new CamadaDados.Faturamento.Pedido.TCD_LanPedido_Item().Select(filtro, 0, string.Empty, string.Empty, string.Empty); }
private void afterBusca() { Utils.TpBusca[] filtro = new Utils.TpBusca[5]; //Empresa filtro[0].vNM_Campo = "a.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + Cd_empresa.Trim() + "'"; //Tipo de Movimento filtro[1].vNM_Campo = "a.tp_movimento"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'" + Tp_movimento.Trim().ToUpper() + "'"; //Clifor filtro[2].vNM_Campo = "a.cd_clifor"; filtro[2].vOperador = "="; filtro[2].vVL_Busca = "'" + Cd_clifor.Trim() + "'"; //Nota nao cancelada filtro[3].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[3].vOperador = "="; filtro[3].vVL_Busca = "'A'"; //Nao pode estar amarrado a um conhecimento de frete diferente de cancelado filtro[4].vNM_Campo = string.Empty; filtro[4].vOperador = "not exists"; filtro[4].vVL_Busca = "(select 1 from tb_ctr_notafiscal x " + "inner join tb_ctr_conhecimentofrete y " + "on x.cd_empresa = y.cd_empresa " + "and x.nr_lanctoctr = y.nr_lanctoctr " + "where x.cd_empresa = a.cd_empresa " + "and x.nr_lanctofiscal = a.nr_lanctofiscal " + "and isnull(y.st_registro, 'A') in('A', 'P'))"; if (nr_notafiscal.Text.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_notafiscal"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = nr_notafiscal.Text; } if (nr_serie.Text.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_serie"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = nr_serie.Text; } if (nr_pedido.Text.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.Text; } if ((DT_Inicial.Text.Trim() != string.Empty) && (DT_Inicial.Text.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = rbEmissao.Checked ? "a.dt_emissao":"a.dt_saient"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(DT_Inicial.Text).ToString("yyyyMMdd")) + " 00:00:00'"; } if ((DT_Final.Text.Trim() != string.Empty) && (DT_Final.Text.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = rbEmissao.Checked ? "a.dt_emissao" : "a.dt_saient"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(DT_Final.Text).ToString("yyyyMMdd")) + " 23:59:59'"; } bsNotaFiscal.DataSource = new CamadaDados.Faturamento.NotaFiscal.TCD_LanFaturamento().Select(filtro, 0, string.Empty); }