protected void btnDadosDuplicacao_Click(object sender, EventArgs e) { lblAltereDadosSeNecessarios.Visible = true; btnConfirmarDuplicacao.Enabled = true; int idVencimento = 0; Nota objNota = new Nota(); objNota.NumeroParcela = ddlEstoqueNotaQuantidadeParcelamento.SelectedValue; IList <Nota> lstNotas = new List <Nota>(); Nota objNotalst = null; for (int i = 0; i < Convert.ToInt32(objNota.NumeroParcela); i++) { idVencimento += 1; objNotalst = new Nota(idVencimento); objNotalst.Vencimento = Convert.ToDateTime(lblDataVencimento.Text); DateTime dtProximoVencimento = objNotalst.Vencimento.AddMonths(i); objNotalst.Vencimento = dtProximoVencimento; objNotalst.Valor = Convert.ToDecimal((Convert.ToDecimal(lblDuplicarValorDocumento.Text).ToString("#0.00"))); lstNotas.Add(objNotalst); } GridVencimentos.DataSource = lstNotas; GridVencimentos.DataBind(); MPEDuplicata.Show(); }
protected void btnEnviarContaReceberAnalise_Click(object sender, EventArgs e) { if (Convert.ToInt32(ddlQuantidadeParcela.SelectedValue) > 0) { lblParcela.ForeColor = System.Drawing.Color.Black; if (Validacao.IsData(txtDataVencimento.Text)) { string value = txtTotalReceber.Text; decimal number; if (Decimal.TryParse(value, out number) && !string.IsNullOrEmpty(txtTotalReceber.Text)) { //if (Convert.ToInt32(ddlQuantidadeParcela.SelectedValue) > 1) //{ // btnAlterarDataVencimento.Enabled = true; //} //else //{ // btnAlterarDataVencimento.Enabled = false; //} int idVencimento = 0; Nota objNota = new Nota(); objNota.NumeroParcela = ddlQuantidadeParcela.SelectedValue; IList <Nota> lstNotas = new List <Nota>(); Nota objNotalst = null; for (int i = 0; i < Convert.ToInt32(objNota.NumeroParcela); i++) { idVencimento = idVencimento + 1; objNotalst = new Nota(idVencimento); objNotalst.NumeroDocumento = txtNumeroDocumento.Text + "/" + idVencimento.ToString(); objNotalst.Vencimento = Convert.ToDateTime(txtDataVencimento.Text); DateTime dtProximoVencimento = objNotalst.Vencimento.AddMonths(i); objNotalst.Vencimento = dtProximoVencimento; objNotalst.Valor = Convert.ToDecimal((Convert.ToDecimal(txtTotalReceber.Text) / Convert.ToDecimal(objNota.NumeroParcela)).ToString("#0.00")); lstNotas.Add(objNotalst); } GridVencimentos.DataSource = lstNotas; GridVencimentos.DataBind(); //Session["ListaDeVencimentosNotas"] = lstNotas; btnCadastrar.Visible = true; } else { string alerta1 = "Preencha com um valor de parcela válida!"; this.ClientScript.RegisterClientScriptBlock(this.GetType(), "alerta", "<script type='text/javascript'>alert('" + alerta1 + "')</script>"); ddlQuantidadeParcela.SelectedValue = "0"; } } else { string alerta1 = "Preencha com uma Data Vencimento válida!"; this.ClientScript.RegisterClientScriptBlock(this.GetType(), "alerta", "<script type='text/javascript'>alert('" + alerta1 + "')</script>"); ddlQuantidadeParcela.SelectedValue = "0"; } } else { lblParcela.ForeColor = System.Drawing.Color.Red; } }