/
Tmsrpt13.c
116 lines (113 loc) · 3.42 KB
/
Tmsrpt13.c
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
//
// This program code is a part of The Master Scheduler (TMS)
// and is Copyright (C) 1991-2004 Schedule Masters, Inc.
// All rights reserved.
//
#include "TMSHeader.h"
//
// Unassigned drivers report
//
BOOL FAR TMSRPT13(TMSRPTPassedDataDef *pPassedData)
{
HFILE hfOutputFile;
BOOL bKeepGoing = FALSE;
char szOutputString[128];
long year, month,day;
int rcode2;
int nI;
pPassedData->nReportNumber = 12;
pPassedData->numDataFiles = 1;
for(nI = 0; nI < m_LastReport; nI++)
{
if(TMSRPT[nI].originalReportNumber == pPassedData->nReportNumber)
{
StatusBarStart(hWndMain, TMSRPT[nI].szReportName);
break;
}
}
//
// Open the output file
//
StatusBarText("Cycling through roster...");
strcpy(tempString, szReportsTempFolder);
strcat(tempString, "\\tmsrpt13.txt");
hfOutputFile = _lcreat(tempString, 0);
if(hfOutputFile == HFILE_ERROR)
{
LoadString(hInst, ERROR_202, szFormatString, sizeof(szFormatString));
sprintf(szarString, szFormatString, tempString);
MessageBeep(MB_ICONSTOP);
MessageBox((HWND)NULL, szarString, TMS, MB_ICONSTOP);
goto deallocate;
}
strcpy(pPassedData->szReportDataFile[0], tempString);
//
// Loop through the drivers in seniority order
//
rcode2 = btrieve(B_GETFIRST, TMS_DRIVERS, &DRIVERS, &DRIVERSKey2, 2);
while(rcode2 == 0)
{
if(ConsideringThisDriverType(DRIVERS.DRIVERTYPESrecordID))
{
ROSTERKey2.DRIVERSrecordID = DRIVERS.recordID;
rcode2 = btrieve(B_GETEQUAL, TMS_ROSTER, &ROSTER, &ROSTERKey2, 2);
if(rcode2 != 0)
{
if(DRIVERS.DRIVERTYPESrecordID == NO_RECORD)
{
strcpy(tempString, "");
}
else
{
DRIVERTYPESKey0.recordID = DRIVERS.DRIVERTYPESrecordID;
rcode2 = btrieve(B_GETEQUAL, TMS_DRIVERTYPES, &DRIVERTYPES, &DRIVERTYPESKey0, 0);
if(rcode2 != 0)
{
strcpy(tempString, "");
}
else
{
strncpy(tempString, DRIVERTYPES.name, DRIVERTYPES_NAME_LENGTH);
trim(tempString, DRIVERTYPES_NAME_LENGTH);
}
}
strcpy(szOutputString, tempString);
strcat(szOutputString, "\t");
GetYMD(DRIVERS.seniorityDate, &year, &month, &day);
sprintf(tempString, "%4ld/%02ld/%02ld - ", year, month, day);
strcat(szOutputString, tempString);
strncpy(tempString, DRIVERS.lastName, DRIVERS_LASTNAME_LENGTH);
trim(tempString, DRIVERS_LASTNAME_LENGTH);
strcat(szOutputString, tempString);
strcat(szOutputString, ", ");
strncpy(tempString, DRIVERS.firstName, DRIVERS_FIRSTNAME_LENGTH);
trim(tempString, DRIVERS_FIRSTNAME_LENGTH);
strcat(szOutputString, tempString);
strncpy(tempString, DRIVERS.badgeNumber, DRIVERS_BADGENUMBER_LENGTH);
trim(tempString, DRIVERS_BADGENUMBER_LENGTH);
if(strcmp(tempString, "") != 0)
{
strcat(szOutputString, " (Badge ");
strcat(szOutputString, tempString);
strcat(szOutputString, ")");
}
strcat(szOutputString, "\r\n");
_lwrite(hfOutputFile, szOutputString, strlen(szOutputString));
}
}
rcode2 = btrieve(B_GETNEXT, TMS_DRIVERS, &DRIVERS, &DRIVERSKey2, 2);
}
bKeepGoing = TRUE;
//
// Free allocated memory / close output file
//
deallocate:
_lclose(hfOutputFile);
StatusBarEnd();
if(!bKeepGoing)
return(FALSE);
//
// All done
//
return(TRUE);
}