00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef REPORTER_H
00021 #define REPORTER_H
00022
00023 #include "openschedException.h"
00024 #include "project.h"
00025
00026 typedef struct NETWORK_CELL
00027 {
00028 int isSpace;
00029 TASK *task;
00030
00031 struct NETWORK_CELL *prev;
00032 struct NETWORK_CELL *next;
00033 }
00034 NETWORK_CELL;
00035
00036
00037 class TASKGRAPH
00038 {
00039 public:
00040 TASKGRAPH(int s, int f, string &fn) : start(s), finish(f), filename(fn) {};
00041 int start;
00042 int finish;
00043 const string filename;
00044 };
00045
00046
00047 class TASKNET
00048 {
00049 public:
00050 TASKNET(int s, int f, string &fn) : start(s), finish(f), filename(fn) {};
00051 int start;
00052 int finish;
00053 const string filename;
00054 };
00055
00056
00057 class Reporter
00058 {
00059 public:
00060
00061 typedef enum
00062 {
00063 TXT_REPORT,
00064 TEX_REPORT,
00065 HTML_REPORT
00066 }
00067 REPORTTYPE;
00068
00069 # define VARIABLE(AA,BB,CC) AA BB;
00070 #include "reporter.i"
00071
00072 Reporter();
00073 void DoReports( Project *project );
00074 void HTMLReport( Project *project, char *filename);
00075 void WeeklyReport( Project *project, char *filename, REPORTTYPE rep_type);
00076 void MonthlyReport( Project *project, char *filename, REPORTTYPE rep_type);
00077 void UtilGraph( Project *project, char *filename);
00078 void AddTaskGraph( int d1, int d2, char *fname );
00079 void AddNetworkDiagram(int c1, int c2, char *fname);
00080 void checkComplete();
00081 void SlippageReport( Project *project );
00082 void TextReport( Project *project, char *filename);
00083 void XMLReport( Project *project, char *filename);
00084 void HardSchedule( Project *project, char *filename);
00085 void TexReport( Project *project, char *filename);
00086 void PrintResourcePeriod( Project *project,
00087 FILE *f, RESOURCE *r, int dayNo, int lastDay,
00088 REPORTTYPE rep_type);
00089
00090 private:
00091
00092 typedef int (Reporter::* Pperfunc)(Project *project, int day, char *name);
00093
00094 int Wday(time_t t);
00095 int Mday(time_t t);
00096 void PrintPeriod(Project *project,
00097 FILE *f, int dayNo, int lastDay, char *weekName,
00098 REPORTTYPE rep_type);
00099 void PeriodicReport( Project * project,
00100 Pperfunc IsPeriod,
00101 char *filename,
00102 REPORTTYPE rep_type);
00103 int IsWeek(Project *project, int dayNo, char *name);
00104 int IsMonth(Project *project, int dayNo, char *name);
00105
00106 void Debug(char *fmt, ...);
00107 void Error(char *fmt, ...);
00108 void Warning(char *fmt, ...);
00109 FILE *OpenOutputFile(char *filename);
00110 char *TeXFix(char *buf, const char *txt);
00111 char *HTMLFix(char *buf, const char *txt);
00112 int MapX( Project *project, int dayNo, int start, int finish);
00113 int Bound(int x, int x1, int x2);
00114 int Offset(int x, int x1, int x2 );
00115 FILE *OpenTaskGraph(const char *filename, int x1, int y1, int x2, int y2);
00116 void TaskGraph( Project *project, int start, int finish, const char *filename);
00117 FILE *openNetworkDiagram( Project *project,
00118 const char *filename, int llx, int lly, int urx, int ury);
00119 void write_milestones( Project *project,
00120 FILE *fp, int ax, int bx, int ay, int by);
00121 void write_chart( Project *project, int start, int finish, const char *filename);
00122 NETWORK_CELL *findCellInColumn(int x, const char *id);
00123 void NetworkDiagram( Project *project, int start, int finish, const char *filename);
00124
00125 void constructStartFinish( Project *project );
00126 int maximumX(Project *project);
00127 void assignY(Project *project);
00128 TASK * mStartTask;
00129 TASK * mFinishTask;
00130
00131 void TeXCostReport(Project *project, FILE *f);
00132 void HTMLCostReport(Project *project, FILE *f);
00133 void CostReport(Project *project, char *filename, REPORTTYPE rep_type);
00134
00135 char *monthNames[13];
00136 int Month(time_t t);
00137 int Year(time_t t);
00138
00139 vector<TASKGRAPH *> mTaskGraphs;
00140 vector<TASKNET *> mTaskNets;
00141 };
00142
00143
00144 class ReporterException
00145 : public OpenschedException
00146 {
00147 public:
00148 ReporterException( string reason );
00149 ~ReporterException();
00150 };
00151
00152 #endif
00153
00154
00155
00156
00157
00158