PortalMenu.apl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #include "PROTHEUS.CH"
  2. #include "RWMAKE.CH"
  3. #include "APWEBEX.CH"
  4. #include "TOPCONN.CH"
  5. #include "TBICONN.CH"
  6. /*
  7. +----------------------------------------------------------------------------+
  8. ! FICHA TECNICA DO PROGRAMA !
  9. +----------------------------------------------------------------------------+
  10. ! DADOS DO PROGRAMA !
  11. +------------------+---------------------------------------------------------+
  12. !Tipo ! Portal SMS !
  13. +------------------+---------------------------------------------------------+
  14. !Modulo ! PortalSMS !
  15. +------------------+---------------------------------------------------------+
  16. !Nome ! PortalSMS !
  17. +------------------+---------------------------------------------------------+
  18. !Descricao ! Portal SMS !
  19. +------------------+---------------------------------------------------------+
  20. !Autor ! Anderson José Zelenski !
  21. +------------------+---------------------------------------------------------+
  22. !Data de Criacao ! 19/09/2013 !
  23. +----------------------------------------------------------------------------+
  24. */
  25. User Function PortalMenu()
  26. Local cHtml
  27. Local cIdMenu := ""
  28. Local aMenu
  29. Private cMenu
  30. Web Extended Init cHtml // Start U_inSite()
  31. /*
  32. 01 -> Clientes
  33. 02 -> Fornecedor
  34. 03 -> Funcionários
  35. 04 -> Compras
  36. 05 -> Vendas
  37. 06 -> Estoque
  38. 07 -> Financeiro
  39. 08 -> Recursos Humanos
  40. */
  41. aMenu := {{'Clientes','5'},{'Fornecedores','5'},{'Funcionários','1'},{'Compras','3'},{'Vendas','2'},{'Estoque','1'},{'Financeiro','4'},{'Recursos Humanos','1'}}
  42. cQuery := " SELECT ZM0_CODIGO, ZM0_NOME, ZM0_DESCRI, ZM0_MENU "
  43. cQuery += " FROM "+RetSqlName("ZM0")+" ZM0 "
  44. cQuery += " INNER JOIN "+RetSqlName("ZM2")+" ZM2 ON "
  45. If !Empty(AllTrim(xFilial("ZM2"))) .And. !Empty(AllTrim(xFilial("ZM0")))
  46. cQuery += " ZM2_FILIAL = ZM0_FILIAL "
  47. Else
  48. cQuery += " ZM2_FILIAL = '"+xFilial("ZM2")+"' "
  49. EndIf
  50. cQuery += " AND ZM0_CODIGO = ZM2_MODULO AND ZM2.D_E_L_E_T_ = ' ' "
  51. cQuery += " WHERE ZM0_FILIAL = '"+xFilial("ZM0")+"'"
  52. cQuery += " AND ZM2.ZM2_USER = '"+HttpSession->UserId+"'"
  53. cQuery += " AND ZM0.D_E_L_E_T_ = ' '"
  54. cQuery += " ORDER BY ZM0_MENU, ZM0_ORDEM"
  55. APWExOpenQuery(ChangeQuery(cQuery),'QRY',.T.)
  56. cMenu := ""
  57. While !QRY->(EOF())
  58. if cIdMenu <> QRY->ZM0_MENU
  59. if cIdMenu <> ""
  60. cMenu += '</ul></li>'
  61. EndIf
  62. cMenu += '<li class="item'+aMenu[val(QRY->ZM0_MENU)][2]+'"><a href="#">'+aMenu[val(QRY->ZM0_MENU)][1]+'</a><ul>'
  63. cIdMenu := QRY->ZM0_MENU
  64. EndIf
  65. cMenu += ' <li class="subitem"><a href="#" onclick="parent.'+AllTrim(QRY->ZM0_NOME)+'();">'+QRY->ZM0_DESCRI+'</a></li>'
  66. DbSkip()
  67. EndDo
  68. cMenu += '</ul></li>'
  69. APWExCloseQuery('QRY')
  70. cHtml := H_PortalMenu()
  71. Web Extended end
  72. return (cHTML)