예제 #1
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 detach_Boletas(Boleta entity)
		{
			this.SendPropertyChanging();
			entity.Usuario = null;
		}
 partial void DeleteBoleta(Boleta instance);
 partial void UpdateBoleta(Boleta instance);
 partial void InsertBoleta(Boleta instance);
        private string SacarTipos(Boleta bole)
        {
            if (bole.DetallesBoletas.Any())
            {
                string tipo = "";
                foreach (DetallesBoleta det in bole.DetallesBoletas)
                {
                    string nstring ;
                    switch (det.Prenda.Tipo)
                    {
                        case "Oro 10Kt Rojo":
                            nstring = det.Prenda.Tipo.Substring(4, 4) + "R";
                            break;
                        case "Oro 10Kt Amarillo":
                            nstring = det.Prenda.Tipo.Substring(4, 4) + "A";
                            break;
                        case "Oro 14Kt":
                            nstring = det.Prenda.Tipo.Substring(4, 4);
                            break;
                        case "Oro 18Kt":
                            nstring = det.Prenda.Tipo.Substring(4, 4);
                            break;
                        case "Oro 22Kt":
                            nstring = det.Prenda.Tipo.Substring(4, 4);
                            break;
                        case "Oro 24Kt":
                            nstring = det.Prenda.Tipo.Substring(4, 4);
                            break;
                        default:
                            nstring = det.Prenda.Tipo;
                            break;
                    }
                    tipo = tipo + nstring + ";";

                }
                return tipo;
            }
            return bole.TipoEmpeño;
        }