btVerAsiento.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 
6 using sage.ew.objetos;
7 using sage.ew.ewbase;
8 using System.Drawing;
9 using sage.ew.contabilidad;
10 using sage.ew.interficies;
11 using sage.ew.docsven;
12 using sage.ew.docscompra;
13 using System.Windows.Forms;
14 
15 namespace sage.ew.botones
16 {
21  {
22  // Propiedades
26  public dynamic _Documento
27  {
28  get { return _oDocumento; }
29  set { _oDocumento = value; }
30  }
31  private dynamic _oDocumento = null;
32 
36  public string _Asi = "";
37 
38  // Delegados
43  public delegate void _Click_Before_Handler(ref Boolean tlOk);
48  public delegate void _Click_After_Handler(Boolean tlOk);
49 
50  // Eventos
54  public event _Click_Before_Handler _Click_Before;
58  public event _Click_After_Handler _Click_After;
59 
60 
64  public btVerAsiento()
65  {
66  this.Text = "Ver asiento";
67 
68  //PE-88602: asignamos imagen
69  this.Image = sage.ew.images.Properties.Resources.doc_accounts_color; // PE-103630
70  this.ImageAlign = ContentAlignment.TopCenter;
71  this.TextAlign = ContentAlignment.BottomCenter;
72 
73  this.Click += new EventHandler(btVerAsiento_Click);
74  }
75 
81  public void btVerAsiento_Click(object sender, EventArgs e)
82  {
83  bool llOk = true;
84  string lcAsi = "";
85 
86  // Llamar al evento "before" antes de comunicar con vfp
87  if (_Click_Before != null)
88  _Click_Before(ref llOk);
89 
90  if (llOk)
91  {
92  // Bug 203305 - Guardar el documento
93  if (_Documento is ewDocVentaFRA || _Documento is ewDocCompraFACTURA)
94  {
95  // Puede que tengamos cambios pendientes
96  if (!string.IsNullOrWhiteSpace(_Documento._Numero))
97  _Documento._Save();
98 
99  if (_Documento._oAsiento._Numero > 0)
100  {
101  _Documento._oAsiento._Show();
102  _Documento._oAsiento = null;
103  }
104  }
105  else
106  {
107  lcAsi = this._Asi;
108  if (string.IsNullOrWhiteSpace(lcAsi))
109  {
110  // Obtenir ASi
111  if (_Documento != null)
112  lcAsi = _Documento._Asi;
113  }
114 
115  // Mostrar pantalla asientos
116  Asientos loAsiento = new Asientos(lcAsi);
117 
118  if (loAsiento._Numero <= 0)
119  loAsiento._Show_Asiento_Vacio();
120  else
121  loAsiento._Show();
122  }
123 
124  LoadFactura();
125 
126  // Llamar al evento "after" después de comunicar con vfp
127  if (_Click_After != null) _Click_After(llOk);
128  }
129  }
130 
134  private void LoadFactura()
135  {
136  if (_Documento != null && (_Documento is ewDocVentaFRA || _Documento is ewDocCompraFACTURA))
137  {
138  bool llFraCompra = _Documento is ewDocCompraFACTURA;
139  string letraproveed = (llFraCompra ? _Documento._Cabecera._Proveedor : _Documento._Letra);
140  string numero = _Documento._Numero;
141  string empresa = _Documento._Empresa;
142 
143  Form loForm = FindForm();
144 
145  if (loForm != null)
146  ((formul.FormBase)loForm)._LockScreen(true); // Bloqueamos para que no se vea el refresco del control de cabecera de documentos ...
147 
148  _Documento._DescargarDatos();
149 
150  _Documento._Load(empresa, numero, letraproveed);
151 
152  if (loForm != null)
153  ((formul.FormBase)loForm)._LockScreen(false);
154  }
155  }
156  }
157 }
Botón que muestra el formulario de Asientos. PE-85390
Definition: btVerAsiento.cs:20
int _Numero
Número de asiento.
Definition: Asientos.cs:650
Classe documento Factura de venta
Definition: DocsVentaFra.cs:61
Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
Clase utilizada para realizar asientos contables.
Definition: Asientos.cs:36
Interfaz utilizada en los controles que se añaden en los perfiles
Classe documento Factura de compra
void btVerAsiento_Click(object sender, EventArgs e)
Click
Definition: btVerAsiento.cs:81
void _Show()
Muestra por pantalla el asiento
Definition: Asientos.cs:2563
_Click_After_Handler _Click_After
_Click_After_Handler
Definition: btVerAsiento.cs:58
void _Show_Asiento_Vacio()
Muestra la pantalla de asientos vacía (PE-85390)
Definition: Asientos.cs:2606
_Click_Before_Handler _Click_Before
_Click_Before_Handler
Definition: btVerAsiento.cs:54
static System.Drawing.Bitmap doc_accounts_color
Busca un recurso adaptado de tipo System.Drawing.Bitmap.
Base para los botones de Eurowin
override string _Numero
Número del document - Aquí ja controla wn_FactCompra