2 using System.Collections.Generic;
14 using System.ComponentModel;
35 protected internal string _cMoneda = EW_GLOBAL._GetVariable(
"wc_moneda").ToString();
51 var handler = _NotificarUsuario;
58 #endregion Custom Events 60 #region INotifyPropertyChanged 71 private void NotifyPropertyChanged(String tcNombrePropidad)
73 var handler = PropertyChanged;
76 handler(
this,
new PropertyChangedEventArgs(tcNombrePropidad));
80 #endregion INotifyPropertyChanged 87 public string _CodigoFormaCobro
89 get {
return _cCodigoFormaCobro; }
92 if (_cCodigoFormaCobro != value)
94 _cCodigoFormaCobro = value;
95 NotifyPropertyChanged(
"_CodigoFormaCobro");
99 private string _cCodigoFormaCobro;
104 public decimal _Entrega
106 get {
return _nEntrega; }
109 if (_nEntrega != value)
112 NotifyPropertyChanged(
"_Entrega");
116 private decimal _nEntrega;
121 public decimal _Cambio
123 get {
return _nCambio; }
126 if (_nCambio != value)
129 NotifyPropertyChanged(
"_Cambio");
133 private decimal _nCambio;
140 get {
return _lActivo; }
143 if (_lActivo != value)
146 NotifyPropertyChanged(
"_Activo");
150 private bool _lActivo;
155 public bool _PermitirEntregasParciales
157 get {
return _nPermitirEntregasParciales; }
160 if (_nPermitirEntregasParciales != value)
162 _nPermitirEntregasParciales = value;
163 NotifyPropertyChanged(
"_PermitirEntregasParciales");
167 private bool _nPermitirEntregasParciales;
172 public string _Terminal
174 get {
return _cTerminal; }
177 if (_cTerminal != value)
180 NotifyPropertyChanged(
"_Terminal");
184 private string _cTerminal = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_terminal"));
189 public string _Error_Message
191 get {
return _cError_Message; }
194 if (_cError_Message != value)
196 _cError_Message = value;
197 NotifyPropertyChanged(
"_Error_Message");
201 private string _cError_Message;
206 public string _Warning_Message
208 get {
return _cWarning_Message; }
211 if (_cWarning_Message != value)
213 _cWarning_Message = value;
214 NotifyPropertyChanged(
"_Warning_Message");
218 private string _cWarning_Message;
223 public string _Wait_Conection_Message
225 get {
return _cWait_Conection_Message; }
228 if (_cWait_Conection_Message != value)
230 _cWait_Conection_Message = value;
231 NotifyPropertyChanged(
"_Wait_Conection_Message");
235 private string _cWait_Conection_Message =
"Operando con el cajón inteligente.";
241 public Dictionary<string, object> _Propiedades
243 get {
return _oPropiedades; }
246 if (_oPropiedades != value)
248 _oPropiedades = value;
249 NotifyPropertyChanged(
"_Propiedades");
253 private Dictionary<string, object> _oPropiedades =
new Dictionary<string, object>();
260 get {
return _oImprimirDocumento; }
263 if (_oImprimirDocumento != value)
265 _oImprimirDocumento = value;
266 NotifyPropertyChanged(
"_ImprimirDocumento");
273 public bool _Visible_CobrosCaja
278 get {
return _lVisible_CobrosCaja; }
281 if (_lVisible_CobrosCaja != value)
283 _lVisible_CobrosCaja = value;
284 NotifyPropertyChanged(
"_Visible_CobrosCaja");
288 private bool _lVisible_CobrosCaja =
true;
293 public bool _Permitir_CobrosCaja
295 get {
return _lPermitir_CobrosCaja; }
298 if (_lPermitir_CobrosCaja != value)
300 _lPermitir_CobrosCaja = value;
301 NotifyPropertyChanged(
"_Permitir_CobrosCaja");
305 private bool _lPermitir_CobrosCaja =
true;
308 #region Cobros Facturas 309 public bool _Visible_CobrosFacturas
314 get {
return _lVisible_CobrosFacturas; }
317 if (_lVisible_CobrosFacturas != value)
319 _lVisible_CobrosFacturas = value;
320 NotifyPropertyChanged(
"_Visible_CobrosFacturas");
324 private bool _lVisible_CobrosFacturas =
true;
329 public bool _Permitir_CobrosFacturas
331 get {
return _lPermitir_CobrosFacturas; }
334 if (_lPermitir_CobrosFacturas != value)
336 _lPermitir_CobrosFacturas = value;
337 NotifyPropertyChanged(
"_Permitir_CobrosFacturas");
341 private bool _lPermitir_CobrosFacturas =
false;
344 #region Cobros Varios 345 public bool _Visible_CobrosVarios
350 get {
return _lVisible_CobrosVarios; }
353 if (_lVisible_CobrosVarios != value)
355 _lVisible_CobrosVarios = value;
356 NotifyPropertyChanged(
"_Visible_CobrosVarios");
360 private bool _lVisible_CobrosVarios =
true;
365 public bool _Permitir_CobrosVarios
367 get {
return _lPermitir_CobrosVarios; }
370 if (_lPermitir_CobrosVarios != value)
372 _lPermitir_CobrosVarios = value;
373 NotifyPropertyChanged(
"_Permitir_CobrosVarios");
377 private bool _lPermitir_CobrosVarios =
false;
381 public bool _Visible_PagosVarios
386 get {
return _lVisible_PagosVarios; }
389 if (_lVisible_PagosVarios != value)
391 _lVisible_PagosVarios = value;
392 NotifyPropertyChanged(
"_Visible_PagosVarios");
396 private bool _lVisible_PagosVarios =
true;
401 public bool _Permitir_PagosVarios
403 get {
return _lPermitir_PagosVarios; }
406 if (_lPermitir_PagosVarios != value)
408 _lPermitir_PagosVarios = value;
409 NotifyPropertyChanged(
"_Permitir_PagosVarios");
413 private bool _lPermitir_PagosVarios =
false;
417 public bool _Visible_Reposiciones
422 get {
return _lVisible_Reposiciones; }
425 if (_lVisible_Reposiciones != value)
427 _lVisible_Reposiciones = value;
428 NotifyPropertyChanged(
"_Visible_Reposiciones");
432 private bool _lVisible_Reposiciones =
true;
437 public bool _Permitir_Reposiciones
439 get {
return _lPermitir_Reposiciones; }
442 if (_lPermitir_Reposiciones != value)
444 _lPermitir_Reposiciones = value;
445 NotifyPropertyChanged(
"_Permitir_Reposiciones");
449 private bool _lPermitir_Reposiciones =
false;
453 public bool _Visible_Retiros
458 get {
return _lVisible_Retiros; }
461 if (_lVisible_Retiros != value)
463 _lVisible_Retiros = value;
464 NotifyPropertyChanged(
"_Visible_Retiros");
468 private bool _lVisible_Retiros =
true;
473 public bool _Permitir_Retiros
475 get {
return _lPermitir_Retiros; }
478 if (_lPermitir_Retiros != value)
480 _lPermitir_Retiros = value;
481 NotifyPropertyChanged(
"_Permitir_Retiros");
485 private bool _lPermitir_Retiros =
false;
489 public bool _Visible_Arqueos
494 get {
return _lVisible_Arqueos; }
497 if (_lVisible_Arqueos != value)
499 _lVisible_Arqueos = value;
500 NotifyPropertyChanged(
"_Visible_Arqueos");
504 private bool _lVisible_Arqueos =
false;
509 public bool _Permitir_Arqueos
511 get {
return _lPermitir_Arqueos; }
514 if (_lPermitir_Arqueos != value)
516 _lPermitir_Arqueos = value;
517 NotifyPropertyChanged(
"_Permitir_Arqueos");
521 private bool _lPermitir_Arqueos =
false;
524 #endregion PROPIEDADES 537 #endregion CONSTRUCTOR 540 public virtual bool _Load()
548 if (this._Terminal == null)
550 this._Error_Message =
"Para cargar la configuración del cash es necesario el terminal.";
555 DataTable dtResult =
new DataTable();
558 string sql =
"select CASHXML from " + DB.SQLDatabase(
"COMUNES",
"TERMINAL") +
" WHERE codigo=" + DB.SQLString(this._Terminal);
559 if (DB.SQLExec(sql, ref dtResult))
561 if (dtResult != null && dtResult.Rows.Count > 0)
564 XmlDocument doc =
new XmlDocument();
565 DataRow drRow = dtResult.Rows[0];
566 if (!String.IsNullOrEmpty(drRow[0].ToString()))
568 doc.LoadXml(drRow[0].ToString());
571 foreach (XmlNode node
in doc.SelectSingleNode(
"//curCash"))
573 if (node.LastChild != null)
575 if (this._oPropiedades.ContainsKey(node.Name))
577 this._oPropiedades[node.Name] = node.LastChild.Value;
581 this._oPropiedades.Add(node.Name, node.LastChild.Value);
590 _lPermitir_CobrosCaja = Convert.ToBoolean(node.LastChild.Value);
594 _lPermitir_CobrosFacturas = Convert.ToBoolean(node.LastChild.Value);
597 _lPermitir_CobrosVarios = Convert.ToBoolean(node.LastChild.Value);
600 _lPermitir_PagosVarios = Convert.ToBoolean(node.LastChild.Value);
603 _lPermitir_Reposiciones = Convert.ToBoolean(node.LastChild.Value);
607 _lPermitir_Retiros = Convert.ToBoolean(node.LastChild.Value);
610 _lVisible_CobrosCaja = Convert.ToBoolean(node.LastChild.Value);
614 _lVisible_CobrosFacturas = Convert.ToBoolean(node.LastChild.Value);
618 _lVisible_CobrosVarios = Convert.ToBoolean(node.LastChild.Value);
622 _lVisible_PagosVarios = Convert.ToBoolean(node.LastChild.Value);
626 _lVisible_Reposiciones = Convert.ToBoolean(node.LastChild.Value);
629 _lVisible_Retiros = Convert.ToBoolean(node.LastChild.Value);
633 this._cCodigoFormaCobro = node.LastChild.Value;
637 switch (node.LastChild.Value)
664 _Obtener_Notificador();
675 if (this._Terminal == null)
677 this._Error_Message =
"Para guardar la configuración del cash es necesario el terminal.";
682 if (this._CodigoFormaCobro == null)
684 this._Error_Message =
"Para guardar la configuración del cash es necesario definir la forma de cobro asociada.";
689 string lcNombrePropiedad =
"";
694 _Update_Property(lcNombrePropiedad, _cCodigoFormaCobro);
697 int lnImprimirDocumento = 0;
698 switch (this._oImprimirDocumento)
701 lnImprimirDocumento = 0;
705 lnImprimirDocumento = 1;
709 lnImprimirDocumento = 2;
715 _Update_Property(lcNombrePropiedad, lnImprimirDocumento);
717 #region Propiedades de operativa permitida 720 _Update_Property(lcNombrePropiedad, _lPermitir_CobrosCaja);
723 _Update_Property(lcNombrePropiedad, _lPermitir_CobrosFacturas);
726 _Update_Property(lcNombrePropiedad, _lPermitir_CobrosVarios);
729 _Update_Property(lcNombrePropiedad, _lPermitir_PagosVarios);
732 _Update_Property(lcNombrePropiedad, _lPermitir_Reposiciones);
735 _Update_Property(lcNombrePropiedad, _lPermitir_Retiros);
737 #endregion Propiedades de operativa permitida 739 #region Propiedades de visibilidad de operativa 742 _Update_Property(lcNombrePropiedad, _lVisible_CobrosCaja);
745 _Update_Property(lcNombrePropiedad, _lVisible_CobrosFacturas);
748 _Update_Property(lcNombrePropiedad, _lVisible_CobrosVarios);
751 _Update_Property(lcNombrePropiedad, _lVisible_PagosVarios);
754 _Update_Property(lcNombrePropiedad, _lVisible_Reposiciones);
757 _Update_Property(lcNombrePropiedad, _lVisible_Retiros);
759 #endregion Propiedades de visibilidad de operativa 762 XDeclaration lsHead =
new XDeclaration(
"1.0",
"Windows-1252",
"yes");
764 XElement lsContent =
new XElement(
"VFPData",
new XElement(
"curCash", this._oPropiedades.Select(kv =>
new XElement(kv.Key, kv.Value))));
766 string lsXml = lsHead.ToString() + Environment.NewLine + lsContent.ToString();
769 string sql =
"update " + DB.SQLDatabase(
"COMUNES",
"TERMINAL") +
" set cashxml = " + DB.SQLString(lsXml) +
" WHERE codigo=" + DB.SQLString(this._Terminal);
771 if (!DB.SQLExec(sql))
773 this._Error_Message =
"Se ha producido un error guardando la configuración de su cash en la Base de Datos.";
785 private void _Update_Property(
string tcNombrePropiedad,
object toValue)
787 if (_oPropiedades.ContainsKey(tcNombrePropiedad))
788 _oPropiedades[tcNombrePropiedad] = toValue;
790 _oPropiedades.Add(tcNombrePropiedad, toValue);
802 foreach (
string lcName
in lcNames)
818 public virtual bool _Cobrar(docventatpv.ewDocVentaTPV toDocVenta, Decimal tnImporte)
828 Forms.frmCash loForm =
new Forms.frmCash(
this);
829 loForm._ShowDialog();
928 return _Retiro(toRetiro, tnImporte);
952 _oNotifier =
new Forms.frmWaitingFor(
this);
958 private object _oNotifier = null;
980 #region METODOS PROTECTED 988 protected string _Connect(
string tcServerIP,
int tnPort,
string lcMessage)
991 string lcResposta =
string.Empty;
1000 TcpClient client =
new TcpClient(tcServerIP, tnPort);
1003 Byte[] data =
new Byte[256];
1004 data =
System.Text.Encoding.ASCII.GetBytes(lcMessage);
1008 NetworkStream stream = client.GetStream();
1011 stream.Write(data, 0, data.Length);
1014 data =
new Byte[256];
1017 String responseData = String.Empty;
1020 Int32 bytes = stream.Read(data, 0, data.Length);
1021 responseData =
System.Text.Encoding.ASCII.GetString(data, 0, bytes);
1023 lcResposta = responseData;
1029 catch (ArgumentNullException e)
1031 _Error_Message =
"ArgumentNullException: " + e;
1033 catch (SocketException e)
1035 _Error_Message =
"SocketException: " + e.ToString();
1040 #endregion METODOS PROTECTED virtual bool _Abono(Retiros toRetiro, decimal tnImporte)
Operación de retiro
Clase que nos gestiona los retiros de caja. Esta clase utilizará como base la tabla TPV...
virtual bool _PagoVarios(PagosVarios toPagosVarios, decimal tnImporte)
Operación de pago vario
delegate void UserNotifyerEvent(object sender, EwCashNotifyEventArgs e)
Delegado para la notificación al usuario
eCash_NombrePropiedad
Enumeración de las propiedades que componen la clase ICash
string _Connect(string tcServerIP, int tnPort, string lcMessage)
Conectar a traves de socket.
Clase derivada de Movcaja, per a gestionar els pagos varios
virtual bool _CobroFactura(CobrosPrevision toCobroFactura, decimal tnImporte)
Operación de cobro de factura
virtual bool _Save()
Ens guardarà a la taula TERMINAL les següents propietats { _CodigoFormaCobro, _Propiedades } ...
virtual bool _Reposicion(Reposicion toReposicion, decimal tnImporte)
Operación de reposición
virtual bool _Cobrar(docventatpv.ewDocVentaTPV toDocVenta, Decimal tnImporte)
Ens executa perquè cobri el CASH Ens retornarà TRUE en cas que ha anat OK Ens retornarà FALSE en cas ...
La classe Cash compleix la interficie ICash, per treballar amb calaixos intel·ligents ...
virtual bool _Probar()
Farà una prova de comunicació amb el calaix
ICash Cash()
Ens retornarà un objecte de tipus ICash a partir del IDNCASH fent una instancia de la llibreria que h...
KeyDiccionarioMascara
Clave para diccionario de máscaras
UserNotifyerEvent _NotificarUsuario
Evento de notificación al usuario
Clase de argumentos de respuesta. Deriba de EventArgs incorporando un booleano para determinar si deb...
virtual bool _Desconectar()
Desconectar la comunicación con el cajón
PropertyChangedEventHandler PropertyChanged
Evento público para notificar cambios en las propiedades
Cash()
Constructor de la clase
virtual void _Obtener_Notificador()
Método que instancia un elemento para mostrar avisos de interacción con el cajon al usuario Sino se s...
Clase no visual que nos gestiona las diferentes reposiciones que pueden haber en un TPV ...
virtual bool _CobroVarios(CobrosVarios toCobroVarios, decimal tnImporte)
Operación de cobro vario
void LanzarEvento_MostrarMensajeUsuario(bool tlMostrar=true, bool tlOk=true)
Método para lanzar eventos de notificación al usuario
Proporciona características adicionales de las máscaras de Eurowin
Definició de la interficie pels calaixos intel·ligents (cash)
PE-86618 : Clase Terminal
virtual bool _BackOffice()
Acceso al BackOffice del cajón electrónico
virtual bool _Retiro(Retiros toRetiro, decimal tnImporte)
Operación de retiro
Clase Arqueo TPV: Para crear un arqueo nuevo para consultar lo pendiente de arquear: ...
Clase derivada de Movcaja, per a gestionar els cobros varios
static bool _GetICash(out ICash toCash)
Método que determina y retorna un objeto ICash
virtual bool _Arqueo(ArqueoTpv toArqueo, decimal tnImporte)
Operación de Arqueo
virtual void _Show()
Ens presenta la pantalla de configuració del Cash
eCash_OrdenImpresion
Se añadirá una nueva propiedad que indicará si el ticket se imprime antes o después de haber ejecutad...