00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llpanelgrouplandmoney.h"
00035
00036 #include "lluiconstants.h"
00037 #include "roles_constants.h"
00038
00039 #include "llparcel.h"
00040 #include "llqueryflags.h"
00041
00042 #include "llagent.h"
00043 #include "lliconctrl.h"
00044 #include "lllineeditor.h"
00045 #include "llscrolllistctrl.h"
00046 #include "lltextbox.h"
00047 #include "lltabcontainer.h"
00048 #include "lltransactiontypes.h"
00049 #include "lluictrlfactory.h"
00050
00051 #include "llstatusbar.h"
00052 #include "llfloaterworldmap.h"
00053 #include "llviewermessage.h"
00054
00056
00057 class LLGroupMoneyTabEventHandler
00058 {
00059 public:
00060 LLGroupMoneyTabEventHandler(LLButton* earlier_button,
00061 LLButton* later_button,
00062 LLTextEditor* text_editor,
00063 LLTabContainer* tab_containerp,
00064 LLPanel* panelp,
00065 const LLString& loading_text,
00066 const LLUUID& group_id,
00067 S32 interval_length_days,
00068 S32 max_interval_days);
00069 virtual ~LLGroupMoneyTabEventHandler();
00070
00071 virtual void requestData(LLMessageSystem* msg);
00072 virtual void processReply(LLMessageSystem* msg, void** data);
00073
00074 virtual void onClickEarlier();
00075 virtual void onClickLater();
00076 virtual void onClickTab();
00077
00078 static void clickEarlierCallback(void* data);
00079 static void clickLaterCallback(void* data);
00080 static void clickTabCallback(void* user_data, bool from_click);
00081
00082 static LLMap<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
00083 static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
00084 protected:
00085 class impl;
00086 impl* mImplementationp;
00087 };
00088
00089 class LLGroupMoneyDetailsTabEventHandler : public LLGroupMoneyTabEventHandler
00090 {
00091 public:
00092 LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
00093 LLButton* later_buttonp,
00094 LLTextEditor* text_editorp,
00095 LLTabContainer* tab_containerp,
00096 LLPanel* panelp,
00097 const LLString& loading_text,
00098 const LLUUID& group_id);
00099 virtual ~LLGroupMoneyDetailsTabEventHandler();
00100
00101 virtual void requestData(LLMessageSystem* msg);
00102 virtual void processReply(LLMessageSystem* msg, void** data);
00103 };
00104
00105
00106 class LLGroupMoneySalesTabEventHandler : public LLGroupMoneyTabEventHandler
00107 {
00108 public:
00109 LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
00110 LLButton* later_buttonp,
00111 LLTextEditor* text_editorp,
00112 LLTabContainer* tab_containerp,
00113 LLPanel* panelp,
00114 const LLString& loading_text,
00115 const LLUUID& group_id);
00116 virtual ~LLGroupMoneySalesTabEventHandler();
00117
00118 virtual void requestData(LLMessageSystem* msg);
00119 virtual void processReply(LLMessageSystem* msg, void** data);
00120 };
00121
00122 class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler
00123 {
00124 public:
00125 LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
00126 LLTabContainer* tab_containerp,
00127 LLPanel* panelp,
00128 const LLString& loading_text,
00129 const LLUUID& group_id);
00130 virtual ~LLGroupMoneyPlanningTabEventHandler();
00131
00132 virtual void requestData(LLMessageSystem* msg);
00133 virtual void processReply(LLMessageSystem* msg, void** data);
00134 };
00135
00137
00138 class LLPanelGroupLandMoney::impl
00139 {
00140 public:
00141 impl(LLPanelGroupLandMoney& panel, const LLUUID& group_id);
00142 virtual ~impl();
00143
00144 void requestGroupLandInfo();
00145
00146 int getStoredContribution();
00147 void setYourContributionTextField(int contrib);
00148 void setYourMaxContributionTextBox(int max);
00149
00150 virtual void onMapButton();
00151 virtual bool applyContribution();
00152 virtual void processGroupLand(LLMessageSystem* msg);
00153
00154 static void mapCallback(void* data);
00155 static void contributionCommitCallback(LLUICtrl* ctrl, void* userdata);
00156 static void contributionKeystrokeCallback(LLLineEditor* caller, void* userdata);
00157
00158
00159 public:
00160 LLPanelGroupLandMoney& mPanel;
00161
00162 LLTextBox* mGroupOverLimitTextp;
00163 LLIconCtrl* mGroupOverLimitIconp;
00164
00165 LLLineEditor* mYourContributionEditorp;
00166
00167 LLButton* mMapButtonp;
00168
00169 LLGroupMoneyTabEventHandler* mMoneyDetailsTabEHp;
00170 LLGroupMoneyTabEventHandler* mMoneyPlanningTabEHp;
00171 LLGroupMoneyTabEventHandler* mMoneySalesTabEHp;
00172
00173 LLScrollListCtrl* mGroupParcelsp;
00174
00175 LLUUID mGroupID;
00176 LLUUID mTransID;
00177
00178 bool mBeenActivated;
00179 bool mNeedsSendGroupLandRequest;
00180 bool mNeedsApply;
00181
00182 std::string mCantViewParcelsText;
00183 std::string mCantViewAccountsText;
00184 };
00185
00186
00187
00188
00189 LLPanelGroupLandMoney::impl::impl(LLPanelGroupLandMoney& panel, const LLUUID& group_id)
00190 : mPanel(panel),
00191 mGroupID(group_id)
00192 {
00193 mTransID = LLUUID::null;
00194
00195 mBeenActivated = false;
00196 mNeedsSendGroupLandRequest = true;
00197 mNeedsApply = false;
00198
00199 mYourContributionEditorp = NULL;
00200 mMapButtonp = NULL;
00201 mGroupParcelsp = NULL;
00202 mGroupOverLimitTextp = NULL;
00203 mGroupOverLimitIconp = NULL;
00204
00205 mMoneySalesTabEHp = NULL;
00206 mMoneyPlanningTabEHp = NULL;
00207 mMoneyDetailsTabEHp = NULL;
00208 }
00209
00210 LLPanelGroupLandMoney::impl::~impl()
00211 {
00212 if ( mMoneySalesTabEHp ) delete mMoneySalesTabEHp;
00213 if ( mMoneyDetailsTabEHp ) delete mMoneyDetailsTabEHp;
00214 if ( mMoneyPlanningTabEHp ) delete mMoneyPlanningTabEHp;
00215 }
00216
00217 void LLPanelGroupLandMoney::impl::requestGroupLandInfo()
00218 {
00219 U32 query_flags = DFQ_GROUP_OWNED;
00220
00221 mTransID.generate();
00222 mGroupParcelsp->deleteAllItems();
00223
00224 send_places_query(mGroupID, mTransID, "", query_flags, LLParcel::C_ANY, "");
00225 }
00226
00227 void LLPanelGroupLandMoney::impl::onMapButton()
00228 {
00229 LLScrollListItem* itemp;
00230 itemp = mGroupParcelsp->getFirstSelected();
00231 if (!itemp) return;
00232
00233 const LLScrollListCell* cellp;
00234
00235
00236
00237 cellp = itemp->getColumn(3);
00238
00239 F32 global_x = 0.f;
00240 F32 global_y = 0.f;
00241 sscanf(cellp->getValue().asString().c_str(), "%f %f", &global_x, &global_y);
00242
00243
00244 F64 global_z = gAgent.getPositionGlobal().mdV[VZ];
00245
00246 LLVector3d pos_global(global_x, global_y, global_z);
00247 gFloaterWorldMap->trackLocation(pos_global);
00248
00249 LLFloaterWorldMap::show(NULL, TRUE);
00250 }
00251
00252 bool LLPanelGroupLandMoney::impl::applyContribution()
00253 {
00254
00255 S32 your_contribution = 0;
00256 S32 sqm_avail;
00257
00258 your_contribution = getStoredContribution();
00259 sqm_avail = your_contribution;
00260
00261 if(gStatusBar)
00262 {
00263 sqm_avail += gStatusBar->getSquareMetersLeft();
00264 }
00265
00266
00267 S32 new_contribution = atoi(mYourContributionEditorp->getText().c_str());
00268
00269 if( new_contribution != your_contribution &&
00270 new_contribution >= 0 &&
00271 new_contribution <= sqm_avail )
00272 {
00273
00274 if(!gAgent.setGroupContribution(mGroupID, new_contribution))
00275 {
00276
00277 llwarns << "Unable to set contribution." << llendl;
00278 return false;
00279 }
00280 }
00281 else
00282 {
00283
00284
00285 new_contribution = your_contribution;
00286 }
00287
00288
00289 setYourContributionTextField(new_contribution);
00290
00291 return true;
00292 }
00293
00294
00295
00296 int LLPanelGroupLandMoney::impl::getStoredContribution()
00297 {
00298 LLGroupData group_data;
00299
00300 group_data.mContribution = 0;
00301 gAgent.getGroupData(mGroupID, group_data);
00302
00303 return group_data.mContribution;
00304 }
00305
00306
00307 void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
00308 {
00309 LLString buffer = llformat("%d", contrib);
00310
00311 if ( mYourContributionEditorp )
00312 {
00313 mYourContributionEditorp->setText(buffer);
00314 }
00315 }
00316
00317 void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max)
00318 {
00319 mPanel.childSetTextArg("your_contribution_max_value", "[AMOUNT]", llformat("%d", max));
00320 }
00321
00322
00323 void LLPanelGroupLandMoney::impl::mapCallback(void* data)
00324 {
00325 LLPanelGroupLandMoney::impl* selfp = (LLPanelGroupLandMoney::impl*) data;
00326
00327 if ( selfp ) selfp->onMapButton();
00328 }
00329
00330 void LLPanelGroupLandMoney::impl::contributionCommitCallback(LLUICtrl* ctrl,
00331 void* userdata)
00332 {
00333 LLPanelGroupLandMoney* tabp = (LLPanelGroupLandMoney*) userdata;
00334 LLLineEditor* editorp = (LLLineEditor*) ctrl;
00335
00336 if ( tabp && editorp )
00337 {
00338 impl* self = tabp->mImplementationp;
00339 int your_contribution = 0;
00340 int new_contribution = 0;
00341
00342 new_contribution= atoi(editorp->getText().c_str());
00343 your_contribution = self->getStoredContribution();
00344
00345
00346 self->setYourContributionTextField(new_contribution);
00347
00348
00349 self->mNeedsApply = new_contribution != your_contribution;
00350 tabp->notifyObservers();
00351 }
00352 }
00353
00354 void LLPanelGroupLandMoney::impl::contributionKeystrokeCallback(LLLineEditor* caller,
00355 void* userdata)
00356 {
00357 impl::contributionCommitCallback(caller, userdata);
00358 }
00359
00360
00361 void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
00362 {
00363 S32 count = msg->getNumberOfBlocks("QueryData");
00364 if(count > 0)
00365 {
00366 S32 first_block = 0;
00367
00368 LLUUID owner_id;
00369 LLUUID trans_id;
00370
00371 msg->getUUID("QueryData", "OwnerID", owner_id, 0);
00372 msg->getUUID("TransactionData", "TransactionID", trans_id);
00373
00374 if(owner_id.isNull())
00375 {
00376
00377 ++first_block;
00378
00379 S32 total_contribution;
00380 msg->getS32("QueryData", "ActualArea", total_contribution, 0);
00381 mPanel.childSetTextArg("total_contributed_land_value", "[AREA]", llformat("%d", total_contribution));
00382
00383 S32 committed;
00384 msg->getS32("QueryData", "BillableArea", committed, 0);
00385 mPanel.childSetTextArg("total_land_in_use_value", "[AREA]", llformat("%d", committed));
00386
00387 S32 available = total_contribution - committed;
00388 mPanel.childSetTextArg("land_available_value", "[AREA]", llformat("%d", available));
00389
00390 if ( mGroupOverLimitTextp && mGroupOverLimitIconp )
00391 {
00392 mGroupOverLimitIconp->setVisible(available < 0);
00393 mGroupOverLimitTextp->setVisible(available < 0);
00394 }
00395 }
00396
00397 if ( trans_id != mTransID ) return;
00398
00399
00400 if (!gAgent.isInGroup(mGroupID)) return;
00401
00402
00403 if ( count > 1)
00404 {
00405 mMapButtonp->setEnabled(TRUE);
00406 }
00407
00408 char name[MAX_STRING];
00409 char desc[MAX_STRING];
00410 S32 actual_area;
00411 S32 billable_area;
00412 U8 flags;
00413 F32 global_x;
00414 F32 global_y;
00415 char sim_name[MAX_STRING];
00416 for(S32 i = first_block; i < count; ++i)
00417 {
00418 msg->getUUID("QueryData", "OwnerID", owner_id, i);
00419 msg->getString("QueryData", "Name", MAX_STRING, name, i);
00420 msg->getString("QueryData", "Desc", MAX_STRING, desc, i);
00421 msg->getS32("QueryData", "ActualArea", actual_area, i);
00422 msg->getS32("QueryData", "BillableArea", billable_area, i);
00423 msg->getU8("QueryData", "Flags", flags, i);
00424 msg->getF32("QueryData", "GlobalX", global_x, i);
00425 msg->getF32("QueryData", "GlobalY", global_y, i);
00426 msg->getString("QueryData", "SimName", MAX_STRING, sim_name, i);
00427
00428 S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
00429 S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
00430 char location[MAX_STRING];
00431 snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y);
00432 char area[MAX_STRING];
00433 if(billable_area == actual_area)
00434 {
00435 snprintf(area, MAX_STRING, "%d", billable_area);
00436 }
00437 else
00438 {
00439 snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area);
00440 }
00441 char hidden[MAX_STRING];
00442 snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y);
00443
00444 LLSD row;
00445
00446 row["columns"][0]["column"] = "name";
00447 row["columns"][0]["value"] = name;
00448 row["columns"][0]["font"] = "SANSSERIFSMALL";
00449
00450 row["columns"][1]["column"] = "location";
00451 row["columns"][1]["value"] = location;
00452 row["columns"][1]["font"] = "SANSSERIFSMALL";
00453
00454 row["columns"][2]["column"] = "area";
00455 row["columns"][2]["value"] = area;
00456 row["columns"][2]["font"] = "SANSSERIFSMALL";
00457
00458 row["columns"][3]["column"] = "hidden";
00459 row["columns"][3]["value"] = hidden;
00460
00461 mGroupParcelsp->addElement(row, ADD_SORTED);
00462 }
00463 }
00464 }
00465
00466
00467
00468
00469
00470
00471 void* LLPanelGroupLandMoney::createTab(void* data)
00472 {
00473 LLUUID* group_id = static_cast<LLUUID*>(data);
00474 return new LLPanelGroupLandMoney("panel group land money", *group_id);
00475 }
00476
00477
00478 LLMap<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs;
00479
00480 LLPanelGroupLandMoney::LLPanelGroupLandMoney(const std::string& name,
00481 const LLUUID& group_id) :
00482 LLPanelGroupTab(name, group_id)
00483 {
00484 mImplementationp = new impl(*this, group_id);
00485
00486
00487
00488
00489 LLPanelGroupLandMoney::sGroupIDs.addData(group_id, this);
00490 }
00491
00492 LLPanelGroupLandMoney::~LLPanelGroupLandMoney()
00493 {
00494 delete mImplementationp;
00495 LLPanelGroupLandMoney::sGroupIDs.removeData(mGroupID);
00496 }
00497
00498 void LLPanelGroupLandMoney::activate()
00499 {
00500 if ( !mImplementationp->mBeenActivated )
00501 {
00502
00503 LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
00504
00505 if ( tabp )
00506 {
00507 tabp->selectFirstTab();
00508 mImplementationp->mBeenActivated = true;
00509 }
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 S32 max_avail = mImplementationp->getStoredContribution();
00529 if(gStatusBar)
00530 {
00531 max_avail += gStatusBar->getSquareMetersLeft();
00532 }
00533 mImplementationp->setYourMaxContributionTextBox(max_avail);
00534 }
00535
00536 update(GC_ALL);
00537 }
00538
00539 void LLPanelGroupLandMoney::update(LLGroupChange gc)
00540 {
00541 if (gc != GC_ALL) return;
00542
00543 LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
00544
00545 if ( tabp )
00546 {
00547 LLPanel* panelp;
00548 LLGroupMoneyTabEventHandler* eh;
00549
00550 panelp = tabp->getCurrentPanel();
00551
00552
00553 if ( panelp )
00554 {
00555 eh = get_if_there(LLGroupMoneyTabEventHandler::sTabsToHandlers,
00556 panelp,
00557 (LLGroupMoneyTabEventHandler*)NULL);
00558 if ( eh ) eh->onClickTab();
00559 }
00560 }
00561
00562 mImplementationp->requestGroupLandInfo();
00563 mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
00564 }
00565
00566 bool LLPanelGroupLandMoney::needsApply(LLString& mesg)
00567 {
00568 return mImplementationp->mNeedsApply;
00569 }
00570
00571 bool LLPanelGroupLandMoney::apply(LLString& mesg)
00572 {
00573 if (!mImplementationp->applyContribution() )
00574 {
00575 mesg.assign(getUIString("land_contrib_error"));
00576 return false;
00577 }
00578
00579 mImplementationp->mNeedsApply = false;
00580 notifyObservers();
00581
00582 return true;
00583 }
00584
00585 void LLPanelGroupLandMoney::cancel()
00586 {
00587
00588 mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
00589
00590 mImplementationp->mNeedsApply = false;
00591 notifyObservers();
00592 }
00593
00594
00595 BOOL LLPanelGroupLandMoney::postBuild()
00596 {
00597
00598
00599
00600
00601
00602
00603
00604 bool can_view = gAgent.isInGroup(mGroupID);
00605
00606 mImplementationp->mGroupOverLimitIconp =
00607 getChild<LLIconCtrl>("group_over_limit_icon");
00608 mImplementationp->mGroupOverLimitTextp =
00609 getChild<LLTextBox>("group_over_limit_text");
00610
00611 mImplementationp->mYourContributionEditorp
00612 = getChild<LLLineEditor>("your_contribution_line_editor");
00613 if ( mImplementationp->mYourContributionEditorp )
00614 {
00615 LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
00616
00617 editor->setCommitCallback(mImplementationp->contributionCommitCallback);
00618 editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback);
00619 editor->setCallbackUserData(this);
00620 }
00621
00622 mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
00623
00624 mImplementationp->mGroupParcelsp =
00625 getChild<LLScrollListCtrl>("group_parcel_list");
00626
00627 mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
00628 mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
00629
00630 if ( mImplementationp->mMapButtonp )
00631 {
00632 mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp);
00633 }
00634
00635 if ( mImplementationp->mGroupOverLimitTextp )
00636 {
00637 mImplementationp->mGroupOverLimitTextp->setVisible(FALSE);
00638 }
00639
00640 if ( mImplementationp->mGroupOverLimitIconp )
00641 {
00642 mImplementationp->mGroupOverLimitIconp->setVisible(FALSE);
00643 }
00644
00645 if ( mImplementationp->mMapButtonp )
00646 {
00647 mImplementationp->mMapButtonp->setEnabled(FALSE);
00648 }
00649
00650 if ( !can_view )
00651 {
00652 if ( mImplementationp->mGroupParcelsp )
00653 {
00654 mImplementationp->mGroupParcelsp->addCommentText(
00655 mImplementationp->mCantViewParcelsText);
00656 mImplementationp->mGroupParcelsp->setEnabled(FALSE);
00657 }
00658 }
00659
00660
00661
00662 LLButton* earlierp, *laterp;
00663 LLTextEditor* textp;
00664 LLPanel* panelp;
00665
00666 LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
00667
00668 if ( !can_view )
00669 {
00670 if ( tabcp )
00671 {
00672 S32 i;
00673 S32 tab_count = tabcp->getTabCount();
00674
00675 for (i = tab_count - 1; i >=0; --i)
00676 {
00677 tabcp->enableTabButton(i, false);
00678 }
00679 }
00680 }
00681
00682 LLString loading_text = getString("loading_txt");
00683
00684
00685 earlierp = getChild<LLButton>("earlier_details_button", true);
00686 laterp = getChild<LLButton>("later_details_button", true);
00687 textp = getChild<LLTextEditor>("group_money_details_text", true);
00688 panelp = getChild<LLPanel>("group_money_details_tab", true);
00689
00690 if ( !can_view )
00691 {
00692 textp->setText(mImplementationp->mCantViewAccountsText);
00693 }
00694 else
00695 {
00696 mImplementationp->mMoneyDetailsTabEHp =
00697 new LLGroupMoneyDetailsTabEventHandler(earlierp,
00698 laterp,
00699 textp,
00700 tabcp,
00701 panelp,
00702 loading_text,
00703 mGroupID);
00704 }
00705
00706 textp = getChild<LLTextEditor>("group_money_planning_text", true);
00707 panelp = getChild<LLPanel>("group_money_planning_tab", true);
00708
00709 if ( !can_view )
00710 {
00711 textp->setText(mImplementationp->mCantViewAccountsText);
00712 }
00713 else
00714 {
00715 mImplementationp->mMoneyPlanningTabEHp =
00716 new LLGroupMoneyPlanningTabEventHandler(textp,
00717 tabcp,
00718 panelp,
00719 loading_text,
00720 mGroupID);
00721 }
00722
00723
00724 earlierp = getChild<LLButton>("earlier_sales_button", true);
00725 laterp = getChild<LLButton>("later_sales_button", true);
00726 textp = getChild<LLTextEditor>("group_money_sales_text", true);
00727 panelp = getChild<LLPanel>("group_money_sales_tab", true);
00728
00729 if ( !can_view )
00730 {
00731 textp->setText(mImplementationp->mCantViewAccountsText);
00732 }
00733 else
00734 {
00735 mImplementationp->mMoneySalesTabEHp =
00736 new LLGroupMoneySalesTabEventHandler(earlierp,
00737 laterp,
00738 textp,
00739 tabcp,
00740 panelp,
00741 loading_text,
00742 mGroupID);
00743 }
00744
00745 return LLPanelGroupTab::postBuild();
00746 }
00747
00748 BOOL LLPanelGroupLandMoney::isVisibleByAgent(LLAgent* agentp)
00749 {
00750 return mAllowEdit && agentp->isInGroup(mGroupID);
00751 }
00752
00753 void LLPanelGroupLandMoney::processPlacesReply(LLMessageSystem* msg, void**)
00754 {
00755 LLUUID group_id;
00756 msg->getUUID("AgentData", "QueryID", group_id);
00757
00758 LLPanelGroupLandMoney* selfp = sGroupIDs.getIfThere(group_id);
00759 if(!selfp)
00760 {
00761 llinfos << "Group Panel Land L$ " << group_id << " no longer in existence."
00762 << llendl;
00763 return;
00764 }
00765
00766 selfp->mImplementationp->processGroupLand(msg);
00767 }
00768
00769
00770
00771
00772
00773 class LLGroupMoneyTabEventHandler::impl
00774 {
00775 public:
00776 impl(LLButton* earlier_buttonp,
00777 LLButton* later_buttonp,
00778 LLTextEditor* text_editorp,
00779 LLPanel* tabpanelp,
00780 const LLString& loading_text,
00781 const LLUUID& group_id,
00782 S32 interval_length_days,
00783 S32 max_interval_days);
00784 ~impl();
00785
00786 bool getCanClickLater();
00787 bool getCanClickEarlier();
00788
00789 void updateButtons();
00790
00791
00792 public:
00793 LLUUID mGroupID;
00794 LLUUID mPanelID;
00795
00796 LLPanel* mTabPanelp;
00797
00798 int mIntervalLength;
00799 int mMaxInterval;
00800 int mCurrentInterval;
00801
00802 LLTextEditor* mTextEditorp;
00803 LLButton* mEarlierButtonp;
00804 LLButton* mLaterButtonp;
00805
00806 LLString mLoadingText;
00807 };
00808
00809 LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp,
00810 LLButton* later_buttonp,
00811 LLTextEditor* text_editorp,
00812 LLPanel* tabpanelp,
00813 const LLString& loading_text,
00814 const LLUUID& group_id,
00815 S32 interval_length_days,
00816 S32 max_interval_days)
00817 {
00818 mGroupID = group_id;
00819 mPanelID.generate();
00820
00821 mIntervalLength = interval_length_days;
00822 mMaxInterval = max_interval_days;
00823 mCurrentInterval = 0;
00824
00825 mTextEditorp = text_editorp;
00826 mEarlierButtonp = earlier_buttonp;
00827 mLaterButtonp = later_buttonp;
00828 mTabPanelp = tabpanelp;
00829
00830 mLoadingText = loading_text;
00831 }
00832
00833 LLGroupMoneyTabEventHandler::impl::~impl()
00834 {
00835 }
00836
00837 bool LLGroupMoneyTabEventHandler::impl::getCanClickEarlier()
00838 {
00839 return (mCurrentInterval < mMaxInterval);
00840 }
00841
00842 bool LLGroupMoneyTabEventHandler::impl::getCanClickLater()
00843 {
00844 return ( mCurrentInterval > 0 );
00845 }
00846
00847 void LLGroupMoneyTabEventHandler::impl::updateButtons()
00848 {
00849 if ( mEarlierButtonp )
00850 {
00851 mEarlierButtonp->setEnabled(getCanClickEarlier());
00852 }
00853 if ( mLaterButtonp )
00854 {
00855 mLaterButtonp->setEnabled(getCanClickLater());
00856 }
00857 }
00858
00859
00860
00861
00862
00863 LLMap<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs;
00864 std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sTabsToHandlers;
00865
00866 LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp,
00867 LLButton* later_buttonp,
00868 LLTextEditor* text_editorp,
00869 LLTabContainer* tab_containerp,
00870 LLPanel* panelp,
00871 const LLString& loading_text,
00872 const LLUUID& group_id,
00873 S32 interval_length_days,
00874 S32 max_interval_days)
00875 {
00876 mImplementationp = new impl(earlier_buttonp,
00877 later_buttonp,
00878 text_editorp,
00879 panelp,
00880 loading_text,
00881 group_id,
00882 interval_length_days,
00883 max_interval_days);
00884
00885 if ( earlier_buttonp )
00886 {
00887 earlier_buttonp->setClickedCallback(clickEarlierCallback, this);
00888 }
00889
00890 if ( later_buttonp )
00891 {
00892 later_buttonp->setClickedCallback(clickLaterCallback, this);
00893 }
00894
00895 mImplementationp->updateButtons();
00896
00897 if ( tab_containerp && panelp )
00898 {
00899 tab_containerp->setTabChangeCallback(panelp, clickTabCallback);
00900 tab_containerp->setTabUserData(panelp, this);
00901 }
00902
00903 sInstanceIDs.addData(mImplementationp->mPanelID, this);
00904 sTabsToHandlers[panelp] = this;
00905 }
00906
00907 LLGroupMoneyTabEventHandler::~LLGroupMoneyTabEventHandler()
00908 {
00909 sInstanceIDs.removeData(mImplementationp->mPanelID);
00910 sTabsToHandlers.erase(mImplementationp->mTabPanelp);
00911
00912 delete mImplementationp;
00913 }
00914
00915
00916 void LLGroupMoneyTabEventHandler::onClickTab()
00917 {
00918 requestData(gMessageSystem);
00919 }
00920
00921 void LLGroupMoneyTabEventHandler::requestData(LLMessageSystem* msg)
00922 {
00923
00924 }
00925
00926 void LLGroupMoneyTabEventHandler::processReply(LLMessageSystem* msg, void** data)
00927 {
00928
00929 }
00930
00931 void LLGroupMoneyTabEventHandler::onClickEarlier()
00932 {
00933 if ( mImplementationp->mTextEditorp)
00934 {
00935 mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
00936 }
00937 mImplementationp->mCurrentInterval++;
00938
00939 mImplementationp->updateButtons();
00940
00941 requestData(gMessageSystem);
00942 }
00943
00944 void LLGroupMoneyTabEventHandler::onClickLater()
00945 {
00946 if ( mImplementationp->mTextEditorp )
00947 {
00948 mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
00949 }
00950 mImplementationp->mCurrentInterval--;
00951
00952 mImplementationp->updateButtons();
00953
00954 requestData(gMessageSystem);
00955 }
00956
00957
00958 void LLGroupMoneyTabEventHandler::clickEarlierCallback(void* data)
00959 {
00960 LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
00961
00962 if ( selfp ) selfp->onClickEarlier();
00963 }
00964
00965
00966 void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data)
00967 {
00968 LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
00969 if ( selfp ) selfp->onClickLater();
00970 }
00971
00972
00973 void LLGroupMoneyTabEventHandler::clickTabCallback(void* data, bool from_click)
00974 {
00975 LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
00976 if ( selfp ) selfp->onClickTab();
00977 }
00978
00979
00980
00981
00982
00983 LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
00984 LLButton* later_buttonp,
00985 LLTextEditor* text_editorp,
00986 LLTabContainer* tab_containerp,
00987 LLPanel* panelp,
00988 const LLString& loading_text,
00989 const LLUUID& group_id)
00990 : LLGroupMoneyTabEventHandler(earlier_buttonp,
00991 later_buttonp,
00992 text_editorp,
00993 tab_containerp,
00994 panelp,
00995 loading_text,
00996 group_id,
00997 SUMMARY_INTERVAL,
00998 SUMMARY_MAX)
00999 {
01000 }
01001
01002 LLGroupMoneyDetailsTabEventHandler::~LLGroupMoneyDetailsTabEventHandler()
01003 {
01004 }
01005
01006 void LLGroupMoneyDetailsTabEventHandler::requestData(LLMessageSystem* msg)
01007 {
01008 msg->newMessageFast(_PREHASH_GroupAccountDetailsRequest);
01009 msg->nextBlockFast(_PREHASH_AgentData);
01010 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
01011 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
01012 msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID );
01013 msg->nextBlockFast(_PREHASH_MoneyData);
01014 msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
01015 msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
01016 msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
01017
01018 gAgent.sendReliableMessage();
01019
01020 if ( mImplementationp->mTextEditorp )
01021 {
01022 mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
01023 }
01024
01025 LLGroupMoneyTabEventHandler::requestData(msg);
01026 }
01027
01028 void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,
01029 void** data)
01030 {
01031 LLUUID group_id;
01032 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
01033 if (mImplementationp->mGroupID != group_id)
01034 {
01035 llwarns << "Group Account details not for this group!" << llendl;
01036 return;
01037 }
01038
01039 char line[MAX_STRING];
01040 LLString text;
01041
01042 char start_date[MAX_STRING];
01043 S32 interval_days;
01044 S32 current_interval;
01045
01046 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
01047 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
01048 msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date);
01049
01050 if ( interval_days != mImplementationp->mIntervalLength ||
01051 current_interval != mImplementationp->mCurrentInterval )
01052 {
01053 llinfos << "Out of date details packet " << interval_days << " "
01054 << current_interval << llendl;
01055 return;
01056 }
01057
01058 snprintf(line, MAX_STRING, "%s\n\n", start_date);
01059 text.append(line);
01060
01061 S32 total_amount = 0;
01062 S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
01063 for(S32 i = 0; i < transactions; i++)
01064 {
01065 S32 amount = 0;
01066 char desc[MAX_STRING];
01067
01068 msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Description, MAX_STRING, desc, i );
01069 msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
01070
01071 if (amount != 0)
01072 {
01073 snprintf(line, MAX_STRING, "%-24s %6d\n", desc, amount );
01074 text.append(line);
01075 }
01076 else
01077 {
01078
01079 }
01080
01081 total_amount += amount;
01082 }
01083
01084 text.append(1, '\n');
01085
01086 snprintf(line, MAX_STRING, "%-24s %6d\n", "Total", total_amount );
01087 text.append(line);
01088
01089 if ( mImplementationp->mTextEditorp )
01090 {
01091 mImplementationp->mTextEditorp->setText(text);
01092 }
01093 }
01094
01095
01096 void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg,
01097 void** data)
01098 {
01099 LLUUID agent_id;
01100 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
01101 if (gAgent.getID() != agent_id)
01102 {
01103 llwarns << "Got group L$ history reply for another agent!" << llendl;
01104 return;
01105 }
01106
01107 LLUUID request_id;
01108 msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
01109 LLGroupMoneyTabEventHandler* selfp = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
01110 if (!selfp)
01111 {
01112 llwarns << "GroupAccountDetails recieved for non-existent group panel." << llendl;
01113 return;
01114 }
01115
01116 selfp->processReply(msg, data);
01117 }
01118
01119
01120
01121
01122
01123 LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
01124 LLButton* later_buttonp,
01125 LLTextEditor* text_editorp,
01126 LLTabContainer* tab_containerp,
01127 LLPanel* panelp,
01128 const LLString& loading_text,
01129 const LLUUID& group_id)
01130 : LLGroupMoneyTabEventHandler(earlier_buttonp,
01131 later_buttonp,
01132 text_editorp,
01133 tab_containerp,
01134 panelp,
01135 loading_text,
01136 group_id,
01137 SUMMARY_INTERVAL,
01138 SUMMARY_MAX)
01139 {
01140 }
01141
01142 LLGroupMoneySalesTabEventHandler::~LLGroupMoneySalesTabEventHandler()
01143 {
01144 }
01145
01146 void LLGroupMoneySalesTabEventHandler::requestData(LLMessageSystem* msg)
01147 {
01148 msg->newMessageFast(_PREHASH_GroupAccountTransactionsRequest);
01149 msg->nextBlockFast(_PREHASH_AgentData);
01150 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
01151 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
01152 msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID );
01153 msg->nextBlockFast(_PREHASH_MoneyData);
01154 msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
01155 msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
01156 msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
01157
01158 gAgent.sendReliableMessage();
01159
01160 if ( mImplementationp->mTextEditorp )
01161 {
01162 mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
01163 }
01164
01165 LLGroupMoneyTabEventHandler::requestData(msg);
01166 }
01167
01168 void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
01169 void** data)
01170 {
01171 LLUUID group_id;
01172 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
01173 if (mImplementationp->mGroupID != group_id)
01174 {
01175 llwarns << "Group Account Transactions not for this group!" << llendl;
01176 return;
01177 }
01178
01179 char line[MAX_STRING];
01180 std::string text = mImplementationp->mTextEditorp->getText();
01181
01182 char start_date[MAX_STRING];
01183 S32 interval_days;
01184 S32 current_interval;
01185
01186 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
01187 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
01188 msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date);
01189
01190 if (interval_days != mImplementationp->mIntervalLength ||
01191 current_interval != mImplementationp->mCurrentInterval)
01192 {
01193 llinfos << "Out of date details packet " << interval_days << " "
01194 << current_interval << llendl;
01195 return;
01196 }
01197
01198
01199
01200 if (text == mImplementationp->mLoadingText)
01201 {
01202 text.clear();
01203
01204 snprintf(line, MAX_STRING, "%s\n\n", start_date);
01205 text.append(line);
01206 }
01207
01208 S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
01209 if (transactions == 0)
01210 {
01211 text.append("(none)");
01212 }
01213 else
01214 {
01215 for(S32 i = 0; i < transactions; i++)
01216 {
01217 const S32 SHORT_STRING = 64;
01218 char time[SHORT_STRING];
01219 S32 type = 0;
01220 S32 amount = 0;
01221 char user[SHORT_STRING];
01222 char item[SHORT_STRING];
01223
01224 msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Time, SHORT_STRING, time, i);
01225 msg->getStringFast(_PREHASH_HistoryData, _PREHASH_User, SHORT_STRING, user, i );
01226 msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Type, type, i);
01227 msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Item, SHORT_STRING, item, i );
01228 msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
01229
01230 if (amount != 0)
01231 {
01232 char* verb;
01233
01234 switch(type)
01235 {
01236 case TRANS_OBJECT_SALE:
01237 verb = "bought";
01238 break;
01239 case TRANS_GIFT:
01240 verb = "paid you";
01241 break;
01242 case TRANS_PAY_OBJECT:
01243 verb = "paid into";
01244 break;
01245 case TRANS_LAND_PASS_SALE:
01246 verb = "bought pass to";
01247 break;
01248 case TRANS_EVENT_FEE:
01249 verb = "paid fee for event";
01250 break;
01251 case TRANS_EVENT_PRIZE:
01252 verb = "paid prize for event";
01253 break;
01254 default:
01255 verb = "";
01256 break;
01257 }
01258
01259 snprintf(line, sizeof(line), "%s %6d - %s %s %s\n", time, amount, user, verb, item);
01260 text.append(line);
01261 }
01262 }
01263 }
01264
01265 if ( mImplementationp->mTextEditorp)
01266 {
01267 mImplementationp->mTextEditorp->setText(text);
01268 }
01269 }
01270
01271
01272 void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem* msg,
01273 void** data)
01274 {
01275 LLUUID agent_id;
01276 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
01277 if (gAgent.getID() != agent_id)
01278 {
01279 llwarns << "Got group L$ history reply for another agent!" << llendl;
01280 return;
01281 }
01282
01283 LLUUID request_id;
01284 msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
01285
01286 LLGroupMoneyTabEventHandler* self;
01287
01288 self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
01289 if (!self)
01290 {
01291 llwarns << "GroupAccountTransactions recieved for non-existent group panel." << llendl;
01292 return;
01293 }
01294
01295 self->processReply(msg, data);
01296 }
01297
01298
01299
01300
01301
01302 LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp,
01303 LLTabContainer* tab_containerp,
01304 LLPanel* panelp,
01305 const LLString& loading_text,
01306 const LLUUID& group_id)
01307 : LLGroupMoneyTabEventHandler(NULL,
01308 NULL,
01309 text_editorp,
01310 tab_containerp,
01311 panelp,
01312 loading_text,
01313 group_id,
01314 SUMMARY_INTERVAL,
01315 SUMMARY_MAX)
01316 {
01317 }
01318
01319 LLGroupMoneyPlanningTabEventHandler::~LLGroupMoneyPlanningTabEventHandler()
01320 {
01321 }
01322
01323 void LLGroupMoneyPlanningTabEventHandler::requestData(LLMessageSystem* msg)
01324 {
01325 msg->newMessageFast(_PREHASH_GroupAccountSummaryRequest);
01326 msg->nextBlockFast(_PREHASH_AgentData);
01327 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
01328 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
01329 msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->mGroupID );
01330 msg->nextBlockFast(_PREHASH_MoneyData);
01331 msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
01332 msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength);
01333 msg->addS32Fast(_PREHASH_CurrentInterval, 0);
01334
01335 gAgent.sendReliableMessage();
01336
01337 if ( mImplementationp->mTextEditorp )
01338 {
01339 mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
01340 }
01341
01342 LLGroupMoneyTabEventHandler::requestData(msg);
01343 }
01344
01345 void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,
01346 void** data)
01347 {
01348 LLUUID group_id;
01349 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
01350 if (mImplementationp->mGroupID != group_id)
01351 {
01352 llwarns << "Group Account Summary received not for this group!" << llendl;
01353 return;
01354 }
01355
01356 char line[MAX_STRING];
01357 LLString text;
01358
01359 char start_date[MAX_STRING];
01360 char last_stipend_date[MAX_STRING];
01361 char next_stipend_date[MAX_STRING];
01362 S32 interval_days;
01363 S32 current_interval;
01364 S32 balance;
01365 S32 total_credits;
01366 S32 total_debits;
01367 S32 cur_object_tax;
01368 S32 cur_light_tax;
01369 S32 cur_land_tax;
01370 S32 cur_group_tax;
01371 S32 cur_parcel_dir_fee;
01372 S32 cur_total_tax;
01373 S32 proj_object_tax;
01374 S32 proj_light_tax;
01375 S32 proj_land_tax;
01376 S32 proj_group_tax;
01377 S32 proj_parcel_dir_fee;
01378 S32 proj_total_tax;
01379 S32 non_exempt_members;
01380
01381 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
01382 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
01383 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_Balance, balance );
01384 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalCredits, total_credits );
01385 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalDebits, total_debits );
01386 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxCurrent, cur_object_tax );
01387 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxCurrent, cur_light_tax );
01388 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxCurrent, cur_land_tax );
01389 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxCurrent, cur_group_tax );
01390 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeCurrent, cur_parcel_dir_fee );
01391 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxEstimate, proj_object_tax );
01392 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxEstimate, proj_light_tax );
01393 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxEstimate, proj_land_tax );
01394 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxEstimate, proj_group_tax );
01395 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeEstimate, proj_parcel_dir_fee );
01396 msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_NonExemptMembers, non_exempt_members );
01397
01398 msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date);
01399 msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, MAX_STRING, last_stipend_date);
01400 msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, MAX_STRING, next_stipend_date);
01401
01402 cur_total_tax = cur_object_tax + cur_light_tax + cur_land_tax + cur_group_tax + cur_parcel_dir_fee;
01403 proj_total_tax = proj_object_tax + proj_light_tax + proj_land_tax + proj_group_tax + proj_parcel_dir_fee;
01404
01405 if (interval_days != mImplementationp->mIntervalLength ||
01406 current_interval != mImplementationp->mCurrentInterval)
01407 {
01408 llinfos << "Out of date summary packet " << interval_days << " "
01409 << current_interval << llendl;
01410 return;
01411 }
01412
01413 snprintf(line, MAX_STRING, "Summary for this week, beginning on %s\n", start_date);
01414 text.append(line);
01415
01416 if (current_interval == 0)
01417 {
01418 snprintf(line, MAX_STRING, "The next stipend day is %s\n\n", next_stipend_date);
01419 text.append(line);
01420 snprintf(line, MAX_STRING, "%-24sL$%6d\n", "Balance", balance );
01421 text.append(line);
01422
01423 text.append(1, '\n');
01424 }
01425
01426 snprintf(line, MAX_STRING, " Group Individual Share\n");
01427 text.append(line);
01428 snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members));
01429 text.append(line);
01430 snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Debits", total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members));
01431 text.append(line);
01432 snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Total", total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members));
01433 text.append(line);
01434
01435 if ( mImplementationp->mTextEditorp )
01436 {
01437 mImplementationp->mTextEditorp->setText(text);
01438 }
01439 }
01440
01441
01442 void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg,
01443 void** data)
01444 {
01445 LLUUID agent_id;
01446 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
01447 if (gAgent.getID() != agent_id)
01448 {
01449 llwarns << "Got group L$ history reply for another agent!" << llendl;
01450 return;
01451 }
01452
01453 LLUUID request_id;
01454 msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
01455
01456 LLGroupMoneyTabEventHandler* self;
01457
01458 self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
01459 if (!self)
01460 {
01461 llwarns << "GroupAccountSummary recieved for non-existent group L$ planning tab." << llendl;
01462 return;
01463 }
01464
01465 self->processReply(msg, data);
01466 }