Commit c7ca364c authored by Omar Chehab's avatar Omar Chehab

Set Payslip and Billable time Date to today and add preprepend Description with start date

parent 379651da
......@@ -532,8 +532,8 @@ importReportTab.addEventListener('submit', async function(event) {
if (togglReport.data.length > 0) {
managerBillableTime = togglReport.data.map(group => (
group.items.map(item => ({
Date: selections.reportStartDate,
Description: `${selections.reportEndDate} - ${group.title.project} - ${item.title.user}${item.cur !== null ? ' - ' + item.cur : ''}`,
Date: today(),
Description: `${selections.reportStartDate} - ${selections.reportEndDate} - ${group.title.project} - ${item.title.user}${item.cur !== null ? ' - ' + item.cur : ''}`,
Hours: hours(item.time),
Minutes: minutes(item.time),
HourlyRate: item.rate || 0,
......@@ -564,8 +564,8 @@ importReportTab.addEventListener('submit', async function(event) {
managerPayslip = null
if (togglReport.data.length > 0) {
managerPayslip = {
Date: selections.reportStartDate,
Description: selections.reportEndDate,
Date: today(),
Description: `${selections.reportStartDate} - ${selections.reportEndDate}`,
Earnings: togglReport.data.map(group => ({
Units: 1,
Rate: group.total_currencies[0].amount || 0,
......@@ -775,4 +775,8 @@ function refreshAllTabsMatching(pathname) {
}
});
});
}
function today() {
return new Date().toISOString().substr(0, 10);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment