update 1907240908

This commit is contained in:
vkservicesllc
2019-07-24 09:08:50 -04:00
parent bc7a85782f
commit bc166653c7
6 changed files with 262 additions and 2 deletions

126
app-new/functions.js Normal file
View File

@@ -0,0 +1,126 @@
const ss = weeklySpreadsheets;
var list = '',
uno = '<th>CAROLINA LOGISTIC &nbsp<span>70830515178332</span></th>',
dos = '<th>CAROLINA TRANSPORTATION &nbsp<span>70830515178290</span></th>',
tres = '<th>DELTA EXPRESS &nbsp<span>70830515177576</span></th>',
keys = Object.keys(monthlySpreadsheets);
for (var i = 2; i < 14; i++) {
if (!ss.length || i == ss.length) break;
list += '<li><a class="h" target="_blank" href="';
list += 'https://docs.google.com/spreadsheets/d/' + ss[i].key;
list += '/edit#gid=1250765514">' + ss[i].setTitle() + '</a></li>'
}
list = list.concat(
'<li style="background: beige;"><a class="h" target="_blank" ' +
'title="Open Google Drive folder' + String.fromCharCode(10) +
'containing all weeks' + String.fromCharCode(10) +
'starting Dec 10, 2017" ' +
' href="https://drive.google.com/drive/folders/1MfNPealueJQJKTeV_J9iu9vCQr6qGPn1">' +
'<span>... Entire History</span></a></li>'
);
uno = extend(uno, 'CL', 'Carolina Logistic, Inc');
dos = extend(dos, 'CT', 'Carolina Transportation, Inc');
tres = extend(tres, 'DE', 'Delta Express, Inc');
document.getElementById('tH').innerHTML = ss[0].setTitle();
document.getElementById('tC').innerHTML = ss[0].createAnchor('expense');
document.getElementById('tL').innerHTML = ss[0].createAnchor('payroll');
document.getElementById('bH').innerHTML = ss[1].setTitle();
document.getElementById('bC').innerHTML = ss[1].createAnchor('expense');
document.getElementById('bL').innerHTML = ss[1].createAnchor('payroll');
document.getElementById('hist').innerHTML = list;
document.getElementById('uno').innerHTML = uno;
document.getElementById('dos').innerHTML = dos;
document.getElementById('tres').innerHTML = tres;
document.getElementById('repD').innerHTML = createRepD();
function extend(row, key, title) {
var obj1 = monthlySpreadsheets[keys[1]],
obj2 = monthlySpreadsheets[keys[0]],
mon1 = keys[1].split('-')[1],
mon2 = keys[0].split('-')[1],
now = new Date,
date = new Date(mon2 + ' 1, ' + keys[1].split('-')[0]),
active = now >= date,
user1 = '<span>Helen</span>',
user2 = '<span>Joyce</span>';
const dropCardAnchor = (cardArr, mon, shouldUseActive) => {
if (cardArr[0]) {
let anchorHtml = '<a class="h" target="_blank" title="' + title +
'" href="https://docs.google.com/spreadsheets/d/' + cardArr[0];
row += '<em>' + anchorHtml + '/edit#gid=686342087">';
row += (((shouldUseActive) ? active : true) && cardArr[1]) ? mon + '</a>' : '</a>' + mon;
row += '</em>&nbsp;&nbsp;&nbsp;';
row += anchorHtml + '/edit#gid=1995296890">';
row += (((shouldUseActive) ? active : true) && cardArr[2]) ? user1 + '</a>' : '</a>' + user1;
row += '&nbsp;';
row += anchorHtml + '/edit#gid=2117669368">';
row += (((shouldUseActive) ? active : true) && cardArr[3]) ? user2 + '</a>' : '</a>' + user2;
}
};
const dropMcAnchor = (mcArr, mon, shouldUseActive) => {
if (mcArr[0]) {
row += '<a class="h" target="_blank" title="' + title;
row += '" href="https://docs.google.com/spreadsheets/d/' + mcArr[0];
row += '/edit#gid=1165085359">';
row += (((shouldUseActive) ? active : true) && mcArr[1]) ? mon + '</a>' : '</a>' + mon;
}
}
row += '<td>'; dropCardAnchor(obj1.cards[key], mon1); row += '</td>';
row += '<td>'; dropCardAnchor(obj2.cards[key], mon2, true); row += '</td>';
row += '<td>'; dropMcAnchor(obj1.money_codes[key], mon1); row += '</td>';
row += '<td>'; dropMcAnchor(obj2.money_codes[key], mon2, true); row += '</td>';
return row;
}
function createRepD() {
var el = 'Reporting Drivers',
mon1 = keys[0].split('-')[1],
mon2 = keys[1].split('-')[1],
now = new Date,
date = new Date(mon1 + ' 1, ' + keys[1].split('-')[0]),
showNew = now >= date,
id = (showNew) ? monthlySpreadsheets[keys[0]].repTabId : monthlySpreadsheets[keys[1]].repTabId,
mon = '<span>' + ((showNew) ? mon1 : mon2) + '<span>';
if (id) el = '<a class="h" target="_blank" href="https://docs.google.com/spreadsheets/d/' +
'1b2g3BARa4ibqdqtTj5_IQoBSI8hp6A4R5A3bSbrfA58/edit?pli=1#gid=' + id + '">' +
el + ' ' + mon + '</a>';
return el;
}

