private void BB_CondPGTO_Click(object sender, EventArgs e) { string vParam = string.Empty; //Verificar se condicao de pagamento para o vendedor object obj = null; if (!string.IsNullOrEmpty((bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor)) { obj = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_CondPgto().BuscarEscalar( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_fat_vendedor_x_condpgto x " + "where x.cd_condpgto = a.cd_condpgto " + "and x.cd_vendedor = '" + (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor + "')" } }, "1"); } if (obj == null ? false : obj.ToString().Trim().Equals("1")) { vParam = "|exists|(select 1 from tb_fat_vendedor_x_condpgto x " + " where x.cd_condpgto = a.cd_condpgto " + " and x.cd_vendedor = '" + (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor + "')"; } FormBusca.UtilPesquisa.BTN_BUSCA("a.DS_CondPGTO|Condição Pagamento|300;a.QT_Parcelas|Quantidade Parcelas|40;" + "a.ST_ComEntrada|Entrada|40;a.QT_DiasDesdobro|Dias Desdobro|40;a.ST_VenctoEmFeriado|Vence em Feriado|40;a.cd_condPGTO|Código|100;a.ST_SolicitarDtVencto|Solicitar Data Vencimento|100" , new Componentes.EditDefault[] { CD_CondPGTO, DS_CondPGTO }, new CamadaDados.Financeiro.Cadastros.TCD_CadCondPgto(), vParam); CD_CondPGTO_Leave(this, new EventArgs()); }
private void CD_CondPGTO_Leave(object sender, EventArgs e) { string vParam = "CD_CondPGTO|=|'" + CD_CondPGTO.Text.Trim() + "'"; object obj = null; if (!string.IsNullOrEmpty((bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor)) { obj = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_CondPgto().BuscarEscalar( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_fat_vendedor_x_condpgto x " + "where x.cd_condpgto = a.cd_condpgto " + "and x.cd_vendedor = '" + (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor + "')" } }, "1"); } if (obj == null ? false : obj.ToString().Trim().Equals("1")) { vParam += ";|exists|(select 1 from tb_fat_vendedor_x_condpgto x " + " where x.cd_condpgto = a.cd_condpgto " + " and x.cd_vendedor = '" + (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Cd_vendedor + "')"; } DataRow linha = FormBusca.UtilPesquisa.EDIT_LEAVE(vParam, new Componentes.EditDefault[] { CD_CondPGTO, DS_CondPGTO }, new CamadaDados.Financeiro.Cadastros.TCD_CadCondPgto()); if (linha != null) { (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Parcelas_Dias_Desdobro = decimal.Parse(linha["qt_diasdesdobro"].ToString()); (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Parcelas_Entrada = linha["st_comentrada"].ToString(); (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).Parcelas_Feriado = linha["ST_VenctoEmFeriado"].ToString(); (bsPedido.Current as CamadaDados.Faturamento.Pedido.TRegistro_Pedido).ST_SolicitarDtVencto = linha["ST_SolicitarDtVencto"].ToString(); Parcelas.Value = Convert.ToDecimal(linha["qt_parcelas"].ToString()); QT_DIASDESDOBRO.Value = Convert.ToDecimal(linha["qt_diasdesdobro"].ToString()); ST_ComEntrada.Checked = linha["st_comentrada"].ToString().Trim().ToUpper().Equals("S"); cd_juro_fin.Text = linha["cd_juro_fin"].ToString(); ds_juro_fin.Text = linha["ds_juro_fin"].ToString(); PC_JuroDiario_Atrazo.Value = linha["pc_juroDiario_atrazoFin"].ToString().Equals("") ? 0 : Convert.ToDecimal(linha["pc_juroDiario_atrazoFin"].ToString()); tp_juro.Text = linha["tp_juro"].ToString(); } else { Parcelas.Value = 0; QT_DIASDESDOBRO.Value = 0; ST_ComEntrada.Checked = false; cd_juro_fin.Clear(); ds_juro_fin.Clear(); PC_JuroDiario_Atrazo.Value = 0; } this.AjustarDadosFinanceiros(); }
private void CD_CondPGTO_Leave(object sender, EventArgs e) { string vParam = "CD_CondPGTO|=|'" + CD_CondPGTO.Text.Trim() + "';" + (!St_cartao ? "isnull(b.TP_PortadorPDV, 'A') |=| 'P' " : "b.ST_CartaoCredito |=| '0' "); object obj = null; if (!string.IsNullOrEmpty(vCd_vendedor)) { obj = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_CondPgto().BuscarEscalar( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_fat_vendedor_x_condpgto x " + "where x.cd_condpgto = a.cd_condpgto " + "and x.cd_vendedor = '" + vCd_vendedor.Trim() + "')" } }, "1"); } if (obj == null ? false : obj.ToString().Trim().Equals("1")) { vParam += ";|exists|(select 1 from tb_fat_vendedor_x_condpgto x " + " where x.cd_condpgto = a.cd_condpgto " + " and x.cd_vendedor = '" + vCd_vendedor.Trim() + "')"; } DataRow linha = UtilPesquisa.EDIT_LEAVE(vParam, new Componentes.EditDefault[] { CD_CondPGTO, DS_CondPGTO }, new CamadaDados.Financeiro.Cadastros.TCD_CadCondPgto()); string ds_juro = string.Empty; if (linha != null) { Parcelas.Value = Convert.ToDecimal(linha["qt_parcelas"].ToString()); QT_DIASDESDOBRO.Value = Convert.ToDecimal(linha["qt_diasdesdobro"].ToString()); ST_ComEntrada.Checked = linha["st_comentrada"].ToString().Trim().ToUpper().Equals("S"); cd_juro_fin.Text = linha["cd_juro_fin"].ToString(); ds_juro = linha["ds_juro_fin"].ToString(); PC_JuroDiario_Atrazo.Value = linha["pc_juroDiario_atrazoFin"].ToString().Equals("") ? 0 : Convert.ToDecimal(linha["pc_juroDiario_atrazoFin"].ToString()); tp_juro.Text = linha["tp_juro_fin"].ToString(); if (bsPreVenda.Current != null) { (bsPreVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_PreVenda).ST_SolicitarDtVencto = linha["ST_SolicitarDtVencto"].ToString(); } } else { Parcelas.Value = decimal.Zero; QT_DIASDESDOBRO.Value = decimal.Zero; ST_ComEntrada.Checked = false; cd_juro_fin.Clear(); PC_JuroDiario_Atrazo.Value = decimal.Zero; if (bsPreVenda.Current != null) { (bsPreVenda.Current as CamadaDados.Faturamento.PDV.TRegistro_PreVenda).ST_SolicitarDtVencto = string.Empty; } } CalcularValorPedidoItem(); AjustarDadosFinanceiros(); VL_Entrada.Value = decimal.Zero; BS_PARCELAS_PositionChanged(this, new EventArgs()); if (St_cartao) { parcelasCartao.Text = BS_PARCELAS.Count + "x" + (PC_JuroDiario_Atrazo.Value > decimal.Zero ? " COM JUROS": " SEM JUROS"); parcelasCartao.Visible = true; } }