1 #line 2 "src/Gui/BillPay/Model.cpp"
3 #include <Wt/WStandardItem.h>
6 #include "../Dbo/Vars/Vars.h"
10 #define HEADER_COL0_HAS_TABLE_TYPE_NAME
16 {
"accountKey" ,
"120px", Wt::AlignmentFlag::Left,
"Primary Account Identifier" },
17 {
"last4" ,
"60px", Wt::AlignmentFlag::Center,
"Last 4 digits of account number" },
18 {
"Nickname" ,
"100px", Wt::AlignmentFlag::Left,
"Friendly Nickname for the account" },
19 {
"Gp" ,
"50px", Wt::AlignmentFlag::Center,
"Grouping" },
20 {
"Dy" ,
"50px", Wt::AlignmentFlag::Center,
"Day that the payment is due" },
21 {
"Min" ,
"50px", Wt::AlignmentFlag::Right,
"Minimum Payment Due" },
22 {
"Bgt" ,
"50px", Wt::AlignmentFlag::Right,
"Payment Budget" },
23 {
"Actual" ,
"75px", Wt::AlignmentFlag::Right,
"Actual payment most recently made" },
24 {
"Au" ,
"50px", Wt::AlignmentFlag::Center,
"Automatic Payment Indicator" },
25 {
"01" ,
"35px", Wt::AlignmentFlag::Center,
"January" },
26 {
"02" ,
"35px", Wt::AlignmentFlag::Center,
"February" },
27 {
"03" ,
"35px", Wt::AlignmentFlag::Center,
"March" },
28 {
"04" ,
"35px", Wt::AlignmentFlag::Center,
"April" },
29 {
"05" ,
"35px", Wt::AlignmentFlag::Center,
"May" },
30 {
"06" ,
"35px", Wt::AlignmentFlag::Center,
"June" },
31 {
"07" ,
"35px", Wt::AlignmentFlag::Center,
"July" },
32 {
"08" ,
"35px", Wt::AlignmentFlag::Center,
"August" },
33 {
"09" ,
"35px", Wt::AlignmentFlag::Center,
"September" },
34 {
"10" ,
"35px", Wt::AlignmentFlag::Center,
"October" },
35 {
"11" ,
"35px", Wt::AlignmentFlag::Center,
"November" },
36 {
"12" ,
"35px", Wt::AlignmentFlag::Center,
"December" },
39 #define COLUMN_COUNT (sizeof(columns)/sizeof(GCW::Gui::BillPay::ColumnDef_t))
64 setHeaderData( col, Wt::Orientation::Horizontal, columns[ col ].
name , Wt::ItemDataRole::Display );
65 setHeaderData( col, Wt::Orientation::Horizontal, columns[ col ].toolTip , Wt::ItemDataRole::ToolTip );
78 loadData(
int _selectedMonth )->
void
95 Wt::Orientation::Horizontal,
97 Wt::ItemDataRole::Display
104 while( rowCount() > 0 )
112 Wt::Dbo::Transaction t(
GCW::app()-> gnucashew_session() );
122 std::string yesNo =
"yes";
132 std::vector< GCW::Gui::BillPay::Item > bpItems;
133 for(
auto item : items )
141 auto isActive =
bpItem.isActive () ==
"yes";
142 auto isVisible =
bpItem.isVisible() ==
"yes";
156 if( isActive && isVisible )
165 if(
bpItem.cb( _selectedMonth ) == yesNo )
167 bpItems.push_back(
bpItem );
184 if( !isActive || !isVisible )
185 bpItems.push_back(
bpItem );
203 for(
auto bpItem : bpItems )
209 auto accountName = std::make_unique< Wt::WStandardItem >();
210 auto accountGuid =
bpItem.accountGuid();
212 if( accountGuid !=
"" )
222 accountName-> setData( accountItem->
name() , Wt::ItemDataRole::Display );
223 accountName-> setData(
bpItem.guid() , Wt::ItemDataRole::User );
232 std::vector< std::unique_ptr< Wt::WStandardItem > > columns;
233 columns.push_back( std::move( accountName ) );
234 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.last4 () ) );
235 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.nickname () ) );
236 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.group () ) );
237 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.dueDay () ) );
238 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.minimum () ) );
239 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.budget () ) );
240 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.actual () ) );
241 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.autoPay () ) );
243 for(
int month=1; month<= 12; month++ )
245 auto cb = std::make_unique< Wt::WStandardItem >(
bpItem.cb( month ) );
256 if( _selectedMonth == month )
257 cb-> setStyleClass(
"colsel" );
259 columns.push_back( std::move( cb ) );
267 appendRow( std::move( columns ) );
282 sort( std::vector< GCW::Gui::BillPay::Item > & _bpItems )->
void
308 return item1.sortValue()
#define GCW_GUI_BILLPAY_ITEM_CFY
Status m_status
Model Status.
auto sort(std::vector< GCW::Gui::BillPay::Item > &_bpItems) -> void
Sorter.
auto loadData(int _selectedMonth) -> void
Reload the data based on the selected month.
Model(int _selectedMonth, Status _status)
ctor
auto columnDef(int _col) -> ColumnDef_t
Column Definition.
const Wt::WFormModel::Field name
auto byGuid(const std::string &_guid) -> Item::Ptr
Load Account by GUID.
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
auto bpItem(const std::string &_guid) -> GCW::Gui::BillPay::Item
Bill Pay Item.
std::string asString(Status _status)
Get Status as String.
@ Disabled
Disabled Status.
auto toString(int _value) -> std::string
Convert Integer to String.