1#line 2 "src/Gui/BillPay/PaymentWidget.cpp"
6#include <Wt/WVBoxLayout.h>
8#include "../../Eng/TransactionManager.h"
9#include "../../Glb/Core.h"
14:
Wt::WContainerWidget(),
24 auto lw =
setLayout( std::make_unique< Wt::WVBoxLayout >() );
32 addWidget( std::make_unique< Wt::WTemplate >(
TR(
"gcw_gui.billpay.paymentwidget.form.main") ) );
51#ifdef INCLUDE_TABLE_WITH_MULTIPLE_INPUT_ROWS
89 for(
int row=1; row<= 3; row++ )
112 m_date -> setPlaceholderText(
TR(
"gcw.billPay.pht.date" ) );
113 m_num -> setPlaceholderText(
TR(
"gcw.billPay.pht.num" ) );
114 m_desc -> setPlaceholderText(
TR(
"gcw.billPay.pht.desc" ) );
115 m_acct -> setPlaceholderText(
TR(
"gcw.billPay.pht.acct" ) );
116 m_recon -> setPlaceholderText(
TR(
"gcw.billPay.pht.recon" ) );
118 m_credit -> setPlaceholderText(
TR(
"gcw.billPay.pht.credit") );
126 m_confirm-> setPlaceholderText(
TR(
"gcw.billPay.pht.confirm") );
148 GCW_NUMERIC cVal( m_credit-> valueText().toUTF8() );
161 for(
auto si = splitItems.rbegin(); si != splitItems.rend(); si++ )
163 auto splitItem = *si;
166 if( txItem-> num() ==
"bp" )
181 if(
auto txItem = lastTx() )
185 if( splitItem-> account_guid() !=
bpItem.accountGuid() )
208 auto desc =
bpItem.nickname();
209 if(
bpItem.last4() !=
"" )
210 desc +=
" (" +
bpItem.last4() +
")";
213 m_num -> setValueText(
"bp" );
214 m_desc -> setValueText( desc );
215 m_recon -> setValueText(
"n" );
217 if(
auto splitItem = lastSplit() )
229 if( m_acct-> valueText() ==
"" )
251 std::cout << __FILE__ <<
":" << __LINE__
252 <<
" " <<
bpItem.accountFullName()
253 <<
" " <<
bpItem.accountGuid()
254 <<
" " <<
bpItem.nickname()
257 std::cout << __FILE__ <<
":" << __LINE__
258 <<
" vt:" << m_acct-> valueText()
259 <<
" id:" << acctItem-> guid()
260 <<
" ds:" << acctItem-> description()
279 transMan.
newTransaction(
bpItem.accountGuid(), acctItem-> guid(), m_date-> date(), value(), m_desc-> valueText().toUTF8() );
280 transMan.
setValue ( acctItem-> guid() , -value() );
281 transMan.
setNotes (
bpItem.accountGuid(), m_confirm-> valueText().toUTF8() );
282 transMan.
setNum ( m_num-> valueText().toUTF8() );
285 std::string logMessage;
287 logMessage +=
"\tpayment";
291 logMessage +=
"\t" +
toString( value() );
292 logMessage +=
"\t" +
toOneLineString( m_confirm-> valueText().toUTF8() );
301 bool hasHeader = std::filesystem::exists( fileName );
303 std::ofstream file( fileName, std::ios_base::out | std::ios_base::app );
306 file <<
"dateTime\taction\ttoAccount\tfromAccount\tpaymentDate\tpaymentAmount\tconfirmation" << std::endl;
308 file << logMessage << std::endl;
310 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << fileName <<
":\t" << logMessage << std::endl;
325 return m_date-> valueText().toUTF8();
333 addStyleClass(
"PaymentWidgetDialog" );
335 rejectWhenEscapePressed(
true );
338 setWindowTitle(
TR(
"gcw.billPay.dialog.title" ) );
340 m_editWidget = contents()-> addNew< PaymentWidget >( _bpGuid );
342 auto pbSave = titleBar()-> addNew< Wt::WPushButton >(
TR(
"gcw.billPay.lbl.save" ) );
343 auto pbCancel = titleBar()-> addNew< Wt::WPushButton >(
TR(
"gcw.billPay.lbl.cancel" ) );
345 pbSave -> setStyleClass(
"btn-xs" );
346 pbCancel -> setStyleClass(
"btn-xs" );
357 if( m_editWidget-> saveData() )
367 return m_editWidget-> paymentDate();
auto setNum(const std::string &_value) -> void
auto setNotes(const std::string &_acctGuid, const std::string &_value) -> void
auto setValue(GCW_NUMERIC _value) -> void
auto newTransaction(const std::string &_accountGuid1, const std::string &_accountGuid2, const Wt::WDate &_date=Wt::WDate::currentDate(), GCW_NUMERIC _value=GCW_NUMERIC(0), const std::string &_description="") -> void
New Transaction.
static WDate currentDate()
std::string toUTF8() const
WString & arg(const std::wstring &value)
#define GCW_DATE_FORMAT_DISPLAY
#define GCW_NUMERIC
Internal Numeric Type.
auto dateStorageString(const Wt::WDate *_date) -> std::string
auto currentDateTimeDisplayString() -> std::string
auto currentDateTimeStorageString() -> std::string
auto byFullName(const std::string &_fullName) -> Item::Ptr
Load Account by 'full name' with ':' account separator.
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
auto byTransaction(const std::string &_txGuid) -> Item::Vector
Load Splits by Transaction.
auto byAccount(const std::string &_accountGuid) -> Item::Vector
Load Splits by Account.
auto byGuid(const std::string &_txGuid) -> Item::Ptr
Load Transaction by Guid.
auto bpItem(const std::string &_guid) -> GCW::Gui::BillPay::Item
Bill Pay Item.
auto toOneLineString(const std::string &_input) -> std::string
Convert a string with new-lines.
auto toString(int _value) -> std::string
Convert Integer to String.