Пример #1
0
 protected void cbxTipoFormaPago_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int       idfp = Convert.ToInt32(cbxTipoFormaPago.SelectedValue);
         FormaPago fp;
         using (ControladorFormaPago c_fp = new ControladorFormaPago())
         {
             fp = c_fp.BuscarFormaPago(idfp);
         }
         if (fp.AceptaNotaCredito)
         {
             panelNotaCredito.Visible = true;
             txtMontoFP.Text          = "0";
         }
         else
         {
             panelNotaCredito.Visible = false;
             txtMontoFP.Text          = "0";
         }
     }
     catch (ExcepcionPropia myex)
     {
         mostrarExcepcion(myex.Message);
         cerrarModal("formaPagoModal");
     }
 }
Пример #2
0
    protected void btnAgregarFormaPAgo_Click(object sender, EventArgs e)
    {
        try
        {
            FormaPago fp;
            using (ControladorFormaPago c_fp = new ControladorFormaPago())
            {
                fp = c_fp.BuscarFormaPago(Convert.ToInt32(cbxTipoFormaPago.SelectedValue));
            }
            if (fp.AceptaNotaCredito && notaCreditoActual == null)
            {
                mostrarExcepcionFormaPago("La forma de pago exige una nota de credito");
            }
            else
            {
                fp.Monto       = Convert.ToDecimal(txtMontoFP.Text);
                fp.NotaCredito = notaCreditoActual;
                if (ventaActual.ListFormaPago == null)
                {
                    ventaActual.ListFormaPago = new List <FormaPago>();
                }

                ventaActual.ListFormaPago.Add(fp);
                dgvFormaPago.DataSource = ventaActual.ListFormaPago;
                dgvFormaPago.DataBind();
                cerrarModal(modalFormaPagoModal);
            }
        }
        catch (Exception ex)
        {
            mostrarExcepcion(ex.Message);
            cerrarModal(modalFormaPagoModal);
        }
    }
Пример #3
0
    protected void btnAgregarFormaPAgo_Click(object sender, EventArgs e)
    {
        try
        {
            FormaPago fp;
            using (ControladorFormaPago c_fp = new ControladorFormaPago())
            {
                fp = c_fp.BuscarFormaPago(Convert.ToInt32(cbxTipoFormaPago.SelectedValue));
            }
            if (fp.AceptaNotaCredito && notaCreditoActual == null)
            {
                mostrarExcepcionFormaPago("La forma de pago exige una nota de credito");
            }
            else
            {
                fp.Monto       = Convert.ToDecimal(txtMontoFP.Text);
                fp.NotaCredito = notaCreditoActual;
                if (VentaActual.ListFormaPago == null)
                {
                    VentaActual.ListFormaPago = new List <FormaPago>();
                }

                VentaActual.ListFormaPago.Add(fp);
                dgvFormaPago.DataSource = VentaActual.ListFormaPago;
                dgvFormaPago.DataBind();
                txtTotalFP.Text = VentaActual.ListFormaPago.Sum(l => l.Monto).ToString();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#formaPagoModal').modal('hide');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "FPShowModalScript", sb.ToString(), false);
            }
        }
        catch (ExcepcionPropia myEx)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#formaPagoModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "FPShowModalScript", sb.ToString(), false);
            PanelError.Visible = true;
            lblError.Text      = myEx.Message;
        }
        catch (FormatException myEx)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#formaPagoModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "FPShowModalScript", sb.ToString(), false);
            PanelError.Visible = true;
            lblError.Text      = myEx.Message;
        }
    }