Ananas Library 0.9.5
aARegister Class Reference

#include <aaregister.h>

Inheritance diagram for aARegister:
aIRegister aObject

Public Slots

virtual ERR_Code New ()
 Adds new line to register table.
 
virtual int Update ()
 
QVariant getSaldo (const QDateTime &date, const QString &dimfieldname, QVariant dimvalue, const QString &resname)
 
QVariant getSaldo (const QString &dateISO, const QString &dimfieldname, QVariant dimvalue, const QString &resname)
 
QVariant getSaldoByManyDimensions (const QString &from, const QString &to, const QString &dimfieldname, QVariant dimvalue, const QString &resname)
 
- Public Slots inherited from aIRegister
virtual int SetDocument (aDocument *doc)
 Sets document.
 
virtual aDocumentGetDocument ()
 Gets document.
 
virtual int SetTable (const QString &tblname)
 Sets table.
 
virtual int New ()
 Adds new line to infomation register table.
 
virtual int Select (const QString &from, const QString &to)
 Selects records for date interval.
 
virtual int Select (QDateTime from, QDateTime to)
 Selects records for period.
 
virtual int SelectByDoc ()
 
virtual QVariant Value (const QString &name, const QString &tableName="")
 Return field value with name = name of the primary object database table.
 
virtual int SetFilter (const QString &fieldName, const QVariant &value)
 Sets filter.
 
virtual bool Next ()
 
virtual bool Prev ()
 
virtual bool First ()
 
virtual bool Last ()
 
- Public Slots inherited from aObject
virtual QString Uid ()
 
virtual bool IsSelected ()
 Checks if object selected.
 
virtual bool IsMarkDeleted (const QString &tname="")
 Checks "Deleted" marker.
 
virtual bool IsMarked ()
 Checks "Marked" marker.
 
virtual int SetMarkDeleted (bool Deleted, const QString &tablename="")
 Устанавливает признак логического удаления объекта (записи SQL таблицы)
 
virtual int SetMarked (bool Marked)
 Выставляет отметку на объекте.
 
virtual int New ()
 Add new object record in database.
 
virtual int Copy ()
 
virtual int Delete ()
 
virtual int Update ()
 Update curent selected object record to database.
 
virtual int Conduct ()
 
virtual int UnConduct ()
 
virtual bool IsConducted ()
 
virtual QString Kind (const QString &name=QString::null)
 
virtual QVariant Value (const QString &name, const QString &tableName="")
 Return field value of the primary object database table.
 
virtual int SetValue (const QString &name, const QVariant &value, const QString &tableName="")
 Set field value of the primary object database table.
 
virtual QVariant sysValue (const QString &name, const QString &tableName="")
 Gets system field value.
 
virtual int setSysValue (const QString &name, QVariant value, const QString &tableName="")
 Sets system field value.
 
virtual int SetFilter (const QString &valname, const QVariant &value)
 Задает фильтр записей/объектов
 
virtual int ClearFilter ()
 Чистит фильтр записей/объектов.
 
virtual int TableSetFilter (const QString &tname, const QString &valname, const QVariant &value)
 Устанавливает вильтр записей табличной части объекта.
 
virtual int TableClearFilter (const QString &tname)
 Чистит фильтр записей указанной табличной части объекта.
 
virtual bool IsFiltred ()
 Показывает наличие активного фильтра
 

Public Member Functions

 aARegister (aCfgItem context, aDatabase *adb=0)
 
 aARegister (QString name, aDatabase *adb=0)
 
virtual ~aARegister ()
 
virtual ERR_Code initObject ()
 
virtual bool deleteDocument (aDocument *doc)
 
virtual QString trSysName (const QString &sname)
 Not implemented.
 
- Public Member Functions inherited from aIRegister
 aIRegister (aCfgItem registerItem, aDatabase *adb=0)
 Create object aIRegister by ananas configuration object.
 
 aIRegister (const QString &name, aDatabase *adb=0, const QString &type="InfoRegister.")
 Create object aIRegister by information register metadata name.
 
virtual ~aIRegister ()
 
virtual bool deleteTable (Q_ULLONG iddt)
 Removes records with given table id.
 
