/* VK Services, LLC v1.0 | 20180811 License: none (public) */ var el = [], list = '', gHttp = 'https://docs.google.com/spreadsheets/d/', idPointer = '/edit#gid=', IDs = [ 'tH', 'tC', 'tL', 'bH', 'bC', 'bL', 'hist', 'uno', 'dos', 'tres' ], idLen = IDs.length, user1 = 'Helen', user2 = 'Joyce'; // timers / decisions var wkEffDt = new Date('2018-10-20'), mnEffDt = new Date('2018-10-31'), today = new Date(), weeklyTopKey = (today >= wkEffDt) ? '11x3ZRsTrQiKHeZkOUDqZ9kWVNO6OuzhyJWUm-S45Atg' : '#', mI = (today >= mnEffDt) ? 1 : 0; // weekly URLS var weeklyUrls = { top: { header: 'Oct 21 — Oct 27', key: weeklyTopKey, collectorId: '914973738', linkId: '978213208' }, bottom: { header: 'Oct 14 — Oct 20', key: '1gV1QNaRESX95EnLXonsAMTa3eY_l_q7nPMYPnj-AGQ0', collectorId: '914973738', linkId: '978213208' }, show: function(top, purpose) { var dir, val; if (top) { dir = this.top; } else { dir = this.bottom; } var linkBuilder = (purpose > 0) ? '' + 'URL Collector'; } else { val = linkBuilder + '#">URL Collector'; } break; case 2: if (dir.key != '#') { val = linkBuilder + dir.linkId + '">' + 'Payroll Hyperlinks'; } else { val = linkBuilder + '#">Payroll Hyperlinks'; } } return val; } }; // history var historyList = [ { header: ' — ', key: '#', id: '1250765514' }, { header: 'Oct 7 — Oct 13', key: '1bWEbPgE2Zs8u4sZ5ys5qlFcXRj2oWMYce9c4WL0wP3w', id: '1250765514' }, { header: 'Sep 30 — Oct 6', key: '1Pufb8yCXh0CNG5Kizm-jfyD2BV1dQyXlgQUXYP8ZrZM', id: '1250765514' }, { header: 'Sep 23 — Sep 29', key: '1n2EEk44WA_KRJqLNzVaZDqTF7K0HNiOHWsXHtk-ifVw', id: '1250765514' }, { header: 'Sep 16 — Sep 22', key: '1w8CbjzLOVtQ-BJhdo5RzIxFqhsrZeSCcPKorX7opZq0', id: '1250765514' }, { header: 'Sep 9 — Sep 15', key: '1onTJWxXam4hqJwoEY6HWj7OXBbvr24iIaIDkMnF3RxE', id: '1250765514' }, { header: 'Sep 2 — Sep 8', key: '1G9G1599r3C9FaMtC83OyErB1byAdKr9DxBIfzp7-vaY', id: '1250765514' }, { header: 'Aug 26 — Sep 1', key: '1TSDMsATXzu7LqabccJLfgpM8G0y1Ux64IOh9pkGqf2s', id: '1250765514' }, { header: 'Aug 19 — Aug 25', key: '1Dku5Hw_HUVGVhFYQjNOSHxLhjazYjxKPJ-97OyE1fjQ', id: '1250765514' }, { header: 'Aug 12 — Aug 18', key: '1SOxJyR4Lu9g9uZnxkNDFogeplQOiLBTcfknKhQJJGLU', id: '1250765514' }, { header: 'Aug 5 — Aug 11', key: '1-_pg13i_0z9AQ1htln6TQtuVG4tlGsat8EoIjpJQKsM', id: '1250765514' }, { header: 'Jul 29 — Aug 4', key: '16VR3LxYIjSRBOCUcsN9pd6GlD6sGNUwHfPUx1mma9Y0', id: '1250765514' }, { header: 'Jul 22 — Jul 28', key: '1Me0A2QT1rjs4yjkzk9VmF2IesMFnbcNvRt_t8aMLTrQ', id: '1250765514' }, { header: 'Jul 15 — Jul 21', key: '1om2yc9ZZzw-sSEpwTe5zsXSPDv-LJLOb1l3qxcew09w', id: '1250765514' }, { header: 'Jul 8 — Jul 14', key: '1FFdgUldfpiBPMzoi9DRqOFPWDC3wio0cUipYj78C1F4', id: '1250765514' }, { header: 'Jul 1 — Jul 7', key: '1vWTfjW7OPc5ref78iwDh_5QuU5e1ZHNCS9TCuzT4LL0', id: '1250765514' }, ]; // monthly URLs var monthlyUrls = { CL: { title: 'Carolina Logistic, Inc', name: 'CAROLINA LOGISTIC  708305151783320', month1_cards: { user0: [1, '686342087'], user1: [1, '1995296890'], user2: [1, '2117669368'], month_key: ['Oct', '1iGfQHOCjvbpy-oY6LDaKmbzh8yLIw6ECGF-KTKHDbbM'] }, month2_cards: { user0: [mI, '686342087'], user1: [mI, '1995296890'], user2: [mI, '2117669368'], month_key: ['Nov', '1_2O8iuEPL09N5B5sLeWjbVL1KU23gzlbSGIR6ZmwOLw'] }, month1_codes: { user0: [1, '1165085359', '1782605551'], month_key: ['Oct', '1DgqMnLzN6I85wUdkM8YKSbTk5Mp9kJdGb-rLZWHsfXY'] }, month2_codes: { user0: [mI, '1165085359', '1782605551'], month_key: ['Nov', '17i83HKnlJ5tH-M-nD7mCD8s5Wd3kdqfQSN9VibPVWHQ'] } }, CT: { title: 'Carolina Transportation, Inc', name: 'CAROLINA TRANSPORTATION  70830515178290', month1_cards: { user0: [1, '686342087'], user1: [1, '1995296890'], user2: [1, '2117669368'], month_key: ['Oct', '1n9RDORRFa7HgjHqKE_ELi-vKA75IVzMNpOYYsuWkxJQ'] }, month2_cards: { user0: [mI, '686342087'], user1: [mI, '1995296890'], user2: [mI, '2117669368'], month_key: ['Nov', '1LtSWqxJ2KGlpLqa1FGj7OTaPbmvqPxNVL8QjCk5kkRo'] }, month1_codes: { user0: [1, '1165085359', '1782605551'], month_key: ['Oct', '1axHhWC77PrYxQgBYwLO5BtfyTfI_LiPdYNMoku-JJ70'] }, month2_codes: { user0: [mI, '1165085359', '1782605551'], month_key: ['Nov', '1kYpzrEfG5Ga7apDG313Rb3OH9l4l1C0gVB2hE2ue2h4'] } }, DE: { title: 'Delta Express, Inc', name: 'DELTA EXPRESS  70830515177576', month1_cards: { user0: [1, '686342087'], user1: [1, '1995296890'], user2: [1, '2117669368'], month_key: ['Oct', '1mxNC1B3zz1MwwKthZUJyw_7ANA8j9Exoddv-wSqFt_o'] }, month2_cards: { user0: [mI, '686342087'], user1: [mI, '1995296890'], user2: [mI, '2117669368'], month_key: ['Nov', '1wKfkvH-Con2Y9J8zE14rlHhZ4d0MHYjvbMeSCoKxadM'] }, month1_codes: { user0: [0, '1165085359', '1782605551'], month_key: ['Aug', '#'] }, month2_codes: { user0: [mI, '1165085359', '1782605551'], month_key: ['Sep', '#'] } } } // reporting drivers var repId = '1627254794', month = 'Oct'; var el_rd = '' + 'Reporting Drivers ' + month + ''; document.getElementById('repD').innerHTML = el_rd; // element list by IDs for (var i = 0; i < idLen; i++) { el[i] = document.getElementById(IDs[i]); } // history list for (var j = 1; j <= 12; j++) { list += '
  • ' + historyList[j].header + '
  • '; } list = list.concat( '
  • ' + '... Entire History
  • ' ); // monthly URLs distribution function showMonthlyUrls(idx) { var comps = ['CL', 'CT', 'DE'], dir = monthlyUrls[comps[idx]], val; var pt1 = '', pt2 = '', pt3 ='', pt4 = '', pt5 = '', pt6 = '', pt7 = '', pt8 = '', anchor = '' + dir.month1_cards.month_key[0]; break; case 1: pt1 += gHttp + dir.month1_cards.month_key[1] + idPointer + dir.month1_cards.user0[1] + '">'; pt1 += dir.month1_cards.month_key[0] + ''; } pt2 = anchor; switch (dir.month1_cards.user1[0]) { case 0: pt2 += '">' + user1; break; case 1: pt2 += gHttp + dir.month1_cards.month_key[1] + idPointer + dir.month1_cards.user1[1] + '">'; pt2 += user1 + ''; } pt3 = anchor; switch (dir.month1_cards.user2[0]) { case 0: pt3 += '">' + user2; break; case 1: pt3 += gHttp + dir.month1_cards.month_key[1] + idPointer + dir.month1_cards.user2[1] + '">'; pt3 += user2 + ''; } } if (dir.month2_cards.month_key[1] != '#') { pt4 = anchor; switch (dir.month2_cards.user0[0]) { case 0: pt4 += '">' + dir.month2_cards.month_key[0]; break; case 1: pt4 += gHttp + dir.month2_cards.month_key[1] + idPointer + dir.month2_cards.user0[1] + '">'; pt4 += dir.month2_cards.month_key[0] + ''; } pt5 = anchor; switch (dir.month2_cards.user1[0]) { case 0: pt5 += '">' + user1; break; case 1: pt5 += gHttp + dir.month2_cards.month_key[1] + idPointer + dir.month2_cards.user1[1] + '">'; pt5 += user1 + ''; } pt6 = anchor; switch (dir.month2_cards.user2[0]) { case 0: pt6 += '">' + user2; break; case 1: pt6 += gHttp + dir.month2_cards.month_key[1] + idPointer + dir.month2_cards.user2[1] + '">'; pt6 += user2 + ''; } } if (dir.month1_codes.month_key[1] != '#') { pt7 = anchor; switch (true) { case dir.month1_codes.user0[0] == 0: pt7 += '">' + dir.month1_codes.month_key[0]; break; case dir.month1_codes.user0[0] > 0: var n = dir.month1_codes.user0[0]; pt7 += gHttp + dir.month1_codes.month_key[1] + idPointer + dir.month1_codes.user0[n] + '">'; pt7 += dir.month1_codes.month_key[0] + ''; } } if (dir.month2_codes.month_key[1] != '#') { pt8 = anchor; switch (true) { case dir.month2_codes.user0[0] == 0: pt8 += '">' + dir.month2_codes.month_key[0]; break; case dir.month2_codes.user0[0] > 0: var n = dir.month2_codes.user0[0]; pt8 += gHttp + dir.month2_codes.month_key[1] + idPointer + dir.month2_codes.user0[n] + '">'; pt8 += dir.month2_codes.month_key[0] + ''; } } val = dir.name + '' + pt1 + '   ' + pt2 + ' ' + pt3 + '' + '' + pt4 + '   ' + pt5 + ' ' + pt6 + '' + '' + pt7 + '' + '' + pt8 + ''; return val; } // element insertion el[0].innerHTML = weeklyUrls.show(true, 0); el[1].innerHTML = weeklyUrls.show(true, 1); el[2].innerHTML = weeklyUrls.show(true, 2); el[3].innerHTML = weeklyUrls.show(false, 0); el[4].innerHTML = weeklyUrls.show(false, 1); el[5].innerHTML = weeklyUrls.show(false, 2); el[6].innerHTML = list; el[7].innerHTML = showMonthlyUrls(0); el[8].innerHTML = showMonthlyUrls(1); el[9].innerHTML = showMonthlyUrls(2);