Cargando...
Buscando...
Nada coincide
DocPrint.cs
1//#define ewTools //Descomentar para medir el rendimiento
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
11using sage.ew.db;
13using sage.ew.usuario;
14using sage.ew.objetos;
15using System.Data;
16using System.IO;
17using System.Windows.Forms;
18using sage.ew.docsven;
22using System.Drawing.Printing;
25using System.Diagnostics;
27using System.Runtime.CompilerServices;
28
29namespace sage.ew.ewbase
30{
34 public class DocPrint : IDocPrint
35 {
40 {
48 Pdf = 1,
52 Excel = 2,
60 Html = 4,
64 Xml = 5,
68 txt = 6,
72 CSV = 7
73 }
74
75 #region Variables
76
77 #region Variables de entorno
78
82 protected bool _lHera = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_hera"));
86 protected bool _lSage50 = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_sage50"));
90 protected bool _lColor = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_color"));
94 protected bool _lPeso = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_peso"));
98 protected bool _lCajas = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_cajas"));
99
100 #endregion Variables de entorno
101
105 private Empresa _oEmpresa = null;
109 private Terminal _oTerminal = null;
113 private Report _oReport = null;
117 private IDocumentoImprimible _oDocumento = null;
121 private List<OpcionesImpresion> _oOpciones_Impresion;
125 private eFormato_exportacion _eFormato_exportacion = eFormato_exportacion.Ninguno;
129 protected List<CampoOrdenacion> _oCamposOrdenacion = null;
130
135
139 public delegate void _ImpresionVistaPreliminarEvent();
140
141 private String _cPrinter = "";
142 private String _cRutaFichero = "";
143 private String _cTemplate;
144 private String _cDestinatario_Email = "";
145 private String _cPlantillaComunicado = "";
146 private int _nNumero_Copias = 0;
147 private bool _lIVA_Desglosado = true;
148 private bool _lEditMode = false;
149 private bool _lValorado = true;
150 private bool _lVista_Preliminar = false;
151 private bool _lFieldRandomBackColor = false;
152 private bool _lExportar = false;
153 private bool _lEmail = false;
154 private bool _lEmailAut = false;
155 private DataTable _dtPlantillasComunicados = null;
159 private ImpresionNormalMultiple _oTipoImpresion = ImpresionNormalMultiple.Normal;
163 protected String _cIdioma = "";
167 protected UserControl _oUserControlAdicional = null;
171 private Boolean _bUnMailCliente = false;
175 private Boolean _bMarcarImpreso = false;
179 private List<FiltroImpresion> _oFiltrosDocumentosImpresion = new List<FiltroImpresion>();
183 protected String _cReportBaseEW = "";
187 private String _cErrorMessage = "";
188
189 #region Mascaras
190
194 private ewMascara _oMascaraImport = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_total));
198 private ewMascara _oMascaraPrecio = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_precioven));
202 protected ewMascara _oMascaraPorcent = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_tpc));
206 protected ewMascara _oMascaraUnidades = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_unidades));
210 protected ewMascara _oMascaraPeso = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_mascarapeso));
214 protected ewMascara _oMascaraCajas = new ewbase.ewMascara(ew.global.EW_GLOBAL._GetMascara(KeyDiccionarioMascara.wc_mascaracajas));
218 private bool _bImprimirExelOpenXml = false;
219
223 public Boolean _ImprimirExelOpenXml
224 {
225 get
226 {
227 return _bImprimirExelOpenXml;
228 }
229 set
230 {
231 _bImprimirExelOpenXml = value;
232 }
233 }
234
237 public ewMascara _Mascara_Importes
238 {
239 get
240 {
241 return _oMascaraImport;
242 }
243 }
244
248 public ewMascara _Mascara_Precios
249 {
250 get
251 {
252 return _oMascaraPrecio;
253 }
254 }
255
259 public ewMascara _Mascara_Porcentajes
260 {
261 get
262 {
263 return _oMascaraPorcent;
264 }
265 }
266
270 public ewMascara _Mascara_Unidades
271 {
272 get
273 {
274 return _oMascaraUnidades;
275 }
276 }
277
281 public ewMascara _Mascara_Pesos
282 {
283 get
284 {
285 return _oMascaraPeso;
286 }
287 }
288
292 public ewMascara _Mascara_Cajas
293 {
294 get
295 {
296 return _oMascaraCajas;
297 }
298 }
299
300 #endregion Mascaras
301
302 #endregion Variables
303
304 #region PROPIEDADES
305
309 public virtual Boolean _ShowEditMode
310 {
311 get
312 {
313 return true;
314 }
315 }
316
320 public string _Idioma
321 {
322 get
323 {
324 return _cIdioma;
325 }
326 set
327 {
328 if (_cIdioma != value)
329 {
330 _cIdioma = value;
331 _Printer = String.Empty;
332 }
333 }
334 }
335
339 public string _ErrorMessage
340 {
341 get
342 {
343 return _cErrorMessage;
344 }
345 set
346 {
347 _cErrorMessage = value;
348 }
349 }
350
354 public String _ReportBaseEW
355 {
356 get
357 {
358 return _cReportBaseEW;
359 }
360 }
361
365 public Boolean _UnMailCliente
366 {
367 get
368 {
369 return _bUnMailCliente;
370 }
371 set
372 {
373 _bUnMailCliente = value;
374 }
375 }
376
377
381 public Boolean _MarcarImpreso
382 {
383 get
384 {
385 return _bMarcarImpreso;
386 }
387 set
388 {
389 _bMarcarImpreso = value;
390 }
391 }
392
396 public string _Template
397 {
398 get
399 {
400 return _cTemplate;
401 }
402 set
403 {
404
405 if (_cTemplate != value)
406 {
407 _cTemplate = value;
408 _cPrinter = String.Empty;
409 }
410 }
411 }
412
417 {
418 get
419 {
420 return _oDocumento;
421 }
422 set
423 {
424 _oDocumento = value;
425 }
426 }
427
432 {
433 get
434 {
435 if (_oDocumento == null || String.IsNullOrWhiteSpace(_oDocumento._Empresa))
436 {
437 _oEmpresa = EW_GLOBAL._Empresa;
438 }
439 else if (_oDocumento != null && (_oEmpresa == null || _oEmpresa._Codigo != _oDocumento._Empresa))
440 {
441 _oEmpresa = Empresa._NewEmpresa(_oDocumento._Empresa);
442 _oEmpresa._Load_Codigo_Config();
443 }
444
445 return _oEmpresa;
446 }
447 }
448
453 {
454 get
455 {
456 if (_oTerminal == null) _oTerminal = EW_GLOBAL._Terminal == null ? new Terminal() : EW_GLOBAL._Terminal as Terminal;
457
458 return _oTerminal;
459 }
460 }
461
466 {
467 get
468 {
469 if (_oFileDialog == null)
470 {
471 _oFileDialog = EW_GLOBAL._FileDialog365;
472 }
473 return _oFileDialog;
474 }
475 }
476 private IFileDialog365 _oFileDialog = null;
477
481 protected Report _Report
482 {
483 get
484 {
485 if (_oReport == null) _oReport = _CrearReport();
486 return _oReport;
487 }
488 set
489 {
490 _oReport = value;
491 }
492 }
493
498 {
499 get
500 {
501 return _oTipoImpresion;
502 }
503 set
504 {
505 _oTipoImpresion = value;
506 }
507 }
508
512 public virtual bool _DivisaActiva
513 {
514 get
515 {
516 bool divisaActiva = false;
517 if (_Documento != null && //Tengo documento
518 _Documento is IDivisaOperable && //Es operable con divisa
519 !string.IsNullOrWhiteSpace(((IDivisaOperable)_Documento)._Divisa)) //Tengo divisa informada
520 {
521 divisaActiva = !Divisa._EsDivisaEmpresa(((IDivisaOperable)_Documento)._Divisa);
522 }
523 return divisaActiva;
524 }
525 }
526
530 public virtual String _Printer
531 {
532 get
533 {
534 if (String.IsNullOrWhiteSpace(_cPrinter)) _cPrinter = Obtener_impresora();
535 if (String.IsNullOrWhiteSpace(_cPrinter)) _cPrinter = _DefaultSystemPrinter;
536 return _cPrinter;
537 }
538 set
539 {
540 _cPrinter = value;
541 }
542 }
543
547 public virtual String _DefaultSystemPrinter
548 {
549 get
550 {
551 PrinterSettings loSettings = new PrinterSettings();
552 return loSettings.PrinterName;
553 }
554 }
555
559 public List<OpcionesImpresion> _Opciones_Impresion
560 {
561 get
562 {
563 return _oOpciones_Impresion;
564 }
565 set
566 {
567 _oOpciones_Impresion = value;
568 }
569 }
570
574 public virtual UserControl _UserControlAdicional
575 {
576 get
577 {
579 }
580 set
581 {
583 }
584 }
585
589 public bool _IVA_Desglosado
590 {
591 get
592 {
593 return _lIVA_Desglosado;
594 }
595 set
596 {
597 _lIVA_Desglosado = value;
598 }
599 }
600
604 public bool _Valorado
605 {
606 get
607 {
608 return _lValorado;
609 }
610 set
611 {
612 _lValorado = value;
613 }
614 }
615
619 public virtual bool _Vista_Preliminar
620 {
621 get
622 {
623 return _ImpresionNormalMultiple == ImpresionNormalMultiple.Normal ? _lVista_Preliminar : false;
624 }
625 set
626 {
627 _lVista_Preliminar = value;
628
629 if (value && _ImpresionVistaPreliminar == null)
630 {
632 }
633 }
634 }
635
636
640 public virtual void _MarcaDocumentoImpreso()
641 {
642 if (_oDocumento is IMarcaImpreso)
643 {
644 ((IMarcaImpreso)_oDocumento)._Printed();
645 }
646 }
647
651 public int _Numero_Copias
652 {
653 get
654 {
655 return _nNumero_Copias;
656 }
657 set
658 {
659 _nNumero_Copias = value;
660 }
661 }
662
666 public string _Ruta_Fichero
667 {
668 get
669 {
670 return _cRutaFichero;
671 }
672 set
673 {
674 if (value == null) _cRutaFichero = ""; //PE-94887 Estos valores se pasan a VFP y este no admite nulos
675 else _cRutaFichero = value;
676 }
677 }
678
682 public bool _EditMode
683 {
684 get
685 {
686 return _lEditMode;
687 }
688 set
689 {
690 _lEditMode = value;
691 }
692 }
693
698 {
699 get
700 {
701 return _lFieldRandomBackColor;
702 }
703 set
704 {
705 _lFieldRandomBackColor = value;
706 }
707 }
708
713 {
714 get
715 {
716 return _eFormato_exportacion;
717 }
718 set
719 {
720 _eFormato_exportacion = value;
721 }
722 }
723
727 public bool _Exportar
728 {
729 get
730 {
731 return _lExportar;
732 }
733 set
734 {
735 _lExportar = value;
736 }
737 }
738
743 {
744 get
745 {
746 return _cDestinatario_Email;
747 }
748 set
749 {
750 if (value == null) _cDestinatario_Email = ""; //PE-94887 Estos valores se pasan a VFP y este no admite nulos
751 else _cDestinatario_Email = value;
752 }
753 }
754
758 public bool _EmailAut
759 {
760 get
761 {
762 return _lEmailAut;
763 }
764 set
765 {
766 _lEmailAut = value;
767 }
768 }
769
773 public bool _Email
774 {
775 get
776 {
777 return _lEmail;
778 }
779 set
780 {
781 _lEmail = value;
782 }
783 }
784
788 public virtual List<CampoOrdenacion> _CamposOrdenacion
789 {
790 get
791 {
792 return _oCamposOrdenacion;
793 }
794 set
795 {
796 _oCamposOrdenacion = value;
797 }
798 }
799
804 {
805 get
806 {
807 return _cPlantillaComunicado;
808 }
809 set
810 {
811 _cPlantillaComunicado = value;
812 }
813 }
814
815 #endregion PROPIEDADES
816
817 #region Eventos
818
822 public delegate void _Evento_Exportacion_Completada(object sender, ExportEventArgs e);
823
828
832 public class ExportEventArgs : EventArgs
833 {
834
835 #region Propiedades
836
840 public string _Path { get; set; }
841
842 #endregion Propiedades
843
844 #region Constructores
845
849 public ExportEventArgs() : base()
850 {
851 _Path = "";
852 }
853
858 public ExportEventArgs(string TcPath) : base()
859 {
860 _Path = TcPath;
861 }
862
863 #endregion Constructores
864 }
865
870 protected void _LanzarEvento_ExportacionCompletada(string tcPath)
871 {
872 //Si hay suscriptores les aviso
875 }
876
877 #endregion Eventos
878
879 #region Métodos IDocPrint
880
886 public virtual bool _Print()
887 {
888 throw new NotImplementedException();
889 }
890
897 public virtual bool _Show_Print(int tnAbrirEn = 1)
898 {
899 throw new NotImplementedException();
900 }
901
907 public virtual DocPrint _Clonar(DocPrint toDocPrint)
908 {
909 toDocPrint._Valorado = _Valorado;
910 toDocPrint._IVA_Desglosado = _IVA_Desglosado;
911 toDocPrint._Idioma = _Idioma;
912 toDocPrint._EmailAut = _EmailAut;
913 toDocPrint._Vista_Preliminar = _Vista_Preliminar;
914 toDocPrint._Destinatario_Email = _Destinatario_Email;
915 toDocPrint._PlantillaComunicado = _PlantillaComunicado;
916 toDocPrint._Numero_Copias = _Numero_Copias;
917 toDocPrint._Ruta_Fichero = _Ruta_Fichero;
918 toDocPrint._CamposOrdenacion = _CamposOrdenacion;
919 toDocPrint._Exportar = _Exportar;
920 toDocPrint._Formato_exportacion = _Formato_exportacion;
921 toDocPrint._Email = _Email;
922 toDocPrint._Template = _Template;
923 toDocPrint._Printer = _Printer;
924 toDocPrint._ImpresionNormalMultiple = _ImpresionNormalMultiple;
925 toDocPrint._UserControlAdicional = null;
926
927 return toDocPrint;
928 }
929
930
937 public virtual DataTable _OrdenarDatosSageReports(List<CampoOrdenacion> loCamposOrdenacion, DataTable tdDatos)
938 {
939 String lcOrden = "";
940
941 if (loCamposOrdenacion.Count > 0)
942 {
943 foreach (CampoOrdenacion loCampo in loCamposOrdenacion)
944 {
945 if (tdDatos.Columns.Contains(loCampo._Campo))
946 {
947 if (!String.IsNullOrEmpty(lcOrden)) lcOrden += ",";
948 lcOrden += String.Format("{0} {1}", loCampo._Campo, loCampo._TipoOrden == CampoOrdenacion.TipoOrden.Ascendente ? "asc" : "desc");
949 }
950 }
951
952 if (!String.IsNullOrEmpty(lcOrden))
953 {
954 DataView loDataView;
955
956 tdDatos.CaseSensitive = true; //Bug 109134
957 loDataView = tdDatos.DefaultView;
958 loDataView.Sort = lcOrden;
959 tdDatos = loDataView.ToTable();
960 }
961 }
962
963 return tdDatos;
964 }
965
966 #endregion Métodos IDocPrint
967
968 #region Métodos auxiliares
969
973 public virtual void _OpenEditor()
974 {
975 _Report?._OpenEditor();
976 }
977
982 protected virtual bool _PrintNET()
983 {
984 bool llOk = true;
985
986 //Determino acción predeterminada
987 Report.ReportAction loAction = Obtener_accion(); //Se crea un método para poder reaprovechar el código desde clases deribadas
988
989 //Ponemos el nombre que utilizará para la impresión
990 _Report._Name = _GetFileReportName(_Documento._Nombre);
991 String lcPath = _Ruta_Fichero;
992 Boolean llExportO365 = false;
993
994 if (_FileDialog._IsPath(lcPath))
995 {
996 lcPath = Path.GetTempFileName() + lcPath.Substring(lcPath.LastIndexOf("."));
997 llExportO365 = true;
998 }
999
1000 //T111264
1001 _Report._FieldRandomBackColor = _FieldRandomBackColor;
1002
1004
1005 if (_ImprimirExelOpenXml && _Exportar && loAction == Report.ReportAction.xlsx)
1006 {
1007 _ExportarOpenXml(lcPath);
1008 }
1009 else
1010 {
1011 //Bloqueamos el usuario
1012 _Lock(loAction);
1013 //Bloqueamos el usuario
1014 _Report._ExecuteAction(ref lcPath, loAction, _Printer, Convert.ToInt16(_Numero_Copias), llSuppressUserInteraction: true);
1015 //Desbloqueamos el usuario
1016 _UnLock(loAction);
1017 }
1018
1019 if (loAction != Report.ReportAction.prn)
1020 {
1021
1022 //PE-96202
1023 switch (loAction) //En función de la acción determino
1024 {
1025 //No hacer nada, solo exportaciones
1026 case Report.ReportAction.Email:
1027 case Report.ReportAction.none:
1028 case Report.ReportAction.preview:
1029 case Report.ReportAction.prn:
1030 case Report.ReportAction.edit:
1031 break;
1032
1033 default:
1034
1035 if (llExportO365)
1036 {
1037 _FileDialog._UploadFile(lcPath, _Ruta_Fichero);
1038 }
1039 _LanzarEvento_ExportacionCompletada(lcPath); //Notifico la ruta de exportación a los suscriptores
1040 break;
1041 }
1042
1043 //Adicionamente a la exportación se puede haber indicado que lo mande por email
1044 if (!String.IsNullOrWhiteSpace(_Destinatario_Email) && File.Exists(lcPath)) _SendEmail(lcPath);
1045 }
1046
1047 if (Debugger.IsAttached && !String.IsNullOrEmpty(_Report._Error_Message)) MessageBox.Show(_Report._Error_Message);
1048
1049 //Corto el vínculo entre el documento y el objeto de impresión para no arrastrar configuraciones
1050 _Documento._DocPrint = null;
1051
1052 return llOk;
1053 }
1054
1059 protected void _Lock(Report.ReportAction toAction)
1060 {
1061 if (toAction == Report.ReportAction.edit) Usuario._This._LockConnect($"EDIT {_ReportBase}");
1062 }
1063
1068 protected void _UnLock(Report.ReportAction toAction)
1069 {
1070 if (toAction == Report.ReportAction.edit) Usuario._This._UnLockConnect();
1071 }
1072
1073
1079 public virtual String _GetFileReportName(String tcNombre)
1080 {
1081 return tcNombre;
1082 }
1083
1089 protected virtual Boolean _ExportarOpenXml(String tcPath)
1090 {
1091 ExportExcel loExport = new ExportExcel(tcPath);
1092 return loExport.CreateFile(_Report._ReportTitle, _Report._ReportData);
1093 }
1094
1100 public String _ValidaExtension(String tcPath)
1101 {
1103
1104 return Report._ValidaExtension(loAction, tcPath);
1105
1106 }
1107
1113 protected void _AsignarEventoImpresionVistaPreviaAfter(Report.ReportAction toAction, Report toReport = null)
1114 {
1115 if (toAction == Report.ReportAction.preview && _ImpresionVistaPreliminar != null)
1116 {
1117 if (toReport is Report)
1118 {
1119 toReport._ImpresionVistaPreliminar += () => { _ImpresionVistaPreliminar(); };
1120 }
1121 else
1122 {
1123 _Report._ImpresionVistaPreliminar += () => { _ImpresionVistaPreliminar(); };
1124 }
1125 }
1126 }
1127
1134 protected virtual bool _SendEmail(string tcFileName)
1135 {
1136 return _SendEmail(tcFileName, new List<string>());
1137 }
1138
1146 protected bool _SendEmail(string tcFicherosAdjuntos, List<string> toEmailsCCO)
1147 {
1148 return _SendEmail(tcFicherosAdjuntos.Split('|').ToList(), toEmailsCCO);
1149 }
1150
1158 protected bool _SendEmail(List<string> toFicherosAdjuntos, List<string> toEmailsCCO)
1159 {
1160#if ewTools //Rendimiento
1161 EwTools._WriteTrace(EwTools.eMethodStatus.Inicio);
1162#endif
1163 bool llOk = true;
1164 string lcSubject = _Documento._Nombre;
1165 string lcBody = "";
1166
1167 // PE-104751. Revisión para terminar de centralizar el envío del correo mediante la nueva clase "SendMail"
1168
1169 // Preparar emails destino
1170 List<string> loEmailsDestino = new List<string>();
1171 loEmailsDestino = _Destinatario_Email.Split(';').ToList();
1172
1173 if (toFicherosAdjuntos.Count > 0)
1174 {
1175 lcBody = (toFicherosAdjuntos.Count > 1) ? "Se adjuntan los siguientes archivos o vínculos: " : "Se adjunta el siguiente archivo o vínculo: ";
1176 lcBody += string.Join(", ", toFicherosAdjuntos.Select(f => Path.GetFileName(f)));
1177 }
1178
1179 //PE-101222: Preparar datos para guardar log al enviar email
1180 string lcCliente = string.Empty;
1181 string lcProveedor = string.Empty;
1182 string lcClientePotencial = string.Empty;
1183 string lcResumen = string.Empty;
1184 dynamic loDoc = _Documento;
1185
1186 if (loDoc != null)
1187 {
1188 if (loDoc is EntregasFactura)
1189 {
1190 lcCliente = loDoc._Items[0]._Codigo;
1191 lcResumen = "Entregas a cuenta: " + loDoc._Items[0]._Factura;
1192 }
1193 else
1194 {
1195 switch ((eTipoDocumento)loDoc._TipoDocumento)
1196 {
1197 case eTipoDocumento.AlbaranCompra:
1198 lcProveedor = loDoc._Cabecera._Proveedor;
1199 lcResumen = "Albaran de compra: " + loDoc._Numero;
1200 break;
1201
1202 case eTipoDocumento.DepositoCompra:
1203 lcProveedor = loDoc._Cabecera._Proveedor;
1204 lcResumen = "Depósito de compra: " + loDoc._Numero;
1205 break;
1206
1207 case eTipoDocumento.FacturaCompra:
1208 lcProveedor = loDoc._Cabecera._Proveedor;
1209 lcResumen = "Factura de compra: " + loDoc._Numero;
1210 break;
1211
1212 case eTipoDocumento.PedidoCompra:
1213 lcProveedor = loDoc._Cabecera._Proveedor;
1214 lcResumen = "Pedido de compra: " + loDoc._Numero;
1215 break;
1216
1217 case eTipoDocumento.PropuestaCompra:
1218 lcProveedor = loDoc._Cabecera._Proveedor;
1219 lcResumen = "Propuesta de compra: " + loDoc._Numero;
1220 break;
1221
1222 case eTipoDocumento.AlbaranVenta: // Albaran de venta no facturado
1223 case eTipoDocumento.Factura: // Albaran de venta facturado
1224 case eTipoDocumento.Ticket: // Albaran de venta facturado como ticket
1225 lcCliente = loDoc._Cabecera._Cliente;
1226 lcResumen = "Albarán de venta: " + loDoc._Letra + loDoc._Numero;
1227 break;
1228
1229 case eTipoDocumento.DepositoVenta:
1230 lcCliente = loDoc._Cabecera._Cliente;
1231 lcResumen = "Depósito de venta: " + loDoc._Letra + loDoc._Numero;
1232 break;
1233
1234 case eTipoDocumento.FacturaVenta:
1235
1236 string lcBodyExtra = "";
1237
1238 //PE-102719 : Tener en cuenta los textos configurables de Informes (Empresa > Configuracion > Informes > Textos)
1239 if (!string.IsNullOrWhiteSpace(_Empresa._Mensaje_FactElec_Asunto))
1240 lcSubject = _oEmpresa._Mensaje_FactElec_Asunto + " : " + lcSubject;
1241
1242 lcBodyExtra = _GetBodyExtra();
1243
1244 if (!string.IsNullOrWhiteSpace(lcBodyExtra))
1245 lcBody = $"{FUNCTIONS.TextToHtml(lcBodyExtra)}<br><br>{lcBody}";
1246
1247 lcCliente = loDoc._Cabecera._Cliente;
1248 lcResumen = "Factura de venta: " + loDoc._Letra + loDoc._Numero;
1249 break;
1250
1251 case eTipoDocumento.PedidoVenta:
1252 lcCliente = loDoc._Cabecera._Cliente;
1253 lcResumen = "Pedido de venta: " + loDoc._Letra + loDoc._Numero;
1254 break;
1255
1256 case eTipoDocumento.PresupuestoVenta:
1257 lcCliente = loDoc._Cabecera._Cliente;
1258 lcClientePotencial = loDoc._Cabecera._Futuro ? Convert.ToString(loDoc._Cabecera._Futuro_Cliente) : "";
1259 lcResumen = "Presupuesto de venta: " + loDoc._Letra + loDoc._Numero;
1260 break;
1261
1262 case eTipoDocumento.Services:
1263 lcCliente = loDoc._Cliente;
1264 lcResumen = "Servicio: " + loDoc._Letra + loDoc._Numero;
1265 break;
1266 }
1267 }
1268 }
1269
1270 // PE-104208. Usar la nueva clase
1271 SendMail loSendMail = new SendMail
1272 {
1273 _Emails = loEmailsDestino,
1274 _Subject = lcSubject,
1275 _Body = lcBody,
1276 _Attachments = toFicherosAdjuntos,
1277 _ShowEmailForm = !_EmailAut,
1278 _CCOUsuarioActivo = toEmailsCCO.Count == 0,
1279 _CCUsuarioActivo = toEmailsCCO.Count == 0,
1280 _EmailsCCO = toEmailsCCO
1281 };
1282
1283 // Task 198556 - Configurar email según plantilla
1284 ConfigurarPlantillaComunicado(loSendMail, lcCliente, lcProveedor, lcClientePotencial);
1285
1286 // Bug 173603 : Permitimos reconfigurar el objeto
1287 _ConfigureSendMail(loSendMail);
1288
1289 // Envío del correo
1290 llOk = loSendMail._Send(lcCliente, lcProveedor, lcResumen);
1291
1292 if (!llOk && !string.IsNullOrWhiteSpace(loSendMail._Error_Message))
1293 FUNCTIONS._MessageBox(loSendMail._Error_Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, DialogResult.OK);
1294
1295 return llOk;
1296 }
1297
1302 protected virtual string _GetBodyExtra()
1303 {
1304 return _Empresa._Mensaje_FactElec_Cuerpo.Trim();
1305 }
1306
1307 // Bug 173603
1312 public virtual void _ConfigureSendMail(SendMail sendmail)
1313 {
1314
1315 }
1316
1321 public virtual Report _CrearReport()
1322 {
1323#if ewTools //Rendimiento
1324 EwTools._WriteTrace(EwTools.eMethodStatus.Inicio);
1325#endif
1326
1327 DataTable ldtLineas = new DataTable();
1328 Report loReport = null;
1329 List<FilterReportBase> llisFiltros = new List<FilterReportBase>();
1330
1331 //PE-88304
1332 loReport = new Report(_GetReportFileName(), ldtLineas);
1333
1334 //PE-97636 DEbemos poner el nombre del report base
1335 loReport._TableName = loReport._ReportTitle = _GetReportBase();
1336 //loReport._ReportTitle = lcReportName;
1337
1338 loReport._ReportTitlePreview = _Documento._ReportTitlePreview; //PE-103490
1339 loReport._Name = _Documento._Nombre;
1340
1341 //Forzamos que los ajuste de tamaño se realizen sobre el campo definición
1342 loReport._FieldNameOnAutosizeForze = "descripcion";
1343
1344 _ConfigurePath(loReport);
1345
1346 if (_Documento != null)
1347 {
1348 //Indicamos el tipo de documento
1349 loReport._TipoDocumento = _GetTipoDocumento();
1350
1351 //Recuperación de filtros de cabecera de documento
1352 Dictionary<string, object> ldicParametrosReport = new Dictionary<string, object>();
1353
1354#if ewTools //Rendimiento
1355 EwTools._WriteTrace(EwTools.eMethodStatus.Llamando, "_ConfigurarObtencionFiltros");
1356#endif
1357 //Llamo al método específico de cada Subclase para la recuperación de la configuración a utilizar durante la recuperación de filtros en el documento
1358 _ConfigurarObtencionFiltros(ref ldicParametrosReport);
1359#if ewTools //Rendimiento
1360 EwTools._WriteTrace(EwTools.eMethodStatus.Volviendo, "_ConfigurarObtencionFiltros");
1361#endif
1362
1363 //Obtengo los datos específicos del _Documento
1364 _GetFilters(_Documento, ldicParametrosReport, ref llisFiltros);
1365#if ewTools //Rendimiento
1366 EwTools._WriteTrace(EwTools.eMethodStatus.Llamando, "_Obtener_Datos_SageReports");
1367#endif
1368 //Obtengo los datos de las líneas
1369 DataTable loDataTable = _Documento._Obtener_Datos_SageReports(ldicParametrosReport);
1370 //T107428 Ordenamos los datos seleccionados
1371 loDataTable = _OrdenarDatosSageReports(_GetCamposOrdenacion(), loDataTable);
1372
1373 if (_Documento is ISageReportsEditDataProvider) loDataTable = ((ISageReportsEditDataProvider)_Documento)._Modificar_Datos_SageReports(loDataTable, ldicParametrosReport);
1374
1375 loReport._ReportData = loDataTable;
1376
1377#if ewTools //Rendimiento
1378 EwTools._WriteTrace(EwTools.eMethodStatus.Volviendo, "_Obtener_Datos_SageReports");
1379#endif
1380 //Asignamos si trabaja con divisas
1381 loReport._WorksWithDivisa = _DivisaActiva;
1382 }
1383
1384#if ewTools //Rendimiento
1385 EwTools._WriteTrace(EwTools.eMethodStatus.Llamando, "Asignar loReport._Filtros ");
1386#endif
1387 loReport._Filtros = llisFiltros;
1388#if ewTools //Rendimiento
1389 EwTools._WriteTrace(EwTools.eMethodStatus.Volviendo, "Asignar loReport._Filtros ");
1390#endif
1391 // Lanzar impresión
1392 //loReport._OpenEditor(); //Descomentar esta linea si se estan copiando reports para poder editar el apartado ENLACES y cambiar la tabla
1393
1394#if ewTools //Rendimiento
1395 EwTools._WriteTrace(EwTools.eMethodStatus.Fin);
1396#endif
1397
1398 return loReport;
1399 }
1400
1401
1409 private void ConfigurarPlantillaComunicado(SendMail loSendMail, string tcCliente, string tcProveedor, string tcClientePotencial)
1410 {
1411 // Si no hay plantilla comunicado no hacer nada
1412 if (string.IsNullOrWhiteSpace(_PlantillaComunicado))
1413 return;
1414
1415 // Obtener la información de la plantilla
1416 DataRow dtRow = ConfigurarPlantillaComunicadoCodigo(_PlantillaComunicado);
1417 if (dtRow == null)
1418 return;
1419
1420 string lcAsunto = Convert.ToString(dtRow["asunto"]);
1421 string lcCuerpo = Convert.ToString(dtRow["cuerpo"]);
1422
1423 // Sustituir el asunto
1424 loSendMail._Subject = !string.IsNullOrWhiteSpace(lcAsunto) ? lcAsunto : loSendMail._Subject;
1425
1426 string lcFigura = string.Empty;
1428 if (!string.IsNullOrWhiteSpace(tcClientePotencial))
1429 {
1430 lcFigura = tcClientePotencial;
1431 loTipoFigura = ComunicadosGenerar.ComunicaTipoFigura.ClientePotencial;
1432 }
1433 else if (!string.IsNullOrWhiteSpace(tcCliente))
1434 {
1435 lcFigura = tcCliente;
1436 loTipoFigura = ComunicadosGenerar.ComunicaTipoFigura.Cliente;
1437 }
1438 else if (!string.IsNullOrWhiteSpace(tcProveedor))
1439 {
1440 lcFigura = tcProveedor;
1441 loTipoFigura = ComunicadosGenerar.ComunicaTipoFigura.Proveedor;
1442 }
1443
1444 ComunicadosGenerar loGenerar = new ComunicadosGenerar();
1445 loGenerar._EnvioDocumentoEmailPorPlantillaUnoAUno = !this._EmailAut;
1446 if (loGenerar._Simular(lcFigura, loTipoFigura, lcCuerpo))
1447 loSendMail._Body = loGenerar._ResultHtml;
1448 loGenerar = null;
1449 }
1450
1456 private DataRow ConfigurarPlantillaComunicadoCodigo(string tcCodigo)
1457 {
1458 DataRow dtRow = null;
1459 if (_dtPlantillasComunicados == null)
1460 {
1461 using (PlantillasComunicados loPlantilla = new PlantillasComunicados())
1462 _dtPlantillasComunicados = loPlantilla._GetPlantillas(4);
1463 }
1464
1465 if (_dtPlantillasComunicados != null)
1466 dtRow = _dtPlantillasComunicados.AsEnumerable().Where(x => x.Field<string>("codigo") == _PlantillaComunicado).ToList().FirstOrDefault();
1467
1468 return dtRow;
1469 }
1470
1471
1472 private void _ConfigurePath(Report toReport)
1473 {
1474 _ConfigureCustomPath(toReport);
1475
1476 toReport._PathServer = Convert.ToString(EW_GLOBAL._GetVariable("wc_iniservidor"));
1477 }
1478
1479
1484 protected virtual void _ConfigureCustomPath(Report toReport)
1485 {
1486 ((ReportPath)toReport._Path)._Empresa = Convert.ToString(EW_GLOBAL._GetVariable("wc_empresa"));
1487 ((ReportPath)toReport._Path)._Usuario = Convert.ToString(EW_GLOBAL._GetVariable("wc_usuario"));
1488 ((ReportPath)toReport._Path)._Caja = Convert.ToString(EW_GLOBAL._GetVariable("wc_cajatpv"));
1489 }
1490
1496 {
1497 TipoDocumento loTipo;
1498
1500 {
1501 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Pedicom);
1502 }
1503 else if (_Documento is ewDocCompraALBARAN)
1504 {
1505 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Albacom);
1506 }
1507 else if (_Documento is ewDocCompraFACTURA)
1508 {
1509 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Factucom);
1510 }
1511 else if (_Documento is ewDocCompraDEPOSITO)
1512 {
1513 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Depocom);
1514 }
1515 else if (_Documento is ewDocCompraPROPUESTA)
1516 {
1517 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Precom);
1518 }
1519 else if (_Documento is ewDocVentaDEPOSITO)
1520 {
1521 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Depoven);
1522 }
1523 else if (_Documento is ewDocVentaPRESUP)
1524 {
1525 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Presuven);
1526 }
1527 else if (_Documento is ewDocVentaTPV)
1528 {
1529 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Albaven);
1530 }
1531 else if (_Documento is ewDocVentaFRA)
1532 {
1533 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Factuven);
1534 }
1535 else if (_Documento is ewDocVentaPED)
1536 {
1537 loTipo = new TipoDocumento(TipoDocumento.eTipoDocumento.Pediven);
1538 }
1539 else
1540 {
1541 loTipo = new TipoDocumento();
1542 }
1543
1544 return loTipo;
1545 }
1546
1551 private List<CampoOrdenacion> _GetCamposOrdenacion()
1552 {
1553 List<CampoOrdenacion> loCamposSeleccionados = new List<CampoOrdenacion>(); ;
1554
1555 if (_CamposOrdenacion is List<CampoOrdenacion>)
1556 {
1557 loCamposSeleccionados = (from loCampo in _CamposOrdenacion
1558 where loCampo._Seleccionado && !String.IsNullOrEmpty(loCampo._Campo)
1559 select loCampo).ToList();
1560 }
1561
1562 return loCamposSeleccionados;
1563 }
1564
1569 protected virtual string _GetReportBase()
1570 {
1571 return _Documento._ReportBase;
1572 }
1573
1578 public String _ReportBase
1579 {
1580 get
1581 {
1582 return _GetReportBase();
1583 }
1584 }
1585
1589 public List<FiltroImpresion> _FiltrosDocumentosImpresion
1590 {
1591 get
1592 {
1593 return _oFiltrosDocumentosImpresion;
1594 }
1595 set
1596 {
1597 _oFiltrosDocumentosImpresion = value;
1598 }
1599 }
1600
1601 //PE-95253
1609 {
1610#if ewTools //Rendimiento
1611 EwTools._MedirTiempo(EwTools.eMethodStatus.Inicio);
1612#endif
1613
1615
1616 //Miro si debo modificar la acción por otra de exportación
1617 if (_Exportar || !String.IsNullOrEmpty(_Destinatario_Email)) //Si tengo marcado exportación o destinatario de email
1618 {
1619 switch (_Formato_exportacion)
1620 {
1621 case eFormato_exportacion.Excel:
1622 loAction = Report.ReportAction.xls;
1623 break;
1624 case eFormato_exportacion.Excel_xlsx:
1625 loAction = Report.ReportAction.xlsx;
1626 break;
1627 case eFormato_exportacion.Html:
1628 loAction = Report.ReportAction.html;
1629 break;
1630 case eFormato_exportacion.Xml:
1631 loAction = Report.ReportAction.xml;
1632 break;
1633 //T111264
1634 case eFormato_exportacion.txt:
1635 loAction = Report.ReportAction.txt;
1636 break;
1637 case eFormato_exportacion.CSV:
1638 loAction = Report.ReportAction.delimited;
1639 break;
1640 //Marcada exportación pero sin elegir formato => Se elige PDF
1641 case eFormato_exportacion.Ninguno:
1642 case eFormato_exportacion.Pdf:
1643 default:
1644 loAction = Report.ReportAction.pdf;
1645 break;
1646 }
1647 }
1648
1649#if ewTools //Rendimiento
1650 EwTools._MedirTiempo(EwTools.eMethodStatus.Fin);
1651#endif
1652
1653 //T111264
1654 if (_EditMode) loAction = Report.ReportAction.edit;
1655
1656 return loAction;
1657 }
1658
1666 protected string Obtener_impresora()
1667 {
1668#if ewTools //Rendimiento
1669 EwTools._MedirTiempo(EwTools.eMethodStatus.Inicio);
1670#endif
1671
1672 String lcSql;
1673 string lcPrinterName = "";
1674 DataTable ldtImpresora = new DataTable();
1675
1676 #region Configuración del terminal
1677
1678 //Determinamos si realemte hay un registro para este código
1679 if (_Terminal._ExisteRegistro)
1680 {
1681 String lcDocumento = "";
1682
1683 //Ahora trato de mejorar el resultado mirando si hay una específica para el documento
1684 if(!String.IsNullOrEmpty(_ReportBaseEW))
1685 {
1686 lcDocumento = _ReportBaseEW;
1687 }
1688 else if (_Documento != null)
1689 {
1690 lcDocumento = _Documento._ReportBase;
1691 }
1692
1693 if (String.IsNullOrEmpty(lcPrinterName))
1694 {
1695 lcSql = "";
1696 //PE-95961
1697 if (Convert.ToBoolean(_Terminal._Campo("HERCONFTPV")))
1698 {
1699 lcSql = String.Format("SELECT i.GUID_ID FROM {0} i INNER JOIN {1} c ON i.CODIGO = c.IMPRESORA2 WHERE c.CODIGO = '{2}' ", DB.SQLDatabase("TPV", "IMPRESOR"), DB.SQLDatabase("TPV", "CAJAS"), EW_GLOBAL._GetVariable("wc_cajatpv"));
1700 }
1701 else if (!String.IsNullOrEmpty(_Terminal._Campo("IMPNORM").ToString().Trim()))
1702 {
1703 lcSql = String.Format("SELECT i.GUID_ID FROM {0} i WHERE i.CODIGO = '{1}' ", DB.SQLDatabase("TPV", "IMPRESOR"), _Terminal._Campo("IMPNORM"));
1704 }
1705
1706
1707 if(!String.IsNullOrEmpty(lcSql))
1708 {
1709 ldtImpresora = new DataTable();
1710 DB.SQLExec(lcSql, ref ldtImpresora);
1711
1712 if(ldtImpresora.Rows.Count > 0)
1713 {
1714 tpv.Impresora loImpresora = new tpv.Impresora();
1715 loImpresora._Load(Convert.ToString(ldtImpresora.Rows[0][0]));
1716 if(!String.IsNullOrEmpty(loImpresora._Nombre_Local)) lcPrinterName = functions.FUNCTIONS._GetPrinterDriver(loImpresora._Nombre_Local); //PE-95961 Se añade un trim al nombre de impresora ya que viene con espacios en blanco
1717 }
1718 }
1719
1720 //PE-96827
1721 if (String.IsNullOrEmpty(lcPrinterName)) lcPrinterName = Convert.ToString(_Terminal._Campo("IMPRESORA")).TrimEnd();
1722 }
1723 }
1724
1725 #endregion Configuración del terminal
1726
1727 #region Configuración de último uso SAGE REPORTS
1728
1729 //Sino tengo nombre de impresora lo busco en COMUNES.SAGEREPORTS
1730 if (String.IsNullOrWhiteSpace(lcPrinterName))
1731 {
1732 string lcSageReportPrinter = "";
1733
1734 if (!String.IsNullOrEmpty(_Template))
1735 {
1736 lcSageReportPrinter = Convert.ToString(DB.SQLValor("SAGEREPORTS", new string[2] { "USUARIO", "ID_REPLAN" }, new string[2] { Usuario._This._Codigo, _Template }, "IMPRESORA", "COMUNES"));
1737 }
1738 else
1739 {
1740 lcSageReportPrinter = Convert.ToString(DB.SQLValor("SAGEREPORTS", new string[2] { "USUARIO", "LOWER(REPORT)" }, new string[2] { Usuario._This._Codigo, _GetReportFileName() }, "IMPRESORA", "COMUNES"));
1741 }
1742 if (!String.IsNullOrWhiteSpace(lcSageReportPrinter)) lcPrinterName = lcSageReportPrinter.TrimEnd(); //Si he obtenido impresora asigno.
1743 }
1744
1745 #endregion Configuración de último uso SAGE REPORTS
1746
1747#if ewTools //Rendimiento
1748 EwTools._MedirTiempo(EwTools.eMethodStatus.Fin);
1749#endif
1750
1751 return lcPrinterName;
1752 }
1753
1758 public string _ObtenerImpresoraRes(String tcDocumento)
1759 {
1760 return Convert.ToString(DB.SQLValor("IMP_REPS", new string[2] { "TERMINAL", "UPPER(INFORME)" }, new string[2] { _Terminal._Codigo, tcDocumento }, "IMPRESORA", "COMUNES"));
1761 }
1762
1770 protected bool _GetFilters(ISageReportsFilterProvider toOrigen, Dictionary<string, object> toParams, ref List<FilterReportBase> tlisFiltros)
1771 {
1772#if ewTools //Rendimiento
1773 EwTools._MedirTiempo(EwTools.eMethodStatus.Inicio);
1774#endif
1775 //Diccionario de recogida de filtros
1776 bool llOk = true;
1777
1778 Dictionary<string, object> ldicFiltrosDefecto, ldicFiltrosNegocio;
1779
1780 ldicFiltrosNegocio = toOrigen._Obtener_Filtros_SageReports(toParams);
1781
1782 llOk = _AddFiltersFromDicctionary(ldicFiltrosNegocio, ref tlisFiltros);
1783
1784 ldicFiltrosDefecto = ReportTPV._ObtenerFiltrosDefecto();
1785
1786 llOk = _AddFiltersFromDicctionary(ldicFiltrosDefecto, ref tlisFiltros);
1787
1788#if ewTools //Rendimiento
1789 EwTools._MedirTiempo(EwTools.eMethodStatus.Fin);
1790#endif
1791 return llOk;
1792 }
1793
1800 protected bool _AddFiltersFromDicctionary(Dictionary<string, object> toDiccionario, ref List<FilterReportBase> toFiltros)
1801 {
1802 bool llOk = true;
1803
1804 List<String> loKeys = (from loFiltro in toFiltros
1805 select loFiltro._Key).ToList();
1806
1807 foreach (KeyValuePair<string, object> loKeyValue in toDiccionario)
1808 {
1809 if(!loKeys.Contains(loKeyValue.Key) && loKeyValue.Value != null)
1810 {
1811 Type loType = loKeyValue.Value.GetType();
1812
1813 if(loKeyValue.Value is FilterReportBase)
1814 {
1815 toFiltros.Add((FilterReportBase)loKeyValue.Value);
1816 }
1817 else if (loType == typeof(String) || loType == typeof(Int32) || loType == typeof(Int16) || loType == typeof(Boolean))
1818 {
1819 toFiltros.Add(new FilterReport(loKeyValue.Key, Convert.ToString(loKeyValue.Value), FilterReport.TypeFilter.Especial));
1820 }
1821 else
1822 {
1823 //Sage Reports soporta objects pero la clase puente ReportTPV no esta preparada
1824 throw new ArgumentException(String.Format("Tipo de datos del filtro {0} no soportado. Tipo: {1}", loKeyValue.Key, loType.ToString()));
1825 }
1826 }
1827 }
1828
1829 return llOk;
1830 }
1831
1838 public void _ConfigurarObtencionFiltros(ref Dictionary<string, object> toDiccionario)
1839 {
1840 _Configurar_obtencion_filtros(ref toDiccionario);
1841 }
1842
1849 protected virtual void _Configurar_obtencion_filtros(ref Dictionary<string, object> toDiccionario)
1850 {
1851 //Este método debe implementarse en las clases deribadas y sirve para generar un diccionario con las propiedades específicas del DocPrintXXX concreto y poder
1852 //mandarlo al _Documento usando los métodos de la BASE (DocPrint)
1853 }
1854
1859 protected virtual string _GetReportName()
1860 {
1861 return _Documento != null ? _Documento._ReportBase : "";
1862 }
1863
1868 public virtual String _GetReportFileName()
1869 {
1870 return String.Format("{0}.report", _GetReportName().ToLower());
1871 }
1872
1873 #endregion Métodos auxiliares
1874
1875 #region Métodos públicos
1876
1881 {
1882
1883 }
1884
1885 //PE-95253
1892 {
1893 eFormato_exportacion leResultado = eFormato_exportacion.Ninguno;
1894
1895 switch (teTipo)
1896 {
1897 case ewTiposExportacion.Excel:
1898 leResultado = eFormato_exportacion.Excel;
1899 break;
1900 case ewTiposExportacion.HTML:
1901 leResultado = eFormato_exportacion.Html;
1902 break;
1903
1904 case ewTiposExportacion.XML:
1905 leResultado = eFormato_exportacion.Xml;
1906 break;
1907
1908 case ewTiposExportacion.PDF:
1909 default:
1910 leResultado = eFormato_exportacion.Pdf;
1911 break;
1912 }
1913 return leResultado;
1914 }
1915
1920 public bool _ValidatePrinting()
1921 {
1922 if(!ValidatePrinting())
1923 {
1924 _Reset();
1925 return false;
1926 }
1927
1928 return true;
1929 }
1930
1934 protected virtual void _Reset()
1935 {
1936 _oReport = null;
1938 _Exportar = false;
1939 }
1940
1945 protected virtual bool ValidatePrinting()
1946 {
1947 _ErrorMessage = "";
1948
1950 {
1951 _ErrorMessage = $"No se puede realizar {GetAccion()}.{Environment.NewLine}Sage Reports no está intalado.";
1952 }
1953 // PE-101701. Hay que comprobar que el documento exista en el disco
1954 else if (!File.Exists(_Report?._Path?._PathFile))
1955 {
1956 _ErrorMessage = $"No se puede realizar {GetAccion()}, el fichero del report {_Report._ReportFile.ToUpper()} no existe.";
1957 }
1958 else if (_Exportar)
1959 {
1960 if (!string.IsNullOrEmpty(_Ruta_Fichero) && !Directory.Exists(Path.GetDirectoryName(_Ruta_Fichero)))
1961 {
1962 if (!string.IsNullOrEmpty(_Destinatario_Email))
1963 {
1964 if (Directory.Exists(EW_GLOBAL._Ruta_Exportacion_Docs()))
1965 {
1966 _Ruta_Fichero = Path.Combine(EW_GLOBAL._Ruta_Exportacion_Docs(), Path.GetFileName(_Ruta_Fichero));
1967 }
1968 else
1969 {
1970 _ErrorMessage = "La ruta de exportación configurada en el mantenimiento de empresa es incorrecta.";
1971 }
1972 }
1973 else
1974 {
1975 _ErrorMessage = $"No se puede realizar {GetAccion()}, el path del fichero de exportación {Path.GetDirectoryName(_Ruta_Fichero)} no existe.";
1976 }
1977 }
1978 else if (string.IsNullOrEmpty(_Ruta_Fichero))
1979 {
1980 _ErrorMessage = "La ruta de exportación no puede estar vacia.";
1981 }
1982 }
1983
1984 return string.IsNullOrEmpty(_ErrorMessage);
1985
1986 }
1987
1988 private string GetAccion()
1989 {
1990 string lcAccion;
1991 Report.ReportAction loAction;
1992
1993 loAction = Obtener_accion();
1994
1995 switch (loAction)
1996 {
1997 case Report.ReportAction.htmlPrn:
1998 case Report.ReportAction.prn:
1999 lcAccion = "la impresión";
2000 break;
2001 case Report.ReportAction.preview:
2002 lcAccion = "la previsualización";
2003 break;
2004 case Report.ReportAction.edit:
2005 lcAccion = "la edición";
2006 break;
2007 default:
2008 lcAccion = "la exportación";
2009 break;
2010
2011 }
2012
2013 return lcAccion;
2014 }
2015
2019 public DocPrint()
2020 {
2021
2022 }
2023
2024 #endregion Métodos públicos
2025 }
2026
2031 public class MultiDocPrint<T> : DocPrint where T : IDocumentoImprimible
2032 {
2033 private IDocPrint _oDocPrint = null;
2034 private String _cReportTitlePreview;
2035 private String _cNombre;
2036
2040 public List<T> _Items = new List<T>();
2041
2045 public String _ErrorMessages = "";
2046
2051 public override Report _CrearReport()
2052 {
2053 DataTable ldtLineas = new DataTable();
2054 Report loReport = null;
2055 List<FilterReportBase> llisFiltros = new List<FilterReportBase>();
2056
2057 //PE-88304
2058 loReport = new Report(((DocPrint)_DocPrint)._GetReportFileName(), ldtLineas);
2059
2060 //PE-97636 DEbemos poner el nombre del report base
2061 loReport._TableName = loReport._ReportTitle = ((DocPrint)_DocPrint)._ReportBase;
2062 //loReport._ReportTitle = lcReportName;
2063
2064 loReport._ReportTitlePreview = _Items.Count == 1 && !String.IsNullOrWhiteSpace(_Items[0]._ReportTitlePreview) ? _Items[0]._ReportTitlePreview : _ReportTitlePreview;
2065 loReport._Name = _Items.Count == 1 && !String.IsNullOrWhiteSpace(_Items[0]._Nombre) ? _Items[0]._Nombre : _Nombre;
2066
2067 loReport._PathServer = Convert.ToString(EW_GLOBAL._GetVariable("wc_iniservidor"));
2068 ((ReportPath)loReport._Path)._Empresa = Convert.ToString(EW_GLOBAL._GetVariable("wc_empresa"));
2069 ((ReportPath)loReport._Path)._Usuario = Convert.ToString(EW_GLOBAL._GetVariable("wc_usuario"));
2070 ((ReportPath)loReport._Path)._Caja = Convert.ToString(EW_GLOBAL._GetVariable("wc_cajatpv"));
2071
2072 if (_Items.Count > 0)
2073 {
2074 //Recuperación de filtros de cabecera de documento
2075 Dictionary<string, object> ldicParametrosReport = new Dictionary<string, object>();
2076
2078
2079 //Obtengo los datos de las líneas
2080 DataTable loDataTable = _ObtenerDatosSageReports(ldicParametrosReport);
2081
2082 loReport._ReportData = loDataTable;
2083
2084 //Asignamos si trabaja con divisas
2085 loReport._WorksWithDivisa = _DivisaActiva;
2086
2087 }
2088 loReport._Filtros = llisFiltros;
2089
2090 return loReport;
2091 }
2092
2097 {
2098 get
2099 {
2100 return _cReportTitlePreview;
2101 }
2102 set
2103 {
2104 _cReportTitlePreview = value;
2105 }
2106 }
2107
2111 public string _Nombre
2112 {
2113 get
2114 {
2115 return _cNombre;
2116 }
2117 set
2118 {
2119 _cNombre = value;
2120 }
2121 }
2122
2127 {
2128 get
2129 {
2130 if (!(_oDocPrint is IDocPrint))
2131 {
2132 _Documento = ((IDocumentoImprimible)Activator.CreateInstance(typeof(T), true));
2133 _oDocPrint = _Documento._DocPrint;
2134 }
2135 return _oDocPrint;
2136 }
2137 }
2138
2144 public override bool _Show_Print(int tnAbrirEn = 1)
2145 {
2146 if (_DocPrint is IDocPrint)
2147 {
2149
2150 if (_Documento._Show_Print(tnAbrirEn))
2151 {
2152 ((DocPrint)_Documento._DocPrint)._Clonar((DocPrint)this);
2153 return true;
2154 }
2155 }
2156 return false;
2157 }
2158
2162 public override void _MarcaDocumentoImpreso()
2163 {
2164 if(_Items.Count > 0)
2165 {
2166 foreach (T loItem in _Items)
2167 {
2168 if (loItem is IMarcaImpreso) ((IMarcaImpreso)loItem)._Printed();
2169 }
2170 }
2171 }
2172
2173 private DataTable _ObtenerDatosSageReports(Dictionary<string, object> tdicParametros = null)
2174 {
2175 DataTable loDt = null;
2176 DataTable loDtToPrint = null;
2177 StringBuilder loErrors = new StringBuilder();
2178 Int32 lnCopias = 0;
2179
2180 if (_Numero_Copias < 0) _Numero_Copias = 0;
2181
2182 foreach (IDocumentoImprimible loItem in _Items)
2183 {
2184 try
2185 {
2186 loItem._DocPrint._Numero_Copias = _Numero_Copias;
2187
2188 loDt = loItem._Obtener_Datos_SageReports(tdicParametros);
2189 if (loItem is ISageReportsEditDataProvider) loDt = ((ISageReportsEditDataProvider)loItem)._Modificar_Datos_SageReports(loDt, tdicParametros);
2190
2191 while (lnCopias <= _Numero_Copias)
2192 {
2193 if (loDtToPrint is DataTable)
2194 {
2195 if (loDt.Rows.Count > 0)
2196 {
2197 foreach (DataRow loRow in loDt.Rows)
2198 {
2199 loDtToPrint.ImportRow(loRow);
2200 }
2201 }
2202 }
2203 else
2204 {
2205 loDtToPrint = loDt.Copy();
2206 }
2207 lnCopias++;
2208 }
2209 lnCopias = 0;
2210 }
2211 catch (Exception loEx)
2212 {
2213 loErrors.AppendLine(loEx.Message);
2214 }
2215 }
2216
2217 _Numero_Copias = 0;
2218 _ErrorMessages = loErrors.ToString();
2219
2220 return loDtToPrint;
2221 }
2222
2227 protected override bool _PrintNET()
2228 {
2229 bool llOk = true;
2230
2231 // PE-101701. Hay que comprobar que el documento exista en el disco
2232 if (!File.Exists(_Report._Path._PathFile))
2233 {
2234 _ErrorMessages = String.Format("El report {0} no existe", _Report._ReportFile);
2235 return false;
2236 }
2237
2238 //Determino acción predeterminada
2239 Report.ReportAction loAction = Obtener_accion(); //Se crea un método para poder reaprovechar el código desde clases deribadas
2240
2241 String lcPath = _Ruta_Fichero;
2242 Boolean llExportO365 = false;
2243 //FileDialog365 oFileDialog = DeterminarExportacionO365(ref lcPath, ref llExportO365);
2244 if (_FileDialog._IsPath(lcPath))
2245 {
2246 lcPath = Path.GetTempFileName() + lcPath.Substring(lcPath.LastIndexOf("."));
2247 llExportO365 = true;
2248 }
2249
2250 //T111264
2251 _Report._FieldRandomBackColor = _FieldRandomBackColor;
2252
2254 //Bloqueamos el usuario
2255 _Lock(loAction);
2256 //Ejecutamos
2257 _Report._ExecuteAction(ref lcPath, loAction, _Printer, 0, llSuppressUserInteraction: true);
2258 //Desbloqueamos el usuario
2259 _UnLock(loAction);
2260
2261 if (loAction != Report.ReportAction.prn)
2262 {
2263 //PE-96202
2264 switch (loAction) //En función de la acción determino
2265 {
2266 //No hacer nada, solo exportaciones
2267 case Report.ReportAction.Email:
2268 case Report.ReportAction.none:
2269 case Report.ReportAction.preview:
2270 case Report.ReportAction.prn:
2271 case Report.ReportAction.edit:
2272 break;
2273 default:
2274 //PE-97035
2275 if (llExportO365) _FileDialog._UploadFile(lcPath, _Ruta_Fichero);
2276
2277 //Notifico la ruta de exportación a los suscriptores
2279 break;
2280 }
2281
2282 //Adicionamente a la exportación se puede haber indicado que lo mande por email
2283 if (!String.IsNullOrWhiteSpace(_Destinatario_Email) && File.Exists(lcPath)) _SendEmail(lcPath);
2284 }
2285
2286 return llOk;
2287 }
2288
2293 public override Boolean _Print()
2294 {
2295 Boolean lOk = false;
2296
2298 {
2299 lOk = _PrintNET();
2300 }
2301
2302 return lOk;
2303 }
2304
2305 }
2306}
Clase de negocio para la generación del comunicado.
bool _Simular()
Método para realizar una simulación del comunicado.
ComunicaTipoFigura
Enumerado de tipos de figuras de los documentos.
DataTable _GetPlantillas(int tnTipo=-1)
Devuelve datatable con las plantillas de un tipo concreto.
Clase documento de ALBARANES DE COMPRA.
Clase documento de DEPOSITO DE COMPRA.
Classe documento Factura de compra.
Clase documento de PEDIDOS DE COMPRA.
Clase documento de PROPUESTAS DE COMPRA.
Clase de documentos DEPOSITO.
Classe documento Factura de venta.
Clase documento de PEDIDOS.
Definition DocsPed.cs:42
Clase documento de PRESUPUESTOS.
Definition DocsPresup.cs:42
Clase documento de venta TPV.
Classe empresa basada en sage.ew.ewmante.
Definition clsEmpresa.cs:59
static Empresa _NewEmpresa(string tcCodigoEmpresa)
Devueleve una nueva instancia de empresa Puede devolver el objeto EW_GLOBAL._EMPRESA.
virtual void _Load_Codigo_Config()
_Load_Codigo_Config: Creamos todos los campos de las tablas relacionadas con la pantalla de configura...
Clase para la exportación a Excel de los listados.
bool CreateFile(String tcTitle, DataTable toDt, List< ExcelCell > toListCells=null)
Crea un fichero a partir de los datos del DataTable.
ReportTPV clase que se utiliza para poder inicializar los datos de la clase Report.
Definition ReportTPV.cs:30
static Dictionary< string, object > _ObtenerFiltrosDefecto()
Obtine los filtros por defecto.
Definition ReportTPV.cs:169
Clase para el envío de emails.
Definition SendMail.cs:28
string _Subject
Asunto del correo.
Definition SendMail.cs:102
bool _Send(string tcCliente="", string tcProveedor="", string tcResumen="")
Envia el correo.
Definition SendMail.cs:226
string _Error_Message
Mensaje de error.
Definition SendMail.cs:175
Clase de negocio para la DIVISA (Moneda)
Definition Divisa.cs:79
static bool _EsDivisaEmpresa(string tcCodigoDivisa)
Método que informa de si es la misma divisa que la empresa.
Definition Divisa.cs:1685
Parámetros de retorno de exportación.
Definition DocPrint.cs:833
string _Path
Ruta de fichero resultante.
Definition DocPrint.cs:840
ExportEventArgs(string TcPath)
Constructor con parámetros.
Definition DocPrint.cs:858
virtual List< CampoOrdenacion > _CamposOrdenacion
Devuelve la lista de los campos por lo que se podrá ordenar para la impresión.
Definition DocPrint.cs:789
Report _Report
Devuelve el report que va ha imprimir.
Definition DocPrint.cs:482
virtual Boolean _ExportarOpenXml(String tcPath)
Exportar exel en OpenXml.
Definition DocPrint.cs:1089
virtual Boolean _ShowEditMode
Indica si dbe mostrar el botón de edición en el formulario por defecto de impresión.
Definition DocPrint.cs:310
Boolean _UnMailCliente
Indica si solo se enviará un mail por cliente.
Definition DocPrint.cs:366
Boolean _ImprimirExelOpenXml
Indica si exportamos el Excel po OpenXml.
Definition DocPrint.cs:224
int _Numero_Copias
Nos indicará el número de copias a imprimir.
Definition DocPrint.cs:652
string _ObtenerImpresoraRes(String tcDocumento)
Obtiene la impresora configurada en IMP_REPS.
Definition DocPrint.cs:1758
_Evento_Exportacion_Completada _Evento_Exportacion_Finalizada
Delegado del evento para el refresco del formulario.
Definition DocPrint.cs:827
List< FiltroImpresion > _FiltrosDocumentosImpresion
Listado de filtros de impresion (impresión multiple)
Definition DocPrint.cs:1590
virtual Report.ReportAction Obtener_accion()
Método auxiliar para determinar la acción a realizar Determinar si estamos imprimiendo o previsualiza...
Definition DocPrint.cs:1608
List< CampoOrdenacion > _oCamposOrdenacion
Campos ordenación.
Definition DocPrint.cs:129
virtual string _GetReportBase()
Devuelve el report base.
Definition DocPrint.cs:1569
bool _Valorado
Nos indicará si el documento se imprimirá valorado.
Definition DocPrint.cs:605
void _ConfigurarObtencionFiltros(ref Dictionary< string, object > toDiccionario)
Método auxiliar para la asignación de propiedades específicas de la clase DocPrintXXX Este diccionari...
Definition DocPrint.cs:1838
virtual Report _CrearReport()
PE-86889 Método que inicializa un reports y le asigna los valores comunes para la impresión.
Definition DocPrint.cs:1321
bool _EmailAut
Nos indicará si hay que enviar el email automáticamente.
Definition DocPrint.cs:759
bool _lColor
Guarda el valor acerca del trabajo con tallas y colores.
Definition DocPrint.cs:90
ewMascara _Mascara_Unidades
Mascara de unidades.
Definition DocPrint.cs:271
ewMascara _Mascara_Precios
Mascara de precio.
Definition DocPrint.cs:249
eFormato_exportacion _Formato_exportacion
Formato de exportación.
Definition DocPrint.cs:713
IFileDialog365 _FileDialog
Objeto FileDialog.
Definition DocPrint.cs:466
virtual bool _Vista_Preliminar
Nos indicará si se realizará una vista preliminar del documento.
Definition DocPrint.cs:620
ewMascara _oMascaraPeso
Mascara de peso.
Definition DocPrint.cs:210
void _UnLock(Report.ReportAction toAction)
Desbloquea el ususario.
Definition DocPrint.cs:1068
UserControl _oUserControlAdicional
UserControl para las opciones de impresion multiple.
Definition DocPrint.cs:167
ewMascara _oMascaraPorcent
Mascara de porcentaje.
Definition DocPrint.cs:202
bool _Exportar
Determina si el documento.
Definition DocPrint.cs:728
eFormato_exportacion _Obtener_formato_exportacion(ewTiposExportacion teTipo)
Conversor de enumeraciones. Permite pasar de ewTiposExportacion (objetos) a eFormato_exportacion (sag...
Definition DocPrint.cs:1891
virtual String _Printer
C106325 Devuelve la impresora configurada.
Definition DocPrint.cs:531
virtual void _OpenEditor()
Abre la edicíon de report calculando las variables a partir del documento.
Definition DocPrint.cs:973
virtual String _GetFileReportName(String tcNombre)
Trata el nombre antes de asignarlo al Report.
Definition DocPrint.cs:1079
void _Lock(Report.ReportAction toAction)
Bloquea el ususario.
Definition DocPrint.cs:1059
bool _EditMode
Modo de edición.
Definition DocPrint.cs:683
String _cReportBaseEW
Report base de EW para buscar la impresora en IMP_RES.
Definition DocPrint.cs:183
string _Destinatario_Email
Nos indicará la dirección de email en caso que se desee imprimir en PDF.
Definition DocPrint.cs:743
ewMascara _oMascaraUnidades
Mascara de unidades.
Definition DocPrint.cs:206
virtual bool _Print()
Método que imprementa la impresión. Se debe implementar en la clase específica.
Definition DocPrint.cs:886
virtual bool _DivisaActiva
T105514 Indica si se trabaja con divisa.
Definition DocPrint.cs:513
string Obtener_impresora()
Método protected para tratar de establecer la impresora. 1.- Mira de obtener la impresora a través de...
Definition DocPrint.cs:1666
Terminal _Terminal
Terminal.
Definition DocPrint.cs:453
ImpresionNormalMultiple _ImpresionNormalMultiple
Indica el tipo de impresión.
Definition DocPrint.cs:498
ewMascara _Mascara_Porcentajes
Mascara de porcentaje.
Definition DocPrint.cs:260
delegate void _Evento_Exportacion_Completada(object sender, ExportEventArgs e)
Delegado del evento para la notificación de exportación completa
virtual DataTable _OrdenarDatosSageReports(List< CampoOrdenacion > loCamposOrdenacion, DataTable tdDatos)
Método que ordena los datos segun los campos especificados.
Definition DocPrint.cs:937
eFormato_exportacion
Tipos de exportación soportados.
Definition DocPrint.cs:40
virtual bool _PrintNET()
PE-86889 Método para realizar la impresión de un documento mediante Sage Reports.
Definition DocPrint.cs:982
IDocumentoImprimible _Documento
Referéncia al documento.
Definition DocPrint.cs:417
bool _ValidatePrinting()
Validaciones antes de imprimir.
Definition DocPrint.cs:1920
List< OpcionesImpresion > _Opciones_Impresion
Opiones de impresión.
Definition DocPrint.cs:560
string _ErrorMessage
Mensajede de error.
Definition DocPrint.cs:340
String _ValidaExtension(String tcPath)
Nos devuelve el fichero con la extensión.
Definition DocPrint.cs:1100
void _AsignarEventoImpresionVistaPreviaAfter(Report.ReportAction toAction, Report toReport=null)
Asigna el evento para la impresión desde vista previa.
Definition DocPrint.cs:1113
virtual String _DefaultSystemPrinter
Devuelve la impresora por defecto del sistem.
Definition DocPrint.cs:548
bool _lCajas
Guarda el valor acerca del trabajo con cajas.
Definition DocPrint.cs:98
virtual void _Configurar_obtencion_filtros(ref Dictionary< string, object > toDiccionario)
Método auxiliar para la asignación de propiedades específicas de la clase DocPrintXXX Este diccionari...
Definition DocPrint.cs:1849
virtual void _ConfigureSendMail(SendMail sendmail)
Permite reconfigurar el objeto SendMail antes de llamar a _Send()
Definition DocPrint.cs:1312
DocPrint()
Constructor.
Definition DocPrint.cs:2019
bool _SendEmail(List< string > toFicherosAdjuntos, List< string > toEmailsCCO)
Envia email segun confguracion del usuario Si tiene el opcemp 9050 activo, hace un envío directo medi...
Definition DocPrint.cs:1158
delegate void _ImpresionVistaPreliminarEvent()
Delegado para los messagebox.
bool _lPeso
Guarda el valor acerca del trabajo con peso.
Definition DocPrint.cs:94
bool _GetFilters(ISageReportsFilterProvider toOrigen, Dictionary< string, object > toParams, ref List< FilterReportBase > tlisFiltros)
Método auxiliar que invoca la recuperación de filtros para SageReports.
Definition DocPrint.cs:1770
string _Idioma
Nos indicará el código del idioma para la impresión.
Definition DocPrint.cs:321
virtual bool ValidatePrinting()
Validaciones antes de imprimir.
Definition DocPrint.cs:1945
bool _Email
Nos indicará si hay que enviar el email.
Definition DocPrint.cs:774
string _Template
Indica si se impreme con una template.
Definition DocPrint.cs:397
bool _lSage50
Guarda el valor acerca de si es un Sage 50.
Definition DocPrint.cs:86
bool _lHera
Guarda el valor acerca de si somos un Hera.
Definition DocPrint.cs:82
void _LanzarEvento_ExportacionCompletada(string tcPath)
Método auxiliar para el lanzamiento de eventos.
Definition DocPrint.cs:870
ewMascara _oMascaraCajas
Mascara de cajas.
Definition DocPrint.cs:214
ewMascara _Mascara_Cajas
Mascara de cajas.
Definition DocPrint.cs:293
virtual TipoDocumento _GetTipoDocumento()
Devuelve la relación del documento para los campos adicionales.
Definition DocPrint.cs:1495
String _ReportBase
Devuelve el report base.
Definition DocPrint.cs:1579
String _cIdioma
Idioma.
Definition DocPrint.cs:163
bool _AddFiltersFromDicctionary(Dictionary< string, object > toDiccionario, ref List< FilterReportBase > toFiltros)
Método auxiliar que a partir de un diccionario de valores los añade a la lista de filtros recibida po...
Definition DocPrint.cs:1800
string _PlantillaComunicado
Nos indica la plantilla de comunicado a utilizar en el email.
Definition DocPrint.cs:804
Boolean _MarcarImpreso
Indica sise marcará el documento como impreso.
Definition DocPrint.cs:382
virtual DocPrint _Clonar(DocPrint toDocPrint)
Copia la configuración al Docprint pasado.
Definition DocPrint.cs:907
bool _SendEmail(string tcFicherosAdjuntos, List< string > toEmailsCCO)
Envia email segun confguracion del usuario Si tiene el opcemp 9050 activo, hace un envío directo medi...
Definition DocPrint.cs:1146
bool _IVA_Desglosado
Nos indicará si el documento se imprimirá con el IVA desglosado.
Definition DocPrint.cs:590
virtual void _ConfigureCustomPath(Report toReport)
Permite configurar el path.
Definition DocPrint.cs:1484
String _ReportBaseEW
Report base de EW para buscar la impresora en IMP_RES.
Definition DocPrint.cs:355
ewMascara _Mascara_Importes
Mascara de importes.
Definition DocPrint.cs:238
virtual string _GetBodyExtra()
Texto para el body del mail.
Definition DocPrint.cs:1302
string _Ruta_Fichero
Nos indicará la ruta donde nos guardará el fichero del documento en formato PDF.
Definition DocPrint.cs:667
ewMascara _Mascara_Pesos
Mascara de peso.
Definition DocPrint.cs:282
virtual void _MarcaDocumentoImpreso()
Metodo que se ejecutará al imprimir desde el preview para marcar los documentos como impresos.
Definition DocPrint.cs:640
Empresa _Empresa
Empresa.
Definition DocPrint.cs:432
virtual String _GetReportFileName()
C106325 Devuelve el nombre del fichero de report.
Definition DocPrint.cs:1868
virtual string _GetReportName()
Obtener el nombre del report base.
Definition DocPrint.cs:1859
bool _FieldRandomBackColor
Propiedad _FieldRandomBackColor.
Definition DocPrint.cs:698
virtual bool _SendEmail(string tcFileName)
Envia email segun confguracion del usuario Si tiene el opcemp 9050 activo, hace un envío directo medi...
Definition DocPrint.cs:1134
virtual UserControl _UserControlAdicional
Opiones de impresión.
Definition DocPrint.cs:575
virtual void _Reset()
Al fallar la validación hay que reiniciar algunos valores de la pantalla ya que ahora ésta no se cier...
Definition DocPrint.cs:1934
virtual void _ObtenerConfigurarionOpcionesImpresionMultiple()
Metodo para cargar la configuración del UserControl de multiple impresión.
Definition DocPrint.cs:1880
virtual bool _Show_Print(int tnAbrirEn=1)
Método que imprementa la visualización de opciones de impresión. Se debe implementar en la clase espe...
Definition DocPrint.cs:897
_ImpresionVistaPreliminarEvent _ImpresionVistaPreliminar
Evento delegado para los messagebox.
Definition DocPrint.cs:134
Clase base de negocio de las entregas a cuenta por facturas.
List< T > _Items
Lisdfo de documento a imprimir.
Definition DocPrint.cs:2040
override bool _PrintNET()
PE-86889 Método para realizar la impresión de un documento mediante Sage Reports.
Definition DocPrint.cs:2227
override Report _CrearReport()
Método que inicializa un reports y le asigna los valores comunes para la impresión.
Definition DocPrint.cs:2051
override Boolean _Print()
Override _Print.
Definition DocPrint.cs:2293
override bool _Show_Print(int tnAbrirEn=1)
ShowPrint.
Definition DocPrint.cs:2144
string _ReportTitlePreview
Título del documento.
Definition DocPrint.cs:2097
string _Nombre
Nombre del fichero.
Definition DocPrint.cs:2112
String _ErrorMessages
Indica si se ha producido algun error.
Definition DocPrint.cs:2045
override void _MarcaDocumentoImpreso()
Metodo que se ejecutará al imprimir desde el preview para marcar los documentos como impresos.
Definition DocPrint.cs:2162
IDocPrint _DocPrint
_DocPrint
Definition DocPrint.cs:2127
Diferentes opciones de para la ordenación de los datos para la impresión.
Definition IDocPrint.cs:199
TipoOrden
Indica el tipo de orden.
Definition IDocPrint.cs:290
String _Campo
Campo por el que se ordenará
Definition IDocPrint.cs:241
TipoOrden _TipoOrden
Tipo de orden.
Definition IDocPrint.cs:271
Clase base para traspasar información en el objeto serializado.
Clase para traspasar información en el objeto serializado.
static bool IsSageReportInstaled()
India si existe el fichero del deigner y por lo tanto esta instalado.
Definition Report.cs:1982
BaseReportPath _Path
Path base.
Definition Report.cs:436
ReportAction
PE-84803 enum para las acciones a realizar.
Definition Report.cs:93
@ preview
Previsualizar el documento.
Definition Report.cs:157
static string _ValidaExtension(ReportAction type, String tcFileName)
Metodo que valida la extensión para un tipo de acción.
Definition Report.cs:1177
Clase para indicar el tipo de documento para los campos adicionales.
Definition Report.cs:2260
eTipoDocumento
Tipo documento.
Definition Report.cs:2267
static Boolean _TransformReportToLabel(Report toReport)
_TransformReportToLabel
PE-86618 : Clase Terminal.
Definition Terminal.cs:23
Clase de impresoras.
override void _Load()
Override del método _Load.
Interficie de los objetos que soportan divisa.
Definición de la interfície necesaria para las páginas(tabPage) a utilizar en formularios de tipo For...
Definition IDocPrint.cs:17
Definición de la interficie que deben cumplir los documentos de cualquier tipo para poder interactuar...
Definition IDocPrint.cs:377
Interficie del gestor de ficheros o365.
Interficia par los documentos que se tiene que marcar como impresos.
DataTable _Obtener_Datos_SageReports(Dictionary< string, object > tdicParametros=null)
Método que devuelve un datatable con los datos para las líneas de SageReports.
Definición de la interficie que han de cumplir aquellos clases que quieran modificar los resultados d...
Definition IDocPrint.cs:472
Definición de la interficie que han de cumplir aquellas clases que quieran proveer de información de ...
Definition IDocPrint.cs:445
Dictionary< string, object > _Obtener_Filtros_SageReports(Dictionary< string, object > tdicParametros=null)
Método que devuelve un diccionario con parejas clave-valor para ser convertidas en Filtros de SageRep...
eTipoDocumento
Detalle los tipos de documento posibles de ventas y compras.
ImpresionNormalMultiple
Indica si es una impresión normal o multiple.
Definition reports.cs:13
KeyDiccionarioMascara
Clave para diccionario de máscaras.
ewTiposExportacion
Enumeración de los diferentes tipos de exportación.