示例#1
0
        public override ReciboSueldo ReadBy(ReciboSueldo objeto)
        {
            ReciboSueldoDAC reciboSueldoComponent = new ReciboSueldoDAC();
            ReciboSueldo    reciboSueldo          = new ReciboSueldo();

            reciboSueldo = reciboSueldoComponent.ReadBy(objeto);
            EmpleadoComponent empleadoComponent = new EmpleadoComponent();

            reciboSueldo.empleado = empleadoComponent.ReadBy(reciboSueldo.empleado.Id);
            LegajoItemComponent legajoItemComponent = new LegajoItemComponent();
            LegajoItem          item = new LegajoItem();

            item.ReciboSueldo.Id   = objeto.Id;
            reciboSueldo.listaItem = legajoItemComponent.Obtener(item);
            foreach (LegajoItem unItem in reciboSueldo.listaItem)
            {
                if (unItem.item.Tipo.tipoItem == "Retencion")
                {
                    reciboSueldo.totalRetencion = reciboSueldo.totalRetencion + unItem.valor;
                }
                else if (unItem.item.Tipo.tipoItem == "Exentas")
                {
                    reciboSueldo.totalExenta = reciboSueldo.totalExenta + unItem.valor;
                }
                else if (unItem.item.Tipo.tipoItem == "Deducciones")
                {
                    reciboSueldo.totalDeducciones = reciboSueldo.totalDeducciones + unItem.valor;
                }
            }

            reciboSueldo.totalNeto = reciboSueldo.totalRetencion + reciboSueldo.totalExenta - reciboSueldo.totalDeducciones;


            return(reciboSueldo);
        }
