示例#1
0
 public SV_TRANSACTION_DETAIL GetByPartSystem(int head_id, SV_SYSTEM system)
 {
     return(_source
            .Where(td => td.trx_head_id == head_id &&
                   td.system_id == system.id)
            .FirstOrDefault());
 }
        public RespuestaAccion DELETE_PURCHASE_PARAM(int head_id, SV_SYSTEM sistema, SV_PARAMETER parametro)
        {
            var res = new RespuestaAccion();

            try
            {
                TRANSACTION_PARAMETER_DETAIL curr_param = (from p in _context.TRANSACTIONS_PARAMETERS_DETAILS
                                                           where p.trx_head_id == head_id &&
                                                           p.paratemer_id == parametro.id &&
                                                           p.system_id == sistema.id
                                                           select p).FirstOrDefault();
                if (curr_param != null)
                {
                    _context.TRANSACTIONS_PARAMETERS_DETAILS.DeleteObject(curr_param);
                    _context.SaveChanges();
                    res.result_objs.Add((SV_TRANSACTION_PARAMETER_DETAIL)curr_param);
                    res.set_ok();
                }
                else
                {
                    //no existe, por lo que no hay que borrarlo
                    res.set(2, "No existe parametro para borrar");
                }
            }
            catch (Exception ex)
            {
                res.set(-1, ex.StackTrace);
            }
            return(res);
        }
示例#3
0
        public RespuestaAccion REGISTER_PURCHASE_DETAIL(GENERIC_VALUE cabecera, SV_SYSTEM sistema, bool depreciar, bool con_credito)
        {
            var res = new RespuestaAccion();

            try
            {
                TRANSACTION_DETAIL nuevo_det = new TRANSACTION_DETAIL();
                nuevo_det.trx_head_id  = cabecera.id;
                nuevo_det.system_id    = sistema.id;
                nuevo_det.validity_id  = Vigencias.VIGENTE().id;
                nuevo_det.depreciate   = depreciar;
                nuevo_det.allow_credit = con_credito;

                _context.TRANSACTIONS_DETAILS.AddObject(nuevo_det);
                _context.SaveChanges();

                res.result_objs.Add((SV_TRANSACTION_DETAIL)nuevo_det);

                res.set_ok();
            }
            catch (Exception ex)
            {
                res.set(-1, ex.StackTrace);
            }
            return(res);
        }
示例#4
0
        public RespuestaAccion MODIF_PURCHASE_DETAIL(int headId, SV_SYSTEM sistema, bool depreciar, bool con_credito)
        {
            var res = new RespuestaAccion();

            try
            {
                int validity_id = 1;    //Durante las compras nunca se debe cambiar el estado de validacion

                var FindDetail = (from d in _context.TRANSACTIONS_DETAILS
                                  where d.trx_head_id == headId &&
                                  d.system_id == sistema.id
                                  select d).FirstOrDefault();
                if (FindDetail != null)
                {
                    FindDetail.validity_id  = validity_id;
                    FindDetail.allow_credit = con_credito;
                    FindDetail.depreciate   = depreciar;

                    _context.SaveChanges();
                    res.AddResultObj(FindDetail.id, FindDetail.GetType());
                    res.set_ok();
                }
                else
                {
                    res.set(-2, "No se encontro cabecera para modificar");
                }
            }
            catch (Exception ex)
            {
                res.set(-1, ex.StackTrace);
            }
            return(res);
        }
示例#5
0
 public List <SV_TRANSACTION_DETAIL> GetByHeadsSystem(int[] head_ids, SV_SYSTEM system)
 {
     return(_source
            .Where(td =>
                   head_ids.Contains(td.trx_head_id) &&
                   td.system_id == system.id)
            .ToList());
 }
