pub struct SpendingReport {
pub start_date: NaiveDate,
pub end_date: NaiveDate,
pub groups: Vec<SpendingByGroup>,
pub total_spending: Money,
pub total_income: Money,
pub total_transactions: usize,
pub uncategorized_spending: Money,
pub uncategorized_count: usize,
}Expand description
Spending Report
Fields§
§start_date: NaiveDateStart date of the report
end_date: NaiveDateEnd date of the report
groups: Vec<SpendingByGroup>Spending by group
total_spending: MoneyTotal spending across all categories
total_income: MoneyTotal income in the period
total_transactions: usizeTotal transaction count
uncategorized_spending: MoneyUncategorized spending
uncategorized_count: usizeUncategorized transaction count
Implementations§
Source§impl SpendingReport
impl SpendingReport
Sourcepub fn generate(
storage: &Storage,
start_date: NaiveDate,
end_date: NaiveDate,
) -> EnvelopeResult<Self>
pub fn generate( storage: &Storage, start_date: NaiveDate, end_date: NaiveDate, ) -> EnvelopeResult<Self>
Generate a spending report for a date range
Sourcepub fn format_terminal(&self) -> String
pub fn format_terminal(&self) -> String
Format the report for terminal display
Sourcepub fn export_csv<W: Write>(&self, writer: &mut W) -> EnvelopeResult<()>
pub fn export_csv<W: Write>(&self, writer: &mut W) -> EnvelopeResult<()>
Export the report to CSV format
Sourcepub fn top_categories(&self, limit: usize) -> Vec<&SpendingByCategory>
pub fn top_categories(&self, limit: usize) -> Vec<&SpendingByCategory>
Get top spending categories
Trait Implementations§
Source§impl Clone for SpendingReport
impl Clone for SpendingReport
Source§fn clone(&self) -> SpendingReport
fn clone(&self) -> SpendingReport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SpendingReport
impl RefUnwindSafe for SpendingReport
impl Send for SpendingReport
impl Sync for SpendingReport
impl Unpin for SpendingReport
impl UnwindSafe for SpendingReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more