public TRegistro_CadCondPgto() { this.Cd_condpgto = string.Empty; this.Ds_condpgto = string.Empty; this.Cd_portador = string.Empty; this.Ds_portador = string.Empty; this.Cd_moeda = string.Empty; this.Ds_moeda_singular = string.Empty; this.Sigla = string.Empty; this.st_comentrada = string.Empty; this.st_comentradabool = false; this.Cd_juro = string.Empty; this.Ds_juro = string.Empty; this.Tp_juro = string.Empty; this.Pc_jurodiario_atrazo = 0; this.cd_Juro_Fin = string.Empty; this.ds_Juro_Fin = string.Empty; this.Tp_juro_fin = string.Empty; this.Pc_jurodiario_atrazoFin = 0; this.Qt_parcelas = 1; this.Qt_diasdesdobro = 0; this.pc_custofin = decimal.Zero; this.St_registro = "A"; this.status = true; this.st_venctoemferiado = "N"; this.st_venctoemferiadobool = false; this.st_solicitardtvencto = "N"; this.st_solicitardtvenctobool = false; this.lCondPgto_X_Parcelas = new TList_CadCondPgto_X_Parcelas(); this.lCondParcDel = new TList_CadCondPgto_X_Parcelas(); }
public TList_CadCondPgto_X_Parcelas Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo) { TList_CadCondPgto_X_Parcelas lista = new TList_CadCondPgto_X_Parcelas(); SqlDataReader reader; bool podeFecharBco = false; if (Banco_Dados == null) { this.CriarBanco_Dados(true); podeFecharBco = true; } reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), "")); try { while (reader.Read()) { TRegistro_CadCondPgto_X_Parcelas reg = new TRegistro_CadCondPgto_X_Parcelas(); if (!(reader.IsDBNull(reader.GetOrdinal("CD_CondPGTO")))) { reg.Cd_condpgto = reader.GetString(reader.GetOrdinal("CD_CondPGTO")); } if (!(reader.IsDBNull(reader.GetOrdinal("ID_Parcela")))) { reg.Id_parcela = reader.GetDecimal(reader.GetOrdinal("ID_Parcela")); } if (!(reader.IsDBNull(reader.GetOrdinal("QT_Dias")))) { reg.Qt_dias = reader.GetDecimal(reader.GetOrdinal("QT_Dias")); } if (!reader.IsDBNull(reader.GetOrdinal("PC_Rateio"))) { reg.Pc_rateio = reader.GetDecimal(reader.GetOrdinal("PC_Rateio")); } lista.Add(reg); } } finally { reader.Close(); reader.Dispose(); if (podeFecharBco) { this.deletarBanco_Dados(); } } return(lista); }
public static TList_CadCondPgto_X_Parcelas CriarParcelas(TRegistro_CadCondPgto val) { TList_CadCondPgto_X_Parcelas retorno = new TList_CadCondPgto_X_Parcelas(); decimal pc_rateio = Math.Round(100 / val.Qt_parcelas, 2); for (int i = 0; i < val.Qt_parcelas; i++) { retorno.Add(new TRegistro_CadCondPgto_X_Parcelas() { Id_parcela = i + 1, Cd_condpgto = val.Cd_condpgto, Pc_rateio = pc_rateio, Qt_dias = val.St_comentradabool ? val.Qt_diasdesdobro * i : val.Qt_diasdesdobro * (i + 1) }); } retorno[retorno.Count - 1].Pc_rateio += 100 - retorno.Sum(p => p.Pc_rateio); return(retorno); }
public static TList_Parcelas CalcularParcelas(decimal Vl_documento, decimal Vl_documento_padrao, DateTime Dt_emissao, TList_CadCondPgto_X_Parcelas lCondParc) { TList_Parcelas lParc = new TList_Parcelas(); lCondParc.ForEach(p => { lParc.Add(new TParcelas() { Dt_vencimento = Dt_emissao.AddDays(Convert.ToDouble(p.Qt_dias)), Vl_parcela = Math.Round(Math.Round(Vl_documento, 2) * Math.Round(p.Pc_rateio, 2) / 100, 2), Vl_parcela_padrao = Math.Round(Math.Round(Vl_documento_padrao, 2) * Math.Round(p.Pc_rateio, 2) / 100, 2) } ); }); return(lParc); }