void HumanoidDataLogger::saveData() { const wxDateTime now = wxDateTime::UNow(); wxString dataDirectory(dataSaveDirectory.c_str(),wxConvUTF8); wxString curFilePath = dataDirectory + wxT("/recentData.dat"); dataDirectory += now.FormatISODate(); wxString dataFile = now.FormatISODate() + wxT("_") + now.FormatISOTime() + wxT(".dat"); dataFile.Replace(wxT(":"), wxT("-")); wxString dataPath = dataDirectory + wxT("/") + dataFile; if(! wxDirExists(dataDirectory)) { wxMkdir(dataDirectory); } stringstream ss; ss << dataPath.mb_str(); setFile(ss.str()); writeRecords(); FILE * curFile = fopen(curFilePath.mb_str(),"w"); fprintf(curFile, "%s",ss.str().c_str()); fclose(curFile); }
wxString DateToAnsiStr(const wxDateTime &datetime) { if (!datetime.IsValid()) return wxEmptyString; return datetime.FormatISODate() + wxT(" ") + datetime.FormatISOTime(); }
int DB_Init_Model::Add_Trans_Transfer(const wxString& account_name, const wxDateTime& date, const wxString& to_account, double value , const wxString& category, const wxString& subcategory, bool advanced, double adv_value) { if (m_account_name != account_name) { m_account_name = account_name; m_account_id = Get_account_id(account_name); } Model_Checking::Data* tran_entry = Model_Checking::instance().create(); tran_entry->ACCOUNTID = m_account_id; tran_entry->TOACCOUNTID = Get_account_id(to_account); tran_entry->PAYEEID = -1; // Set to Transfer tran_entry->TRANSCODE = Model_Checking::instance().all_type()[Model_Checking::TRANSFER]; tran_entry->TRANSAMOUNT = value; tran_entry->STATUS = Model_Checking::all_status()[Model_Checking::RECONCILED].Mid(0,1); tran_entry->CATEGID = Get_category_id(category); tran_entry->SUBCATEGID = Get_subcategory_id(tran_entry->CATEGID, subcategory); tran_entry->TRANSDATE = date.FormatISODate(); tran_entry->FOLLOWUPID = 0; tran_entry->TOTRANSAMOUNT = value; if (advanced) tran_entry->TOTRANSAMOUNT = adv_value; return Model_Checking::instance().save(tran_entry); }
int DB_Init_Model::Add_Trans(const wxString& account_name, Model_Checking::TYPE trans_type, const wxDateTime& date, const wxString& payee, double value , const wxString& category, const wxString& subcategory) { if (m_account_name != account_name) { m_account_name = account_name; m_account_id = Get_account_id(account_name); } Model_Checking::Data* tran_entry = Model_Checking::instance().create(); tran_entry->ACCOUNTID = m_account_id; tran_entry->TOACCOUNTID = -1; tran_entry->PAYEEID = Get_Payee_id(payee); // Set to Deposit tran_entry->TRANSCODE = Model_Checking::instance().all_type()[trans_type]; tran_entry->TRANSAMOUNT = value; tran_entry->STATUS = Model_Checking::all_status()[Model_Checking::RECONCILED].Mid(0,1); tran_entry->CATEGID = Get_category_id(category); tran_entry->SUBCATEGID = Get_subcategory_id(tran_entry->CATEGID, subcategory); tran_entry->TRANSDATE = date.FormatISODate(); tran_entry->FOLLOWUPID = 0; tran_entry->TOTRANSAMOUNT = value; return Model_Checking::instance().save(tran_entry); }
void TrackPoint::SetCreateTime( wxDateTime dt ) { wxString ts; if(dt.IsValid()) ts = dt.FormatISODate().Append(_T("T")).Append(dt.FormatISOTime()).Append(_T("Z")); SetCreateTime(ts); }
int DB_Init_Model::Add_StockHistory_Entry(const wxString& stock_symbol, const wxDateTime& date, double value, int upd_type) { Model_StockHistory::Data* entry = Model_StockHistory::instance().create(); entry->DATE = date.FormatISODate(); entry->SYMBOL = stock_symbol; entry->VALUE = value; entry->UPDTYPE = upd_type; return Model_StockHistory::instance().save(entry); }
/*! \brief Constructor. * * \param parent wxWindow* The parent window. * \param id const wxWindowID The ID of this window. * \param date wxDateTime& The date to display on the button. * \param pos const wxPoint& The button's position. * \param size const wxSize& The button's size. * \param style const longint The button's style. * */ mmDropMonth::mmDropMonth(wxWindow *parent, const wxWindowID id, const wxDateTime &date, const wxPoint &pos, const wxSize &size, const long int style) : mmDropWindow(parent, id, wxT(" ") + date.FormatISODate() + wxT(" "), wxNullBitmap, pos, wxSize(80, 30), style | wxNO_BORDER | mmMB_DROPDOWN, NULL, size) { mUpdateLabel = mStyle & mmDROPMONTH_UPDATE_LABEL; mMonthCtrl = new mmMonthCtrl(this, ID_MONTH_CTRL, date, wxDefaultPosition, size, wxRAISED_BORDER | mmPREV_BTN | mmNEXT_BTN | mmSHOW_ALL | mmRESCALE_FONTS); SetChild(mMonthCtrl, size); } // Constructor
const wxDateTime Model_Billsdeposits::nextOccurDate(int repeatsType, int numRepeats, const wxDateTime& nextOccurDate) { wxDateTime dt = nextOccurDate; if (repeatsType == REPEAT_WEEKLY) dt = dt.Add(wxTimeSpan::Week()); else if (repeatsType == REPEAT_BI_WEEKLY) dt = dt.Add(wxTimeSpan::Weeks(2)); else if (repeatsType == REPEAT_MONTHLY) dt = dt.Add(wxDateSpan::Month()); else if (repeatsType == REPEAT_BI_MONTHLY) dt = dt.Add(wxDateSpan::Months(2)); else if (repeatsType == REPEAT_FOUR_MONTHLY) dt = dt.Add(wxDateSpan::Months(4)); else if (repeatsType == REPEAT_HALF_YEARLY) dt = dt.Add(wxDateSpan::Months(6)); else if (repeatsType == REPEAT_YEARLY) dt = dt.Add(wxDateSpan::Year()); else if (repeatsType == REPEAT_QUARTERLY) dt = dt.Add(wxDateSpan::Months(3)); else if (repeatsType == REPEAT_FOUR_WEEKLY) dt = dt.Add(wxDateSpan::Weeks(4)); else if (repeatsType == REPEAT_DAILY) dt = dt.Add(wxDateSpan::Days(1)); else if (repeatsType == REPEAT_IN_X_DAYS) // repeat in numRepeats Days (Once only) dt = dt.Add(wxDateSpan::Days(numRepeats)); else if (repeatsType == REPEAT_IN_X_MONTHS) // repeat in numRepeats Months (Once only) dt = dt.Add(wxDateSpan::Months(numRepeats)); else if (repeatsType == REPEAT_EVERY_X_DAYS) // repeat every numRepeats Days dt = dt.Add(wxDateSpan::Days(numRepeats)); else if (repeatsType == REPEAT_EVERY_X_MONTHS) // repeat every numRepeats Months dt = dt.Add(wxDateSpan::Months(numRepeats)); else if (repeatsType == REPEAT_MONTHLY_LAST_DAY || REPEAT_MONTHLY_LAST_BUSINESS_DAY == repeatsType) { dt = dt.Add(wxDateSpan::Month()); dt = dt.SetToLastMonthDay(dt.GetMonth(), dt.GetYear()); if (repeatsType == REPEAT_MONTHLY_LAST_BUSINESS_DAY) // last weekday of month { if (dt.GetWeekDay() == wxDateTime::Sun || dt.GetWeekDay() == wxDateTime::Sat) dt.SetToPrevWeekDay(wxDateTime::Fri); } } wxLogDebug("init date: %s -> next date: %s", nextOccurDate.FormatISODate(), dt.FormatISODate()); return dt; }
void DB_Init_Model::Bill_Start(const wxString& account, const wxDateTime& start_date, Model_Billsdeposits::REPEAT_TYPE repeats, int num_occur) { if (!m_bill_entry) { m_bill_entry = Model_Billsdeposits::instance().create(); m_bill_entry->ACCOUNTID = Get_account_id(account); if (m_bill_entry->ACCOUNTID < 0) { ShowMessage("Bill Start for account: " + account + " not found.\n"); } m_bill_entry->NEXTOCCURRENCEDATE = start_date.FormatISODate(); m_bill_entry->REPEATS = repeats; // This will have extra data added multiplexed to this field. m_bill_entry->NUMOCCURRENCES = num_occur; m_bill_initialised = true; } else ShowMessage("Previous bill not saved. \n\nPlease use command: Bill_End(...)\n"); }
// Common to Bill_Trans_Deposit(...) and Bill_Trans_Withdrawal(...) void DB_Init_Model::Bill_Transaction(Model_Checking::TYPE trans_type, const wxDateTime& date, const wxString& payee, double value , const wxString& category, const wxString& subcategory) { if (m_bill_initialised && !m_bill_transaction_set) { m_bill_entry->TOACCOUNTID = -1; m_bill_entry->PAYEEID = Get_Payee_id(payee); // Set to Deposit m_bill_entry->TRANSCODE = Model_Checking::instance().all_type()[trans_type]; m_bill_entry->TRANSAMOUNT = value; m_bill_entry->STATUS = Model_Checking::all_status()[Model_Checking::RECONCILED].Mid(0,1); m_bill_entry->CATEGID = Get_category_id(category); m_bill_entry->SUBCATEGID = Get_subcategory_id(m_bill_entry->CATEGID, subcategory); m_bill_entry->TRANSDATE = date.FormatISODate(); m_bill_entry->FOLLOWUPID = 0; m_bill_entry->TOTRANSAMOUNT = value; m_bill_transaction_set = true; } else ShowMessage("Bill not initialised.\n\nPlease use command: Bill_Start(...)\n"); }
void DB_Init_Model::Bill_Trans_Transfer(const wxDateTime& date, const wxString& to_account, double value , const wxString& category, const wxString& subcategory, bool advanced, double adv_value) { if (m_bill_initialised && !m_bill_transaction_set) { m_bill_entry->TOACCOUNTID = Get_account_id(to_account); m_bill_entry->PAYEEID = -1; // Set to Transfer m_bill_entry->TRANSCODE = Model_Checking::instance().all_type()[Model_Checking::TRANSFER]; m_bill_entry->TRANSAMOUNT = value; m_bill_entry->STATUS = Model_Checking::all_status()[Model_Checking::RECONCILED].Mid(0,1); m_bill_entry->CATEGID = Get_category_id(category); m_bill_entry->SUBCATEGID = Get_subcategory_id(m_bill_entry->CATEGID, subcategory); m_bill_entry->TRANSDATE = date.FormatISODate(); m_bill_entry->FOLLOWUPID = 0; m_bill_entry->TOTRANSAMOUNT = value; if (advanced) m_bill_entry->TOTRANSAMOUNT = adv_value; m_bill_transaction_set = true; } else ShowMessage("Bill not initialised.\n\nPlease use command: Bill_Start(...)\n"); }
/*! \brief * * \param date wxDateTime& A reference to a wxDateTime object. * \return void * */ void mmDropMonth::SetDate(wxDateTime &date) { SetLabel(wxT(" ") + date.FormatISODate() + wxT(" ")); } // SetDate
void Model_Infotable::Set(const wxString& key, const wxDateTime& date) { this->Set(key, date.FormatISODate()); }