示例#2
0
        public bool Verificar(LegajoItem legajoItem)

        {
            const string SQL_STATEMENT = " ";
            LegajoItem   categoria     = null;

            var db = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            using (DbCommand cmd = db.GetSqlStringCommand(SQL_STATEMENT))
            {
                db.AddInParameter(cmd, "@ID_ReciboSueldo", DbType.Int32, legajoItem.ReciboSueldo.Id);
                db.AddInParameter(cmd, "@ID_Item", DbType.Int32, legajoItem.ReciboSueldo.Id);
                using (IDataReader dr = db.ExecuteReader(cmd))
                {
                    if (dr.Read())
                    {
                        categoria = Load(dr);
                    }
                }

                if (categoria is null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public LegajoItem ObtenerFaltantes(LegajoItem legajoItem)

        {
            List <LegajoItem> listaLegajoItem = new List <LegajoItem>();

            listaLegajoItem = Obtener(legajoItem);
            ItemComponent itemComponent = new ItemComponent();
            List <Item>   items         = new List <Item>();

            items = itemComponent.Read();
            LegajoItem result = new LegajoItem();

            foreach (Item item in items)
            {
                int a = 0;
                foreach (LegajoItem subItem in listaLegajoItem)
                {
                    if (item.Id == subItem.item.Id)
                    {
                        a = 1;
                    }
                }
                if (a == 0)
                {
                    result.ListaItem.Add(item);
                }
            }

            return(result);
        }
示例#4
0
        public LegajoItem Load(IDataReader dr)
        {
            LegajoItem legajoItem = new LegajoItem();

            legajoItem.item.Id         = GetDataValue <int>(dr, "Id_Item");
            legajoItem.ReciboSueldo.Id = GetDataValue <int>(dr, "ID_ReciboSueldo");
            legajoItem.valor           = GetDataValue <int>(dr, "valor");
            return(legajoItem);
        }
示例#5
0
        public bool Agregar(LegajoItem legajoItem)

        {
            const string SQL_STATEMENT = "insert into LegajoItem(ID_Item,ID_ReciboSueldo,valor)values (@ID_Item,@ID_ReciboSueldo,@valor)";

            var db = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            using (DbCommand cmd = db.GetSqlStringCommand(SQL_STATEMENT))
            {
                db.AddInParameter(cmd, "@ID_ReciboSueldo", DbType.Int32, legajoItem.ReciboSueldo.listaReciboSueldo[0].Id);
                db.AddInParameter(cmd, "@ID_Item", DbType.Int32, legajoItem.item.Id);
                db.AddInParameter(cmd, "@valor", DbType.Int32, legajoItem.valor);
                db.ExecuteNonQuery(cmd);
            }
            return(true);
        }
示例#6
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                LegajoItemComponent legajoItemComponent = new LegajoItemComponent();
                LegajoItem          item = new LegajoItem();
                item.item.Id         = int.Parse(collection.Get("item.item"));
                item.ReciboSueldo.Id = int.Parse(collection.Get("ReciboSueldo.Id"));
                legajoItemComponent.Agregar(item);
                // TODO: Add insert logic here

                return(RedirectToAction("Index", "ReciboSueldo", new { id = item.ReciboSueldo.Id }));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
        public List <LegajoItem> Obtener(LegajoItem legajoItem)

        {
            LegajoItemDAC     legajo    = new LegajoItemDAC();
            List <LegajoItem> unaLegajo = new List <LegajoItem>();
            List <LegajoItem> result    = new List <LegajoItem>();

            unaLegajo = legajo.Obtener(legajoItem);
            foreach (LegajoItem item in unaLegajo)
            {
                LegajoItem aux = new LegajoItem();
                aux.ReciboSueldo = item.ReciboSueldo;
                ItemComponent itemComponent = new ItemComponent();
                aux.item  = itemComponent.ReadBy(item.item.Id);
                aux.valor = item.valor;
                result.Add(aux);
            }

            return(result);
        }
        public bool Agregar(LegajoItem legajoItem)

        {
            LegajoItemDAC         legajoItemDAC         = new LegajoItemDAC();
            LegajoItem            legajo                = new LegajoItem();
            ItemComponent         item                  = new ItemComponent();
            ReciboSueldoComponent reciboSueldoComponent = new ReciboSueldoComponent();

            legajo.ReciboSueldo = reciboSueldoComponent.ReadByLegajo(legajoItem.ReciboSueldo.Id);

            legajo.item = item.ReadBy(legajoItem.item.Id);
            if (legajo.item.porcentaje == 0)
            {
                legajo.valor = legajo.ReciboSueldo.listaReciboSueldo[0].sueldo;
            }
            else
            {
                legajo.valor = (legajo.ReciboSueldo.listaReciboSueldo[0].sueldo * legajo.item.porcentaje) / 100;
            }
            return(legajoItemDAC.Agregar(legajo));
        }
示例#9
0
        public List <LegajoItem> Obtener(LegajoItem legajoItem)

        {
            const string      SQL_STATEMENT = "SELECT * FROM LegajoItem where ID_ReciboSueldo=@id  ";
            List <LegajoItem> result        = new List <LegajoItem>();
            var db = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            using (DbCommand cmd = db.GetSqlStringCommand(SQL_STATEMENT))
            {
                db.AddInParameter(cmd, "@Id", DbType.Int32, legajoItem.ReciboSueldo.Id);
                using (IDataReader dr = db.ExecuteReader(cmd))
                {
                    while (dr.Read())
                    {
                        LegajoItem categoria = Load(dr);
                        result.Add(categoria);
                    }
                }
            }

            return(result);
        }
示例#10
0
        // GET: LegajoItem/Create
        public ActionResult Create(int id)
        {
            LegajoItem item = new LegajoItem();

            item.ReciboSueldo.Id = id;
            LegajoItemComponent legajoItemComponent = new LegajoItemComponent();
            LegajoItem          result = new LegajoItem();

            result = legajoItemComponent.ObtenerFaltantes(item);
            result.ReciboSueldo.Id = id;
            result.ListaItem.Select(y =>
                                    new
            {
                y.Id,
                y.item
            });

            ViewBag.ListaCategoria = new SelectList(result.ListaItem, "Id", "item");



            return(View(result));
        }
示例#11
0
 public void Update(LegajoItem legajoItem)
 {
     throw new NotImplementedException();
 }