Guest User

Untitled

a guest
Dec 12th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. def build_pos_headers(display_client, display_garment, display_brand, display_supplier, display_season)
  2. headers = []
  3. widths = []
  4. no_main_headers = [display_client, display_garment, display_brand, display_supplier, display_season].count(true)
  5. font_size (no_main_headers < 3 ? Array([11, 11, 10])[no_main_headers-1] : 9)
  6. if display_garment
  7. headers << "Produto"
  8. widths << Array([100, 96, 80, 67, 47])[no_main_headers-1]
  9. end
  10. if display_client
  11. headers << "Cliente"
  12. widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
  13. end
  14. if display_brand
  15. headers << "Marca"
  16. widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
  17. end
  18. if display_supplier
  19. headers << "Fornecedor"
  20. widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
  21. end
  22. if display_season
  23. headers << I18n.t('words.season')
  24. widths << ([5,4].include?(no_main_headers) ? 32 : (no_main_headers == 3 ? 33 : 35) )
  25. end
  26. headers += ["PO", "Deadline", "E. #{I18n.t('words.factory')}", "Embarque", I18n.t('words.pieces'), "Destino", "Hold Fabric/Detalhes"]
  27. case no_main_headers
  28. when 0
  29. po_width = 50
  30. dates_width = 50
  31. embarque_width = 45
  32. destino_width = 45
  33. hold_fabric_width = 224
  34. when 1
  35. po_width = 50
  36. dates_width = 50
  37. embarque_width = 45
  38. destino_width = 45
  39. hold_fabric_width = (display_garment ? 124 : 174)
  40. when 2
  41. po_width = 47
  42. dates_width = 50
  43. embarque_width = 38
  44. destino_width = 38
  45. hold_fabric_width = (display_garment ? 110 : 156)
  46. when 3
  47. po_width = 45
  48. dates_width = 48
  49. embarque_width = 36
  50. destino_width = 36
  51. hold_fabric_width = (display_garment ? 93 : 136)
  52. when 4
  53. po_width = 44
  54. dates_width = 47
  55. embarque_width = 35
  56. destino_width = 35
  57. hold_fabric_width = (display_garment ? 66 : 86)
  58. when 5
  59. po_width = 44
  60. dates_width = 47
  61. embarque_width = 35
  62. destino_width = 35
  63. hold_fabric_width = 39
  64. end
  65. widths += [po_width] + [dates_width]*3 + [embarque_width] + [destino_width] + [hold_fabric_width]
  66. #widths += [44] + [48]*3 + [35] + [38] + [40]
  67. puts headers
  68. puts widths
  69. puts widths.sum
  70. return [headers, widths]
  71. end
Add Comment
Please, Sign In to add comment