コード例 #1
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaPago.Text) == false)
            {
                MessageBox.Show("Debe ingresar una fecha válida", Clases.cMensaje.Mensaje());
                return;
            }
            double Importe  = fun.ToDouble(txtImporte.Text);
            double Tope     = fun.ToDouble(txtTope.Text);
            double dif      = Tope - Importe;
            string Descrip2 = "";

            if (dif > 0)
            {
                Descrip2 = "DIFERENCIA POSITVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text;
            }
            if (dif < 0)
            {
                Descrip2 = "DIFERENCIA NEGATIVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text;
            }

            if (dif < 0)
            {
                //paga el tope mas la diferencia negativa
                Importe = Tope;
            }

            if (dif > 0)
            {
                //paga el tope mas la diferencia negativa
                Importe = Tope;
            }

            string Descripcion = txtDescripcion.Text + " " + txtPatente.Text;

            Clases.cMovimiento mov   = new Clases.cMovimiento();
            DateTime           Fecha = Convert.ToDateTime(txtFechaPago.Text);

            Clases.cGastosPagar gasto = new Clases.cGastosPagar();
            gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), Fecha);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            if (dif != 0)
            {
                Int32?CodVenta = null;
                if (txtCodVenta.Text.Trim() != "")
                {
                    CodVenta = Convert.ToInt32(txtCodVenta.Text);
                }
                //hubo exedente o menor plata
                mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, dif, 0, 0, 0, 0, Fecha, Descrip2);
                Clases.cDiferenciaTransferencia obj = new Clases.cDiferenciaTransferencia();
                obj.Insertar(CodVenta, dif, Convert.ToInt32(Principal.CodigoPrincipalAbm));
            }
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            btnGrabar.Enabled = false;
        }
コード例 #2
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            string msj    = "Confirma anular el pago";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.No)
            {
                return;
            }
            Clases.cFunciones fun     = new Clases.cFunciones();
            double            Importe = fun.ToDouble(txtImporte.Text);

            string Descripcion = "PAGO ANULADO " + txtDescripcion.Text + " " + txtPatente.Text;

            Clases.cMovimiento mov   = new Clases.cMovimiento();
            DateTime           Fecha = Convert.ToDateTime(txtFechaPago.Text);

            Clases.cGastosPagar             gasto  = new Clases.cGastosPagar();
            Clases.cDiferenciaTransferencia objDif = new Clases.cDiferenciaTransferencia();
            double ImporteDiferencia = objDif.GetImporteDiferenciaxCodGasto(Convert.ToInt32(Principal.CodigoPrincipalAbm));
            int    positivo          = 0;

            if (ImporteDiferencia > 0)
            {
                positivo = 1;
            }
            ImporteDiferencia = -1 * ImporteDiferencia;

            if (positivo == 1)
            {
                Importe = Importe + ImporteDiferencia;
            }

            gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), null);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            //saco el exedente
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, ImporteDiferencia, 0, 0, 0, 0, Fecha, "AJUSTE DE DIFERENCIA");
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            objDif.Borrar(Convert.ToInt32(Principal.CodigoPrincipalAbm));
            btnAnular.Enabled = false;
        }