-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskShiftOutput.h
118 lines (93 loc) · 3.54 KB
/
TaskShiftOutput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// TaskShiftOutput.h: interface for the CTaskShiftOutput class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_TASKSHIFTOUTPUT_H__E099EDA7_7DD3_4028_B929_EC9A680E0911__INCLUDED_)
#define AFX_TASKSHIFTOUTPUT_H__E099EDA7_7DD3_4028_B929_EC9A680E0911__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
#include "TaskShiftDefs.h"
#include "IncludedFiles\excel8.h"
enum eTaskShiftOutputType
{
OutputToExcel,
OutputToCSV,
OutputTypeCount
};
enum eTaskShiftOutputItem
{
TaskDescription,
TaskStartTime,
TaskEndTime,
TaskDuration,
TaskDate,
TaskDay,
Blank,
TaskDurationFloat,
TaskBreaks,
OutputItemCount
};
struct tTSOutputColumn
{
CString strLabel;
eTaskShiftOutputItem eItem;
tTSOutputColumn(LPCTSTR label, eTaskShiftOutputItem item) : strLabel(label), eItem(item) { ; }
};
typedef std::vector<tTSOutputColumn> TSOutputColumnVector;
class CTaskShiftOutput
{
public:
CTaskShiftOutput();
virtual ~CTaskShiftOutput();
bool ResetToDefaultOptions();
bool Output(TimeBlockVector &avecTimeBlocks, TaskVector &avecTasks);
bool SaveOutputFormat();
bool LoadOutputFormat();
void SetOutputFolder(LPCTSTR apszOutputFolder) { m_cstrOutputFolder = apszOutputFolder; }
LPCTSTR GetOutputFolder() { return m_cstrOutputFolder; }
void SetOutputFilenameFormat(LPCTSTR apszFormat) { m_cstrOutputFilenameFormat = apszFormat; }
LPCTSTR GetOutputFilenameFormat() { return m_cstrOutputFilenameFormat; }
void SetOutputType(eTaskShiftOutputType aeType) { m_eOutputType = aeType; }
eTaskShiftOutputType GetOutputType() { return m_eOutputType; }
void SetOpenAfterOutput(bool abOpen) { m_bOpenAfterOutput = abOpen; }
bool GetOpenAfterOutput() { return m_bOpenAfterOutput; }
void SetEmailOptions(bool abAttach,
LPCTSTR apszSendTo = NULL,
LPCTSTR apszFrom = NULL,
LPCTSTR apszSMTPServer = NULL,
LPCTSTR apszSubject = NULL,
LPCTSTR apszBody = NULL);
bool GetAttachToEmail() { return m_bAttachToEmail; }
LPCTSTR GetEmailTo() { return m_cstrEmailTo; }
LPCTSTR GetEmailFrom() { return m_cstrEmailFrom; }
LPCTSTR GetEmailSMTPServer() { return m_cstrSMTPServer; }
LPCTSTR GetEmailSubject() { return m_cstrEmailSubject; }
LPCTSTR GetEmailBody() { return m_cstrEmailBody; }
TSOutputColumnVector &GetOutputColumns() { return m_vecColumns; }
static CString m_acstrOutputItemLabel[OutputItemCount];
void SetTemplateFile(LPCTSTR apszTemplateFile) { m_cstrUseTemplateFile = apszTemplateFile; }
LPCTSTR GetTemplateFile() { return m_cstrUseTemplateFile; }
protected:
bool OutputToCSVFile(TimeBlockVector &avecTimeBlocks, LPCTSTR apszFilename, TaskVector &avecTasks);
bool OutputToExcelFile(TimeBlockVector &avecTimeBlocks, LPCTSTR apszFilename, TaskVector &avecTasks);
bool AttachExcelApplication(MSExcel::_Application &atApplication);
protected:
eTaskShiftOutputType m_eOutputType;
bool m_bOpenAfterOutput;
bool m_bAttachToEmail;
bool m_bMergeAdjoiningTasks;
CString m_cstrEmailTo;
CString m_cstrEmailFrom;
CString m_cstrSMTPServer;
CString m_cstrEmailSubject;
CString m_cstrEmailBody;
TSOutputColumnVector m_vecColumns;
CString m_cstrOutputFolder;
CString m_cstrOutputFilenameFormat;
CString m_cstrUseTemplateFile;
bool m_bOutputOnlyChangedColumns;
std::vector<CString> m_vecOutputFormat;
std::vector<CString> m_vecOutputItem;
};
#endif // !defined(AFX_TASKSHIFTOUTPUT_H__E099EDA7_7DD3_4028_B929_EC9A680E0911__INCLUDED_)