Exemplo n.º 1
0
        public async Task <Vtrmvh> RecuperoDatosCAE(string moduloComprobante, string codigoComprobante, int numeroComprobante)
        {
            Vtrmvh header = await Context.Vtrmvh
                            .Where(c => c.Vtrmvh_Modfor == moduloComprobante &&
                                   c.Vtrmvh_Codfor == codigoComprobante &&
                                   c.Vtrmvh_Nrofor == numeroComprobante).FirstOrDefaultAsync();

            return(header);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <FacturasDTO> > Get(string codigoComprobante, int?numeroComprobante, int?idOperacion)
        {
            FacturasDTO factura = Mapper.Map <FacturasDTO>(await Repository.Get(codigoComprobante, numeroComprobante, idOperacion));


            if (factura == null)
            {
                throw new BadRequestException("El comprobante solicitado no existe.");
            }
            Vtrmvh header = await Repository.RecuperoDatosCAE("VT", factura.CodigoComprobante, factura.NumeroComprobante);

            factura.NumeroCAE      = header.Vtrmvh_Nrocae;
            factura.VencimientoCAE = header.Vtrmvh_Vencae;

            factura.ImpuestosFactura.AddRange(await Repository.RecuperoImpuestosComprobante("VT", factura.CodigoComprobante, factura.NumeroComprobante));
            factura.ImporteTotal = await Repository.RecuperoTotalComprobante("VT", factura.CodigoComprobante, factura.NumeroComprobante);

            return(factura);
        }