protected void CopyValues(ExpedientInfo source, ExpenseList list
                                  , InputDeliveryLineList conceptos
                                  , InputDeliveryList albaranes)
        {
            if (source == null)
            {
                return;
            }

            Oid        = source.Oid;
            Expediente = source.Codigo;

            foreach (ExpenseInfo item in list)
            {
                if (item.OidExpediente == source.Oid)
                {
                    CheckGasto(item);
                }
            }

            foreach (InputDeliveryLineInfo item in conceptos)
            {
                if (item.OidExpediente == source.Oid)
                {
                    CheckGasto(list, albaranes.GetItem(item.OidAlbaran));
                }
            }

            if (Proveedor != null)
            {
                Proveedor = Proveedor.Substring(0, Proveedor.Length - 1);
            }
            if (Naviera != null)
            {
                Naviera = Naviera.Substring(0, Naviera.Length - 1);
            }
            if (Despachante != null)
            {
                Despachante = Despachante.Substring(0, Despachante.Length - 1);
            }
            if (TransportistaOrigen != null)
            {
                TransportistaOrigen = TransportistaOrigen.Substring(0, TransportistaOrigen.Length - 1);
            }
            if (TransportistaDestino != null)
            {
                TransportistaDestino = TransportistaDestino.Substring(0, TransportistaDestino.Length - 1);
            }
        }
        public virtual void UpdateGastosPartidas()
        {
            InputDeliveryLineList conceptos = InputDeliveryLineList.GetByExpedienteStockList(Oid, false, true);

            if (Ayuda)
            {
                if (_expedientes_rea == null)
                {
                    LoadChilds(typeof(REAExpedient), true, false);
                }
            }

            KilosTotal = 0;

            foreach (BatchInfo item in Partidas)
            {
                if (item.OidExpediente != Oid)
                {
                    continue;
                }
                KilosTotal += item.KilosIniciales;
            }

            decimal ayudas     = 0;
            decimal kilos      = 0;
            decimal ayuda_kilo = 0;

            foreach (BatchInfo item in Partidas)
            {
                if (item.OidExpediente != Oid)
                {
                    continue;
                }

                if (Ayuda)
                {
                    ayudas     = ExpedientesREA.GetTotalAyudas(item.CodigoAduanero);
                    kilos      = Partidas.GetTotalKilos(item.CodigoAduanero);
                    ayuda_kilo = ayudas / kilos;
                }
                else
                {
                    ayuda_kilo = 0;
                }

                item.CalculaCostes(GastoPorKilo, ayuda_kilo);
            }
        }
        public ExpensesReportVerticalRpt GetInformeGastoVerticalListReport(ExpenseList list,
                                                                           ExpedienteList expedientes,
                                                                           ReportFilter filter,
                                                                           InputDeliveryLineList conceptos)
        {
            if (list == null)
            {
                return(null);
            }

            ExpensesReportVerticalRpt doc = new ExpensesReportVerticalRpt();

            List <ResumenGastoPrint> pList     = new List <ResumenGastoPrint>();
            InputDeliveryList        albaranes = InputDeliveryList.GetList(false);

            foreach (ExpedientInfo item in expedientes)
            {
                if (filter.SoloIncompletos)
                {
                    if (list.ExpedienteIsComplete(item.Oid))
                    {
                        continue;
                    }
                }

                ResumenGastoPrint registro = ResumenGastoPrint.New(item, list, conceptos, albaranes);

                if (registro.Proveedor != null ||
                    registro.Naviera != null ||
                    registro.Despachante != null ||
                    registro.TransportistaDestino != null ||
                    registro.TransportistaOrigen != null)
                {
                    pList.Add(registro);
                }
            }

            doc.SetDataSource(pList);

            FormatHeader(doc);

            return(doc);
        }