Exemplo n.º 1
0
Date parse_date(char *str)
{
    int y, m, d, y2, m2, d2, delta;
    Date ret;

    if (sscanf(str, "%d-%d-%d", &y, &m, &d) == 3) {
	if (d < 1 || d > 31 || m < 1 || m > 12 || y < 1900)
	    return INVALID_DATE;

	ret = ymd_to_date(y, m, d);

	/*
	 * Double-check the user hasn't entered anything stupid such as
	 * 30th Feb.
	 */
	date_to_ymd(ret, &y2, &m2, &d2);
	if (y2 != y || m2 != m || d2 != d)
	    return INVALID_DATE;
    } else if (sscanf(str, "+%d", &delta) == 1) {
	return today() + delta;
    } else if (sscanf(str, "-%d", &delta) == 1) {
	return today() - delta;
    } else {
	return INVALID_DATE;
    }

    return ret;
}
Exemplo n.º 2
0
int Cvip_item_log::add(uint32_t logtype,uint32_t itemid, int32_t count)
{
	int ret;
	GEN_SQLSTR(this->sqlstr, "update %s set count=count+%d where logday=%u and logtype=%u and itemid=%u",
			this->get_table_name(), count, today(), logtype, itemid);
	ret = this->exec_update_sql(this->sqlstr, MOLE2_KEY_NOT_EXIST_ERR);
	if(ret == MOLE2_KEY_NOT_EXIST_ERR) {
		GEN_SQLSTR(this->sqlstr, "insert into %s values(%u,%u,%u,%d)",
				this->get_table_name(),today(),logtype,itemid,count);
		ret = this->exec_insert_sql(this->sqlstr, MOLE2_KEY_EXIST_ERR);
	}
	return ret;
}
Exemplo n.º 3
0
    FlightInfo(QMainWindow *parent = 0): QMainWindow(parent) {

        QWidget *w = new QWidget(this);
        ui.setupUi(w);
        setCentralWidget(w);

        ui.searchBar->hide();
        ui.infoBox->hide();
        connect(ui.searchButton, SIGNAL(clicked()), SLOT(startSearch()));
        connect(ui.flightEdit, SIGNAL(returnPressed()), SLOT(startSearch()));

        setWindowTitle("Flight Info");

        // Rendered from the public-domain vectorized aircraft
        // http://openclipart.org/media/people/Jarno
        m_map = QPixmap(":/aircraft.png");

        QAction *searchTodayAction = new QAction("Today's Flight", this);
        QAction *searchYesterdayAction = new QAction("Yesterday's Flight", this);
        QAction *randomAction = new QAction("Random Flight", this);
        connect(searchTodayAction, SIGNAL(triggered()), SLOT(today()));
        connect(searchYesterdayAction, SIGNAL(triggered()), SLOT(yesterday()));
        connect(randomAction, SIGNAL(triggered()), SLOT(randomFlight()));
        connect(&m_manager, SIGNAL(finished(QNetworkReply*)),
                this, SLOT(handleNetworkData(QNetworkReply*)));
        addAction(searchTodayAction);
        addAction(searchYesterdayAction);
        addAction(randomAction);
        setContextMenuPolicy(Qt::ActionsContextMenu);
    }