55
app-new/months.js Normal file
View File

@@ -0,0 +1,55 @@
const monthlySpreadsheets = {
/*
'yyyy-mmm': { repTabId: '',
cards: {
CL: ['', 1, 1, 1],
CT: ['', 1, 1, 1],
DE: ['', 1, 1, 1],
},
money_codes: {
CL: ['', 1],
CT: ['', 1],
DE: ['', 1],
},
},
*/
'2019-Aug': { repTabId: '250126383',
cards: {
CL: ['1HUbp1T4Mxjev85qpLUIHzmTbtiTsIsgj8dsODyEH5S8', 1, 1, 1],
CT: ['1hNf1mtmgUua6pZRv7YRsBzYuHzKSX8vJN2oBpV2VXG0', 1, 1, 1],
DE: ['1azSH_gx4LAdRU3-gfZeqZC4gUpEXuTd1VI3MkLZ4YFc', 1, 1, 1],
},
money_codes: {
CL: ['1TJIVqKqPaw-nNVyfIZUDPuOXSEffZhIu85Ao6eV6Y28', 1],
CT: ['14CcOWxZkn7oVhVXA_LIQjGgUD4vECQdQ70I0JZLL0qs', 1],
DE: ['', 1],
},
},
'2019-Jul': { repTabId: '474259561',
cards: {
CL: ['11vp8gorwJRpoXOv3fwxuYYpiHc0Lg0LnzRET24blxRc', 1, 1, 1],
CT: ['1pCh07jpwDT-qxBeMtrrPWar2YumSc7TgLBz_gbfKzmY', 1, 1, 1],
DE: ['1KLX_q0iuBj9vCIp9Ix7moAlPYpR5_NYMRZXO-mmWmDE', 1, 1, 1],
},
money_codes: {
CL: ['1hnxrK1FrL_XcF4kExhVkqn1Btlfvc1s7B2p7E2WjA-A', 1],
CT: ['1XQenYPKvzp1CcjgJQDkk8PCXcS5pktfF5NpONmcGN6Q', 1],
DE: ['', 1],
},
},
};

52
app-new/objects.js Normal file
View File

@@ -0,0 +1,52 @@
// Weeks
function WeeklySpreadsheet(start, key) {
this.start = new Date(start);
this.key = key;
this.setTitle = () => {
let end = addDays(this.start, 6);
let monthsArr = new Months().short;
return monthsArr[this.start.getMonth()] + ' ' + this.start.getDate() + ' — ' +
monthsArr[end.getMonth()] + ' ' + end.getDate();
};
this.createAnchor = purpose => {
let title = this.setTitle(), text = '';
let active = new Date().getTime() >= this.start.getTime();
let anchor = '<a class="h" target="_blank" href="https://docs.google.com/spreadsheets/d/';
anchor += this.key + '/edit#gid=';
switch (purpose) {
case 'expense': anchor += '914973738'; text = 'URL Collector'; break;
case 'payroll': anchor += '978213208'; text = 'Payroll Hyperlinks'; break;
}
anchor += '" title="' + title + '">' + ((active) ? text + '</a>' : '</a>' + text);
return anchor;
};
}
// Assistance
function Months() {
this.short = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
];
// this.long = [
// 'January', 'February', 'March',
// 'April', 'May', 'June',
// 'July', 'August', 'September',
// 'October', 'November', 'December'
// ];
}
function addDays(date, days) {
return new Date(date.getTime() + days * 24 * 60 * 60 * 1000);
}

15
app-new/weeks.js Normal file
View File

@@ -0,0 +1,15 @@
const weeklySpreadsheets = [
// WeeklySpreadsheet(start, key),
new WeeklySpreadsheet('07/28/2019', '1XpaNJI3VsTRWB6NLFcfTUHAXa6M0yDihjWKElVmCick'),
new WeeklySpreadsheet('07/21/2019', '1GF3bHikV1W21xKVSCi9yrfNDlZOSw90ibmN5UuD-r_c'),
new WeeklySpreadsheet('07/14/2019', '1OSvqOCv-f0JeIQZsagAaHgQZtuO1DRp3lgkGowc7tWU'),
new WeeklySpreadsheet('07/07/2019', '1tLQhHkQ7ZsID96BKf2AGma_FVVLW9bJoEFdeIe7KaBE'),
new WeeklySpreadsheet('06/30/2019', '1E87lbH7CaQn9V_S0YLBB1MJrHJTcB2o_taDd_gWhkBs')
];