private void EnviaLoteEnCurso() { // Realizamos el envío del lote a la AEAT Wsd.SendOperIntracom(_LoteOperIntracom); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _LoteOperIntracom.GetReceivedFileName() }; frmXmlViewer.ShowDialog(); // Obtengo la respuesta de facturas recibidas del archivo de // respuesta de la AEAT. RespuestaLRF respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaLRDetOperacionesIntracomunitarias; if (respuesta == null) { DialogResult resultMsg; string _msgError = "Se ha recibido una respuesta inesperada. Pulse 'Aceptar', si quiere revisarla"; resultMsg = MessageBox.Show(_msgError, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (resultMsg == DialogResult.OK) { frmXmlViewer.ShowDialog(); } return; } foreach (DataGridViewRow row in grdInvoices.Rows) // Recorro las facturas enviadas { string numFra = row.Cells[0].Value.ToString(); // Busco en las líneas de la respuesta el número de factura var linqQryFra = from respuestaFra in respuesta.RespuestaLinea where respuestaFra.IDFactura.NumSerieFacturaEmisor == numFra select respuestaFra; // Si el estado del registro es correcto lo marco como ok foreach (RespuestaLinea respuestaFra in linqQryFra) { if (respuestaFra.EstadoRegistro == "Correcto") { row.Cells[7].Value = MSeniorSII.Properties.Resources.circle_green; } else { row.Cells[7].Value = MSeniorSII.Properties.Resources.circle_red; } } } MessageBox.Show($"Estado del envío realizado a la AEAT: {respuesta.EstadoEnvio}.\nCódigo CVS: {respuesta.CSV}"); }
private void EnviaLoteEnCurso() { // Realizamos el envío del lote a la AEAT Wsd.SendCobrosFacturasEmitidas(_LoteDeCobrosEmitidas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _LoteDeCobrosEmitidas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); // Obtengo la respuesta de facturas recibidas del archivo de // respuesta de la AEAT. RespuestaLRF respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaLRCobrosEmitidas; if (respuesta == null) { SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError; if (msgError != null) { MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } foreach (DataGridViewRow row in grdInvoices.Rows) // Recorro las facturas enviadas { string numFra = row.Cells[0].Value.ToString(); // Busco en las líneas de la respuesta el número de factura var linqQryFra = from respuestaFra in respuesta.RespuestaLinea where respuestaFra.IDFactura.NumSerieFacturaEmisor == numFra select respuestaFra; // Si el estado del registro es correcto lo marco como ok foreach (RespuestaLinea respuestaFra in linqQryFra) { if (respuestaFra.EstadoRegistro == "Correcto") { row.Cells[5].Value = MSeniorSII.Properties.Resources.circle_green; } else { row.Cells[5].Value = MSeniorSII.Properties.Resources.circle_red; row.Cells[6].Value = respuestaFra.DescripcionErrorRegistro; } } } if (respuesta.EstadoEnvio == "Correcto") { string _msg = ($"Estado del envío realizado a la AEAT: {respuesta.EstadoEnvio}.\nCódigo CSV: {respuesta.CSV}"); MessageBox.Show(_msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btBuscaFacts_Click(object sender, EventArgs e) { BindModelTitular(); BindModelBusqueda(); // Realizamos la consulta de las facturas en la AEAT Wsd.GetFacturasEmitidasCobros(_PetCobroFactEmitEnviadas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _PetCobroFactEmitEnviadas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); try { // Obtengo la respuesta de la consulta de facturas recibidas del archivo de respuesta de la AEAT. RespuestaConsultaCobros respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaCobros; if (respuesta == null) { DialogResult resultMsg; string _msg = "Se ha recibido una respuesta inesperada. Pulse 'Aceptar', si quiere revisarla"; resultMsg = MessageBox.Show(_msg, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (resultMsg == DialogResult.OK) { frmXmlViewer.ShowDialog(); } return; } // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura. grdInvoices.Rows.Clear(); if (respuesta.ResultadoConsulta == "ConDatos") { foreach (var invoice in respuesta.RegistroRespuestaConsultaCobros) { System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok; decimal TotalTmp = Convert.ToDecimal(invoice.Cobro.Importe, DefaultNumberFormatInfo); grdInvoices.Rows.Add(invoice.Cobro.Fecha, TotalTmp.ToString("#,##0.00"), invoice.Cobro.Medio, invoice.Cobro.Cuenta_O_Medio, invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } txFechaBusqueda.Focus(); }
private void LanzarConsulta() { // Realizamos la consulta de las facturas en la AEAT Wsd.GetOperIntracom(_PetOperIntraEnviadas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _PetOperIntraEnviadas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); try { // Obtengo la respuesta de la consulta de facturas recibidas del archivo de respuesta de la AEAT. RespuestaConsultaLRDetOperIntracomunitarias respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaLRDetOperIntracomunitarias; if (respuesta == null) { SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError; if (msgError != null) { MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura. grdInvoices.Rows.Clear(); if (respuesta.ResultadoConsulta == "ConDatos") { foreach (var invoice in respuesta.RegistroRCLRDetOperIntracom) { System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok; if (invoice.EstadoFactura.EstadoRegistro == "Anulada") { _marcaFact = MSeniorSII.Properties.Resources.Tag_Delete; } grdInvoices.Rows.Add(invoice.IDFactura.NumSerieFacturaEmisor, invoice.IDFactura.FechaExpedicionFacturaEmisor, invoice.OperacionIntracomunitaria.OperacionIntracom.TipoOperacion, invoice.OperacionIntracomunitaria.OperacionIntracom.ClaveDeclarado, invoice.OperacionIntracomunitaria.OperacionIntracom.DescripcionBienes, invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion, invoice.EstadoFactura.TimestampUltimaModificacion); } } } catch (Exception ex) { string _msgError = "Error: " + ex.Message; MessageBox.Show(_msgError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } txFechaBusqueda.Focus(); }
private void MnViewXML_Click(object sender, EventArgs e) { // Generaremos el lote para poder dar de baja las facturas que se hayan seleccionado en el DataGrid. _LoteBajaOperIntracom = new ITInvoicesDeleteBatch(); foreach (DataGridViewRow row in grdInvoices.SelectedRows) { _LoteBajaOperIntracom.Titular = _Titular; ITInvoice _OperIntracomBaja = new ITInvoice(); RegistroRCLRDetOperIntracom _RegWrk = new RegistroRCLRDetOperIntracom(); _RegWrk = (RegistroRCLRDetOperIntracom)row.Cells[5].Value; // Sólo daremos de baja aquellas facturas cuyo estado sean correctas, que tras realizar varias pruebas, // las anuladas también las devuelve y al seleccionarlas se puede producir un error. if (_RegWrk.EstadoFactura.EstadoRegistro == "Correcta") { _OperIntracomBaja.BuyerParty = new Party { PartyName = _RegWrk.IDFactura.IDEmisorFactura.NombreRazon, TaxIdentificationNumber = _RegWrk.IDFactura.IDEmisorFactura.NIF }; if (_RegWrk.IDFactura.IDEmisorFactura.IDOtro != null) { _OperIntracomBaja.CountryCode = _RegWrk.IDFactura.IDEmisorFactura.IDOtro.CodigoPais; _OperIntracomBaja.BuyerParty.TaxIdentificationNumber = _RegWrk.IDFactura.IDEmisorFactura.IDOtro.ID; } _OperIntracomBaja.IssueDate = Convert.ToDateTime(_RegWrk.IDFactura.FechaExpedicionFacturaEmisor); _OperIntracomBaja.InvoiceNumber = _RegWrk.IDFactura.NumSerieFacturaEmisor; _LoteBajaOperIntracom.ITInvoices.Add(_OperIntracomBaja); } } try { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteBajaOperIntracom.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); } catch (Exception ex) { string _msgError = "Error: " + ex.Message; MessageBox.Show(_msgError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void mnViewXML_Click(object sender, EventArgs e) { // Generaremos el lote para poder dar de baja las facturas que se hayan seleccionado en el DataGrid. _LoteBajaFactRecibidas = new APInvoicesDeleteBatch(); foreach (DataGridViewRow row in grdInvoices.SelectedRows) { _LoteBajaFactRecibidas.Titular = _Titular; APInvoice _FactRecibidaBaja = new APInvoice(); RegistroRCLRFacturasRecibidas _regWrk = new RegistroRCLRFacturasRecibidas(); _regWrk = (RegistroRCLRFacturasRecibidas)row.Cells[5].Value; // Sólo daremos de baja aquellas facturas cuyo estado sean correctas, que tras realizar varias pruebas, // las anuladas también las devuelve y al seleccionarlas se puede producir un error. if (_regWrk.EstadoFactura.EstadoRegistro == "Correcta") { _FactRecibidaBaja.SellerParty = new Party { PartyName = _regWrk.FacturaRecibida.Contraparte.NombreRazon, TaxIdentificationNumber = _regWrk.FacturaRecibida.Contraparte.NIF }; if (_regWrk.FacturaRecibida.Contraparte.IDOtro != null) { _FactRecibidaBaja.CountryCode = _regWrk.FacturaRecibida.Contraparte.IDOtro.CodigoPais; } _FactRecibidaBaja.IssueDate = Convert.ToDateTime(_regWrk.IDFactura.FechaExpedicionFacturaEmisor); _FactRecibidaBaja.InvoiceNumber = _regWrk.IDFactura.NumSerieFacturaEmisor; _LoteBajaFactRecibidas.APInvoices.Add(_FactRecibidaBaja); } } try { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteBajaFactRecibidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LanzarConsulta() { // Realizamos la consulta de las facturas en la AEAT Wsd.GetFacturasEmitidasCobros(_PetCobroFactEmitEnviadas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _PetCobroFactEmitEnviadas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); try { // Obtengo la respuesta de la consulta de facturas recibidas del archivo de respuesta de la AEAT. RespuestaConsultaCobros respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaCobros; if (respuesta == null) { SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError; if (msgError != null) { MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura. grdInvoices.Rows.Clear(); if (respuesta.ResultadoConsulta == "ConDatos") { foreach (var invoice in respuesta.RegistroRespuestaConsultaCobros) { System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok; decimal TotalTmp = Convert.ToDecimal(invoice.Cobro.Importe, DefaultNumberFormatInfo); grdInvoices.Rows.Add(invoice.Cobro.Fecha, TotalTmp.ToString("#,##0.00"), invoice.Cobro.Medio, invoice.Cobro.Cuenta_O_Medio, invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion); } } } catch (Exception ex) { string _msgError = "Error: " + ex.Message; MessageBox.Show(_msgError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } txFechaBusqueda.Focus(); }
private void mnViewXML_Click(object sender, EventArgs e) { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteDeFacturasEmitidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); }
private void MnViewXML_Click(object sender, EventArgs e) { // Generaremos el lote para poder dar de baja las facturas que se hayan seleccionado en el DataGrid. _LoteBajaFactEmitidas = new Batch(BatchActionKeys.DR, BatchActionPrefixes.BajaLR, BatchTypes.FacturasEmitidas); foreach (DataGridViewRow row in grdInvoices.SelectedRows) { _LoteBajaFactEmitidas.Titular = _Titular; ARInvoice _FactEmitidaBaja = new ARInvoice(); RegistroRCLRFacturasEmitidas _RegWrk = new RegistroRCLRFacturasEmitidas(); _RegWrk = (RegistroRCLRFacturasEmitidas)row.Cells[5].Value; // Sólo daremos de baja aquellas facturas cuyo estado sean correctas, que tras realizar varias pruebas, // las anuladas también las devuelve y al seleccionarlas se puede producir un error. if (_RegWrk.EstadoFactura.EstadoRegistro == "Correcta") { _FactEmitidaBaja.SellerParty = new Party { TaxIdentificationNumber = _RegWrk.IDFactura.IDEmisorFactura.NIF }; _FactEmitidaBaja.IssueDate = Convert.ToDateTime(_RegWrk.IDFactura.FechaExpedicionFacturaEmisor); _FactEmitidaBaja.InvoiceNumber = _RegWrk.IDFactura.NumSerieFacturaEmisor; _LoteBajaFactEmitidas.BatchItems.Add(_FactEmitidaBaja); } } try { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteBajaFactEmitidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); } catch (Exception ex) { string _msgError = "Error: " + ex.Message; MessageBox.Show(_msgError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EnviaLoteEnCurso() { // Realizamos el envío del lote a la AEAT Wsd.SendFacturasRecibidas(_LoteDeFacturasRecibidas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _LoteDeFacturasRecibidas.GetReceivedFileName() }; frmXmlViewer.ShowDialog(); }
private void mnViewXML_Click(object sender, EventArgs e) { BindModelTitular(); string tmpath = Path.GetTempFileName(); _LoteDeFacturasRecibidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); }
private void mnViewXML_Click(object sender, EventArgs e) { try { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteDePagosRecibidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void MnViewXML_Click(object sender, EventArgs e) { try { string tmpath = Path.GetTempFileName(); // Genera el archivo xml y lo guarda en la ruta facilitada comno parámetro _LoteDeCobrosEmitidas.GetXml(tmpath); FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = tmpath }; frmXmlViewer.ShowDialog(); } catch (Exception ex) { string _msgError = "Error: " + ex.Message; MessageBox.Show(_msgError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EnviaLoteEnCurso() { // Realizamos el envío del lote de facturas a borrar a la AEAT Wsd.DeleteOperIntracom(_LoteBajaOperIntracom); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _LoteBajaOperIntracom.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); // Obtengo la respuesta de la baja de facturas emitidas del archivo de respuesta de la AEAT. RespuestaLRF respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaLRBajaDetOperacionesIntracomunitarias; if (respuesta == null) { SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError; if (msgError != null) { MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } foreach (DataGridViewRow row in grdInvoices.Rows) // Recorro las facturas enviadas { string numFra = row.Cells[0].Value.ToString(); // Busco en las líneas de la respuesta el número de factura var linqQryFra = from respuestaFra in respuesta.RespuestaLinea where respuestaFra.IDFactura.NumSerieFacturaEmisor == numFra select respuestaFra; // Si el estado del registro es correcto lo marco como factura eliminada foreach (RespuestaLinea respuestaFra in linqQryFra) { if (respuestaFra.EstadoRegistro == "Correcto") { row.Cells[6].Value = MSeniorSII.Properties.Resources.Tag_Delete; } else { row.Cells[6].Value = MSeniorSII.Properties.Resources.Tag_Ok; } } } string _msg = ""; if (respuesta.EstadoEnvio == "Incorrecto") { _msg = "Envío Rechazado. Para saber el motivo revise el fichero: " + frmXmlViewer.Path; } else { _msg = ($"Estado del envío realizado a la AEAT: {respuesta.EstadoEnvio}.\nCódigo CVS: {respuesta.CSV}"); } MessageBox.Show(_msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btBuscaFacts_Click(object sender, EventArgs e) { BindModelTitular(); BindModelBusqueda(); // Realizamos la consulta de las facturas en la AEAT Wsd.GetOperIntracom(_PetOperIntraEnviadas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _PetOperIntraEnviadas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); try { // Obtengo la respuesta de la consulta de facturas recibidas del archivo de respuesta de la AEAT. RespuestaConsultaLRDetOperIntracomunitarias respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaLRDetOperIntracomunitarias; if (respuesta == null) { DialogResult resultMsg; string _msg = "Se ha recibido una respuesta inesperada. Pulse 'Aceptar', si quiere revisarla"; resultMsg = MessageBox.Show(_msg, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (resultMsg == DialogResult.OK) { frmXmlViewer.ShowDialog(); } return; } // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura. grdInvoices.Rows.Clear(); if (respuesta.ResultadoConsulta == "ConDatos") { foreach (var invoice in respuesta.RegistroRCLRDetOperIntracom) { System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok; if (invoice.EstadoFactura.EstadoRegistro == "Anulada") { _marcaFact = MSeniorSII.Properties.Resources.Tag_Delete; } grdInvoices.Rows.Add(invoice.IDFactura.NumSerieFacturaEmisor, invoice.IDFactura.FechaExpedicionFacturaEmisor, invoice.OperacionIntracomunitaria.OperacionIntracom.TipoOperacion, invoice.OperacionIntracomunitaria.OperacionIntracom.ClaveDeclarado, invoice.OperacionIntracomunitaria.OperacionIntracom.DescripcionBienes, invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion, invoice.EstadoFactura.TimestampUltimaModificacion); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } txFechaBusqueda.Focus(); }