Exemplo n.º 4
0
static bool getYesterdayTodayAndTomorrow(JNIEnv* env, jobject localeData, const Locale& locale, const char* locale_name) {
  UErrorCode status = U_ZERO_ERROR;
  ScopedResourceBundle root(ures_open(NULL, locale_name, &status));
  ScopedResourceBundle fields(ures_getByKey(root.get(), "fields", NULL, &status));
  ScopedResourceBundle day(ures_getByKey(fields.get(), "day", NULL, &status));
  ScopedResourceBundle relative(ures_getByKey(day.get(), "relative", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }

  UnicodeString yesterday(ures_getUnicodeStringByKey(relative.get(), "-1", &status));
  UnicodeString today(ures_getUnicodeStringByKey(relative.get(), "0", &status));
  UnicodeString tomorrow(ures_getUnicodeStringByKey(relative.get(), "1", &status));
  if (U_FAILURE(status)) {
    ALOGE("Error getting yesterday/today/tomorrow for %s: %s", locale_name, u_errorName(status));
    return false;
  }

  // We title-case the strings so they have consistent capitalization (http://b/14493853).
  UniquePtr<BreakIterator> brk(BreakIterator::createSentenceInstance(locale, status));
  if (U_FAILURE(status)) {
    ALOGE("Error getting yesterday/today/tomorrow break iterator for %s: %s", locale_name, u_errorName(status));
    return false;
  }
  yesterday.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
  today.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
  tomorrow.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);

  setStringField(env, localeData, "yesterday", yesterday);
  setStringField(env, localeData, "today", today);
  setStringField(env, localeData, "tomorrow", tomorrow);
  return true;
}
Exemplo n.º 5
0
int Cval::update_val(uint32_t userid, uint32_t limit, uint32_t &rt)
{
	uint32_t date=today(),day=0;
	this->check_val_day(userid, rt, day);
	if( day !=date ){
		GEN_SQLSTR(this->sqlstr,"insert into %s values(%u, 1, %u) ON DUPLICATE KEY UPDATE %s=1 ",
				this->get_table_name(), userid, date, STR_VAL);
		if(this->exec_insert_sql(this->sqlstr, MOLE2_KEY_EXIST_ERR) !=0)
			return MOLE2_KEY_EXIST_ERR;
		rt=1;
		GEN_SQLSTR(this->sqlstr,"update %s set %s= %u where %s =%u",
                this->get_table_name(), STR_TODAY, date, STR_USERID ,userid);	
		return this->exec_insert_sql(this->sqlstr, MOLE2_KEY_EXIST_ERR);
	
	}
	else
	{
		if(limit>rt){
			GEN_SQLSTR(this->sqlstr,"update %s set %s = %s +1 where userid = %u",
					this->get_table_name(), STR_VAL, STR_VAL, userid);
			if(this->exec_insert_sql(this->sqlstr, MOLE2_KEY_EXIST_ERR) !=0)
				return MOLE2_KEY_EXIST_ERR;
			rt+=1;
		} else {
			return MOLE2_KEY_EXIST_ERR;
		}
	}
	return 0;
}
Exemplo n.º 6
0
void
QA::initGlobalAtts(InFile &in)
{
  // global atts at creation.
  std::string today( Date::getTodayStr() );

  nc->setGlobalAtt( "project", "CORDEX");
  nc->setGlobalAtt( "product", "quality check of CORDEX data set");

  nc->setGlobalAtt( "QA revision", revision);
  nc->setGlobalAtt( "contact", "*****@*****.**");

#ifndef NONE
  std::string t("csv formatted ");
  t += qaExp.varReqTable.basename ;
  nc->setGlobalAtt( "standard_table", t);
#endif

  nc->setGlobalAtt( "creation_date", today);

  // helper vector
  std::vector<std::string> vs;

  for( size_t m=0 ; m < qaExp.varMeDa.size() ; ++m )
    vs.push_back( qaExp.varMeDa[m].var->name );

  nc->copyAtts(in.nc, "NC_GLOBAL", &vs);

  return;
}
Exemplo n.º 7
0
    FlightInfo(QMainWindow *parent = 0): QMainWindow(parent) {

        QWidget *w = new QWidget(this);
        ui.setupUi(w);
        setCentralWidget(w);

        ui.searchBar->hide();
        ui.infoBox->hide();
        connect(ui.searchButton, SIGNAL(clicked()), SLOT(startSearch()));
        connect(ui.flightEdit, SIGNAL(returnPressed()), SLOT(startSearch()));

        setWindowTitle("Flight Info");
        QTimer::singleShot(0, this, SLOT(delayedInit()));

        // Rendered from the public-domain vectorized aircraft
        // http://openclipart.org/media/people/Jarno
        m_map = QPixmap(":/aircraft.png");

        QAction *searchTodayAction = new QAction("Today's Flight", this);
        QAction *searchYesterdayAction = new QAction("Yesterday's Flight", this);
        QAction *randomAction = new QAction("Random Flight", this);
        connect(searchTodayAction, SIGNAL(triggered()), SLOT(today()));
        connect(searchYesterdayAction, SIGNAL(triggered()), SLOT(yesterday()));
        connect(randomAction, SIGNAL(triggered()), SLOT(randomFlight()));
#if defined(Q_OS_SYMBIAN)
        menuBar()->addAction(searchTodayAction);
        menuBar()->addAction(searchYesterdayAction);
        menuBar()->addAction(randomAction);
#else
        addAction(searchTodayAction);
        addAction(searchYesterdayAction);
        addAction(randomAction);
        setContextMenuPolicy(Qt::ActionsContextMenu);
#endif
    }
