Ejemplo n.º 1
0
 private void txtIdCliente_Leave(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(this.txtIdCliente.Text))
     {
         this.lblTotal.Text = String.Format("{0:#,##0.00}", NPagos.CalcularDeudaTotal(Convert.ToInt32(this.txtIdCliente.Text)));
         if (Convert.ToDecimal(this.lblTotal.Text) == 0)
         {
             new Configuracion().Mensaje("El cliente seleccionado no posee facturas por pagar.", "Cliente sin Deuda",
                                         MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.lblRazonSocial.Text     = "";
             this.dgvEdoCuenta.DataSource = "";
         }
         else
         {
             this.lblRazonSocial.Text     = NPagos.RevisarCuenta(Convert.ToInt32(this.txtIdCliente.Text));
             this.dgvEdoCuenta.DataSource = NPagos.CalcularCuenta(Convert.ToInt32(this.txtIdCliente.Text));
         }
     }
 }
Ejemplo n.º 2
0
        //btnAnularPago - Evento Click - Anula el pago seleccionado en dgv
        private void btnAnularPago_Click(object sender, EventArgs e)
        {
            if (this.dgvPagos.Rows.Count > 0)
            {
                //Mensaje de confirmación.
                DialogResult Confirmacion = MessageBox.Show(String.Format(@"¿Está seguro de anular el pagp número {0}?, 
 después de haberlo anulado no podrá revertir los cambios realizados", this.ObtenerFila().Cells["N° PAGO"].
                                                                          Value), String.Format(Configuracion.Titulo, "Anular Pago"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (Confirmacion == DialogResult.Yes)
                {
                    string Respuesta = NPagos.Anular(Convert.ToInt32(this.ObtenerFila().Cells["N° PAGO"].Value));

                    if (Respuesta == "OK")
                    {
                        //Establece mensaje de eliminación el el "lblMensajes".
                        Mensaje(String.Format("El pago {0} ha sido ANULADO satisfactoriamente.",
                                              Convert.ToString(this.ObtenerFila().Cells["N° PAGO"].Value)));

                        //Mensaje al usuario de cción satisfactoria.
                        new Configuracion().Mensaje(String.Format("El pago {0} ha sido ANULADO exitosamente.",
                                                                  this.ObtenerFila().Cells["N° PAGO"].Value), "Pago Anulado", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);

                        //Refresca la vista.
                        this.Refrescar();
                    }
                    else
                    {
                        //Envía mensaje con error.
                        new Configuracion().Mensaje(Respuesta, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                //Envía mensaje con error.
                new Configuracion().Mensaje("Debe seleccionar un pago para poder anularlo.", "Error",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
 //Método Mostrar - Muestra los registros actuales en el "dgvPagos" y establece la cantidad de páginas.
 public void Mostrar()
 {
     this.dgvPagos.DataSource      = NPagos.Mostrar(Configuracion.RegistrosPorPagina, Configuracion.NumeroPagina);
     Configuracion.CantidadPaginas = NPagos.Tamaño(Configuracion.RegistrosPorPagina);
     this.lblPaginacion.Text       = String.Format("Página {0} de {1}.", Configuracion.NumeroPagina, Configuracion.CantidadPaginas);
 }
Ejemplo n.º 4
0
        //btnPagar - Evento Click - Inserta el pago en la base de datos y emite el comprobante.
        private void btnPagar_Click(object sender, EventArgs e)
        {
            string Respuesta = "";

            //Revisión de datos obligatorios
            if (String.IsNullOrWhiteSpace(this.txtNumFactura.Text))
            {
                new Configuracion().Mensaje("Debe ingresar un número de factura para efectuar el pago.", "Dato Inválido",
                                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.errorProvider.SetError(this.txtNumFactura, "Ingrese un cliente.");
            }
            else if (Convert.ToDecimal(this.lblPendiente.Text) > 0)
            {
                new Configuracion().Mensaje("Debe pagar la factura completa para poder procesar el pago.", "Dato Inválido",
                                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                int     Banco1 = 0;
                int     Banco2 = 0;
                int     Banco3 = 0;
                int     Banco4 = 0;
                decimal Ref1   = 0;
                decimal Ref2   = 0;
                decimal Ref3   = 0;
                decimal Ref4   = 0;

                //Obtiene los id de los bancos cuando el pago no es en efectivo.
                if (this.cbxPago1.Text != "Efectivo")
                {
                    Banco1 = Convert.ToInt32(this.cbxBanco1.SelectedValue);
                    Ref1   = Convert.ToDecimal(this.txtRef1.Text);
                }
                if (this.cbxPago2.Text != "Efectivo")
                {
                    Banco2 = Convert.ToInt32(this.cbxBanco2.SelectedValue);
                    Ref2   = Convert.ToDecimal(this.txtRef2.Text);
                }
                if (this.cbxPago3.Text != "Efectivo")
                {
                    Banco3 = Convert.ToInt32(this.cbxBanco3.SelectedValue);
                    Ref3   = Convert.ToDecimal(this.txtRef3.Text);
                }
                if (this.cbxPago4.Text != "Efectivo")
                {
                    Banco4 = Convert.ToInt32(this.cbxBanco4.SelectedValue);
                    Ref4   = Convert.ToDecimal(this.txtRef4.Text);
                }

                decimal Monto1 = 0;
                decimal Monto2 = 0;
                decimal Monto3 = 0;
                decimal Monto4 = 0;

                if (!String.IsNullOrEmpty(this.txtMonto1.Text))
                {
                    Monto1 = Convert.ToDecimal(this.txtMonto1.Text);
                }
                if (!String.IsNullOrEmpty(this.txtMonto2.Text))
                {
                    Monto2 = Convert.ToDecimal(this.txtMonto2.Text);
                }
                if (!String.IsNullOrEmpty(this.txtMonto3.Text))
                {
                    Monto3 = Convert.ToDecimal(this.txtMonto3.Text);
                }
                if (!String.IsNullOrEmpty(this.txtMonto4.Text))
                {
                    Monto4 = Convert.ToDecimal(this.txtMonto4.Text);
                }

                //Envía los datos para que sean ingresados en la base de datos.
                Respuesta = NPagos.Pagar(Convert.ToInt32(this.txtNumFactura.Text),
                                         this.cbxPago1.Text, Banco1, Ref1, Monto1,
                                         this.cbxPago2.Text, Banco2, Ref2, Monto2,
                                         this.cbxPago3.Text, Banco3, Ref3, Monto3,
                                         this.cbxPago4.Text, Banco4, Ref4, Monto4, IdUsuario);

                if (Respuesta == "OK")
                {
                    //Envía formulario de operación exitosa y descarga el form.
                    new Configuracion().Mensaje(String.Format("La factura {0} ha sido PAGADA exitosamente.",
                                                              Convert.ToString(Convert.ToInt32(this.txtNumFactura.Text))), "Factura Pagada", MessageBoxButtons.OK,
                                                MessageBoxIcon.Information);
                    this.Dispose();
                }
                else
                {
                    //Si ocurre un error muestra mensaje al usuario con la respuesta recibida.
                    new Configuracion().Mensaje(Respuesta, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            //Refresca las facturas en el control
            if (ctrlFacturas != null)
            {
                ctrlFacturas.Refrescar();
            }
            else
            {
                ctrlPagos.Refrescar();
            }
        }
Ejemplo n.º 5
0
        //txtNumFactura - Evento Leave - Busca los datos del número de factura ingresada.
        private void txtNumFactura_Leave(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(this.txtNumFactura.Text))
            {
                //Rellena los campos de información.
                this.lblRazonSocial.Text = NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text), "RAZÓN");
                this.lblEntrega.Text     = NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text), "ENTREGA");
                this.lblItems.Text       = NPagos.CalcularItems(Convert.ToInt32(this.txtNumFactura.Text));

                //Rellena los campos de montos
                this.lblBINombreImp1.Text = "B.I. " + NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text),
                                                                                 "NOMIMP1") + ":";
                this.lblNombreImpuesto1.Text = NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text), "NOMIMP1") + ":";
                this.lblBIImp1.Text          = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                                         this.txtNumFactura.Text), "BIIMP1").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));
                this.lblImp1.Text = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                              this.txtNumFactura.Text), "IMP1").Replace(".", "a").Replace(",", "b").Replace("a", ",")
                                                                               .Replace("b", ".")));

                this.lblBINombreImp2.Text = "B.I. " + NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text),
                                                                                 "NOMIMP2") + ":";
                this.lblNombreImpuesto2.Text = NPagos.ObtenerDatosFactura(Convert.ToInt32(this.txtNumFactura.Text), "NOMIMP2") + ":";
                this.lblBIImp2.Text          = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                                         this.txtNumFactura.Text), "BIIMP2").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));
                this.lblImp2.Text = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                              this.txtNumFactura.Text), "IMP2").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));

                this.lblExento.Text = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                                this.txtNumFactura.Text), "EXENTO").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));
                this.lblSubTotal.Text = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                                  this.txtNumFactura.Text), "SUBTOTAL").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));
                this.lblTotal.Text = String.Format("{0:#,##0.00}", Double.Parse(NPagos.ObtenerDatosFactura(Convert.ToInt32(
                                                                                                               this.txtNumFactura.Text), "TOTAL").Replace(".", "a").Replace(",", "b").Replace("a", ",").Replace("b", ".")));

                this.lblPendiente.Text = String.Format("{0:#,##0.00}", Double.Parse(this.lblTotal.Text));

                //Verifica que hallan sido cargados impuestos.
                if (this.lblNombreImpuesto1.Text == "No encontrado:")
                {
                    this.lblItems.Text           = "0";
                    this.lblEntrega.Text         = "";
                    this.lblNombreImpuesto1.Text = "";
                    this.lblBINombreImp1.Text    = "";
                    this.lblImp1.Text            = "";
                    this.lblBIImp1.Text          = "";
                }

                if (this.lblNombreImpuesto2.Text == "No encontrado:")
                {
                    this.lblNombreImpuesto2.Text = "";
                    this.lblBINombreImp2.Text    = "";
                    this.lblImp2.Text            = "";
                    this.lblBIImp2.Text          = "";
                }
            }
            else
            {
                //Si está vacío borra los campos.
                this.lblRazonSocial.Text     = "";
                this.lblEntrega.Text         = "";
                this.lblItems.Text           = "";
                this.lblNombreImpuesto1.Text = "";
                this.lblNombreImpuesto2.Text = "";
                this.lblBINombreImp1.Text    = "";
                this.lblBINombreImp2.Text    = "";
                this.lblBIImp1.Text          = "";
                this.lblBIImp2.Text          = "";
                this.lblImp1.Text            = "";
                this.lblImp2.Text            = "";

                //Establece calculos en 0.
                this.lblExento.Text   = String.Format("{0:#,##0.00}", 0);
                this.lblSubTotal.Text = String.Format("{0:#,##0.00}", 0);
                this.lblTotal.Text    = String.Format("{0:#,##0.00}", 0);
            }
        }