/// <summary> /// Devuelve las facturas emitidas registradas /// por los clientes del titular /// del lote en el periodo indicado. /// </summary> /// <param name="period">Periodo en formato yyyy.MM.</param> /// <param name="titular">Titular de las facturas a recuperar.</param> /// <param name="cliente">Cliente del que recuperar las facturas.</param> /// <returns>Lista de facturas emitidas en el periodo.</returns> private static RespuestaConsultaLRFactInformadasCliente GetByPeriodFE(string period, Party titular, Party cliente) { ARInvoicesQuery batchInvoiceQuery = new ARInvoicesQuery() { Titular = titular }; ARInvoice templateInvoiceQuery = new ARInvoice(); templateInvoiceQuery.BuyerParty = cliente; string syear = period.Substring(0, 4); string smonth = period.Substring(5, 2); int year = Convert.ToInt32(syear); int month = Convert.ToInt32(smonth); DateTime date = new DateTime(year, month, 1); // Necesitamos indicar una fecha de factura, para que se pueda calcular el ejercicio y periodo // que son necesarios y obligatorios para realizar esta peticiones. templateInvoiceQuery.IssueDate = date; batchInvoiceQuery.ARInvoice = templateInvoiceQuery; string response = Wsd.GetFacturasEmitidasCliente(batchInvoiceQuery); try { // Obtengo la respuesta de la consulta de facturas recibidas del archivo de respuesta de la AEAT. Envelope envelope = Envelope.FromXml(response); if (envelope.Body.RespuestaConsultaLRFactInformadasCliente != null) { return(envelope.Body.RespuestaConsultaLRFactInformadasCliente); } SoapFault msgError = envelope.Body.RespuestaError; if (msgError != null) { throw new Exception($"{msgError.FaultDescription}"); } } catch (Exception ex) { throw ex; } return(null); }