2 using System.Collections.Generic;
3 using System.ComponentModel;
24 using System.Runtime.Remoting.Messaging;
28 using DocumentFormat.OpenXml.Office2010.ExcelAc;
29 using DevExpress.Xpo.DB;
32 namespace sage.addons.factucert.Visual.Forms
45 private enum EstadoEnvio
50 [Description(
"Todos")]
55 [Description(
"Enviados")]
60 [Description(
"Pendientes")]
68 private enum EstadoAdministracion
73 [Description(
"Pendiente")]
78 [Description(
"Aceptada")]
83 [Description(
"Aceptada con errores")]
88 [Description(
"Rechazada")]
93 #endregion ENUMERACIONES 96 #region PROPIEDADES PRIVADAS 105 private string _cRutaRaizFicherosXml =
string.Empty;
117 private string _lcAny = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_any"));
123 private string _cMonedaEmpresa = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_moneda"));
129 private string _cEmpresa = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_empresa"));
135 private bool _lEjerPartido = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_parti"));
141 private bool _llSerFact = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_serfact"));
147 private DateTime _dPeriodoIni = Convert.ToDateTime(EW_GLOBAL._GetVariable(
"wd_periodoini"));
153 private DateTime _dPeriodoFin = Convert.ToDateTime(EW_GLOBAL._GetVariable(
"wd_periodofin"));
159 private bool _lEmpresaNormal = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_normal"));
162 #endregion PROPIEDADES PRIVADAS 165 #region PROPIEDADES PÚBLICAS 171 public bool _MostrarDatosAlEntrar {
get;
set; } =
false;
174 #endregion PROPIEDADES PÚBLICAS 185 InitializeComponent();
187 if (!this.DesignMode)
189 this.constructorVarios();
191 this.programarEventos();
201 private void constructorVarios()
203 this._MostrarAccesoFavoritos =
false;
204 this._MostrarCrearTareaProgramada =
false;
205 this._MostrarGestionAccesos =
true;
206 this._MostrarCrearAccesoDirecto =
false;
207 this._Pantalla =
"REGFACTVERIFACTU";
210 this.btRefrescar.ImageAlign = ContentAlignment.MiddleLeft;
213 this.
btImprimir.ImageAlign = ContentAlignment.MiddleLeft;
215 this.dtFechaDesde.Value = this._dPeriodoIni;
216 this.dtFechaHasta.Value = this._dPeriodoFin;
220 this.txtPeriodo._PermitirFiltradoAutomaticoTextoParcial =
false;
222 this.ewEmpresa.Text = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_empnombre1"));
223 this.ewEjercicio.Text = this._lcAny;
225 string lcRutaRaizFicherosXML =
System.IO.Path.Combine(EW_GLOBAL._GetVariable(
"wc_IniServidor").ToString().Trim(),
"MODULOS");
226 lcRutaRaizFicherosXML =
System.IO.Path.Combine(lcRutaRaizFicherosXML, FACTUCERT._NombreAddOn);
227 lcRutaRaizFicherosXML =
System.IO.Path.Combine(lcRutaRaizFicherosXML, ew.ewbase.GrupoEmpresa._CodigoGrupoActual().ToString().Trim());
228 lcRutaRaizFicherosXML =
System.IO.Path.Combine(lcRutaRaizFicherosXML, EW_GLOBAL._GetVariable(
"wc_empresa").ToString().Trim());
229 lcRutaRaizFicherosXML =
System.IO.Path.Combine(lcRutaRaizFicherosXML, EW_GLOBAL._GetVariable(
"wc_any").ToString().Trim());
231 this._cRutaRaizFicherosXml = lcRutaRaizFicherosXML;
235 this.populateComboEstado(EstadoEnvio.Todos);
244 private void programarEventos()
246 this.btRefrescar.Click +=
new System.EventHandler(this.btRefrescar_Click);
247 this.btVerAsiento.Click +=
new System.EventHandler(this.btVerAsiento_Click);
248 this.btVerDocumento.Click +=
new System.EventHandler(this.btVerDocumento_Click);
249 this.btVerCliente.Click +=
new System.EventHandler(this.btVerCliente_Click);
250 this.btVerDatosCertif.Click +=
new System.EventHandler(this.btVerDatosCertif_Click);
251 this.Shown +=
new System.EventHandler(this.frmRegFactVerifactu_Shown);
252 this.
Load +=
new System.EventHandler(this.frmRegFactVerifactu_Load);
254 this.txtPeriodo._Codigo_Cambiado += TxtPeriodo__Codigo_Cambiado;
255 this.ewgridDatos.RowPrePaint += EwgridDatos_RowPrePaint;
256 this.ewgridDatos.CellClick += EwgridDatos_CellClick;
257 this.
btImprimir._onPrintBefore += BtImprimir__onPrintBefore;
266 private void cancelarEventos()
268 this.btRefrescar.Click -=
new System.EventHandler(this.btRefrescar_Click);
269 this.btVerAsiento.Click -=
new System.EventHandler(this.btVerAsiento_Click);
270 this.btVerDocumento.Click -=
new System.EventHandler(this.btVerDocumento_Click);
271 this.btVerCliente.Click -=
new System.EventHandler(this.btVerCliente_Click);
272 this.btVerDatosCertif.Click -=
new System.EventHandler(this.btVerDatosCertif_Click);
273 this.
Load -=
new System.EventHandler(this.frmRegFactVerifactu_Load);
274 this.Shown -=
new System.EventHandler(this.frmRegFactVerifactu_Shown);
276 this.txtPeriodo._Codigo_Cambiado -= TxtPeriodo__Codigo_Cambiado;
277 this.ewgridDatos.RowPrePaint -= EwgridDatos_RowPrePaint;
278 this.ewgridDatos.CellClick -= EwgridDatos_CellClick;
279 this.
btImprimir._onPrintBefore -= BtImprimir__onPrintBefore;
285 #endregion CONSTRUCTOR 288 #region MÉTODOS PROTECTED OVERRIDE 297 this.cancelarEventos();
306 if (this.ewgridDatos != null && this.ewgridDatos.DataSource != null &&
this.ewgridDatos.DataSource is DataTable)
308 DataTable ldtTable = this.ewgridDatos.DataSource as DataTable;
319 #endregion MÉTODOS PROTECTED OVERRIDE 322 #region MÉTODO PRIVADOS 329 private void populateComboEstado(
object selectedvalue = null)
331 object selvalue = null;
332 DataTable sourcedatatable =
new DataTable();
333 sourcedatatable.Columns.Add(
"id", typeof(
int));
334 sourcedatatable.Columns.Add(
"nombre", typeof(
string));
336 foreach (EstadoEnvio loEstado
in Enum.GetValues(typeof(EstadoEnvio)))
338 sourcedatatable.Rows.Add((
int)loEstado, FUNCTIONS._GetEnumDescription((Enum)loEstado));
339 if (loEstado.Equals(selectedvalue))
343 this.cmbMostrarRegistros.DataSource = sourcedatatable;
344 this.cmbMostrarRegistros.ValueMember =
"id";
345 this.cmbMostrarRegistros.DisplayMember =
"nombre";
347 if (selvalue != null)
348 this.cmbMostrarRegistros.SelectedValue = selvalue;
359 private void btVerAsiento_Click(
object sender, EventArgs e)
361 if (this.ewgridDatos.CurrentCell.RowIndex < 0)
364 DataRow loRow = ((DataRowView)ewgridDatos.Rows[
this.ewgridDatos.CurrentCell.RowIndex].DataBoundItem).Row;
366 int lnTipoReg = Convert.ToInt32(loRow[
"idtiporeg"]);
368 if (lnTipoReg >= 0 && lnTipoReg <= 3)
370 string lcEmpresa = loRow[
"empresa"].ToString();
371 string lcFactura = loRow[
"numero"].ToString();
373 if (
string.IsNullOrWhiteSpace(lcEmpresa) ||
string.IsNullOrWhiteSpace(lcFactura))
375 FUNCTIONS._MessageBox(
"No se ha detectado el nº de la factura.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
381 loFra.
_Load(lcEmpresa, lcFactura);
382 string lcAsi = loFra.
_Asi;
384 if (!
string.IsNullOrWhiteSpace(lcAsi))
393 FUNCTIONS._MessageBox(
"No se ha detectado el asiento de la factura.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
407 private void btVerDocumento_Click(
object sender, EventArgs e)
409 if (this.ewgridDatos.CurrentCell.RowIndex < 0)
412 DataRow loRow = ((DataRowView)ewgridDatos.Rows[
this.ewgridDatos.CurrentCell.RowIndex].DataBoundItem).Row;
414 int lnTipoReg = Convert.ToInt32(loRow[
"idtiporeg"]);
416 if (lnTipoReg >= 0 && lnTipoReg <= 3)
418 string lcEmpresa = loRow[
"empresa"].ToString();
419 string lcFactura = loRow[
"numero"].ToString();
428 else if (EW_GLOBAL._ModuloActivo(
"TPV") && lnTipoReg >= 4 && lnTipoReg <= 7)
430 string lcEmpresa = loRow[
"empresa"].ToString();
431 string lcNumero = loRow[
"numero"].ToString();
432 string lcLetra = loRow[
"letra"].ToString();
435 loDoc.
_Load(lcEmpresa, lcNumero, lcLetra);
460 private void btVerCliente_Click(
object sender, EventArgs e)
462 if (this.ewgridDatos.CurrentCell.RowIndex < 0)
465 string lcCodigo = this.ewgridDatos.Rows[this.ewgridDatos.CurrentCell.RowIndex].Cells[
"Cliente"].Value.ToString();
480 private void btVerDatosCertif_Click(
object sender, EventArgs e)
482 if (this.ewgridDatos.CurrentCell.RowIndex < 0)
485 DataRow loRow = ((DataRowView)ewgridDatos.Rows[
this.ewgridDatos.CurrentCell.RowIndex].DataBoundItem).Row;
487 int lnTipoReg = Convert.ToInt32(loRow[
"idtiporeg"]);
488 string lcEmpresa = Convert.ToString(loRow[
"empresa"]);
490 if (lnTipoReg >= 0 && lnTipoReg <= 3)
492 string lcFactura = loRow[
"numero"].ToString();
494 if (
string.IsNullOrWhiteSpace(lcEmpresa) ||
string.IsNullOrWhiteSpace(lcFactura))
496 FUNCTIONS._MessageBox(
"No se ha detectado el nº de la factura.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
502 if (loDocFra.
_Load(lcEmpresa, lcFactura))
505 lobtOpcionesFacturaTicket.
_Documento = loDocFra;
506 lobtOpcionesFacturaTicket._ShowDatosCertificacion();
510 FUNCTIONS._MessageBox(
"No se ha podido cargar la factura.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
515 else if (EW_GLOBAL._ModuloActivo(
"TPV") && lnTipoReg >= 4 && lnTipoReg <= 7)
519 string lcNumero = loRow[
"numero"].ToString();
520 string lcLetra = loRow[
"letra"].ToString();
522 if (
string.IsNullOrWhiteSpace(lcEmpresa) ||
string.IsNullOrWhiteSpace(lcNumero))
524 FUNCTIONS._MessageBox(
"No se ha detectado el nº del ticket.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
528 if (loDocTicket.
_Load(lcEmpresa, lcNumero, lcLetra))
531 lobtOpcionesFacturaTicket.
_Documento = loDocTicket;
532 lobtOpcionesFacturaTicket._ShowDatosCertificacion();
536 FUNCTIONS._MessageBox(
"No se ha podido cargar el ticket.", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, DialogResult.OK);
550 private void frmRegFactVerifactu_Load(
object sender, EventArgs e)
552 this.configurarGrid();
563 private void frmRegFactVerifactu_Shown(
object sender, EventArgs e)
565 if (this._MostrarDatosAlEntrar)
569 btRefrescar.ImageAlign = ContentAlignment.MiddleLeft;
576 btSalir1.Top = btVerAsiento.Top;
577 btSalir1.Height = btVerAsiento.Height;
586 private void configurarGrid()
588 this.ewgridDatos.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
589 this.ewgridDatos.ReadOnly =
true;
591 this.ewgridDatos.AutoGenerateColumns =
false;
592 this.ewgridDatos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
593 this.ewgridDatos.AllowUserToAddRows =
false;
594 this.ewgridDatos.AllowUserToDeleteRows =
false;
595 this.ewgridDatos.Columns.Clear();
614 ldgtbColEstado.Name =
"Estado";
615 ldgtbColEstado.DataPropertyName =
"Estado";
616 ldgtbColEstado.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
617 ldgtbColEstado.HeaderText =
"Estado";
618 ldgtbColEstado.ValueType = typeof(
string);
619 ldgtbColEstado.Visible =
true;
620 ldgtbColEstado._NoParar =
false;
621 ldgtbColEstado.ReadOnly =
true;
622 ldgtbColEstado.Width = 85;
623 this.ewgridDatos.Columns.Add(ldgtbColEstado);
626 ldgtbColEstadoAdm.Name =
"Estadoadm";
627 ldgtbColEstadoAdm.DataPropertyName =
"Estadoadm";
628 ldgtbColEstadoAdm.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
629 ldgtbColEstadoAdm.HeaderText =
"Estado administr.";
630 ldgtbColEstadoAdm.ValueType = typeof(
string);
631 ldgtbColEstadoAdm.Visible =
true;
632 ldgtbColEstadoAdm._NoParar =
false;
633 ldgtbColEstadoAdm.ReadOnly =
true;
634 ldgtbColEstadoAdm.Width = 140;
635 this.ewgridDatos.Columns.Add(ldgtbColEstadoAdm);
638 ldgtbColIncidencia.Name =
"Incidencia";
639 ldgtbColIncidencia.DataPropertyName =
"Incidencia";
640 ldgtbColIncidencia.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
641 ldgtbColIncidencia.HeaderText =
"Incidencia";
642 ldgtbColIncidencia.ValueType = typeof(
string);
643 ldgtbColIncidencia.Visible =
true;
644 ldgtbColIncidencia._NoParar =
false;
645 ldgtbColIncidencia.ReadOnly =
true;
646 ldgtbColIncidencia.Width = 160;
647 this.ewgridDatos.Columns.Add(ldgtbColIncidencia);
650 ldgtbColTipoReg.Name =
"Tiporeg";
651 ldgtbColTipoReg.DataPropertyName =
"Tiporeg";
652 ldgtbColTipoReg.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
653 ldgtbColTipoReg.HeaderText =
"Tipo registro";
654 ldgtbColTipoReg.ValueType = typeof(
string);
655 ldgtbColTipoReg.Visible =
true;
656 ldgtbColTipoReg._NoParar =
false;
657 ldgtbColTipoReg.ReadOnly =
true;
658 ldgtbColTipoReg.Width = 110;
659 this.ewgridDatos.Columns.Add(ldgtbColTipoReg);
662 ldgtbColNumero.Name =
"Numero";
663 ldgtbColNumero.DataPropertyName =
"Letranumero";
664 ldgtbColNumero.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
665 ldgtbColNumero.HeaderText =
"Número";
666 ldgtbColNumero.ValueType = typeof(
string);
667 ldgtbColNumero.Visible =
true;
668 ldgtbColNumero._NoParar =
false;
669 ldgtbColNumero.ReadOnly =
true;
670 ldgtbColNumero.Width = 85;
671 this.ewgridDatos.Columns.Add(ldgtbColNumero);
674 ldgtbColFraExp.Name =
"Numfraexp";
675 ldgtbColFraExp.DataPropertyName =
"numfraexp";
676 ldgtbColFraExp.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
677 ldgtbColFraExp.HeaderText =
"Nº factura exped.";
678 ldgtbColFraExp.ValueType = typeof(
string);
679 ldgtbColFraExp.Visible =
true;
680 ldgtbColFraExp._NoParar =
false;
681 ldgtbColFraExp.ReadOnly =
true;
682 ldgtbColFraExp.Width = 140;
683 this.ewgridDatos.Columns.Add(ldgtbColFraExp);
686 ldgtbColTerminal.Name =
"Terminal";
687 ldgtbColTerminal.DataPropertyName =
"Terminal";
688 ldgtbColTerminal.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
689 ldgtbColTerminal.HeaderText =
"Terminal";
690 ldgtbColTerminal.ValueType = typeof(
string);
691 ldgtbColTerminal.Visible =
true;
692 ldgtbColTerminal._NoParar =
false;
693 ldgtbColTerminal.ReadOnly =
true;
694 ldgtbColTerminal.Width = 150;
695 this.ewgridDatos.Columns.Add(ldgtbColTerminal);
698 ldgtbColFechaReg.Name =
"Fecha";
699 ldgtbColFechaReg.DataPropertyName =
"Fecha";
700 ldgtbColFechaReg.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
701 ldgtbColFechaReg.HeaderText =
"Fecha";
702 ldgtbColFechaReg.ValueType = typeof(
string);
703 ldgtbColFechaReg.Visible =
true;
704 ldgtbColFechaReg._NoParar =
false;
705 ldgtbColFechaReg.ReadOnly =
true;
706 ldgtbColFechaReg.Width = 80;
707 this.ewgridDatos.Columns.Add(ldgtbColFechaReg);
710 ldgtbColHora.Name =
"Hora";
711 ldgtbColHora.DataPropertyName =
"Hora";
712 ldgtbColHora.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
713 ldgtbColHora.HeaderText =
"Hora";
714 ldgtbColHora.ValueType = typeof(
string);
715 ldgtbColHora.Visible =
true;
716 ldgtbColHora._NoParar =
false;
717 ldgtbColHora.ReadOnly =
true;
718 ldgtbColHora.Width = 75;
719 this.ewgridDatos.Columns.Add(ldgtbColHora);
722 ldgtbColCodigo.Name =
"Cliente";
723 ldgtbColCodigo.DataPropertyName =
"Cliente";
724 ldgtbColCodigo.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
725 ldgtbColCodigo.HeaderText =
"Cliente";
726 ldgtbColCodigo.ValueType = typeof(
string);
727 ldgtbColCodigo.Visible =
true;
728 ldgtbColCodigo._NoParar =
false;
729 ldgtbColCodigo.ReadOnly =
true;
730 ldgtbColCodigo.Width = 85;
731 this.ewgridDatos.Columns.Add(ldgtbColCodigo);
734 ldgtbColNombre.Name =
"Nombre";
735 ldgtbColNombre.DataPropertyName =
"Nombre";
736 ldgtbColNombre.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
737 ldgtbColNombre.HeaderText =
"Nombre";
738 ldgtbColNombre.ValueType = typeof(
string);
739 ldgtbColNombre.Visible =
true;
740 ldgtbColNombre._NoParar =
false;
741 ldgtbColNombre.ReadOnly =
true;
742 ldgtbColNombre.Width = 300;
743 this.ewgridDatos.Columns.Add(ldgtbColNombre);
746 ldgtbColImporte.Name =
"Totaldoc";
747 ldgtbColImporte.DataPropertyName =
"Totaldoc";
748 ldgtbColImporte.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
749 ldgtbColImporte.HeaderText =
"Importe";
750 ldgtbColImporte.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
751 ldgtbColImporte.ValueType = typeof(decimal);
752 ldgtbColImporte.Visible =
true;
753 ldgtbColImporte._NoParar =
false;
754 ldgtbColImporte.ReadOnly =
true;
755 ldgtbColImporte.Width = 100;
756 ldgtbColImporte.DefaultCellStyle.Format = this._oMascaraImporte.
_Mascara_Net;
757 ldgtbColImporte.DecimalPlaces = this._oMascaraImporte.
_Num_Decimales;
758 ldgtbColImporte.Maximum = this._oMascaraImporte.
_Rango_Max;
759 ldgtbColImporte.Minimum = this._oMascaraImporte.
_Rango_Min;
760 ldgtbColImporte.Increment = 1;
761 ldgtbColImporte.ThousandsSeparator =
false;
762 this.ewgridDatos.Columns.Add(ldgtbColImporte);
765 ldgtbColSimbDivisa.Name =
"Divisa";
766 ldgtbColSimbDivisa.DataPropertyName =
"Montexto";
767 ldgtbColSimbDivisa.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
768 ldgtbColSimbDivisa.HeaderText =
"Divisa";
769 ldgtbColSimbDivisa.ValueType = typeof(
string);
770 ldgtbColSimbDivisa.Visible =
true;
771 ldgtbColSimbDivisa._NoParar =
false;
772 ldgtbColSimbDivisa.ReadOnly =
true;
773 ldgtbColSimbDivisa.Width = 70;
774 this.ewgridDatos.Columns.Add(ldgtbColSimbDivisa);
777 ldgtbColImporteDiv.Name =
"Totaldiv";
778 ldgtbColImporteDiv.DataPropertyName =
"Totaldiv";
779 ldgtbColImporteDiv.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
780 ldgtbColImporteDiv.HeaderText =
"Importe divisa";
781 ldgtbColImporteDiv.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
782 ldgtbColImporteDiv.ValueType = typeof(decimal);
783 ldgtbColImporteDiv.Visible =
true;
784 ldgtbColImporteDiv._NoParar =
false;
785 ldgtbColImporteDiv.ReadOnly =
true;
786 ldgtbColImporteDiv.Width = 120;
787 ldgtbColImporteDiv.DefaultCellStyle.Format = this._oMascaraImporte.
_Mascara_Net;
788 ldgtbColImporteDiv.DecimalPlaces = this._oMascaraImporte.
_Num_Decimales;
789 ldgtbColImporteDiv.Maximum = this._oMascaraImporte.
_Rango_Max;
790 ldgtbColImporteDiv.Minimum = this._oMascaraImporte.
_Rango_Min;
791 ldgtbColImporteDiv.Increment = 1;
792 ldgtbColImporteDiv.ThousandsSeparator =
false;
793 this.ewgridDatos.Columns.Add(ldgtbColImporteDiv);
797 ldgtbColXmlEnvioString.Name =
"XmlEnvioString";
798 ldgtbColXmlEnvioString.DataPropertyName =
"Xmlenvio";
799 ldgtbColXmlEnvioString.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
800 ldgtbColXmlEnvioString.HeaderText =
"Xml envío";
801 ldgtbColXmlEnvioString.ValueType = typeof(
string);
802 ldgtbColXmlEnvioString.Visible =
true;
803 ldgtbColXmlEnvioString._NoParar =
false;
804 ldgtbColXmlEnvioString.ReadOnly =
true;
805 ldgtbColXmlEnvioString.Width = 100;
806 ldgtbColXmlEnvioString.Visible =
false;
807 this.ewgridDatos.Columns.Add(ldgtbColXmlEnvioString);
810 ldgtbColXmlEnvioImagen.Name =
"XmlEnvioImg";
811 ldgtbColXmlEnvioImagen.HeaderText =
"XML envio reg.";
812 ldgtbColXmlEnvioImagen.ValueType = typeof(ew.objetos.ewbutton);
813 ldgtbColXmlEnvioImagen.Width = 125;
814 ldgtbColXmlEnvioImagen.Visible =
true;
815 ldgtbColXmlEnvioImagen._NoParar =
false;
816 ldgtbColXmlEnvioImagen.ReadOnly =
false;
817 ldgtbColXmlEnvioImagen.DefaultCellStyle.NullValue = null;
818 this.ewgridDatos.Columns.Add(ldgtbColXmlEnvioImagen);
821 ldgtbColXmlRespString.Name =
"XmlRespString";
822 ldgtbColXmlRespString.DataPropertyName =
"Xmlresp";
823 ldgtbColXmlRespString.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
824 ldgtbColXmlRespString.HeaderText =
"Xml resp.";
825 ldgtbColXmlRespString.ValueType = typeof(
string);
826 ldgtbColXmlRespString.Visible =
true;
827 ldgtbColXmlRespString._NoParar =
false;
828 ldgtbColXmlRespString.ReadOnly =
true;
829 ldgtbColXmlRespString.Width = 100;
830 ldgtbColXmlRespString.Visible =
false;
831 this.ewgridDatos.Columns.Add(ldgtbColXmlRespString);
834 ldgtbColResp.Name =
"XmlRespImg";
835 ldgtbColResp.HeaderText =
"Xml resp.";
836 ldgtbColResp.ValueType = typeof(ew.objetos.ewbutton);
837 ldgtbColResp.Width = 90;
838 ldgtbColResp.Visible =
true;
839 ldgtbColResp._NoParar =
false;
840 ldgtbColResp.ReadOnly =
false;
841 ldgtbColResp.DefaultCellStyle.NullValue = null;
842 this.ewgridDatos.Columns.Add(ldgtbColResp);
845 ldgtbColCsvResp.Name =
"Csv";
846 ldgtbColCsvResp.DataPropertyName =
"Csv";
847 ldgtbColCsvResp.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
848 ldgtbColCsvResp.HeaderText =
"CSV respuesta";
849 ldgtbColCsvResp.ValueType = typeof(
string);
850 ldgtbColCsvResp.Visible =
true;
851 ldgtbColCsvResp._NoParar =
false;
852 ldgtbColCsvResp.ReadOnly =
true;
853 ldgtbColCsvResp.Width = 150;
854 this.ewgridDatos.Columns.Add(ldgtbColCsvResp);
856 this.ewgridDatos._FiltrarPorColumna =
true;
868 private void EwgridDatos_CellClick(
object sender, DataGridViewCellEventArgs e)
870 string lcFicheroXml =
string.Empty;
872 if (this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlEnvioImg"].Index ||
873 this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlRespImg"].Index)
882 if (this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlEnvioImg"].Index)
884 lcFicheroXml = this._cRutaRaizFicherosXml +
@"\C_E\" + this.ewgridDatos.Rows[this.ewgridDatos.CurrentCell.RowIndex].Cells[
"XmlEnvioString"].Value.ToString();
886 else if (this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlRespImg"].Index)
888 lcFicheroXml = this._cRutaRaizFicherosXml +
@"\C_E\Respuesta\" + this.ewgridDatos.Rows[this.ewgridDatos.CurrentCell.RowIndex].Cells[
"XmlRespString"].Value.ToString();
891 if (!
string.IsNullOrWhiteSpace(lcFicheroXml))
893 if (File.Exists(lcFicheroXml))
895 string lcTitulo =
string.Empty;
896 if (this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlEnvioImg"].Index)
897 lcTitulo =
"Fichero XML envío";
898 else if (this.ewgridDatos.CurrentCell.ColumnIndex ==
this.ewgridDatos.Columns[
"XmlRespImg"].Index)
899 lcTitulo =
"Fichero XML respuesta";
901 lcTitulo +=
" - " + lcFicheroXml;
907 loForm._ShowDialog();
911 FUNCTIONS._MessageBox(
"No se ha encontrado el fichero XML "+lcFicheroXml, MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, DialogResult.None);
926 private bool BtImprimir__onPrintBefore(ref DataTable toDt, ew.reports.Report.ReportAction toAction)
928 string lcForeColorDefault = FUNCTIONS.Color_To_Rgb(
Color.Black);
929 int lnNumColumnas = toDt.Columns.Count;
931 for (
int ln_i = 0; ln_i < lnNumColumnas; ln_i++)
933 DataColumn loColumn = toDt.Columns[ln_i];
937 if (!loColumn.ColumnName.EndsWith(
"_forecolor"))
941 if (!toDt.Columns.Contains(loColumn.ColumnName +
"_forecolor"))
943 DataColumn loColumnData =
new DataColumn(loColumn.ColumnName +
"_forecolor", typeof(
string));
944 loColumnData.DefaultValue = lcForeColorDefault;
945 toDt.Columns.Add(loColumnData);
950 foreach (DataRow loRow
in toDt.Rows)
952 EstadoAdministracion eEstadoAdm = (EstadoAdministracion)Enum.Parse(typeof(EstadoAdministracion), Convert.ToString(Convert.ToInt32(loRow[
"idestadoadm"])));
955 case EstadoAdministracion.Pendiente:
958 case EstadoAdministracion.Aceptada:
959 this.ponerFilaDataTableColor(loRow, ShapeLeyendaAceptadas.BackColor);
961 case EstadoAdministracion.AceptadaConErrores:
962 this.ponerFilaDataTableColor(loRow, ShapeLeyendaAceptErrores.BackColor);
964 case EstadoAdministracion.Rechazada:
965 this.ponerFilaDataTableColor(loRow, ShapeLeyendaRechazadas.BackColor);
979 private void ponerFilaDataTableColor(DataRow toRow, Color toColor)
981 foreach (DataColumn loColumn
in toRow.Table.Columns)
983 if (loColumn.ColumnName.EndsWith(
"_forecolor"))
984 toRow[loColumn.ColumnName] = FUNCTIONS.Color_To_Rgb(toColor);
994 private void obtenerDatos()
996 DataTable ldtRegistros =
new DataTable();
997 string lcSqlFacturas =
string.Empty, lcSqlTickets =
string.Empty, lcSql =
string.Empty;
998 string lcParametroEmpresa =
string.Empty, lcParametroEjercicio =
string.Empty, lcParametroFechas =
string.Empty, lcParametroEstado =
string.Empty;
1000 DateTime dFechaIni = this.dtFechaDesde.Value, dFechaFin = this.dtFechaHasta.Value;
1005 List<DB.QueryParams> parametros =
new List<DB.QueryParams>();
1010 if (this._lEmpresaNormal)
1014 parametros.Add(
new DB.QueryParams(
"@empresa",
this._cEmpresa, SqlDbType.Char));
1015 lcParametroEmpresa =
"ev.empresa = @empresa";
1021 string[] l_wa_Consolida = (
string[])EW_GLOBAL._GetVariable(
"wa_consolid");
1022 lcParametroEmpresa =
"(";
1023 for (
int ln = 0; ln < l_wa_Consolida.Length; ln++)
1025 parametros.Add(
new DB.QueryParams(
"@empresaparam" + ln.ToString().Trim(), l_wa_Consolida[ln], SqlDbType.Char));
1026 lcParametroEmpresa +=
"ev.empresa = @empresaparam" + ln.ToString().Trim()+
" or ";
1028 lcParametroEmpresa +=
")";
1033 parametros.Add(
new DB.QueryParams(
"@ejercicio",
this._lcAny, SqlDbType.Char));
1034 lcParametroEjercicio =
"ev.ejercicio = @ejercicio";
1045 parametros.Add(
new DB.QueryParams(
"@fechainicial", dFechaIni.ToShortDateString(), SqlDbType.DateTime));
1046 parametros.Add(
new DB.QueryParams(
"@fechafinal", dFechaFin.ToShortDateString(), SqlDbType.DateTime));
1047 lcParametroFechas =
"cast(ev.fechareg as date) >= @fechainicial and cast(ev.fechareg as date) <= @fechafinal";
1054 parametros.Add(
new DB.QueryParams(
"@estado",
"1", SqlDbType.Int));
1056 parametros.Add(
new DB.QueryParams(
"@estado",
"0", SqlDbType.Int));
1058 lcParametroEstado =
" and ev.estado = @estado ";
1068 lcSqlFacturas = $
@"Select ev.empresa, ev.estado as idestado, 1069 {cadenaEstado("ev.estado
")} as estado, 1070 ev.estadoadm as idestadoadm, 1071 {cadenaEstadoAdm("ev.estadoadm
")} as estadoadm, 1073 ev.tiporeg as idtiporeg, 1074 {cadenaTipoReg("ev.tiporeg
")} as tiporeg, 1075 ev.numero, ev.letra, ev.numero as letranumero, ev.siiframod as numfraexp, ev.terminal, 1076 ev.fechareg as fechahora, 1077 cast(ev.fechareg as date) as fecha, 1078 substring(cast(cast(ev.fechareg as time) as varchar),1,8) as hora, 1079 ev.codigo_cli as cliente, ev.nombre_cli as nombre, 1080 ev.totaldoc, ev.divisa, ev.totaldiv, ev.xml_ce as xmlenvio, ev.xmlresp, ev.csv, ev.tipoenvio, ev.guid_emp, ev.husohora, 1081 rtrim(ltrim(m.nombre)) + (case when m.simbolo <> '' then ' (' + rtrim(ltrim(m.simbolo)) + ')' else 1082 (case when m.abrev <> '' then ' (' + rtrim(ltrim(m.abrev)) + ')' else '' end) end) as montexto 1083 From {DB.SQLDatabase(FACTUCERT._NombreAddOn, "fcfactuven
")} fc 1084 inner join {DB.SQLDatabase(FACTUCERT._NombreAddOn, "estvericer
")} ev ON fc.empresa = ev.empresa and fc.ejercicio = ev.ejercicio and fc.numero = ev.numero 1085 inner join {DB.SQLDatabase("gestion
", "c_factuven
")} a1 ON a1.empresa = fc.empresa and a1.numero = fc.numero and fc.ejercicio = {DB.SQLString(this._lcAny)} 1086 left join {DB.SQLDatabase("gestion
", "moneda
")} m on ev.divisa = m.codigo 1087 where {lcParametroEmpresa} and 1088 {lcParametroEjercicio} and 1089 ev.tiporeg in (0, 1, 2, 3) and 1091 {lcParametroEstado} ";
1093 if (EW_GLOBAL._ModuloActivo(
"TPV"))
1102 lcSqlTickets = $
@"Select ev.empresa, ev.estado as idestado, 1103 {cadenaEstado("ev.estado
")} as estado, 1104 ev.estadoadm as idestadoadm, 1105 {cadenaEstadoAdm("ev.estadoadm
")} as estadoadm, 1107 ev.tiporeg as idtiporeg, 1108 {cadenaTipoReg("ev.tiporeg
")} as tiporeg, 1109 ev.numero, ev.letra, ev.letra+ev.numero as letranumero, ev.siiframod as numfraexp, ev.terminal, 1110 ev.fechareg as fechahora, 1111 cast(ev.fechareg as date) as fecha, 1112 substring(cast(cast(ev.fechareg as time) as varchar),1,8) as hora, 1113 ev.codigo_cli as cliente, ev.nombre_cli as nombre, 1114 ev.totaldoc, ev.divisa, ev.totaldiv, ev.xml_ce as xmlenvio, ev.xmlresp, ev.csv, ev.tipoenvio, ev.guid_emp, ev.husohora, 1115 rtrim(ltrim(m.nombre)) + (case when m.simbolo <> '' then ' (' + rtrim(ltrim(m.simbolo)) + ')' else 1116 (case when m.abrev <> '' then ' (' + rtrim(ltrim(m.abrev)) + ')' else '' end) end) as montexto 1117 From {DB.SQLDatabase(FACTUCERT._NombreAddOn, "fctickets
")} fc 1118 inner join {DB.SQLDatabase(FACTUCERT._NombreAddOn, "estvericer
")} ev ON fc.empresa = ev.empresa and fc.ejercicio = ev.ejercicio and fc.numero = ev.numero and fc.letra = ev.letra 1119 inner join {DB.SQLDatabase("gestion
", "c_albven
")} a1 ON a1.empresa = fc.empresa and a1.numero = fc.numero and a1.letra=fc.letra and fc.ejercicio = {DB.SQLString(this._lcAny)} 1120 inner join {DB.SQLDatabase("tpv
", "c_albven
")} a2 ON a2.empresa = fc.empresa and a2.numero = fc.numero and a2.letra=fc.letra and a2.ejercicio=fc.ejercicio and fc.ejercicio = {DB.SQLString(this._lcAny)} 1121 left join {DB.SQLDatabase("gestion
", "moneda
")} m on ev.divisa = m.codigo 1122 where {lcParametroEmpresa} and 1123 {lcParametroEjercicio} and 1124 ev.tiporeg in (4, 5, 6, 7) and 1126 {lcParametroEstado} ";
1129 lcSql = lcSqlFacturas + (!
string.IsNullOrWhiteSpace(lcSqlTickets) ?
" Union All " + lcSqlTickets :
"") +
1130 " Order by tipoenvio, terminal, guid_emp, fechahora, husohora Asc";
1132 DB.SQLExecParams(lcSql, ref ldtRegistros, parametros);
1134 this.ewgridDatos.DataSource = ldtRegistros;
1136 this.revisarIconosFilasGrid();
1138 this.configurarImpresion(ldtRegistros);
1148 private void revisarIconosFilasGrid()
1150 foreach (DataGridViewRow ldRow
in this.ewgridDatos.Rows)
1152 if (!
string.IsNullOrWhiteSpace(Convert.ToString(ldRow.Cells[
"XmlEnvioString"].Value)))
1154 ldRow.Cells[
"XmlEnvioImg"].Value = ew.images.Properties.Resources.icon_eye16;
1158 ldRow.Cells[
"XmlEnvioImg"].Value = null;
1161 if (!
string.IsNullOrWhiteSpace(Convert.ToString(ldRow.Cells[
"XmlRespString"].Value)))
1163 ldRow.Cells[
"XmlRespImg"].Value = ew.images.Properties.Resources.icon_eye16;
1167 ldRow.Cells[
"XmlRespImg"].Value = null;
1180 private void configurarImpresion(DataTable tdtRegistros)
1183 btImprimir._Filtros.Add(
"wc_fechas", this.dtFechaDesde.Value.ToShortDateString()+
" - " + this.dtFechaHasta.Value.ToShortDateString());
1184 btImprimir._Filtros.Add(
"wc_mostrarregistros", this.cmbMostrarRegistros.Text);
1190 btImprimir._TipoReport = ew.reports.Report.TipoReport.Modulo;
1200 private void TxtPeriodo__Codigo_Cambiado()
1202 if (
string.IsNullOrWhiteSpace(this.txtPeriodo._Codigo))
1205 int lnPeriodoSel = Convert.ToInt32(this.txtPeriodo._Codigo);
1210 Periodo loPeriodo = loPeriodos._Items.Where(x => x._Periodo == lnPeriodoSel).FirstOrDefault();
1211 if (loPeriodo != null)
1213 this.dtFechaDesde.Value = Convert.ToDateTime(loPeriodo.
_FechaIniReper);
1228 private void EwgridDatos_RowPrePaint(
object sender, DataGridViewRowPrePaintEventArgs e)
1233 DataGridViewRow loRowDataGridViewRow = this.ewgridDatos.Rows[e.RowIndex];
1234 if (loRowDataGridViewRow == null)
1237 DataRow loRow = ((DataRowView)ewgridDatos.Rows[e.RowIndex].DataBoundItem).Row;
1239 EstadoAdministracion eEstadoAdm = (EstadoAdministracion)Enum.Parse(typeof(EstadoAdministracion), Convert.ToString(Convert.ToInt32(loRow[
"idestadoadm"])));
1243 case EstadoAdministracion.Pendiente:
1246 case EstadoAdministracion.Aceptada:
1247 this.ewgridDatos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = ShapeLeyendaAceptadas.BackColor;
1249 case EstadoAdministracion.AceptadaConErrores:
1250 this.ewgridDatos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = ShapeLeyendaAceptErrores.BackColor;
1252 case EstadoAdministracion.Rechazada:
1253 this.ewgridDatos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = ShapeLeyendaRechazadas.BackColor;
1266 private void btRefrescar_Click(
object sender, EventArgs e)
1268 this.obtenerDatos();
1278 private string cadenaEstado(
string tcCampo)
1280 string lcCadena = DB.SQLIif(tcCampo +
"=0",
"'Pendiente'",
"'Enviado'");
1292 private string cadenaEstadoAdm(
string tcCampo)
1294 string lcCadena =
string.Empty;
1296 lcCadena = DB.SQLIif(tcCampo +
"=3",
"'Rechazada'",
"'No contemplado'");
1297 lcCadena = DB.SQLIif(tcCampo +
"=2",
"'Aceptada con errores'", lcCadena);
1298 lcCadena = DB.SQLIif(tcCampo +
"=1",
"'Aceptada'", lcCadena);
1299 lcCadena = DB.SQLIif(tcCampo +
"=0",
"'Pendiente'", lcCadena);
1319 private string cadenaTipoReg(
string tcCampo)
1321 string lcCadena =
string.Empty;
1323 lcCadena = DB.SQLIif(tcCampo +
"=7",
"'Ticket anulado modificado'",
"'No contemplado'");
1324 lcCadena = DB.SQLIif(tcCampo +
"=6",
"'Ticket anulado'", lcCadena);
1325 lcCadena = DB.SQLIif(tcCampo +
"=5",
"'Ticket modificado'", lcCadena);
1326 lcCadena = DB.SQLIif(tcCampo +
"=4",
"'Ticket'", lcCadena);
1327 lcCadena = DB.SQLIif(tcCampo +
"=3",
"'Factura anulada modificada'", lcCadena);
1328 lcCadena = DB.SQLIif(tcCampo +
"=2",
"'Factura anulada'", lcCadena);
1329 lcCadena = DB.SQLIif(tcCampo +
"=1",
"'Factura modificada'", lcCadena);
1330 lcCadena = DB.SQLIif(tcCampo +
"=0",
"'Factura'", lcCadena);
1336 #endregion MÉTODO PRIVADOS decimal _Rango_Max
Valor máximo según la máscara. Es la máscara de VFP convertida a decimal
Clase para las previsiones de cobro
override bool _Load(string tcEmpresa, string tcNumero, string tcLetra="", string tcEjercicio="GESTION")
Carga un documento existente
override void _Load()
Overrides del _Load
Este es el espacio de nombres de su módulo. Puede encontrar más información y ayuda en el fichero rea...
EstadoEnvio
Enumeración para el estado
override string _Codigo
PE-102491: override de _Codigo para que en el Set podamos convertir el número que nos llega a código ...
Clase documento de venta TPV
static System.Drawing.Bitmap refresh
Busca un recurso adaptado de tipo System.Drawing.Bitmap.
static System.Drawing.Bitmap doc_print
Busca un recurso adaptado de tipo System.Drawing.Bitmap.
Classe documento Factura de venta
Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
Clase utilizada para realizar asientos contables.
KeyDiccionarioMascara
Clave para diccionario de máscaras
Base per a les columnes imagen estandar
Consulta de una declaración existente
virtual void _Show()
Muestra el formulario asiociado
Base per a les columnes estandar
void _Show()
Muestra por pantalla el asiento
virtual void _Show()
Implementación del método _Show para ver el documento relacionado (Gestión Documental) ...
Botón Aceptar para formularios
int _Num_Decimales
Número de decimales de la máscara
DateTime _FechaIniReper
Fecha ini reper
Custom column type dedicated to the DataGridViewNumericUpDownCell cell type.
bool _Load(string tcEmpresa, string tcNumero)
Sobrecarrega del load, tcNumero és la lletra + número de factura
Proporciona características adicionales de las máscaras de Eurowin
virtual void _Show_Factura()
Nos presenta la factura de la previsión
string _Factura
Número de factura
decimal _Rango_Min
Valor mínimo según la máscara. Es la máscara de VFP convertida a decimal y en negativo ...
string _Mascara_Net
Máscara convertida en formato .Net
string _Empresa
Código de empresa.
DateTime _FechaFinalReper
Fecha reper
Presenta un datagridview con botones añadir y borrar tipo Mantegrid de Eurowin
Base per a les columnes estandar