- Public Member Functions inherited from aObject
 aObject (QObject *parent=0, const char *name=0)
 
 aObject (const QString &oname, aDatabase *adb, QObject *parent=0, const char *name=0)
 
 aObject (aCfgItem context, aDatabase *adb, QObject *parent=0, const char *name=0)
 
virtual ~aObject ()
 Virtual destructor. .
 
virtual bool checkStructure ()
 Not implemented.
 
ERR_Code init ()
 Tune on metadata object and it's database tables.
 
ERR_Code decodeDocNum (QString nm, QString &pref, int &num)
 Осуществляет выделение символьного префикса из строки.
 
virtual ERR_Code select (Q_ULLONG id)
 
Q_ULLONG getUid ()
 Возвращает уникальный идентификатор объекта из базы данных.
 
bool selected (const QString &tablename="")
 Показывает задан ли текущий объект или запись в его табличной части.
 
ERR_Code select (const QString &query, const QString &tableName="")
 Осуществляет SQL запрос.
 
aDataTabletable (const QString &name="")
 Return the table of object by it's name.
 
virtual Q_ULLONG docId ()
 Returns document database id.
 
virtual bool Next (const QString &tableName="")
 Перемещает указатель на следующую запись SQL таблицы.
 
virtual bool Prev (const QString &tableName="")
 Перемещает указатель на предыдующую запись SQL таблицы.
 
virtual bool First (const QString &tableName="")
 Перемещает указатель на первую запись SQL таблицы.
 
virtual bool Last (const QString &tableName="")
 Перемещает указатель на последнюю запись SQL таблицы.
 
virtual int TableUpdate (const QString &tablename)
 
virtual QString displayString ()
 Возвращает строку, предназначенную для отображения пользователю объекта сложного типа.
 
virtual int LastErrorCode ()
 
virtual QString LastErrorMessage ()
 

Protected Member Functions

void recalculate_saldo (aSQLTable *t, aSQLTable *t_dim, const QDateTime &dd, bool plus, long dimId, QVariant dimValue)
 
int insert_values (QSqlQuery *q, aSQLTable *t_dim, const QDateTime &dd, bool plus, long dimId, QVariant dimValue)
 
int update_values (aSQLTable *t_dim, const QDateTime &dd, bool plus, long dimId, QVariant dimValue, aSQLTable *t=0)
 
- Protected Member Functions inherited from aObject
virtual aCfgItem displayStringContext ()
 Возвращает контекст (узел дерева) метаданных для вычисления строкового представления сложного типа.
 
virtual ERR_Code setObject (aCfgItem newobject)
 Sets new object type after create.
 
bool isInited ()
 
void setInited (bool flag)
 
ERR_Code tableInsert (const QString &dbname, aCfgItem obj, const QString &name="")
 Insert table name and its link into internal buffer.
 
ERR_Code tableInsert (const QString &dbname, const QString &name="")
 Insert table name and its link into internal buffer.
 
ERR_Code tableRemove (const QString &name="")
 Remove table from buffer.
 
virtual QVariant tValue (const QString &tablename, const QString &name)
 Return field value of the secondary object database table.
 
virtual ERR_Code setTValue (const QString &tablename, const QString &name, const QVariant &value)
 Set field value of the secondary object database table.
 
void setSelected (bool sel, const QString &tablename="")
 Явно задает состояние выбранности объекта или записи его табличной части.
 
virtual ERR_Code setTFilter (const QString &tname, const QString &valname, const QVariant &value)
 Устанавливает вильтр записей табличной части объекта.
 
virtual ERR_Code clearTFilter (const QString &tname)
 Чистит фильтр записей указанной табличной части объекта.
 
void setLastError (int, QString)
 Задает значения свойствам lastErrorCode и lastErrorMessage класса
 

Additional Inherited Members

- Public Attributes inherited from aObject
aCfgmd
 
aCfgItem obj
 
aDatabasedb
 
- Protected Attributes inherited from aIRegister
bool docseted
 
bool tableseted
 
QString tname
 
aDocumentnowDoc
 
- Protected Attributes inherited from aObject
bool concrete
 

Detailed Description

Object for working with accumulation register in database. Using for provide between database tables and wobjects or ananas scripts

Constructor & Destructor Documentation

