GnuCashew ~ GnuCash Enabled Web
GCW
|
#include <Model.h>
Inherits Wt::WStandardItemModel.
Public Member Functions | |
Model (int _selectedMonth, Status _status) | |
ctor More... | |
auto | columnDef (int _col) -> ColumnDef_t |
Column Definition. More... | |
auto | loadData (int _selectedMonth) -> void |
Reload the data based on the selected month. More... | |
Private Member Functions | |
auto | sort (std::vector< GCW::Gui::BillPay::Item > &_bpItems) -> void |
Sorter. More... | |
Private Attributes | |
Status | m_status |
Model Status. More... | |
Data Model.
Contains paid, unpaid and disabled accounts.
When constructing the Model, the parameters control the subset of items that will appear in the model. Therefore, the final model contains only 'paid', 'unpaid' or 'disabled' items for the month selected.
GCW::Gui::BillPay::Model::Model | ( | int | _selectedMonth, |
Status | _status | ||
) |
ctor
During construction, the model examines all the billpay-items to detemine if the item meets the parameter criteria. This allows a TableView to be constructed to present the items that meet this criteria as a grouped set of items.
To return all the items in the month of February that are 'paid', the constructor would appear as follows;
_selectedMonth | Select a 'calendar month' to compare status |
_status | Select a BillPay::Status to evaluate to |
Definition at line 43 of file Model.cpp.
References COLUMN_COUNT, loadData(), m_status, GCW::Dbo::Accounts::Field::name, and GCW::Gui::BillPay::Unpaid.
auto GCW::Gui::BillPay::Model::columnDef | ( | int | _col | ) | -> ColumnDef_t |
auto GCW::Gui::BillPay::Model::loadData | ( | int | _selectedMonth | ) | -> void |
Reload the data based on the selected month.
This will drop all the data in the model and reload it with the month selected.
On load, the first column-label is set to indicate the model type as well as the month selected.
On load, all existing data in the model is first dumped.
Get all the var items that are for the 'managed bill pay item' (mbpi) in to a resultList that will then be used to load the resulting model.
Run the resultList collection through an analyzer that will extract billpay items that match the selection criteria of paid/unpaid/disabled/yes/no accordingly.
Sort all the items by the account group.dueDay. (The user is not allowed to sort these views so we do it) This sorts the items with the items that are due first, above those that are due next.
Each item is processed out of the sorted vector and placed in to the item model.
While building the 'month columns', apply a style class to the column of items according to the month selected. This causes the current selected column to be highlighted within the table view in the browser.
Definition at line 77 of file Model.cpp.
References GCW::app(), GCW::Gui::BillPay::asString(), GCW::Gui::BillPay::bpItem(), GCW::Dbo::Accounts::byGuid(), GCW::Gui::BillPay::Disabled, GCW::Dbo::Accounts::fullName(), GCW_GUI_BILLPAY_ITEM_CFY, GCW::Dbo::Accounts::Field::name, GCW::Gui::BillPay::Paid, GCW::Gui::BillPay::toString(), and GCW::Gui::BillPay::Unpaid.
Referenced by Model().
|
private |
Sorter.
This sorter produces a sorted list of bills-to-pay sorted by first 'group' then 'dueDay'. This produces a number that might be like 20.22, meaning group=20, day=22. The result in the view is all the "due next" items at the top of the list, and so on. The group-value is to just help clean the display. The result makes it very clear what bills are due next in line.
Sort the vector of bpItems by group.dueDay
|
private |