示例#6
0
        private RespuestaAccion registrar_parametros(SV_SYSTEM curSystem, int cabecera, decimal valor_unitario, bool derecho, int vutil, GENERIC_VALUE clase, bool isYen)
        {
            RespuestaAccion mRS;
            decimal         valor_proceso;
            //Ingreso Precio Unitario
            SV_PARAMETER pb = P.Consultas.parametros.PrecioBase;

            mRS = P.Consultas.detalle_parametros.REGISTER_PURCHASE_PARAM(cabecera, curSystem, pb, valor_unitario);
            if (mRS.CheckError)
            {
                return(mRS);
            }
            //Ingreso Credito
            if (derecho)
            {
                SV_PARAMETER cred = P.Consultas.parametros.Credito;
                //valor_proceso = Math.Round(curSystem.ENVIORMENT.credit_rate * -valor_unitario,0);
                valor_proceso = curSystem.ENVIORMENT.credit_rate * -valor_unitario;
                mRS           = P.Consultas.detalle_parametros.REGISTER_PURCHASE_PARAM(cabecera, curSystem, cred, valor_proceso);
                if (mRS.CheckError)
                {
                    return(mRS);
                }
            }
            //Ingreso Vida Util     //default monthly
            SV_PARAMETER vu = P.Consultas.parametros.VidaUtil;

            if (curSystem.ENVIORMENT.depreciation_rate == "monthly")
            {
                valor_proceso = vutil;
            }
            else
            {
                valor_proceso = vutil / 12 * 365;
            }
            mRS = P.Consultas.detalle_parametros.REGISTER_PURCHASE_PARAM(cabecera, curSystem, vu, valor_proceso);
            if (mRS.CheckError)
            {
                return(mRS);
            }
            //Valor Residual
            SV_PARAMETER vr = P.Consultas.parametros.ValorResidual;

            if (curSystem.ENVIORMENT == "IFRS")
            {
                decimal porc = P.Consultas.predeter_ifrs.porcentaje_valor_residual(clase);
                valor_proceso = Math.Round(valor_unitario * (-porc), 0);
            }
            else
            {
                valor_proceso = -1;
            }

            mRS = P.Consultas.detalle_parametros.REGISTER_PURCHASE_PARAM(cabecera, curSystem, vr, valor_proceso);
            return(mRS);
        }
示例#7
0
        private RespuestaAccion modificar_parametros(SV_SYSTEM curSystem, int cabecera, decimal valor_unitario, bool derecho, int vutil, GENERIC_VALUE clase, bool isYen)
        {
            RespuestaAccion mRS;
            decimal         ValueToWork;
            //Modifico Precio Unitario
            SV_PARAMETER pb = P.Consultas.parametros.PrecioBase;

            mRS = P.Consultas.detalle_parametros.MODIF_PURCHASE_PARAM(cabecera, curSystem, pb, valor_unitario, !isYen);
            if (mRS.CheckError)
            {
                return(mRS);
            }
            //Ingreso Credito
            if (derecho)
            {
                SV_PARAMETER cred = P.Consultas.parametros.Credito;
                ValueToWork = curSystem.ENVIORMENT.credit_rate * -valor_unitario;
                mRS         = P.Consultas.detalle_parametros.MODIF_PURCHASE_PARAM(cabecera, curSystem, cred, ValueToWork);
                if (mRS.CheckError)
                {
                    return(mRS);
                }
            }
            //Ingreso Vida Util     //default monthly
            SV_PARAMETER vu = P.Consultas.parametros.VidaUtil;

            if (curSystem.ENVIORMENT.depreciation_rate == "monthly")
            {
                ValueToWork = vutil;
            }
            else
            {
                ValueToWork = vutil / 12 * 365;
            }
            mRS = P.Consultas.detalle_parametros.MODIF_PURCHASE_PARAM(cabecera, curSystem, vu, ValueToWork);
            if (mRS.CheckError)
            {
                return(mRS);
            }
            //Valor Residual
            SV_PARAMETER vr = P.Consultas.parametros.ValorResidual;

            if (curSystem.ENVIORMENT == "IFRS")
            {
                decimal porc = P.Consultas.predeter_ifrs.porcentaje_valor_residual(clase);
                ValueToWork = valor_unitario * -porc;
            }
            else
            {
                ValueToWork = -1;
            }

            mRS = P.Consultas.detalle_parametros.MODIF_PURCHASE_PARAM(cabecera, curSystem, vr, ValueToWork);
            return(mRS);
        }
