public void UpdateRow_cta_rubros_x_provision(ro_Config_Param_contable_Info info_det)
        {
            var ls = get_list_cta_rubros();

            ct_plancta_Bus bus_plancta = new ct_plancta_Bus();
            ro_Config_Param_contable_Info edited_info = get_list_cta_rubros().Where(m => m.Secuencia == info_det.Secuencia).First();
            var cta = bus_plancta.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCtaCble_prov_credito);

            if (cta != null)
            {
                info_det.pc_Cuenta_prov_credito = cta.IdCtaCble + " - " + cta.pc_Cuenta;
            }

            var cta_deb = bus_plancta.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCtaCble_prov_debito);

            if (cta_deb != null)
            {
                info_det.pc_Cuenta_prov_debito = cta_deb.IdCtaCble + " - " + cta_deb.pc_Cuenta;
            }

            edited_info.IdCtaCble_prov_credito = info_det.IdCtaCble_prov_credito;
            edited_info.IdCtaCble_prov_debito  = info_det.IdCtaCble_prov_debito;

            edited_info.pc_Cuenta_prov_credito = info_det.pc_Cuenta_prov_credito;
            edited_info.pc_Cuenta_prov_debito  = info_det.pc_Cuenta_prov_debito;
        }
        public ro_Config_Param_contable_Info get_info(int IdEmpresa, int IdDivision, int IdArea, int IdDepartamento, string IdRubro)
        {
            try
            {
                ro_Config_Param_contable_Info info = new  ro_Config_Param_contable_Info();

                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_Config_Param_contable Entity = Context.ro_Config_Param_contable.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdDivision == IdDivision && q.IdArea == IdArea && q.IdDepartamento == IdDepartamento && q.IdRubro == IdRubro);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new  ro_Config_Param_contable_Info
                    {
                        IdEmpresa              = Entity.IdEmpresa,
                        IdDivision             = Entity.IdDivision,
                        IdArea                 = Entity.IdArea,
                        IdDepartamento         = Entity.IdDepartamento,
                        IdRubro                = Entity.IdRubro,
                        IdCentroCosto          = Entity.IdCentroCosto,
                        DebCre                 = Entity.DebCre,
                        IdCtaCble              = Entity.IdCtaCble,
                        IdCtaCble_prov_credito = Entity.IdCtaCble_Haber
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        public void UpdateRow_cta_rubros(ro_Config_Param_contable_Info info_det)
        {
            ro_Config_Param_contable_Info edited_info = get_list_cta_rubros().Where(m => m.Secuencia == info_det.Secuencia).First();

            edited_info.IdCtaCble       = info_det.IdCtaCble;
            edited_info.IdCtaCble_Haber = info_det.IdCtaCble_Haber;
            edited_info.DebCre          = info_det.DebCre;
        }
        public List <ro_Config_Param_contable_Info> Get_List_Config_Param_contable_Sueldo_x_pagar(int IdEmpresa)
        {
            try
            {
                List <ro_Config_Param_contable_Info> listado = new List <ro_Config_Param_contable_Info>();

                string query = "select * from vwRo_Division_Area_dep_rubro where IdEmpresa='" + IdEmpresa + "' and rub_provision=0";


                using (EntitiesRoles db = new EntitiesRoles())
                {
                    var result = db.Database.SqlQuery <ro_Config_Param_contable_Info>(query).ToList();;


                    foreach (var item in result)
                    {
                        ro_Config_Param_contable_Info info = new ro_Config_Param_contable_Info();
                        info.IdEmpresa                  = Convert.ToInt32(item.IdEmpresa);
                        info.IdDivision                 = Convert.ToInt32(item.IdDivision);
                        info.IdArea                     = Convert.ToInt32(item.IdArea);
                        info.IdDepartamento             = Convert.ToInt32(item.IdDepartamento);
                        info.IdRubro                    = item.IdRubro;
                        info.IdCtaCble                  = item.IdCtaCble;
                        info.IdCentroCosto              = item.IdCentroCosto;
                        info.DebCre                     = item.DebCre;
                        info.ru_tipo                    = item.ru_tipo;
                        info.DescripcionDiv             = item.DescripcionDiv;
                        info.DescripcionArea            = item.DescripcionArea;
                        info.de_descripcion             = item.de_descripcion;
                        info.ru_descripcion             = item.ru_descripcion;
                        info.rub_provision              = item.rub_provision;
                        info.rub_nocontab               = (bool)item.rub_nocontab;
                        info.rub_Contabiliza_x_empleado = item.rub_Contabiliza_x_empleado;
                        info.IdCtaCble_Haber            = item.IdCtaCble_Haber;

                        if (item.IdCtaCble == null)
                        {
                            info.IdCtaCble = item.rub_ctacon;
                        }
                        listado.Add(info);
                    }
                }
                return(listado);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
 public bool ModificarDB(ro_Config_Param_contable_Info info)
 {
     try
     {
         return(odata.ModificarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #6
0
        public ActionResult EditingUpdate_provisiones([ModelBinder(typeof(DevExpressEditorsBinder))] ro_Config_Param_contable_Info info_det)
        {
            if (ModelState.IsValid)
            {
                lst_cta_rubro.UpdateRow_cta_rubros(info_det);
            }
            ro_Parametros_Info model = new ro_Parametros_Info();

            model.lst_cta_x_provisiones = lst_cta_rubro.get_list_cta_rubros().Where(v => v.rub_provision == true).ToList();
            cargar_combos_detalle();
            return(PartialView("_GridViewPartial_cta_ctble_provisiones", model));
        }
        public bool ModificarDB(ro_Config_Param_contable_Info info)
        {
            try
            {
                using (Entities_rrhh db = new Entities_rrhh())
                {
                    if (info.IdCtaCble == "")
                    {
                        info.IdCtaCble = null;
                    }
                    if (info.IdCtaCble_prov_debito == "")
                    {
                        info.IdCtaCble_prov_debito = null;
                    }

                    if (info.IdEmpresa == 0)
                    {
                        return(false);
                    }

                    var entity = db.ro_Config_Param_contable.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdDivision == info.IdDivision && q.IdArea == info.IdArea && q.IdDepartamento == info.IdDepartamento && q.IdRubro == info.IdRubro).FirstOrDefault();
                    if (entity != null)
                    {
                        entity.IdCtaCble       = info.rub_provision == true ? info.IdCtaCble_prov_debito : null;
                        entity.IdCtaCble_Haber = info.rub_provision == true ? info.IdCtaCble_prov_credito : info.IdCtaCble;
                    }
                    else
                    {
                        entity = new ro_Config_Param_contable
                        {
                            IdEmpresa      = info.IdEmpresa,
                            IdDivision     = info.IdDivision,
                            IdArea         = info.IdArea,
                            IdDepartamento = info.IdDepartamento,
                            IdRubro        = info.IdRubro,
                            IdCentroCosto  = info.IdCentroCosto,
                            DebCre         = info.DebCre,

                            IdCtaCble       = info.rub_provision == true ? info.IdCtaCble_prov_debito : null,
                            IdCtaCble_Haber = info.rub_provision == true ? info.IdCtaCble_prov_credito : info.IdCtaCble
                        };
                        db.ro_Config_Param_contable.Add(entity);
                    }
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ro_Config_Param_contable_Info info_det)
        {
            if (ModelState.IsValid)
            {
                lst_cta_rubro.UpdateRow_cta_rubros(info_det);
                bus_configuracion_ctas.ModificarDB(lst_cta_rubro.get_list_cta_rubros().Where(q => q.Secuencia == info_det.Secuencia).FirstOrDefault());
            }
            ro_Parametros_Info model = new ro_Parametros_Info();

            model.lst_cta_x_rubros = lst_cta_rubro.get_list_cta_rubros().Where(v => v.rub_provision == false).ToList();
            cargar_combos_detalle();
            return(PartialView("_GridViewPartial_cta_ctble_rubros", model));
        }
        public void UpdateRow_cta_rubros(ro_Config_Param_contable_Info info_det, decimal IdTransaccionSession)
        {
            var ls = get_list_cta_rubros(IdTransaccionSession);

            ct_plancta_Bus bus_plancta = new ct_plancta_Bus();
            ro_Config_Param_contable_Info edited_info = get_list_cta_rubros(IdTransaccionSession).Where(m => m.Secuencia == info_det.Secuencia).First();
            var cta = bus_plancta.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCtaCble);

            if (cta != null)
            {
                info_det.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta;
                edited_info.pc_Cuenta_prov_debito = info_det.pc_Cuenta_prov_debito;
            }

            edited_info.IdCtaCble = info_det.IdCtaCble;
            edited_info.pc_Cuenta = info_det.pc_Cuenta;

            edited_info.IdCtaCble_prov_credito = info_det.IdCtaCble_prov_credito;
            edited_info.DebCre = info_det.DebCre;
        }