Exemplo n.º 8
0
void f()
{
  Date my_birthday;  // error : not initialized
  Date today(12, 24, 2007);  // runtime error
  Date last(2000, 12, 31);  // ok
  Date christmas = Date(1976, 12, 24);  // ok
}
Exemplo n.º 9
0
//
/// Construct TTime with current time (seconds since Jan 1, 1901).
//
TTime::TTime()
{
#if 0
  time_t ltime;
  time(&ltime);
  struct tm *t = localtime(&ltime);

  // Construct the date.  The time struct returns int, so casts are used.
  //
  TDate today( (DayTy)t->tm_mday,
               (MonthTy)(t->tm_mon + 1),
               (YearTy)t->tm_year );// +1900 //????????

  *this = TTime( today,
                 (HourTy)t->tm_hour,
                 (MinuteTy)t->tm_min,
                 (SecondTy)t->tm_sec );
#else
  TSystemTime _clk(TSystemTime::LocalTime());
  *this = TTime(TDate(_clk), 
                _clk.GetHour(), 
                _clk.GetMinute(), 
                _clk.GetSecond());
#endif
}
Exemplo n.º 10
0
void g()
{
  Date birthday(1960, 12, 31);
  ++birthday.d;  // invalid date

  Date today(1970, 2, 3);
  today.m = 14;  // invalid date
}
Exemplo n.º 11
0
int Cday::set(uint32_t userid, uint32_t itemid,uint32_t total,uint32_t count)
{
	int day = today();
	GEN_SQLSTR(this->sqlstr, "insert into %s values(%u,%u,%u,%u,%u) ON DUPLICATE KEY UPDATE total=%u, daycnt=%u, optday=%u",
		this->get_table_name(userid), userid, itemid, total, count, day, total,count, day);

	return this->exec_update_sql(this->sqlstr, 0);
}
Exemplo n.º 12
0
void DAILY_XFER_HISTORY::add(size_t x, bool upload) {
    DAILY_XFER* dxp = today();
    if (upload) {
        dxp->up += x;
    } else {
        dxp->down += x;
    }
    dirty = true;
}
Exemplo n.º 13
0
void write_proem
    (xml_lmi::xml_document& document
    ,std::string const&     // file_leaf_name
    )
{
    std::string const y(value_cast<std::string>(today().year()));
    document.add_comment("Copyright (C) " + y + " Gregory W. Chicares.");
    document.add_comment("http://savannah.nongnu.org/projects/lmi");
}
Exemplo n.º 14
0
/* PUTLOG -- Format and write a message to the logfile.  This is called by
 * the putlog builtin (clputlog() in builtin.c) and in some places in the
 * CL (e.g., exec.c).
 */