◆ aARegister() [1/2]

aARegister::aARegister ( aCfgItem context,
aDatabase * adb = 0 )

Constructor that create object of aAregister by metadata object.

Parameters
context- configuration item,
adb- link on ananas database.

References aIRegister::aIRegister(), and initObject().

◆ aARegister() [2/2]

aARegister::aARegister ( QString name,
aDatabase * adb = 0 )

Сonstructor that create object of aAregister by metadata name

Parameters
context- md name of register,
adb- link on ananas database.

References aIRegister::aIRegister(), and initObject().

◆ ~aARegister()

aARegister::~aARegister ( )
virtual

Destructor

Member Function Documentation

◆ deleteDocument()

bool aARegister::deleteDocument ( aDocument * doc)
virtual

Deletes records from accumulation registers. Deletes all records from accumulation register tables that contents reference to doc.

Parameters
doc- document to delete
Returns
- false if can't find tag <aregisters> in meta data or have no document.

Reimplemented from aIRegister.

References aObject::getUid(), aLog::print(), aObject::table(), and aDocument::Value().

Referenced by aDocument::SignOut().

◆ getSaldo [1/2]

QVariant aARegister::getSaldo ( const QDateTime & date,
const QString & dimfieldname,
QVariant dimvalue,
const QString & resname )
slot

◆ getSaldo [2/2]

QVariant aARegister::getSaldo ( const QString & strdate,
const QString & dimfieldname,
QVariant dimvalue,
const QString & resname )
slot

Gets saldo. Helper metod.

See also
getSaldo(const QDateTime &date, const QString & dimfieldname, QVariant dimvalue, const QString &resname)
Parameters
strdate- date
dimfieldname- name of dimensions field
dimvalue- value of dimensions field
resname- name of resounces field
Returns
- Saldo value or QVariant::Invalid on error.

References getSaldo(), and aObject::setLastError().

◆ getSaldoByManyDimensions

QVariant aARegister::getSaldoByManyDimensions ( const QString & from,
const QString & to,
const QString & dimfieldname,
QVariant dimvalue,
const QString & resname )
slot

◆ initObject()

ERR_Code aARegister::initObject ( )
virtual

Initing this object by metadata object. Сreating used tables and filters

Returns
- error code.

Reimplemented from aIRegister.

References aIRegister::initObject(), aObject::LastErrorCode(), aObject::setLastError(), aObject::table(), and aObject::tableInsert().

Referenced by aARegister(), and aARegister().

◆ insert_values()

int aARegister::insert_values ( QSqlQuery * q,
aSQLTable * t_dim,
const QDateTime & dd,
bool plus,
long dimId,
QVariant dimValue )
protected
Parameters
q- query with selected record
t_dim- saldo table
dd- date for start recalculation.
plus- true for new record, false for delete
dimId- dimension id
dimValue- dimension value

Referenced by recalculate_saldo().

◆ New

int aARegister::New ( )
virtualslot

◆ recalculate_saldo()

void aARegister::recalculate_saldo ( aSQLTable * t_dim,
aSQLTable * t,
const QDateTime & dd,
bool plus,
long dimId,
QVariant dimValue )
protected
Parameters
t_dim- saldo table
t- table
dd- date for start recalculation.
plus- true for new record, false for delete
dimId- dimension id
dimValue- dimension value

References insert_values(), and update_values().

◆ trSysName()

QString aARegister::trSysName ( const QString & sname)
virtual

Not implemented.

Returns
""

Reimplemented from aObject.

◆ Update

int aARegister::Update ( )
virtualslot

Updates information in database. Reimplements aObject function for recalc rests.

Returns
- error code.

References aObject::getUid(), aLog::print(), aObject::table(), and aObject::Update().

Referenced by New().

◆ update_values()

int aARegister::update_values ( aSQLTable * t_dim,
const QDateTime & dd,
bool plus,
long dimId,
QVariant dimValue,
aSQLTable * t = 0 )
protected
Parameters
t_dim- saldo table
t- table
dd- date for start recalculation.
plus- true for new record, false for delete
dimId- dimension id
dimValue- dimension value

Referenced by recalculate_saldo().


The documentation for this class was generated from the following files: