MailCM.prw 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #Include "PROTHEUS.CH"
  2. /*__________________________________________________________________________
  3. ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
  4. ¦¦+-----------------------------------------------------------------------+¦¦
  5. ¦¦¦Funçäo ¦ MailCM ¦ Autor ¦ Lucilene Mendes ¦ Data ¦29.07.2015 ¦¦¦
  6. ¦¦+-----------+-----------------------------------------------------------¦¦¦
  7. ¦¦¦Descriçäo ¦ Programa padrão para de envio de emails de comunicados ¦¦¦
  8. ¦¦+-----------+-----------------------------------------------------------¦¦¦
  9. ¦¦¦Parametros ¦ cTipo - Tipo do comunicado. Ex: Aviso de Inadimplencia¦¦¦
  10. ¦¦¦ ¦ aDest - Array com os e-mails dos Destinatários ¦¦¦
  11. ¦¦¦ ¦ aDestCpy - Array com os e-mails de cópia do email ¦¦¦
  12. ¦¦¦ ¦ cAssunto - Assunto do E-mail ¦¦¦
  13. ¦¦¦ ¦ cMsg - Mensagem do corpo do E-mail ¦¦¦
  14. ¦¦¦ ¦ cTracker - Tabela com os itens do documento ¦¦¦
  15. ¦¦¦ ¦ cLink - Tabela com os itens do documento ¦¦¦
  16. ¦¦+-----------------------------------------------------------------------+¦¦
  17. ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
  18. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*/
  19. User Function MailCM(cTipo,aDest,aDestCpy,cAssunto,cMsg,cTracker,cLink,aAnexo)
  20. Local cDirWF := Alltrim(GetMv('MV_WFDIR'))
  21. Local cCompLink := ""
  22. Local cDestMail := ""
  23. Local cDestCC := ""
  24. Local i := 0
  25. Private cEndServ:= GetMv('MV_WFBRWSR') // Endereço do servidor da pagina do Portal
  26. Private cLFRC := chr(13)+chr(10)
  27. Private cCSS := ""
  28. Private cLogoSMS:= ""
  29. Default aAnexo := {}
  30. If !Empty(aDest)
  31. // If Empty(cDirWF)
  32. // cDirWf := '\WEB\'
  33. // Else
  34. // If Right(cDirWF,1) <> '\'
  35. // cDirWF += '\'
  36. // Endif
  37. // Endif
  38. cDirWF := '\web\portalsms\htm\'
  39. cCSS := MontaCSS()
  40. cLogoSMS := '<img src="http://'+cEndServ+'/images/logoSMS.png" alt="Desenvolvido por SMS Tecnologia da Informação" title="Desenvolvido por SMSTI Tecnologia da Informação">'
  41. //cLogoAero:= '<img src="http://'+cEndServ+'/images/logoAero.png">'
  42. If !Empty(cLink)
  43. cCompLink:='<div class="divLink" align="center">'
  44. cCompLink+=' <a href="'+cLink+'" target="_blank">Clique aqui para acessar este processo no Portal.</a>'
  45. cCompLink+='</div>
  46. Endif
  47. oProcAprov := TWFProcess():New('MAILCM','Workflow SMS')
  48. oProcAprov:cSubject := cAssunto
  49. oProcAprov:NewTask('WFOK',cDirWF+'mailcm.htm')
  50. cDestMail:= ""
  51. For i:= 1 to Len(aDest)
  52. If !Empty(aDest[i]) .and. "@" $ aDest[i]
  53. cDestMail+= aDest[i]+';'
  54. Endif
  55. Next
  56. oProcAprov:cTo := cDestMail
  57. cDestCC:= ""
  58. For i:= 1 to Len(aDestCpy)
  59. If !Empty(aDestCpy[i]) .and. "@" $ aDestCpy[i]
  60. cDestCC+= aDestCpy[i]+';'
  61. Endif
  62. Next
  63. If !Empty(cDestCC)
  64. oProcAprov:cCC := cDestCC
  65. Endif
  66. If Len(aAnexo) > 0
  67. For i:= 1 to Len(aAnexo)
  68. oProcAprov:AttachFile(aAnexo[i])
  69. Next
  70. Endif
  71. oProcAprov:oHtml:ValByName('cTipo',Upper(cTipo))
  72. oProcAprov:oHtml:ValByName('cMsg',cMsg)
  73. oProcAprov:oHtml:ValByName('cCSS',cCSS)
  74. oProcAprov:oHtml:ValByName('TRACKER',cTracker)
  75. oProcAprov:oHtml:ValByName('cLogoSms',cLogoSms)
  76. oProcAprov:oHtml:ValByName('LINK',cCompLink)
  77. oProcAprov:Start()
  78. oProcAprov:Finish()
  79. Endif
  80. Return
  81. /*__________________________________________________________________________
  82. ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
  83. ¦¦+-----------------------------------------------------------------------+¦¦
  84. ¦¦¦Funçäo ¦ MontaCSS ¦ Autor ¦ Lucilene Mendes ¦ Data ¦08.05.2015 ¦¦¦
  85. ¦¦+----------+------------------------------------------------------------¦¦¦
  86. ¦¦¦Descriçäo ¦ Monta o CSS para envio nos emails. ¦¦¦
  87. ¦¦+-----------------------------------------------------------------------+¦¦
  88. ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
  89. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*/
  90. Static Function MontaCSS()
  91. Local _cCSS := ""
  92. // Montagem do CSS para formatação do HTML
  93. _cCSS += 'BODY { margin:0; padding:0;background:#ECF0FF url(http://'+cEndServ+'/images/fundo.gif) repeat-x top;font-family: Tahoma, Arial, Helvetica, sans-serif;font-size:13px;color:#333; }'
  94. _cCSS += 'form{margin:0; padding:0; overflow:hidden;}'
  95. _cCSS += 'P { margin:0 0 15px 0; }'
  96. _cCSS += 'TD { font-size: 13px; vertical-align: top;}'
  97. _cCSS += 'A { text-decoration:none; color:#000; }'
  98. _cCSS += 'A:hover { color:#15568C; }'
  99. _cCSS += 'h1 { font-size:16px; }'
  100. _cCSS += 'h2 { font-size:14px; }'
  101. _cCSS += 'h3 { font-size:14px; }'
  102. _cCSS += 'h4 { font-size:14px; }'
  103. _cCSS += 'h5 { font-size:14px; }'
  104. _cCSS += 'h6 { font-size:14px; }'
  105. _cCSS += '#d_topo { margin:0 auto 0 auto; width:750px; margin-left: auto; margin-right: auto; text-align: center; }'
  106. _cCSS += '#d_corpo { width:980px; background:#f2f2f2; text-align: center; position:relative; width:750px; margin-top: 10px; margin-left: auto; margin-right: auto; }'
  107. _cCSS += '#d_rodape { width:100%; }'
  108. _cCSS += '#d_rodape_creditos { float: left; width:100%; text-align:center; height:40px; }'
  109. _cCSS += '#d_logo { float:left; background:url(http://'+cEndServ+'/images/logomailaero.png); width:187px; height:87px; margin-top:20px; }'
  110. _cCSS += '#d_intranet { margin:0 auto; background:url(http://'+cEndServ+'/imagens/intranet.png); width:247px; height:99px; }'
  111. _cCSS += '#d_esquerda { width:750px; text-align: left; }'
  112. _cCSS += '#d_noticias #d_noticias_titulo, '
  113. _cCSS += '#d_noticias #d_noticias_rodape { width:100%; height:33px; background: #393939; url(http://'+cEndServ+'/imagens/bg_noticias_titulo.png) no-repeat; }'
  114. _cCSS += '#d_noticias #d_noticias_rodape { background: #393939; url(http://'+cEndServ+'/imagens/bg_noticias_rodape.png) no-repeat; }'
  115. _cCSS += '#d_noticias #d_noticias_titulo img{ float:left; top:50%; margin-top: -13px; margin-left:10px; position:relative; } '
  116. _cCSS += '#d_noticias #d_noticias_titulo h2, #d_direita { float:left; margin-top:9px; margin-left:10px; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#fff; text-transform:uppercase; } '
  117. _cCSS += '#d_noticias_conteudo { background:none; } '
  118. _cCSS += '#d_noticias_conteudo { padding:10px 10px 10px 10px; position:relative; background-color: #fff; } '
  119. _cCSS += '#d_noticias_conteudo h3 { margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:normal; } '
  120. _cCSS += '#d_noticias_conteudo h3 strong { color:#0858A4; } '
  121. _cCSS += '#d_noticias_conteudo p { margin:0px; padding:7px 7px 7px 0; color:#818181; } '
  122. _cCSS += '#d_noticias_conteudo a:hover p { color:#000; } '
  123. _cCSS += '#d_noticias_conteudo p strong { font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#F90; } '
  124. _cCSS += '#d_rodape1 { margin: 0 auto; height: 3px; background-color: #ff661b; } '
  125. _cCSS += '#d_rodape2 { margin: 0 auto; height: 4px; background-color: #ffb200; } '
  126. _cCSS += '#d_rodape_creditos span { margin:0 auto; font-family:Arial, Helvetica, sans-serif; font-size:11px; font-style:italic; color:#7E7E7E; display:block; } '
  127. _cCSS += '.centro { text-align:center; } '
  128. _cCSS += '.direita { text-align: right; } '
  129. _cCSS += '.negrito { font-weight: bold; } '
  130. _cCSS += '.sublinhado { text-decoration: underline; } '
  131. _cCSS += '.cls50porcento { float: left; clear: none; width: 49%; } '
  132. _cCSS += '#divFaturamento, #divPosicaoCliente { height: 420px; } '
  133. _cCSS += '.clsQuebra { clear: none; height: 1px; margin: 0px; padding: 0px; width: 1px; } '
  134. _cCSS += '.divEmpilhavel, .divEmpilhavelQuebra { width: 50%; float: left; clear: right; height: 50px; } '
  135. _cCSS += '.divEmpilhavelQuebra { clear: right; } '
  136. _cCSS += '#tblFaturamento, #tblPosicaoCliente, #tblTracker { border-colapse: colapse; border-top: 1px solid #111; border-left: 1px solid #111; padding: 0px; margin: 0px; background-color: #E9E9E6; } '
  137. _cCSS += '#tblFaturamento td, #tblPosicaoCliente td, #tblTracker td { padding: 3px; border-right: 1px solid #111; border-bottom: 1px solid #111; border-colapse: colapse; } '
  138. _cCSS += '#tblPosicaoCliente { background-color: #F0FEFF; } '
  139. _cCSS += '#divPosicaoCliente { float: right; clear: right; height:420px; } '
  140. _cCSS += '.linhavermelha { border-bottom: 2px solid #324e8a; width: 100%; padding-bottom: 5px; margin-bottom: 5px; } '
  141. _cCSS += '.titulo { font-weight: bold; font-size: 16px; } '
  142. _cCSS += '.vermelho-escuro { color: #800000; } '
  143. _cCSS += '.vermelho { color: #C00303; } '
  144. _cCSS += '.branco { color: #FFF; } '
  145. _cCSS += '.verde { color: #008000; } '
  146. _cCSS += '.azul { color:#103090; } '
  147. _cCSS += '* html img/**/ { '
  148. _cCSS += ' filter:expression( '
  149. _cCSS += ' this.alphaxLoaded?"": ( '
  150. _cCSS += ' this.src.substr(this.src.length-4)==".png" ? ( '
  151. _cCSS += ' (!this.complete)?"": ( '
  152. _cCSS += ' this.runtimeStyle.filter= '
  153. _cCSS += ' ("progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.src+")")+ '
  154. _cCSS += ' String(this.onbeforeprint=this.runtimeStyle.filter="";this.src="+this.src+"").substr(0,0)+ '
  155. _cCSS += ' String(this.alphaxLoaded=true).substr(0,0)+ '
  156. _cCSS += ' String(this.src="'+cEndServ+'/imagens/spacer.gif").substr(0,0) '
  157. _cCSS += ' ) '
  158. _cCSS += ' ) : '
  159. _cCSS += ' this.runtimeStyle.filter="" '
  160. _cCSS += ' )); '
  161. _cCSS += '} '
  162. Return _cCSS