void
putlog (
  struct task  *tp,		/* pointer to task or NULL */
  char	*usermsg 
)
{
	register char	*ip, *op, *otop;
	register int	n;
	char	msg[SZ_LOGBUF], job[5];
	char	*pkg, *tname, *today();
	extern  int  bkgno;			/* job number if bkg job */

	if (!keeplog())
	    return;

	/* If background job, format job number, but only if background
	 * logging is enabled.
	 */
	if (firstask->t_flags & T_BATCH) {
	    if (log_background())
	    	sprintf (job, "[%d] ", bkgno);
	    else
		return;
	} else
	    job[0] = EOS;

	/* If a valid task pointer is given, get the package and task name.
	 * Otherwise, assume it's an internal (cl) logging message.
	 */
	if (tp) {
	    pkg   = tp->t_ltp->lt_pkp->pk_name;
	    tname = tp->t_ltp->lt_lname;
	} else {
	    pkg   = "cl";
	    tname = "";
	}

	/* Format the message.  Only use time, no day and date.  Break long
	 * messages into several lines.
	 */
	sprintf (msg, "# %8.8s %s%s%s %s- ",
		(today() + 4), pkg, (tp ? "." : ""), tname, job);
	otop = &msg[SZ_LOGBUF];
	for (op=msg, n=0;  *op && op < otop;  op++)
	    n++;
	for (ip=usermsg;  (*op++ = *ip++) && op < otop;  n++)
	    if (n + 2 >= MAXCOL) {
		*op++ = '\\';
		*op++ = '\n';
		n = 0;
	    }
	*(op-1) = '\n';
	*op = EOS;
	    
	put_logfile (msg);
}
Exemplo n.º 15
0
int Cval::get_val(uint32_t userid, uint32_t &count)
{
    int date=today(), day=0;
    GEN_SQLSTR(this->sqlstr,"select %s, %s from %s where %s = %u",
            STR_VAL, STR_TODAY, this->get_table_name(), STR_USERID, userid);
    STD_QUERY_ONE_BEGIN(this->sqlstr, MOLE2_KEY_NOT_EXIST_ERR);
        INT_CPY_NEXT_FIELD(count);
        INT_CPY_NEXT_FIELD(day);
        if(date !=day)
            count=0;
    STD_QUERY_ONE_END();
}
int main()
{
    //Date my_birthday;                 // error: my_birthday not initialized
    Date today(12,24,2007);             // oops! run-time error 
    Date last(2000, 12, 31);            // ok (colloquial style)
    Date christmas = Date(1976,12,24);  // also ok (verbose style)

    //We can now try to use our newly defined variables:

    last.add_day(1);
    //add_day(2);                       // error: what day?
}
Exemplo n.º 17
0
void invoiceList::init()
{
  QDate today(omfgThis->dbDate());
  _dates->setEndDate(today);
  _dates->setStartDate(today.addMonths(-1));

  _invoice->addColumn(tr("Invoice #"),    _orderColumn, Qt::AlignRight, true, "invchead_invcnumber" );
  _invoice->addColumn(tr("Invoice Date"), _dateColumn,  Qt::AlignCenter, true, "invchead_invcdate" );
  _invoice->addColumn(tr("S/O #"),        _orderColumn, Qt::AlignRight, true, "invchead_ordernumber"  );
  _invoice->addColumn(tr("Ship Date"),    _dateColumn,  Qt::AlignCenter, true, "invchead_shipdate" );
  _invoice->addColumn(tr("Cust. P/O #"),  -1,           Qt::AlignLeft, true, "invchead_ponumber"   );
}
Exemplo n.º 18
0
void invoiceList::init()
{
  QDate today(omfgThis->dbDate());
  _dates->setEndDate(today);
  _dates->setStartDate(today.addMonths(-1));

  _invoice->addColumn(tr("Invoice #"),    _orderColumn, Qt::AlignRight  );
  _invoice->addColumn(tr("Invoice Date"), _dateColumn,  Qt::AlignCenter );
  _invoice->addColumn(tr("S/O #"),        _orderColumn, Qt::AlignRight  );
  _invoice->addColumn(tr("Ship Date"),    _dateColumn,  Qt::AlignCenter );
  _invoice->addColumn(tr("Cust. P/O #"),  -1,           Qt::AlignLeft   );
}
Exemplo n.º 19
0
Arquivo: oop4.cpp Projeto: mohitsh/cpp
int main(){

	Fraction f(2,5);
	std::cout << f.GetNumerator() << "\n";
	std::cout << f.GetDenominator() << "\n";
	std::cout << f.getFraction() << "\n";

	Date today(27,9,2015);
	std::cout << today.getDate() << "\n";
	std::cout << today.getMonth() << "\n";
	std::cout << today.getYear() << "\n";

}
Exemplo n.º 20
0
int Cval::get_val(std::vector<stru_usr_val> &vals)
{
	int date=today(), day=0;
	GEN_SQLSTR(this->sqlstr,"select %s, %s, %s from %s",
			STR_USERID, STR_VAL, STR_TODAY, this->get_table_name());
    STD_QUERY_WHILE_BEGIN_NEW(this->sqlstr, vals);
        INT_CPY_NEXT_FIELD(item.userid);
        INT_CPY_NEXT_FIELD(item.val);
        INT_CPY_NEXT_FIELD(day);
		if(date !=day)
			item.val=0;
    STD_QUERY_WHILE_END_NEW();
}
Exemplo n.º 21
0
void CCalendarCtrl::Goto(const COleDateTime& dtDate, bool bSelect)
{
	if( (dtDate < m_BoundUp) && 
		(dtDate > m_BoundDown) )
	{
		m_DateCurrent = dtDate;		
		if(m_nFirstWeekDay<1 || m_nFirstWeekDay>7)
			m_nFirstWeekDay = 1;

		COleDateTime dtIte(m_DateCurrent.GetYear(), m_DateCurrent.GetMonth(), m_DateCurrent.GetDay(),0,0,0);
		int narr[7];
		for (int d=0; d<7; d++)	
			narr[((m_nFirstWeekDay-1)+d)%7] = d;
		int nCellStart = narr[dtIte.GetDayOfWeek()-1];
		for(int i=0; i<nCellStart; i++)	
			dtIte -= COleDateTimeSpan(1,0,0,0);

		for(i=0; i<CALENDAR_ROWS ; i++)
		{
			for(int u=0; u<CALENDAR_COLUMNS; u++)
			{
				// Init the cell
				m_dayCells[i][u].date = dtIte;
				m_dayCells[i][u].bPartial = false;
				m_dayCells[i][u].bMark = false;
				m_dayCells[i][u].csaLines.RemoveAll();

				if(m_pfnDataCallback)
					m_pfnDataCallback(this, DateToSeconds(m_dayCells[i][u].date));
				dtIte += COleDateTimeSpan(1,0,0,0);
			}
		}

		if(bSelect)
		{
			m_RandomSelection.RemoveAll();
			m_SelectionRange[2] = 0;
			m_SelectionRange[1] = DateToSeconds(COleDateTime(m_DateCurrent.GetYear(), m_DateCurrent.GetMonth(), m_DateCurrent.GetDay(),0,0,0));
			m_SelectionRange[0] = m_SelectionRange[1];

			// Scrolling pos
			COleDateTime today(time(NULL));
			m_nVscrollPos = (m_nVscrollMax/2) + (m_DateCurrent-today).GetDays()/7;
			SetScrollPos(SB_VERT, m_nVscrollPos, TRUE);
		}
	}

	Invalidate(true);
}
Exemplo n.º 22
0
int main()
{
	GHB::Host h0("host0", "00:00:00...", 0, "open house");
	GHB::Host h1("host1", "00:00:01...", 1, "closed");


	GHB::Date today(5, 7, 2011);
	GHB::Date yesterday(4,7, 2011);

	GHB::TrafficDay t1(100, h0, today);
	GHB::TrafficDay t2(200, h0, today);
	GHB::TrafficDay t3(300, h1, today);
	GHB::TrafficDay t4(400, h0, yesterday);

	std::list<GHB::TrafficDay> traffics;
	traffics.push_back(t1);
	traffics.push_back(t2);
	traffics.push_back(t3);
	traffics.push_back(t4);
	
	GHB::TrafficTotal total(traffics);

	assert(total.getTotalByDate(today) == 600);
	assert(total.getTotalByHost(h0) == 700);
	assert(total.getTotal() == 1000);
	
	GHB::Host hx("hostx", "00:00:00...", 3, "not existent");
	assert(total.getTotalByHost(hx) == 0);


	GHB::Date someday(1,1,2001);
	assert(total.getTotalByDate(someday) == 0);


	try { const GHB::TrafficDay& ignored = total.getTrafficDay(h0, today); assert(true); }
	catch (std::exception ex) { assert(false); }

	try { const GHB::TrafficDay& ignored = total.getTrafficDay(h0, someday); } 
	catch (std::out_of_range ex) 	{ assert(true); }
	catch (std::exception ex) 	{ assert(false);}
	
	try { const GHB::TrafficDay& ignored = total.getTrafficDay(hx, today); } 
	catch (std::out_of_range ex) 	{ assert(true); }
	catch (std::exception ex) 	{ assert(false);}
	
	try { const GHB::TrafficDay& ignored = total.getTrafficDay(hx, someday); } 
	catch (std::out_of_range ex) 	{ assert(true); }
	catch (std::exception ex) 	{ assert(false);}
}
Exemplo n.º 23
0
int Cday::get(uint32_t userid, uint32_t itemid,uint32_t& total,uint32_t& count,uint32_t& day)
{
	GEN_SQLSTR(this->sqlstr, "select total,daycnt,optday from %s where userid=%u and itemid=%u",
        this->get_table_name(userid),userid,itemid);

	STD_QUERY_ONE_BEGIN(this->sqlstr,ITEM_NOFIND_ERR);
	INT_CPY_NEXT_FIELD(total);
	INT_CPY_NEXT_FIELD(count);
	INT_CPY_NEXT_FIELD(day);
	uint32_t tday = today();
	if (day != tday) {
		count = 0;
		if (itemid == 5 && tday != day + 86400) 
			total = 0;
	}
	STD_QUERY_ONE_END();
}
Exemplo n.º 24
0
int Cday::get_list(userid_t userid, std::vector<item_day_limit_t> &limits)
{
	int day=0;
	int date = today();
	GEN_SQLSTR(this->sqlstr, "select itemid,total,daycnt,optday "
		"from %s where userid=%u", this->get_table_name(userid),userid);
	STD_QUERY_WHILE_BEGIN(this->sqlstr, limits);
		INT_CPY_NEXT_FIELD(item.itemid);
		INT_CPY_NEXT_FIELD(item.total);
		INT_CPY_NEXT_FIELD(item.daycnt);
		INT_CPY_NEXT_FIELD(day);
		if(day != date) {
			item.daycnt = 0;
			if (item.itemid == 5 && date != day + 86400) 
				item.total = 0;
		}
	STD_QUERY_WHILE_END_NEW();
}
Exemplo n.º 25
0
/* OPEN_LOGFILE -- Open the named command logging file for appending,
 * timestamp new session.  The logfile grows without bounds unless the
 * user deletes it or starts a new one.
 */
