Пример #1
0
        public static void MapToSegment(A14FTSegment segment, RawSegment rawSegment)
        {
            var a14ftValue = rawSegment.SegmentString
                             .Replace("A14FT-", string.Empty);

            if (a14ftValue.StartsWith("IdCliente-"))
            {
                segment.ClientId = a14ftValue.Replace("IdCliente-", string.Empty);
            }

            if (a14ftValue.StartsWith("IdUsuario-"))
            {
                segment.UserId = a14ftValue.Replace("IdUsuario-", string.Empty);
            }

            if (a14ftValue.StartsWith("FormaPago-"))
            {
                segment.InvoicePaymentMethod = a14ftValue.Replace("FormaPago-", string.Empty);
            }

            if (a14ftValue.StartsWith("MetodoPago-"))
            {
                segment.InvoicePaymentType = a14ftValue.Replace("MetodoPago-", string.Empty);
            }

            if (a14ftValue.StartsWith("TipoDocumento-"))
            {
                segment.InvoiceTypeId = a14ftValue.Replace("TipoDocumento-", string.Empty);
            }

            if (a14ftValue.StartsWith("UsoCFDI-"))
            {
                segment.InvoiceUseTypeId = a14ftValue.Replace("UsoCFDI-", string.Empty);
            }

            if (a14ftValue.StartsWith("TipoDocumento-"))
            {
                segment.InvoiceTypeId = a14ftValue.Replace("TipoDocumento-", string.Empty);
            }

            if (a14ftValue.StartsWith("CargoServicio-"))
            {
                var cargo = a14ftValue.Replace("CargoServicio-", string.Empty);
                segment.InvoiceServiceAmounts.Add(cargo);
            }

            if (a14ftValue.StartsWith("Concepto-"))
            {
                var concepto = a14ftValue.Replace("Concepto-", string.Empty);
                segment.InvoiceLines.Add(concepto);
            }

            if (a14ftValue.StartsWith("FtMarkup-"))
            {
                var ftMarkup = a14ftValue.Replace("FtMarkup-", string.Empty);
                segment.FtMarkups.Add(ftMarkup);
            }
        }
Пример #2
0
        public static void OrderSubSegments(A14FTSegment segment)
        {
            segment.InvoiceLines = segment.InvoiceLines
                                   .OrderSplit("-");

            segment.InvoiceServiceAmounts = segment.InvoiceServiceAmounts
                                            .OrderSplit("-");

            segment.FtMarkups = segment.FtMarkups
                                .OrderSplit("-");
        }
Пример #3
0
        private static A14FTSegment GenerateA14FTSegment(IList <RawSegment> rawSegments)
        {
            if (rawSegments != null && rawSegments.Any(_ => _.SegmentType != SegmentType.A14FT))
            {
                return(null);
            }

            var a14ftSegment = new A14FTSegment();

            foreach (var rawSegment in rawSegments)
            {
                MapperService.MapToSegment(a14ftSegment, rawSegment);
            }
            MapperService.OrderSubSegments(a14ftSegment);

            return(a14ftSegment);
        }