btNavegarDeposito.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Forms;
6 using System.Drawing;
7 using System.ComponentModel;
8 
9 using sage.ew.objetos;
10 using sage.ew.global;
11 using sage.ew.docsven.Forms;
12 using sage.ew.docscompra.Forms;
13 using sage.ew.interficies;
14 
15 
16 namespace sage.ew.botones.Clases
17 {
22  {
23  #region Eventos
24 
25  //PE-99332 Se requiere un evento Before
31  public delegate void _Click_Before_Handler(object sender, ref Boolean tlOk);
32 
36  public event _Click_Before_Handler _Click_Before;
37 
38  #endregion Eventos
39 
40 
41  private string _cEmpresa = string.Empty;
42  private string _cLetra = string.Empty;
43  private string _cNumero = string.Empty;
44 
45  eTipoDocumentoGeneral _eTipoDocumentoGeneral;
46 
50  public virtual eTipoDocumentoGeneral _TipoDocumentoGeneral
51  {
52  get
53  {
54  return _eTipoDocumentoGeneral;
55  }
56  set
57  {
58  _eTipoDocumentoGeneral = value;
59  switch (_eTipoDocumentoGeneral)
60  {
61  case eTipoDocumentoGeneral.Ventas:
62  this.Text = "Ver depósito de venta";
63  break;
64  case eTipoDocumentoGeneral.Compras:
65  this.Text = "Ver depósito de compra";
66  break;
67  }
68  }
69  }
70 
74  [DefaultValue("")]
75  public string _Empresa
76  {
77  get
78  {
79  if (EW_GLOBAL._EsEjecutable && string.IsNullOrWhiteSpace(_cEmpresa))
80  _cEmpresa = Convert.ToString(EW_GLOBAL._GetVariable("wc_empresa"));
81 
82  return _cEmpresa;
83  }
84  set
85  {
86  _cEmpresa = value;
87  }
88  }
89 
93  [DefaultValue("")]
94  public virtual string _Letra
95  {
96  get
97  {
98  return _cLetra.Trim().PadRight(2);
99  }
100  set
101  {
102  _cLetra = value.Trim().PadRight(2);
103  }
104  }
105 
109  [DefaultValue("")]
110  public virtual string _Numero
111  {
112  get
113  {
114  if (_cNumero != null)
115  _cNumero.Trim().PadLeft(10);
116 
117  return _cNumero;
118  }
119  set
120  {
121  _cNumero = value.Trim().PadLeft(10);
122  }
123  }
124 
125  #region Constructores
126 
131  {
132  // Por compatibilidad por defecto en este constructor será navegación a ventas.
133  this._eTipoDocumentoGeneral = eTipoDocumentoGeneral.Ventas;
134 
135  this.Text = "Ver depósito de venta";
136  this.Size = new System.Drawing.Size(140, 40);
137  this.Click += new EventHandler(btNavegarDeposito_Click);
138  }
139 
143  public btNavegarDeposito(eTipoDocumentoGeneral toTipoDocumentoGeneral)
144  {
145  this._eTipoDocumentoGeneral = toTipoDocumentoGeneral;
146 
147  switch (toTipoDocumentoGeneral)
148  {
149  case eTipoDocumentoGeneral.Ventas:
150  this.Text = "Ver depósito de venta";
151  break;
152  case eTipoDocumentoGeneral.Compras:
153  this.Text = "Ver depósito de compra";
154  break;
155  }
156 
157  this.Size = new System.Drawing.Size(140, 40);
158  this.Click += new EventHandler(btNavegarDeposito_Click);
159  }
160 
167  public btNavegarDeposito(string tcNumero, string tcLetra = "",string tcEmpresa = "")
168  {
169  this.Text = "Ver depósito de venta";
170  this.Size = new System.Drawing.Size(140, 40);
171 
172  // Por compatibilidad por defecto en este constructor será navegación a ventas.
173  this._eTipoDocumentoGeneral = eTipoDocumentoGeneral.Ventas;
174 
175  this._cEmpresa = tcEmpresa;
176  this._cNumero = tcNumero;
177  this._cLetra = tcLetra;
178 
179  this.Click += new EventHandler(btNavegarDeposito_Click);
180  }
181 
182  #endregion Constructores
183 
189  private void btNavegarDeposito_Click(object sender, EventArgs e)
190  {
191  Boolean llOk = true;
192 
193  // Lanzo el evento _Click_Before
194  Raise_Click_Before(ref llOk);
195  if (llOk == false) return;
196 
197  switch (this._eTipoDocumentoGeneral)
198  {
199  case eTipoDocumentoGeneral.Ventas:
200  {
202  loForm._Mantener_Ejecucion = true;
203  loForm._Documento._Load(_Empresa, _Numero, _Letra);
204  loForm._ShowDialog(); //Bug 114218 Cambiar .ShowDialog() por ._ShowDialog()
205  break;
206  }
207  case eTipoDocumentoGeneral.Compras:
208  {
210  loForm._Mantener_Ejecucion = true;
211  loForm._Documento._Load(_Empresa, _Numero);
212  loForm._ShowDialog(); //Bug 114218 Cambiar .ShowDialog() por ._ShowDialog()
213  break;
214  }
215 
216 
217  }
218  }
219 
224  private void Raise_Click_Before(ref bool tlOk)
225  {
226  var handler = _Click_Before;
227  if (handler != null)
228  {
229  handler(this, ref tlOk);
230  }
231 
232  }
233  }
234 }
frmDocCompraDeposito: pantalla de deposito
btNavegarDeposito(eTipoDocumentoGeneral toTipoDocumentoGeneral)
Constructor pasando el tipo de documento general (ventas/compras)
Interfaz para garantizar la presencia de los campos Empresa, Numero, Letra con fines de tratamientos ...
Clase de navegación a depósito de venta
btNavegarDeposito(string tcNumero, string tcLetra="", string tcEmpresa="")
si no es passa l'empresa s'agafa el valor de wc_empresa
eTipoDocumentoGeneral
Enumeración pública para definir las diferentes categorias que tenemos de documentos (ventas...
Definition: General.cs:13
_Click_Before_Handler _Click_Before
_Click_Before_Handler
Base para los botones de Eurowin