示例#8
0
        public List <DETAIL_MOVEMENT> get_changed_mov(SV_SYSTEM sistema, ACode.Vperiodo periodo, DateTime desde, DateTime hasta, int codigo, int parte, bool WithParameters, SV_KIND[] clases, SV_ZONE[] zonas)
        {
            var resultado = new List <DETAIL_MOVEMENT>();
            var principal = get_changed(sistema, desde, hasta, codigo, parte, WithParameters, clases, zonas);

            foreach (var cambio in principal)
            {
                var anteriores = get_detailed(sistema, cambio.fecha_inicio.AddMinutes(-1), cambio.cod_articulo, WithParameters, true);
                if (anteriores.Count > 0)
                {
                    var single_ant = anteriores.Where(a => a.PartId == cambio.PartId).First();
                    if (single_ant != null)
                    {
                        var mov = new DETAIL_MOVEMENT(single_ant, cambio, Situaciones);
                        resultado.Add(mov);
                    }
                }
            }
            return(resultado);
        }
        public RespuestaAccion REGISTER_PURCHASE_PARAM(int head_id, SV_SYSTEM sistema, SV_PARAMETER parametro, decimal valor)
        {
            var res = new RespuestaAccion();

            try
            {
                TRANSACTION_PARAMETER_DETAIL nuevo_param = new TRANSACTION_PARAMETER_DETAIL();
                nuevo_param.trx_head_id     = head_id;
                nuevo_param.system_id       = sistema.id;
                nuevo_param.paratemer_id    = parametro.id;
                nuevo_param.parameter_value = valor;

                _context.TRANSACTIONS_PARAMETERS_DETAILS.AddObject(nuevo_param);
                _context.SaveChanges();
                res.result_objs.Add((SV_TRANSACTION_PARAMETER_DETAIL)nuevo_param);
                res.set_ok();
            }
            catch (Exception ex)
            {
                res.set(-1, ex.StackTrace);
            }
            return(res);
        }
        public RespuestaAccion MODIF_PURCHASE_PARAM(int head_id, SV_SYSTEM sistema, SV_PARAMETER parametro, decimal valor, bool withResiduo)
        {
            var res = new RespuestaAccion();

            try
            {
                TRANSACTION_PARAMETER_DETAIL curr_param = (from p in _context.TRANSACTIONS_PARAMETERS_DETAILS
                                                           where p.trx_head_id == head_id &&
                                                           p.paratemer_id == parametro.id &&
                                                           p.system_id == sistema.id
                                                           select p).FirstOrDefault();
                if (curr_param == null)
                {
                    curr_param                 = new TRANSACTION_PARAMETER_DETAIL();
                    curr_param.trx_head_id     = head_id;
                    curr_param.system_id       = sistema.id;
                    curr_param.paratemer_id    = parametro.id;
                    curr_param.parameter_value = valor;
                    _context.TRANSACTIONS_PARAMETERS_DETAILS.AddObject(curr_param);
                }
                else
                {
                    curr_param.parameter_value = valor;
                }
                _context.SaveChanges();

                res.result_objs.Add((SV_TRANSACTION_PARAMETER_DETAIL)curr_param);

                res.set_ok();
            }
            catch (Exception ex)
            {
                res.set(-1, ex.StackTrace);
            }
            return(res);
        }
