示例#1
0
        // GET: Transacciones/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Transaccione transaccione = db.Transacciones.Find(id);

            if (transaccione == null)
            {
                return(HttpNotFound());
            }
            return(View(transaccione));
        }
示例#2
0
        // GET: Transacciones/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Transaccione transaccione = db.Transacciones.Find(id);

            if (transaccione == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id_cliente       = new SelectList(db.Clientes, "Id_cliente", "Nombre_cliente", transaccione.Id_cliente);
            ViewBag.Id_tipoDocumento = new SelectList(db.Tipo_Documentos, "Id_tipoDocumento", "Descripcion", transaccione.Id_tipoDocumento);
            return(View(transaccione));
        }
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (ClsVerificarCaja.CajaEstado())
                {
                    if ((int)txtCLave.EditValue == 0)
                    {
                        Transaccione tran = new Transaccione
                        {
                            CveUsuario       = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioAPP")),
                            FechaTransaccion = DateTime.Today.Date,
                            TipoTransaccion  = cboTipo.Text,
                            Cantidad         = Convert.ToDecimal(txtCantidad.EditValue),
                            Concepto         = txtConcepto.Text,
                            Estado           = true
                        };

                        txtCLave.EditValue = new LogicaTransacciones().AgregarTransaccion(tran);
                    }
                    ImprimirTikets();
                    new ManejadorControles().LimpiarControles(gpoContenedor);
                    txtCantidad.Focus();
                }
                else
                {
                    MessageBox.Show("La Caja del Día de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }
            catch (ValidationException ex)
            {
                MessageBox.Show(ex.Message, "Validando datos");
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error al querer realizar la transaccion");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error al querer realizar el transaccion");
            }
        }
