Ananas Library  0.9.5
aaregister.h
1 /****************************************************************************
2 ** $Id: aaregister.h,v 1.23 2007/03/10 12:26:51 gr Exp $
3 **
4 ** Header file of the Accumulation Register of Ananas
5 ** Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 ** Copyright (C) 2003-2004 Andrey Paskal <app at lrn dot ru>.
11 **
12 ** This file is part of the Library of the Ananas
13 ** automation accounting system.
14 **
15 ** This file may be distributed and/or modified under the terms of the
16 ** GNU General Public License version 2 as published by the Free Software
17 ** Foundation and appearing in the file LICENSE.GPL included in the
18 ** packaging of this file.
19 **
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 **
23 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
24 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
25 **
26 ** Contact org@leaderit.ru if any conditions of this licensing are
27 ** not clear to you.
28 **
29 **********************************************************************/
30 
31 #ifndef AAREGISTER_H
32 #define AAREGISTER_H
33 
34 #include "acfg.h"
35 #include "airegister.h"
36 
37 
38 
54 class ANANAS_EXPORT aARegister : public aIRegister
55 {
56  Q_OBJECT
57 public:
58  aARegister(aCfgItem context, aDatabase * adb = 0);
59  aARegister(QString name, aDatabase * adb = 0);
60  virtual ~aARegister();
61 
62  virtual ERR_Code initObject();
63 
64  virtual bool deleteDocument( aDocument * doc );
65  //virtual bool deleteTable( Q_ULLONG iddt );
66  virtual QString trSysName( const QString & sname );
67 public slots:
68  virtual ERR_Code New();
69  virtual int Update();
70  //int SelectCountByDoc();
71  //int ClosePeriod( const QDateTime & date = QDateTime::currentDateTime() );
72  //int SelectRemainders(const QDateTime & date = QDateTime::currentDateTime() );
73  //int SelectRemainders(const QString & strdate);
74  //int SelectRemainder(const QString & strdate, const QString & dimfieldname, QVariant dimvalue);
75  QVariant getSaldo(const QDateTime &date, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
76  QVariant getSaldo(const QString &dateISO, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
77 
78  QVariant getSaldoByManyDimensions(const QString &from, const QString &to, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
79  /*
80  QVariant SumValue( const QString & name );
81  bool SumNext();
82  bool SumPrev();
83  bool SumFirst();
84  bool SumLast();
85  */
86 protected:
87  void recalculate_saldo(aSQLTable *t, aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue);
88  int insert_values(QSqlQuery *q, aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue);
89  int update_values(aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue, aSQLTable *t=0);
90 private:
91 
92  void resum( aSQLTable * t, const QDateTime & dd, bool plus );
93  QString tablename;
94  QSqlQuery sumQuery;
95  QMap<long,QString> resnames;
96  QMap<QString,QString> resSysNames;
97  QMap<long,QString> dimnames;
98  //QDateTime actualDate;
99  //ERR_Code makeTmpTable( const QDateTime & date );
100 };
101 
102 #endif// AAREGISTER_H
Определяет программный интерфейс для работы с бизнес объектами типа Документ и их атрибутами...
Definition: adocument.h:62
virtual bool deleteDocument(aDocument *doc)
Удаляет все записи с идентификатором данного документа из всех информационных регистров.
Definition: airegister.cpp:317
virtual ERR_Code initObject()
Инициализирует объект информационного регистра.
Definition: airegister.cpp:114
virtual int Update()
Обновляет запись в базе данных текущеми значениями.
Definition: aobject.cpp:718
Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует QObject.
Definition: adatabase.h:77
virtual QString trSysName(const QString &sname)
Not implemented.
Definition: aobject.cpp:426
virtual int New()
Добавляет новую строку к таблице информационного регистра.
Definition: airegister.cpp:279
Класс aARegister определяет программный интерфейс Накопительных регистров. Наследует aIRegister...
Definition: aaregister.h:54
Класс aIRegister определяет программный интерфейс Информационных регистров.
Definition: airegister.h:61