示例#11
0
        //public test test_add()
        //{

        //    return test_add("hola", 1, new DateTime(2019, 3, 3));
        //}
        //public test test_add(string texto, int numero, DateTime fecha)
        //{
        //    var row = new test();
        //    row.texto = texto;
        //    row.numero = numero;
        //    row.fecha = fecha;

        //    var rel = new rel_test();
        //    rel.texto_rel = texto + numero.ToString();
        //    rel.test = row;
        //    //_context.tests.AddObject(row);
        //    _context.rel_test.AddObject(rel);
        //    _context.SaveChanges();
        //    return row;
        //}
        #endregion

        #region Datos Generales
        public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, int codigo, string[] aprobados, bool WithParameters, bool CheckPost, GENERIC_VALUE clase, GENERIC_VALUE zona)
        {
            var salida = new List <DETAIL_PROCESS>();
            int default_clase = 1;
            int default_zona = 0;
            int rq_cl = default_clase, rq_zn = default_zona, rq_type = 0;

            if (clase != null)
            {
                rq_cl = clase.id;
                if (clase.code == "10")
                {
                    rq_type = 1;
                    rq_cl   = default_clase;
                }
                if (clase.code == "20")
                {
                    rq_type = 2;
                    rq_cl   = default_clase;
                }
            }
            if (zona != null)
            {
                rq_zn = zona.id;
            }

            var datos = (from A in this._context.BATCHS_ARTICLES
                         join B in this._context.PARTS on A.id equals B.article_id
                         join C in this._context.TRANSACTIONS_HEADERS
                         on B.id equals C.article_part_id
                         join D in this._context.TRANSACTIONS_DETAILS
                         on C.id equals D.trx_head_id
                         where
                         (C.trx_ini <= corte &&
                          C.trx_end > corte) &&
                         (A.id == codigo || codigo == 0) &&
                         (C.kind_id == rq_cl || rq_cl == default_clase) &&
                         (C.zone_id == rq_zn || rq_zn == default_zona) &&
                         (A.type_asset_id == rq_type || rq_type == 0) &&
                         (A.account_date <= corte || !CheckPost) &&
                         aprobados.Contains(A.APROVAL_STATE.code) &&
                         D.system_id == sistema.id
                         select new {
                //Batch = A,
                BatchId = A.id,
                BatchDescription = A.descrip,
                BatchPurchaseDate = A.purchase_date,
                BatchAprovalStateId = A.aproval_state_id,
                BatchInitialPrice = A.initial_price,
                BatchInitialLifeTime = A.initial_life_time,
                BatchAccountDate = A.account_date,
                BatchOriginId = A.origin_id,
                BatchAssetId = A.type_asset_id,
                //Part = B,
                PartIndex = B.part_index,
                PartQuantity = B.quantity,
                PartId = B.id,
                PartFirstDate = B.first_date,
                //Head = C,
                HeadTrxIni = C.trx_ini,
                HeadTrxEnd = C.trx_end,
                HeadZoneId = C.zone_id,
                HeadKindId = C.kind_id,
                HeadCategoryId = C.category_id,
                HeadSubZoneId = C.subzone_id,
                HeadSubkindId = C.subkind_id,
                HeadManageId = C.manage_id,
                HeadUserOwn = C.user_own,
                HeadId = C.id,
                HeadIndex = C.head_index,
                HeadRefSource = C.ref_source,
                MethodRevalId = C.method_revalue_id,
                //Detail = D
                DetailValidityId = D.validity_id,
                DetailDepreciate = D.depreciate,
                DetailAllowCredit = D.allow_credit,
                DetailId = D.id,
            }).ToList();
            var selectedHeads = datos.
                                GroupBy(d => d.PartId).
                                Select(d =>
                                       //new {
                                       //PartId = d.Key,
                                       //HeadMaxId = d.Max(e => e.HeadIndex), HeadId =
                                       d.Where(e => e.HeadIndex == d.Max(f => f.HeadIndex))
                                       .FirstOrDefault().HeadId
                                       //}
                                       ).ToArray();

            //var selectedHeads = datos.Select(d => d.HeadId).Distinct().ToArray();
            set_detalle_parametros(sistema.id, selectedHeads);
            var all_params = this.parametros_sistemas.BySystem(sistema.id);

            foreach (var d in datos.Where(a => selectedHeads.Contains(a.HeadId)))
            {
                var line = new DETAIL_PROCESS();
                line.fecha_proceso  = corte;
                line.sistema        = sistema;
                line.cod_articulo   = d.BatchId;
                line.parte          = d.PartIndex;
                line.fecha_inicio   = d.HeadTrxIni;
                line.fecha_fin      = d.HeadTrxEnd;
                line.zona           = this.zonas.ById(d.HeadZoneId);
                line.vigencia       = this.Vigencias.ById(d.DetailValidityId);
                line.cantidad       = d.PartQuantity;
                line.clase          = this.Clases.ById(d.HeadKindId);
                line.categoria      = this.categorias.ById(d.HeadCategoryId);
                line.subzona        = this.subzonas.ById(d.HeadSubZoneId);
                line.subclase       = this.subclases.ById(d.HeadSubkindId);
                line.gestion        = this.gestiones.ById(d.HeadManageId);
                line.usuario        = d.HeadUserOwn;
                line.se_deprecia    = d.DetailDepreciate;
                line.aprobacion     = this.EstadoAprobacion.ById(d.BatchAprovalStateId);
                line.dscrp          = d.BatchDescription;
                line.dsc_extra      = this.inv_articulos_details.ExtraDescrip(d.BatchId);
                line.fecha_compra   = d.BatchPurchaseDate;
                line.documentos     = this.documentos.ByBatch(d.BatchId);
                line.precio_inicial = d.BatchInitialPrice;
                if (sistema.ENVIORMENT.code == "IFRS")
                {
                    line.vida_util_inicial = (int)(Math.Round((double)(d.BatchInitialLifeTime / 12 * 365), 0));
                }
                else
                {
                    line.vida_util_inicial = d.BatchInitialLifeTime;
                }
                line.derecho_credito = d.DetailAllowCredit;
                line.fecha_ing       = d.BatchAccountDate;
                line.origen          = this.origenes.ById(d.BatchOriginId);
                line.tipo            = this.Tipos.ById(d.BatchAssetId);
                line.metodo_reval    = this.MetodosRev.ById(d.MethodRevalId);

                line.PartId    = d.PartId;
                line.HeadId    = d.HeadId;
                line.DetailId  = d.DetailId;
                line.RefSource = d.HeadRefSource;
                if (WithParameters)
                {
                    //Complete TRANSACTIONS_PARAMETERS_DETAILS collection
                    var valores   = new LIST_PARAM_VALUE();
                    var curr_vals = this.DetallesParametros.ByHead_Sys(d.HeadId, sistema.id);
                    foreach (var par in all_params)
                    {
                        SV_PARAMETER meta_param = this.parametros.ById(par.parameter_id);
                        PARAM_VALUE  det;
                        var          act_val = curr_vals.Find(x => x.code == meta_param.code);
                        if (act_val == null)
                        {
                            det = PARAM_VALUE.NoValue(meta_param);
                        }
                        else
                        {
                            det = act_val;
                        }
                        valores.Add(det);
                    }
                    line.parametros = valores;
                    //Complete SCHEMA sales
                    line.precio_venta = this.ventas.GetPriceSalesByPart(d.PartId, sistema.CURRENCY);
                }
                salida.Add(line);
            }

            return(salida);
        }
示例#12
0
 public List <SV_TRANSACTION_PARAMETER_DETAIL> ByHeadSys(int HeadId, SV_SYSTEM system)
 {
     return(_source.Where(x => x.trx_head_id == HeadId && x.system_id == system.id).ToList());
 }
示例#13
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, int codigo, string[] aprobados, bool WithParameters, bool CheckPost)
 {
     return(get_detailed(sistema, corte, codigo, aprobados, WithParameters, CheckPost, null, null));
 }
示例#14
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, int codigo, string[] aprobados)
 {
     return(this.get_detailed(sistema, corte, codigo, aprobados, _def_with_param, _def_check_post));
 }
示例#15
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, int codigo, bool WithParameters)
 {
     return(this.get_detailed(sistema, corte, codigo, _def_apro, WithParameters, _def_check_post));
 }
示例#16
0
 public List <SV_SYSTEM_PARAMETER> BySystem(SV_SYSTEM s)
 {
     return(BySystem(s.id));
 }
示例#17
0
        public List <DETAIL_PROCESS> get_changed(SV_SYSTEM RqSistema, DateTime desde, DateTime hasta, int codigo, int parte, bool WithParameters, SV_KIND[] clases, SV_ZONE[] zonas)
        {
            var salida = new List <DETAIL_PROCESS>();

            int[] default_clase = new int[] { 1 };
            int[] default_zona  = new int[] { 0 };
            int[] rq_cl         = default_clase,
            rq_zn   = default_zona,
            rq_type = default_zona;
            //Some values are fixed from original get_detailed
            string[] aprobados = EstadoAprobacion.ArrOnlyActive;
            bool     CheckPost = true;

            if (clases != null)
            {
                rq_cl   = clases.Select(c => c.id).ToArray();
                rq_type = clases.Select(c => c.type_asset_id).Distinct().ToArray();
            }

            if (zonas != null)
            {
                rq_zn = zonas.Select(c => c.id).ToArray();
            }

            var def_clas = default_clase[0];
            var def_zon  = default_zona[0];


            var datos = (from A in this._context.BATCHS_ARTICLES
                         join B in this._context.PARTS on A.id equals B.article_id
                         join C in this._context.TRANSACTIONS_HEADERS
                         on B.id equals C.article_part_id
                         join D in this._context.TRANSACTIONS_DETAILS
                         on C.id equals D.trx_head_id
                         where
                         (C.trx_ini >= desde &&
                          C.trx_ini <= hasta) &&
                         (A.id == codigo || codigo == 0) &&
                         (B.part_index == parte || parte == -99) &&
                         (rq_cl.Contains(C.kind_id) || rq_cl.Contains(def_clas)) &&
                         (rq_zn.Contains(C.zone_id) || rq_zn.Contains(def_zon)) &&
                         (rq_type.Contains(A.type_asset_id) || rq_type.Contains(def_zon)) &&
                         (A.account_date <= hasta || !CheckPost) &&
                         aprobados.Contains(A.APROVAL_STATE.code) &&
                         (C.ref_source.Contains("TRAS")) &&
                         D.system_id == RqSistema.id
                         select new
            {
                //Batch = A,
                BatchId = A.id,
                BatchDescription = A.descrip,
                BatchPurchaseDate = A.purchase_date,
                BatchAprovalStateId = A.aproval_state_id,
                BatchInitialPrice = A.initial_price,
                BatchInitialLifeTime = A.initial_life_time,
                BatchAccountDate = A.account_date,
                BatchOriginId = A.origin_id,
                BatchAssetId = A.type_asset_id,
                //Part = B,
                PartIndex = B.part_index,
                PartQuantity = B.quantity,
                PartId = B.id,
                PartFirstDate = B.first_date,
                //Head = C,
                HeadTrxIni = C.trx_ini,
                HeadTrxEnd = C.trx_end,
                HeadZoneId = C.zone_id,
                HeadKindId = C.kind_id,
                HeadCategoryId = C.category_id,
                HeadSubZoneId = C.subzone_id,
                HeadSubkindId = C.subkind_id,
                HeadManageId = C.manage_id,
                HeadUserOwn = C.user_own,
                HeadId = C.id,
                HeadRefSource = C.ref_source,
                MethodRevalId = C.method_revalue_id,
                //Detail = D
                DetailValidityId = D.validity_id,
                DetailDepreciate = D.depreciate,
                DetailAllowCredit = D.allow_credit,
                DetailId = D.id
            });

            var selectedHeads = datos.Select(d => d.HeadId).Distinct().ToArray();

            set_detalle_parametros(RqSistema.id, selectedHeads);
            var all_params = this.parametros_sistemas.BySystem(RqSistema.id);

            foreach (var d in datos)
            {
                var line = new DETAIL_PROCESS();
                line.fecha_proceso = desde;
                line.sistema       = RqSistema;
                //Batch = A,
                line.cod_articulo      = d.BatchId;
                line.dscrp             = d.BatchDescription;
                line.dsc_extra         = d.BatchDescription;
                line.fecha_compra      = d.BatchPurchaseDate;
                line.aprobacion        = this.EstadoAprobacion.ById(d.BatchAprovalStateId);
                line.precio_inicial    = d.BatchInitialPrice;
                line.vida_util_inicial = ((RqSistema.ENVIORMENT.code == "IFRS") ? (int)(Math.Round((double)(d.BatchInitialLifeTime / 12 * 365), 0)) : d.BatchInitialLifeTime);
                line.fecha_ing         = d.BatchAccountDate;
                line.origen            = this.origenes.ById(d.BatchOriginId);
                line.tipo = this.Tipos.ById(d.BatchAssetId);
                //Part = B,
                line.parte        = d.PartIndex;
                line.cantidad     = d.PartQuantity;
                line.PartId       = d.PartId;
                line.PrimeraFecha = d.PartFirstDate;
                //Head = C,
                line.fecha_inicio = d.HeadTrxIni;
                line.fecha_fin    = d.HeadTrxEnd;
                line.zona         = this.zonas.ById(d.HeadZoneId);
                line.clase        = this.Clases.ById(d.HeadKindId);
                line.categoria    = this.categorias.ById(d.HeadCategoryId);
                line.subzona      = this.subzonas.ById(d.HeadSubZoneId);
                line.subclase     = this.subclases.ById(d.HeadSubkindId);
                line.gestion      = this.gestiones.ById(d.HeadManageId);
                line.usuario      = d.HeadUserOwn;
                line.HeadId       = d.HeadId;
                line.RefSource    = d.HeadRefSource;
                line.metodo_reval = this.MetodosRev.ById(d.MethodRevalId);
                //Detail = D
                line.vigencia        = this.Vigencias.ById(d.DetailValidityId);
                line.se_deprecia     = d.DetailDepreciate;
                line.derecho_credito = d.DetailAllowCredit;
                line.DetailId        = d.DetailId;

                line.documentos = this.documentos.ByBatch(d.BatchId);

                if (WithParameters)
                {
                    //Complete TRANSACTIONS_PARAMETERS_DETAILS collection
                    var valores   = new LIST_PARAM_VALUE();
                    var curr_vals = this.DetallesParametros.ByHead_Sys(d.HeadId, RqSistema.id);
                    foreach (var par in all_params)
                    {
                        SV_PARAMETER meta_param = this.parametros.ById(par.parameter_id);
                        PARAM_VALUE  det;
                        var          act_val = curr_vals.Find(x => x.code == meta_param.code);
                        if (act_val == null)
                        {
                            det = PARAM_VALUE.NoValue(meta_param);
                        }
                        else
                        {
                            det = act_val;
                        }
                        valores.Add(det);
                    }
                    line.parametros = valores;
                    //Complete SCHEMA sales
                    line.precio_venta = this.ventas.GetPriceSalesByPart(d.PartId, RqSistema.CURRENCY);
                }
                salida.Add(line);
            }

            return(salida);
        }
示例#18
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte)
 {
     return(this.get_detailed(sistema, corte, 0, _def_apro, _def_with_param, _def_check_post));
 }
示例#19
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, bool WithParameters, bool CheckPost)
 {
     return(this.get_detailed(sistema, corte, 0, _def_apro, WithParameters, CheckPost));
 }
示例#20
0
 public List <DETAIL_PROCESS> get_detailed(SV_SYSTEM sistema, DateTime corte, string[] aprobados, bool WithParameters)
 {
     return(this.get_detailed(sistema, corte, 0, aprobados, WithParameters, _def_check_post));
 }