FIRE-17173: Add total amount paid/received to money tracker

Ansariel 2015-10-29 13:51:13 +01:00
parent f53a73594a
commit e4a9613a2c
4 changed files with 43 additions and 4 deletions

View File

@ -32,16 +32,20 @@
#include "llclipboard.h"
#include "llfloaterreg.h"
#include "llnamelistctrl.h"
#include "lltextbox.h"
#include "lltrans.h"
#include "llviewercontrol.h"
FSMoneyTracker::FSMoneyTracker(const LLSD& key)
: LLFloater(key)
: LLFloater(key),
mAmountPaid(0),
mAmountReceived(0)
{
}
BOOL FSMoneyTracker::postBuild()
{
mSummary = getChild<LLTextBox>("summary");
mTransactionHistory = getChild<LLNameListCtrl>("payment_list");
mTransactionHistory->setContextMenu(&gFSMoneyTrackerListMenu);
mTransactionHistory->sortByColumn("time", TRUE);
@ -85,6 +89,17 @@ void FSMoneyTracker::addPayment(const LLUUID other_id, bool is_group, S32 amount
{
mTransactionHistory->setScrollPos(scroll_pos + 1);
}
if (incoming)
{
mAmountReceived += amount;
mSummary->setTextArg("RECEIVED", llformat("%d", mAmountReceived));
}
else
{
mAmountPaid += amount;
mSummary->setTextArg("PAID", llformat("%d", mAmountPaid));
}
}
std::string FSMoneyTracker::getTime(time_t utc_time)
@ -107,7 +122,11 @@ std::string FSMoneyTracker::getDate(time_t utc_time)
void FSMoneyTracker::clear()
{
LL_INFOS() << "Cleared." << LL_ENDL;
mAmountPaid = 0;
mAmountReceived = 0;
mTransactionHistory->clearRows();
mSummary->setTextArg("RECEIVED", llformat("%d", mAmountReceived));
mSummary->setTextArg("PAID", llformat("%d", mAmountPaid));
}
//////////////////////////////////////////////////////////////////////////////

View File

@ -32,6 +32,7 @@
#include "lllistcontextmenu.h"
class LLNameListCtrl;
class LLTextBox;
class FSMoneyTracker: public LLFloater
{
@ -47,7 +48,12 @@ private:
void clear();
std::string getTime(time_t utc_time);
std::string getDate(time_t utc_time);
LLNameListCtrl* mTransactionHistory;
LLNameListCtrl* mTransactionHistory;
LLTextBox* mSummary;
S32 mAmountPaid;
S32 mAmountReceived;
};
class FSMoneyTrackerListMenu : public LLListContextMenu

View File

@ -5,6 +5,9 @@
<name_list.columns name="name" label="Name"/>
<name_list.columns name="amount" label="Betrag"/>
</name_list>
<text name="summary">
Gezahlt: L$ [PAID] - Erhalten: L$ [RECEIVED]
</text>
<check_box label="Immer protokollieren" name="FSAlwaysTrackPayments" tool_tip="Zahlungen auch dann protokollieren, wenn der Money-Tracker geschlossen ist."/>
<button name="Clear" label="Löschen"/>
</floater>

View File

@ -4,7 +4,7 @@
help_topic="fs_tip_tracker"
title="Money Tracker"
width="200"
height="200"
height="220"
min_width="175"
min_height="175"
single_instance="true"
@ -16,7 +16,7 @@
<name_list
draw_heading="true"
follows="all"
bottom="-45"
bottom="-65"
layout="topleft"
left="4"
top="1"
@ -43,6 +43,17 @@
name="time_sort_column"
width="-1"/>
</name_list>
<text
follows="left|right|bottom"
height="16"
layout="topleft"
left="4"
name="summary"
right="-4"
use_ellipses="true"
wrap="false">
Paid: L$ [PAID] - Received: L$ [RECEIVED]
</text>
<check_box
control_name="FSAlwaysTrackPayments"
follows="left|right|bottom"