chIsp.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Forms;
6 
7 using sage.ew.objetos;
8 using sage.ew.global;
9 using sage.ew.usuario;
10 using sage.ew.interficies;
11 
12 namespace sage.ew.docscompra
13 {
18  {
22  private bool _lEnabled = true;
23 
28  public bool _Enabled
29  {
30  get { return _lEnabled; }
31  set
32  {
33  if (_lEnabled != value)
34  {
35  _lEnabled = value;
36  this.Enabled = _lEnabled;
37  }
38  }
39  }
40 
41  private dynamic _oDocumento;
42 
46  public dynamic _Documento
47  {
48  get { return this._oDocumento; }
49  set { this._oDocumento = value; }
50  }
51 
55  public chIsp()
56  {
57  //només visible si es treballa amb obra
58  if(Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_obra")))
59  this.Visible = true;
60  else
61  this.Visible = false;
62 
63  // Asociamos el texto del botón
64  this.Text = "ISP";
65 
66  this.AutoSize = true;
67 
68  this.Click += new EventHandler(chIsp_Click);
69  }
70 
74  public void _Refresh()
75  {
76  if (this._oDocumento != null) //Encontrado error de referencia a Null por casualidad
77  {
78  this.DataBindings.Clear();
79  this.DataBindings.Add("Checked", this._oDocumento._Cabecera, "_Isp", true);
80 
81  // PE96748
82  // Aqui dentro del método se hace todo, se revisa el _ReadOnly del formulario, y si es un frmgestionperfil además también se mira el _Documento, si está vacío, si está en uso, etc.
83  bool llReadOnly = this._oDocumento._oForm._Controles_En_Formulario_De_Solo_Lectura();
84  this._Enabled = !llReadOnly;
85 
86  }
87  }
88 
94  public void chIsp_Click(object sender, EventArgs e)
95  {
96  if (this._Documento == null)
97  return;
98 
99  // Comprobar que tengamos documento
100  if (string.IsNullOrWhiteSpace(this._Documento._Numero) || string.IsNullOrWhiteSpace(this._Documento._Cabecera._Proveedor))
101  {
102  _Documento._MessageBox("Para modificar el ISP debe haber un documento cargado.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, DialogResult.OK);
103  this.Checked = false;
104  return;
105  }
106 
107  if (this._Documento._Hay_Lineas_Con_IVA())
108  {
109  string lcIva = Convert.ToString(EW_GLOBAL._GetVariable("wc_IVA"));
110  this._Documento._MessageBox("Para revisar los tipos de " + lcIva + " debe acceder a la comprobación de " + lcIva + " desde el botón de opciones.", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, DialogResult.OK);
111  }
112 
113  //refresco el check de l'ISP, ho he de fer d'aquesta manera pq si no fins q no es perd el foco no s'entera.
114  if (this.Checked)
115  {
116  this._Documento._Cabecera._Recc = false;
117 
118  Form loForm = this.FindForm();
119  if (loForm != null)
120  {
122  if (loForm2._TipoFormulario == formul._TiposFormulario.Normal)
123  {
124  Control[] loControls = loForm2.Controls.Find("chRecc", true);
125  if (loControls.Length > 0)
126  {
127  chRecc loControl;
128  loControl = (chRecc)loControls[0];
129  loControl._Refresh();
130  }
131  }
132  }
133  }
134  }
135  }
136 }
Marcar si el documento trabaja con ISP
Definition: chIsp.cs:17
frmGestionPerfil; Formulari de gestión de perfiles
Clase sage.ew.objetos.ewcheckbox
Interfaz utilizada en los controles que se añaden en los perfiles
chIsp()
Constructor
Definition: chIsp.cs:55
void _Refresh()
Refrescar objeto para que actualize su contenido en funcion del objeto documento de venta no visual...
Definition: chIsp.cs:74
void chIsp_Click(object sender, EventArgs e)
chRecc_Click : Evento de marcar/desmarcar el check
Definition: chIsp.cs:94
void _Refresh()
Refrescar objeto para que actualize su contenido en funcion del objeto documento de venta no visual...
Definition: chRecc.cs:71
marcar si el documento trabaja con RECC
Definition: chRecc.cs:18
Interfaz para refrescar los controles de los perfiles