33 ON_BN_CLICKED( IDOK, OnBnClickedOk )
34 ON_EN_SETFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_SHIPPER, OnEnSetfocusLoginEdit )
35 ON_EN_KILLFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_SHIPPER, OnEnKillfocusLoginEdit )
36 ON_EN_SETFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_DOC_NUM, OnEnSetfocusLoginEdit )
37 ON_EN_KILLFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_DOC_NUM, OnEnKillfocusLoginEdit )
38 ON_EN_SETFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_COMMODITY, OnEnSetfocusLoginEdit )
39 ON_EN_KILLFOCUS( IDC_DRIVER_SHIPMENTS_EDIT_COMMODITY, OnEnKillfocusLoginEdit )
40 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_TIMESTAMP_DATE, OnDateTimeCtrlSetFocus )
41 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_TIMESTAMP_DATE, OnDateTimeCtrlKillFocus )
42 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_TIMESTAMP_TIME, OnDateTimeCtrlSetFocus )
43 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_TIMESTAMP_TIME, OnDateTimeCtrlKillFocus )
44 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_START_TIME_DATE, OnDateTimeCtrlSetFocus )
45 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_START_TIME_DATE, OnDateTimeCtrlKillFocus )
46 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_START_TIME_TIME, OnDateTimeCtrlSetFocus )
47 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_START_TIME_TIME, OnDateTimeCtrlKillFocus )
48 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_END_TIME_DATE, OnDateTimeCtrlSetFocus )
49 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_END_TIME_DATE, OnDateTimeCtrlKillFocus )
50 ON_NOTIFY( NM_SETFOCUS, IDC_DRIVER_SHIPMENTS_END_TIME_TIME, OnDateTimeCtrlSetFocus )
51 ON_NOTIFY( NM_KILLFOCUS, IDC_DRIVER_SHIPMENTS_END_TIME_TIME, OnDateTimeCtrlKillFocus )
53 ON_LBN_SETFOCUS( IDC_DRIVER_SHIPMENTS_LST_SHIPMENTS, OnLbnSetfocusShipmentList )
54 ON_LBN_KILLFOCUS( IDC_DRIVER_SHIPMENTS_LST_SHIPMENTS, OnLbnKillfocusShipmentList )
62 BOOL CAobrdDriverShipmentsDlg::ShowShipments( CWnd * aParent,
AobrdDriverItem * aDriver )
64 CAobrdDriverShipmentsDlg dlg( aParent, aDriver );
65 INT_PTR r = dlg.DoModal();
81 , mSelectedIndex( -1 )
82 , mShipperName( _T(
"") )
83 , mDocumentNumber( _T(
"") )
84 , mCommodity( _T(
"") )
85 , mTimestampDate( COleDateTime::GetCurrentTime() )
86 , mTimestampTime( COleDateTime::GetCurrentTime() )
87 , mStartTimeDate( COleDateTime::GetCurrentTime() )
88 , mStartTimeTime( COleDateTime::GetCurrentTime() )
89 , mEndTimeDate( COleDateTime::GetCurrentTime() )
90 , mEndTimeTime( COleDateTime::GetCurrentTime() )
107 CDataExchange * aDataExchange
110 CDialog::DoDataExchange( aDataExchange );
132 CDialog::OnInitDialog();
139 SetWindowPos( NULL, 700, 350, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
146 title.Format( _T(
"AOBRD Driver Shipments for %s %s (%s)" ), mDriver->getFirstName(), mDriver->getLastName(), mDriver->getDriverId() );
147 SetWindowText( title );
157 mShipperName = _T(
"" );
158 mDocumentNumber = _T(
"" );
159 mCommodity = _T(
"" );
160 mTimestampDate = COleDateTime::GetCurrentTime();
161 mTimestampTime = COleDateTime::GetCurrentTime();
162 mStartTimeDate = COleDateTime::GetCurrentTime();
163 mStartTimeTime = COleDateTime::GetCurrentTime();
164 mEndTimeDate = COleDateTime::GetCurrentTime();
165 mEndTimeTime = COleDateTime::GetCurrentTime();
178 mSelectedIndex = mListBox.GetCurSel();
179 int topIndex = mListBox.GetTopIndex();
182 mListBox.ResetContent();
184 std::vector<AobrdShipment> shipments = mDriver->getShipments();
185 std::vector<AobrdShipment>::iterator iter;
187 for( iter = shipments.begin(); iter != shipments.end(); ++iter )
191 mListBox.AddString( listItem );
198 mListBox.SetCurSel( mSelectedIndex );
199 mListBox.SetTopIndex( topIndex );
216 mListBox.SetCurSel( mSelectedIndex );
232 if( mSelectedIndex >= 0 )
234 mDriver->deleteShipment( mSelectedIndex );
238 if( mSelectedIndex < 0 )
259 date_time.
date.
month = (
uint8 ) ( 0x00FF & datePart.GetMonth() );
260 date_time.
date.
day = (
uint8 ) ( 0x00FF & datePart.GetDay() );
266 timestamp = date + time;
302 if( 0 <= mSelectedIndex )
304 shipment = mDriver->getShipments().at( mSelectedIndex );
307 char shipperName[40];
311 WideCharToMultiByte( CP_UTF8, 0, mShipperName, -1, shipperName,
sizeof( shipperName ), NULL, NULL );
312 WideCharToMultiByte( CP_UTF8, 0, mDocumentNumber, -1, docNumber,
sizeof( docNumber ), NULL, NULL );
313 WideCharToMultiByte( CP_UTF8, 0, mCommodity, -1, commodity,
sizeof( commodity ), NULL, NULL );
323 if( 0 <= mSelectedIndex )
325 mDriver->replaceShipment( shipment, mSelectedIndex );
329 mDriver->addShipment( shipment );
346 if( (
"" != mShipperName ) && (
"" != mDocumentNumber ) &&
347 (
"" != mCommodity ) &&
348 ( COleDateTime::valid == mTimestampDate.GetStatus() ) && ( COleDateTime::valid == mTimestampTime.GetStatus() ) &&
349 ( COleDateTime::valid == mStartTimeDate.GetStatus() ) && ( COleDateTime::valid == mStartTimeTime.GetStatus() ) &&
350 ( COleDateTime::valid == mEndTimeDate.GetStatus() ) && ( COleDateTime::valid == mEndTimeTime.GetStatus() ) )
369 mSelectedIndex = listBox->GetCurSel();
371 if( mSelectedIndex >= 0 && mSelectedIndex < listBox->GetCount() )
373 AobrdShipment shipment = mDriver->getShipments().at( mSelectedIndex );
387 OnChangeShipmentData();
395 listBox->SetCurSel( mSelectedIndex );
422 CDialog::PostNcDestroy();
454 SendMessage( DM_SETDEFID, IDOK );
464 SendMessage( DM_SETDEFID, IDOK );
484 SendMessage( DM_SETDEFID, IDOK );
void setServerEndTime(const time_type &aTimestamp)
Set the Server End Time for this item.
struct date_time_data_type::_date date
afx_msg void OnBnClickedSet()
Button handler for the Set button.
void setDocNumber(const std::string &aDocNumber)
Set the Document Number for this item.
uint8 second
second (0-59)
void setServerTimestamp(const time_type &aTimestamp)
Set the Server Timestamp for this item.
#define IDC_DRIVER_SHIPMENTS_START_TIME_DATE
Data structure to holds an AOBRD shipment info. Used by the FmiApplicationLayer to provision shipment...
time_type getServerTimestamp() const
Get item's server timestamp.
#define IDC_DRIVER_SHIPMENTS_EDIT_DOC_NUM
uint8 minute
minute (0-59)
void setCommodity(const std::string &aCommodity)
Set the Commodity for this item.
#define IDC_DRIVER_SHIPMENTS_TIMESTAMP_DATE
#define IDC_DRIVER_SHIPMENTS_TIMESTAMP_TIME
afx_msg void OnDateTimeCtrlKillFocus(NMHDR *pNotifyStruct, LRESULT *result)
Handles the kill focus event for date time controls.
afx_msg void OnLbnSelchangeShipmentList()
Selection Changed handler for the Shipments List box.
struct date_time_data_type::_time time
void UTIL_convert_time_type_to_seconds(const date_time_data_type *aDateTime, time_type *aSeconds)
Converts a time_type to seconds since midnight.
#define IDC_DRIVER_SHIPMENTS_BTN_DELETE
afx_msg void OnBnClickedNew()
Button handler for the New button.
void UTIL_convert_seconds_to_time_type(const time_type *aSeconds, date_time_data_type *aDateTime)
Converts from a Garmin time to a structure containing separate members for hour, minute, and second (time_type).
signed short int sint16
16-bit signed integer
Date & time data type with separate fields for month, day, year, hour, minute, and second...
time_type getServerStartTime() const
Get item's server start time.
virtual void DoDataExchange(CDataExchange *pDX)
Perform dialog data exchange and validation.
CString getShipperName() const
Get item's shipper name.
void setServerStartTime(const time_type &aTimestamp)
Set the Server Start Time for this item.
#define IDC_DRIVER_SHIPMENTS_EDIT_SHIPPER
void updateListBox()
Update the shipments list box from the list owned by the driver.
virtual ~CAobrdDriverShipmentsDlg()
Destructor.
BOOL OnInitDialog()
This function is called when the window is created.
void UTIL_convert_seconds_to_date_type(const time_type *aSeconds, date_time_data_type *aDateTime)
Converts a Garmin date to a structure containing year, month, and day.
#define IDC_DRIVER_SHIPMENTS_END_TIME_TIME
#define IDC_DRIVER_SHIPMENTS_END_TIME_DATE
boolean UTIL_convert_date_time_to_seconds(const date_time_data_type *aDateTime, time_type *aSeconds)
Converts a date from from a structure to a Garmin date.
#define IDC_DRIVER_SHIPMENTS_BTN_NEW
CString getCommodity() const
Get item's commodity.
unsigned short int uint16
16-bit unsigned integer
afx_msg void OnEnKillfocusLoginEdit()
Handles the kill focus event for the driver ID and password edit boxes.
#define IDC_DRIVER_SHIPMENTS_LST_SHIPMENTS
#define IDC_DRIVER_SHIPMENTS_START_TIME_TIME
afx_msg void OnLbnSetfocusShipmentList()
Handles the set focus event for the driver list.
static time_type convertToTimeType(COleDateTime &datePart, COleDateTime &timePart)
Convert COleDateTime pairs to time_type.
Data structure to holds an AOBRD driver info. Used by the FmiApplicationLayer to validate logins when...
void PostNcDestroy()
Called by MFC after the window has been destroyed; performs final termination activities.
uint16 year
Real year (1990 means 1990!)
afx_msg void OnEnSetfocusLoginEdit()
Handles the set focus event for the driver ID and password edit boxes.
#define IDC_DRIVER_SHIPMENTS_BTN_SET
afx_msg void OnBnClickedOk()
Button handler for the OK button.
unsigned char uint8
8-bit unsigned integer
#define IDD_AOBRD_DRIVER_SHIPMENTS
void setShipperName(const std::string &aShipperName)
Set the Shipper Name for this item.
static COleDateTime convertFromTimeType(time_type aTimestamp)
Convert time_type to COleDateTime for use with CDateTimeCtrl.
time_type getServerEndTime() const
Get item's server end time.
#define IDC_DRIVER_SHIPMENTS_EDIT_COMMODITY
afx_msg void OnBnClickedDelete()
Button handler for the Delete button.
afx_msg void OnDateTimeCtrlSetFocus(NMHDR *pNotifyStruct, LRESULT *result)
Handles the set focus event for any date time ctrl.
void UTIL_convert_UTC_to_local(const time_type *aUtcTime, time_type *aLocalTime)
Converts a time_type from UTC to local time.
CAobrdDriverShipmentsDlg(CWnd *aParent, AobrdDriverItem *aDriver)
Constructor.
uint32 time_type
Absolute time (number of seconds since 12/31/1989 12:00 am UTC)
afx_msg void OnCancel()
Handler for the Cancel action.
void clearData()
Clear values from the editable fields.
Dialog allowing the user to manage AOBRD driver shipments.
afx_msg void OnLbnKillfocusShipmentList()
Handles the kill focus event for the driver list.
sint16 hour
hour (0-65535), range required for correct ETE conversion
void UTIL_convert_local_to_UTC(const time_type *aLocalTime, time_type *aUtcTime)
Converts a time_type from local to UTC time.
afx_msg void OnChangeShipmentData()
Edit/Change handler for the shipment-specific data controls.
CString getDocNumber() const
Get item's document number.