Enable operation modification in GridAccount

Fix a bug : Fix category in choices of normal operation
Fix a bug : bad request in Database.cpp
Fix a bug : bad month in calendar
Add a 5th week for black line
This commit is contained in:
Grégory Soutadé 2011-11-01 16:17:20 +01:00
parent ab27c553a8
commit a9bcdcc733
5 changed files with 492 additions and 493 deletions

View File

@ -494,7 +494,7 @@ void Database::LinkOrUnlinkOperation(User* user, Operation& op)
// No one or not linked
if (!GetOperation(op.transfert, &linked) || op.description != linked.description || op.amount != -linked.amount || op.account == linked.account)
{
req = QString("UPDATE operation SET transfert='' virtual='0' WHERE id='%1'").arg(op.id);
req = QString("UPDATE operation SET transfert='', virtual='0' WHERE id='%1'").arg(op.id);
EXECUTE_SQL_UPDATE(req, );
op.transfert = 0;
op._virtual = false;

View File

@ -422,8 +422,8 @@ void AccountPanel::ShowMonth(int month, int year)
connect(_accountsGrid, SIGNAL(cellChanged(int, int)), this, SLOT(OnAccountModified(int, int)));
dateStart.setDate(dateStart.year(), dateStart.month(), 1);
dateEnd.setDate(dateEnd.year(), dateEnd.month(), dateStart.daysInMonth());
dateStart.setDate(_curYear, _curMonth+1, 1);
dateEnd.setDate(_curYear, _curMonth+1, dateStart.daysInMonth());
_calendar->setDateRange(dateStart, dateEnd);
if ((curDate.month()-1) == month && curDate.year() == year)
_calendar->showToday();

File diff suppressed because it is too large Load Diff

View File

@ -20,20 +20,12 @@
#ifndef GRIDACCOUNT_H
#define GRIDACCOUNT_H
// #include <wx/wx.h>
// #include <wx/grid.h>
#include <list>
#include <vector>
#include <algorithm>
#include <view/AccountPanel.hpp>
#include <model/model.hpp>
#include <controller/KissCount.hpp>
// #include "wxGridCellFastBoolEditor.hpp"
// #include "wxGridCellTreeButtonRenderer.hpp"
// #include "wxGridCellTreeButtonEditor.hpp"
// #include "wxGridCellBitmapRenderer.hpp"
// #include "wxGridCellFormulaEditor.hpp"
// #include "wxGridCellTabStringRenderer.hpp"
#include <QTableWidget>
#include <QSignalMapper>
@ -55,9 +47,6 @@ public:
bool canAddOperation, bool setWeek, bool synchronizeWithDatabase);
~GridAccount();
// wxPen GetColGridLinePen (int col);
// wxPen GetRowGridLinePen (int row);
virtual void ClearGrid();
void LoadOperations(std::vector<Operation>* operations, int month, int year);
void InsertOperationWithWeek(User* user, Operation& op, int line, bool fix, int month, int year) ;
@ -69,13 +58,14 @@ public:
void UnGroup();
int _fixCosts;
int _week1, _week2, _week3, _week4;
int _week1, _week2, _week3, _week4, _week5;
bool _canAddOperation;
std::vector<Operation> _displayedOperations;
private slots:
void OnOperationModified();
void OnOperationModified(int row, int col);
void OnMetaClicked(int id);
void OnCheckClicked(int id);
private:
QWidget* _parent;
@ -87,7 +77,8 @@ private:
std::vector<Operation>* _operations;
bool _loadOperations;
int _curMonth, _curYear;
QSignalMapper _signalMapper;
QSignalMapper _buttonSignalMapper, _checkSignalMapper;
bool _inModification;
void SetWeek(int week, int line);
void ResetWeeks();

View File

@ -64,7 +64,8 @@ public:
row == _grid->_week1 ||
row == _grid->_week2 ||
row == _grid->_week3 ||
row == _grid->_week4)
row == _grid->_week4 ||
row == _grid->_week5)
painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
}
}