示例#1
0
 public int AgregarTransaccion(Transaccione item)
 {
     if (item.TipoTransaccion == "Retiro")
     {
         string per = _entidad.Usuarios.Single(u => u.CveUsuario == item.CveUsuario).Permisos;
         if (per == "Usuario")
         {
             throw new ValidationException("No tiene permisos para realizar Retiros");
         }
         if (ClsVerificarCaja.SaldoEnCaja() < item.Cantidad)
         {
             throw new ValidationException("No Puede retirar mas de lo disponible en caja");
         }
     }
     if (item.Cantidad == 0)
     {
         throw new ValidationException("La cantidad no puede ser cero");
     }
     if (item.TipoTransaccion == string.Empty)
     {
         throw new ValidationException("Indique el tipo de transacción");
     }
     if (item.Concepto == string.Empty)
     {
         throw new ValidationException("Indique el concepto de la transacción");
     }
     _entidad.Transacciones.InsertOnSubmit(item);
     _entidad.SubmitChanges();
     return(item.Clave);
 }
 public void Guardar()
 {
     try
     {
         if (ClsVerificarCaja.CajaEstado())
         {
             if (ClsVerificarCaja.SaldoEnCaja() >= Convert.ToDecimal(txtTotalCompra.EditValue))
             {
                 if ((int)txtCveCompra.EditValue == 0)
                 {
                     Compra entity = new Compra
                     {
                         CveUsuario  = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp")),
                         TotalCompra = Convert.ToDecimal(txtTotalCompra.EditValue),
                         FechaCompra = DateTime.Today.Date,
                         Estado      = true
                     };
                     txtCveCompra.EditValue = new LogicaCompras().AgregarCompra(entity);
                     foreach (DataRow fila in _dtArticulos.Rows)
                     {
                         DetallesCompra detcomp = new DetallesCompra
                         {
                             CveCompra           = entity.CveCompra,
                             PesoCantidad        = Convert.ToDecimal(fila[1]),
                             TipodeCompra        = fila[0].ToString(),
                             PrecioCompra        = Convert.ToDecimal(fila[2]),
                             TotalPrecioArticulo = Convert.ToDecimal(fila[3]),
                         };
                         new LogicaCompras().AgregarDetalle(detcomp);
                     }
                     ImprimirNotaCompra();
                 }
                 else
                 {
                     XtraMessageBox.Show("Ya se ha Guardado la compra solo se puede Imprimir el Ticket ", "Datos Guardados");
                     ImprimirNotaCompra();
                 }
                 //Nuevo();
             }
             else
             {
                 XtraMessageBox.Show("No puede Comprar mas de lo disponible en la CAJA Actual");
             }
         }
         else
         {
             XtraMessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Application.Exit();
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message, "Error al Guardar la compra");
     }
 }
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     if (!ClsVerificarCaja.CajaEstado())
     {
         MessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     if (ClsVerificarCaja.SaldoEnCaja() >
         ((decimal)txtCantidadCredito.EditValue))
     {
         Guardar();
     }
     else
     {
         MessageBox.Show("Lo disponible en caja es menor a lo que desea financiar", Application.ProductName);
     }
 }
示例#4
0
 public void Guardar()
 {
     if (ClsVerificarCaja.CajaEstado())
     {
         if (ClsVerificarCaja.SaldoEnCaja() >= Convert.ToDecimal(txtPrestamo.EditValue))
         {
             Boleta entity = new Boleta
             {
                 Articulos     = Articulos(),
                 Cliente       = txtNomCliente.Text,
                 Cotitular     = txtCotitular.Text,
                 FechaPrestamo = Convert.ToDateTime(dtpFechaEmpeño.DateTime.Date),
                 Pagado        = false,
                 Folio         = txtFolioBoleta.Text = ObtenerUltimoFolio(),
                 PesoEmpeño    = _dtprenda.Rows.Cast <DataRow>().Aggregate <DataRow, decimal>(0M, (current, row) => current + (decimal)row["PesoCantidad"]),
                 TipoEmpeño    = SacarTipos(),
                 Prestamo      = Convert.ToDecimal(txtPrestamo.EditValue),
                 Interes       = Convert.ToDecimal(txtInteres.EditValue),
                 FechaPago     = Convert.ToDateTime(dtpFechaPago.DateTime.Date),
                 EstadoBoleta  = "Vigente",
                 CveUsuario    = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp"))
             };
             new LogicaBoletas().AgregarBoleta(entity);
             Guardado = true;
             GuardarDetalle();
             XrptBoleta boleta = new XrptBoleta {
                 DatosInForme = { DataSource = entity }
             };
             //boleta.ShowPreviewDialog();
             boleta.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas"));
             Guardado = true;
         }
         else
         {
             XtraMessageBox.Show("No prestar  mas de lo disponible en la CAJA Actual");
         }
     }
     else
     {
         XtraMessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     SendKeys.Send("{TAB}");
 }
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ClsVerificarCaja.CajaEstado())
         {
             MessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Application.Exit();
         }
         if (_cveprestamo > 0)
         {
             if (
                 MessageBox.Show("El Prestamo se ha registrado desea volver a Imprimir documentos", "Reimpresión",
                                 MessageBoxButtons.YesNo) !=
                 DialogResult.Yes)
             {
                 ImprimirDocumentos();
                 return;
             }
         }
         if (ClsVerificarCaja.SaldoEnCaja() >
             ((decimal)txtCantidadFinancimiento.EditValue + Convert.ToDecimal(txtEnganche.EditValue)))
         {
             Prestamo pres = new Prestamo
             {
                 CveCliente           = GuadarCliente(),
                 CveTipoFinancimiento = _cveTipoFinanciamiento,
                 FolioFinanciamiento  = Convert.ToInt32(txtFolioFinanciamiento.EditValue),
                 Cantidad             = Convert.ToDecimal(txtCantidadFinancimiento.EditValue),
                 Enganche             = Convert.ToDecimal(txtEnganche.EditValue),
                 Saldo =
                     Convert.ToDecimal(txtCantidadFinancimiento.EditValue) -
                     Convert.ToDecimal(txtEnganche.EditValue),
                 CveUsuario    = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")),
                 FechaPrestamo = dtpFechaPrestamo.DateTime,
                 Tipo          = cboTipoFinanciamiento.Text,
                 Observacion   = txtObservacion.Text,
                 Interes       = Convert.ToDecimal(txtPorcInteres.EditValue),
                 Recargo       = Convert.ToDecimal(txtPorcRecargo.EditValue),
                 Meses         = Convert.ToInt32(txtMeses.EditValue),
                 Estado        = "Vigente",
             };
             _cveprestamo = new LogicaNegocios.LogicaPrestamos().AgregarPrestamo(pres);
             if (_dtReferencias.Rows.Count > 0)
             {
                 GuardarReferencias(_cveprestamo);
             }
             MessageBox.Show("Prestamo Guardado", Application.ProductName);
             new ManejadorControles().DesectivarTextBox(gpoContenedor, false);
             ImprimirDocumentos();
         }
         else
         {
             MessageBox.Show("Lo disponible en caja es menor a lo que desea financiar", Application.ProductName);
         }
     }
     catch (ValidationException vex)
     {
         MessageBox.Show(vex.Message, "Validación de datos");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName);
     }
 }