int
open_logfile (char *fname)
{
	if (logfp != NULL)
	    close_logfile (fname);

	if ((logfp = fopen (fname, "a")) == NULL) {
	    eprintf ("cannot open logfile\n");
	    return (ERR);
	}

	if (!(firstask->t_flags & T_BATCH))
	    fprintf (logfp, "\n# LOGIN %s\n", today());
	
	if (share_logfile)
	    fclose (logfp);

	return (OK);
}
void datetime(void)
{
    putchar('\n');
    putchar('\n');

    telltime();
    putchar(' ');
    today();
    putchar(' ');
    dayofmon();
    putchar(' ');
    month();
    putchar(' ');
    year();

    putchar('\n');
    putchar('\n');

}
Exemplo n.º 27
0
/* CLOSE_LOGFILE -- Print termination message and close logfile.
 */
void
close_logfile (char *fname)
{
	register FILE *fp;

	if (logfp != NULL) {
	    if (share_logfile) {
		if ((fp = fopen (fname, "a")) == NULL) {
		    eprintf ("cannot open logfile\n");
		    return;
		}
	    } else
		fp = logfp;

	    if (!(firstask->t_flags & T_BATCH))
		fprintf (fp, "# Logout %s\n", today());

	    fclose (fp);
	    logfp = NULL;
	}
}
Exemplo n.º 28
0
invoiceList::invoiceList(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
  : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  // signals and slots connections
  connect(_close, SIGNAL(clicked()), this, SLOT(sClose()));
  connect(_select, SIGNAL(clicked()), this, SLOT(sSelect()));
  connect(_invoice, SIGNAL(itemSelected(int)), this, SLOT(sSelect()));
  connect(_cust, SIGNAL(newId(int)), this, SLOT(sFillList()));
  connect(_dates, SIGNAL(updated()), this, SLOT(sFillList()));

  QDate today(omfgThis->dbDate());
  _dates->setEndDate(today);
  _dates->setStartDate(today.addMonths(-1));

  _invoice->addColumn(tr("Invoice #"),    _orderColumn, Qt::AlignRight, true, "invchead_invcnumber" );
  _invoice->addColumn(tr("Invoice Date"), _dateColumn,  Qt::AlignCenter, true, "invchead_invcdate" );
  _invoice->addColumn(tr("S/O #"),        _orderColumn, Qt::AlignRight, true, "invchead_ordernumber"  );
  _invoice->addColumn(tr("Ship Date"),    _dateColumn,  Qt::AlignCenter, true, "invchead_shipdate" );
  _invoice->addColumn(tr("Cust. P/O #"),  -1,           Qt::AlignLeft, true, "invchead_ponumber"   );
}
Exemplo n.º 29
0
int Cday::change_count(userid_t userid, uint32_t itemid, int change_count, uint32_t add_day)
{
	if (!change_count) return 0;

	uint32_t total_cnt = 0;
	uint32_t count = 0;
	uint32_t day = today();
	
	int ret = this->get(userid, itemid, total_cnt, count, day);
	if (change_count < 0) {
		if (ret == ITEM_NOFIND_ERR || total_cnt < uint32_t (-change_count))
			return ITEM_NOENOUGH_ERR;
		total_cnt += change_count;
	} else {
		total_cnt += change_count;
		count += add_day;
	}

	ret = set(userid, itemid, total_cnt, count);

	return ret;
}
Exemplo n.º 30
0
void MyMoneyAccountTest::testSetFunctions()
{
  MyMoneyAccount a;

  QDate today(QDate::currentDate());
  QVERIFY(a.name().isEmpty());
  QVERIFY(a.lastModified() == QDate());
  QVERIFY(a.description().isEmpty());

  a.setName("Account");
  a.setInstitutionId("Institution1");
  a.setLastModified(today);
  a.setDescription("Desc");
  a.setNumber("123456");
  a.setAccountType(MyMoneyAccount::MoneyMarket);

  QVERIFY(a.name() == "Account");
  QVERIFY(a.institutionId() == "Institution1");
  QVERIFY(a.lastModified() == today);
  QVERIFY(a.description() == "Desc");
  QVERIFY(a.number() == "123456");
  QVERIFY(a.accountType() == MyMoneyAccount::MoneyMarket);
}