Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def build_pos_headers(display_client, display_garment, display_brand, display_supplier, display_season)
- headers = []
- widths = []
- no_main_headers = [display_client, display_garment, display_brand, display_supplier, display_season].count(true)
- font_size (no_main_headers < 3 ? Array([11, 11, 10])[no_main_headers-1] : 9)
- if display_garment
- headers << "Produto"
- widths << Array([100, 96, 80, 67, 47])[no_main_headers-1]
- end
- if display_client
- headers << "Cliente"
- widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
- end
- if display_brand
- headers << "Marca"
- widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
- end
- if display_supplier
- headers << "Fornecedor"
- widths << ([3,4,5].include?(no_main_headers) ? 47 : 50)
- end
- if display_season
- headers << I18n.t('words.season')
- widths << ([5,4].include?(no_main_headers) ? 32 : (no_main_headers == 3 ? 33 : 35) )
- end
- headers += ["PO", "Deadline", "E. #{I18n.t('words.factory')}", "Embarque", I18n.t('words.pieces'), "Destino", "Hold Fabric/Detalhes"]
- case no_main_headers
- when 0
- po_width = 50
- dates_width = 50
- embarque_width = 45
- destino_width = 45
- hold_fabric_width = 224
- when 1
- po_width = 50
- dates_width = 50
- embarque_width = 45
- destino_width = 45
- hold_fabric_width = (display_garment ? 124 : 174)
- when 2
- po_width = 47
- dates_width = 50
- embarque_width = 38
- destino_width = 38
- hold_fabric_width = (display_garment ? 110 : 156)
- when 3
- po_width = 45
- dates_width = 48
- embarque_width = 36
- destino_width = 36
- hold_fabric_width = (display_garment ? 93 : 136)
- when 4
- po_width = 44
- dates_width = 47
- embarque_width = 35
- destino_width = 35
- hold_fabric_width = (display_garment ? 66 : 86)
- when 5
- po_width = 44
- dates_width = 47
- embarque_width = 35
- destino_width = 35
- hold_fabric_width = 39
- end
- widths += [po_width] + [dates_width]*3 + [embarque_width] + [destino_width] + [hold_fabric_width]
- #widths += [44] + [48]*3 + [35] + [38] + [40]
- puts headers
- puts widths
- puts widths.sum
- return [headers, widths]
- end
Add Comment
Please, Sign In to add comment