示例#4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Transaccione transaccione = db.Transacciones.Find(id);

            db.Transacciones.Remove(transaccione);

            if ((ModelState.IsValid) && (transaccione.Tipo_movimiento == "CR"))
            {
                var balanceCliente = db.Balances.Where(x => x.Id_cliente == transaccione.Id_cliente).FirstOrDefault();

                balanceCliente.Monto = balanceCliente.Monto + transaccione.Monto;

                db.Transacciones.Add(transaccione);

                db.Entry(balanceCliente).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            else if ((ModelState.IsValid) && (transaccione.Tipo_movimiento == "DB"))
            {
                var balanceCliente = db.Balances.Where(x => x.Id_cliente == transaccione.Id_cliente).FirstOrDefault();

                balanceCliente.Monto = balanceCliente.Monto - transaccione.Monto;

                db.Transacciones.Add(transaccione);

                db.Entry(balanceCliente).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }



            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult <Transaccione> > PostTransaccione(Transaccione transaccione)
        {
            double?PuntosASumar = 0;

            _context.Transacciones.Add(transaccione);
            //await _context.SaveChangesAsync();

            PuntosxVehiculo puntosxVehiculo = await _context.PuntosxVehiculos.Where(o => o.MatriculaVehiculo.Equals(transaccione.MatriculaVehiculo)).SingleOrDefaultAsync();

            if (_context.Rangos.Where(o => transaccione.CantidadRecargada >= o.MinimoRecargado && transaccione.CantidadRecargada <= o.MaximoRecargado).FirstOrDefault() != null)
            {
                PuntosASumar = _context.Rangos.Where(o => transaccione.CantidadRecargada >= o.MinimoRecargado && transaccione.CantidadRecargada <= o.MaximoRecargado).FirstOrDefault().PuntosObtenidos;
            }
            else
            {
                PuntosASumar = 0;
            }
            puntosxVehiculo.PuntosAcumulados = (int)(puntosxVehiculo.PuntosAcumulados + PuntosASumar);

            _context.Set <PuntosxVehiculo>().Update(puntosxVehiculo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTransacciones", new { id = transaccione.IdTransaccion }, transaccione));
        }
        private void ImprimirRetiroBase()
        {
            Transaccione tran = new Transaccione
            {
                CveUsuario       = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioAPP")),
                FechaTransaccion = DateTime.Today.Date,
                TipoTransaccion  = "Retiro",
                Cantidad         = Convert.ToDecimal(txtBase.EditValue),
                Concepto         = string.Format("RETIRO DE BASE DEL GRUPO {0}-{1} POR SALDAR CRÉDITO", txtCveGrupo.Text, txtNombreGrupo.Text),
                Estado           = true
            };
            EmpeñosDC _enti = new EmpeñosDC(new clsConeccionDB().StringConn());

            _enti.Transacciones.InsertOnSubmit(tran);
            _enti.SubmitChanges();
            //new LogicaTransacciones().AgregarTransaccion(tran);//se comento 4/6/2014 por que usuario normal no tiene permiso de los retiros
            Configuracione empre = new EmpeñosDC(new clsConeccionDB().StringConn()).Configuraciones.First();

            string empresa     = new clsModificarConfiguracion().configGetValue("Empresa");
            string razonSocial = new clsModificarConfiguracion().configGetValue("RazonSocial");
            string rfc         = new clsModificarConfiguracion().configGetValue("RFC");
            string curp        = new clsModificarConfiguracion().configGetValue("CURP");
            string dirc        = String.Format("{0} CP {1} {2}", empre.Direccion, empre.CodigoPostal, empre.Municipio);

            int padRe    = ((40 - empresa.Length) / 2) + empresa.Length;
            int padRrs   = ((40 - razonSocial.Length) / 2) + razonSocial.Length;
            int padRrfc  = ((40 - rfc.Length) / 2) + rfc.Length;
            int padRcurp = ((40 - curp.Length) / 2) + curp.Length;


            Ticket ticket = new Ticket(2);

            ticket.AddHeaderLine("            CASA  DE  EMPEÑOS           ");
            ticket.AddHeaderLine("                                        ");
            ticket.AddHeaderLine(empresa.PadLeft(padRe));
            ticket.AddHeaderLine(razonSocial.PadLeft(padRrs));
            ticket.AddHeaderLine(rfc.PadLeft(padRrfc));
            ticket.AddHeaderLine(curp.PadLeft(padRcurp));
            if (dirc.Length > 40)
            {
                int currentChar = 0;
                int itemLenght  = dirc.Length;

                while (itemLenght > 40)
                {
                    ticket.AddHeaderLine(dirc.Substring(currentChar, 40));
                    currentChar += 40;
                    itemLenght  -= 40;
                }
                ticket.AddHeaderLine(dirc.Substring(currentChar));
            }
            else
            {
                ticket.AddHeaderLine(dirc);
            }
            ticket.AddHeaderLine("           TICKET DE RETIRO");

            ticket.AddSubHeaderLine("CLAVE: " + tran.Clave);
            ticket.AddSubHeaderLine("REALIZO: " + new clsModificarConfiguracion().configGetValue("UsuarioAPP"));
            ticket.AddSubHeaderLine(String.Format("FECHA: {0} {1}", DateTime.Today.ToString("dd/MMM/yyyy").ToUpper(), DateTime.Now.ToShortTimeString()));
            string[] lineas = tran.Concepto.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var linea in lineas)
            {
                ticket.AddItem("", linea, "");
            }
            //ticket.AddItem("", txtConcepto.Text, "");
            ticket.AddTotal("CANTIDAD:", tran.Cantidad.ToString("$ #,##0.00"));
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("________________________________________");
            ticket.AddFooterLine("                AUTORIZO                ");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");

            ticket.PrintTicket(new clsModificarConfiguracion().configGetValue("ImpresoraTickets"));
        }
示例#7
0
        private void btnImprimirDeposito_Click(object sender, EventArgs e)
        {
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Any(f => Convert.ToDecimal(f["Aprobado"]) == 0))
            {
                XtraMessageBox.Show("Indique el monto a aprobar ", "Indicar Monto Aprobado");
                return;
            }
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Any(f => String.IsNullOrEmpty(f["Tipo"].ToString())))
            {
                XtraMessageBox.Show("Indique que cargo tendra el integrante", "Eligir Tipo");
                return;
            }
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Count(f => Convert.ToString(f["Tipo"]) == "PRESIDENTA") == 0)
            {
                XtraMessageBox.Show("Indique quien sera la presidenta ", "Indicar Monto Aprobado");
                return;
            }
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Count(f => Convert.ToString(f["Tipo"]) == "TESORERA") == 0)
            {
                XtraMessageBox.Show("Indique quien sera la Tesorera ", "Indicar Monto Aprobado");
                return;
            }
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Count(f => Convert.ToString(f["Tipo"]) == "PRESIDENTA") > 1)
            {
                XtraMessageBox.Show("No puede haber mas de una Presidenta ", "Indicar Monto Aprobado");
                return;
            }
            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Count(f => Convert.ToString(f["Tipo"]) == "TESORERA") > 1)
            {
                XtraMessageBox.Show("No puede haber mas de una Tesorera ", "Indicar Monto Aprobado");
                return;
            }

            if (
                XtraMessageBox.Show(
                    "Aprobar grupo. \x00bfConfirme si desea aprobar el grupo para otorgar el credito\nUna vez aprobado el grupo no se podra modificar\nSe hara un deposito de la base",
                    "SoftEmpeños", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) ==
                DialogResult.Yes)
            {
                cboEstado.EditValue = "APROBADO";
                Guardar();
                decimal      baseCredito = dtIntegrantesGrupo.Rows.Cast <DataRow>().Aggregate <DataRow, decimal>(0M, (current, row) => current + (decimal)row["Base"]);
                Transaccione tran        = new Transaccione
                {
                    CveUsuario       = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioAPP")),
                    FechaTransaccion = DateTime.Today.Date,
                    TipoTransaccion  = "Base",
                    Cantidad         = baseCredito,
                    Concepto         = string.Format("DEPOSITO DE BASE DEL GRUPO {0}-{1} PARA OTORGAR CREDITO", txtCveGrupo.Text, txtNombreGrupo.Text),
                    Estado           = true
                };

                new LogicaTransacciones().AgregarTransaccion(tran);
                ImprimirTikets(tran.Clave, tran.Concepto, tran.Cantidad);
                new ManejadorControles().DesectivarTextBox(gpoContenedor, true);
                gridIntegrantes.Enabled      = false;
                btnImprimirDeposito.Enabled  = false;
                botonGuardar.Enabled         = false;
                btnAgregarIntegrante.Enabled = false;
                btnNuevoIntegrante.Enabled   = false;
            }
        }