Payroll accounting, class tracking, CPA handoff package (48 MCP tools)
This commit is contained in:
1 parent
3d80a270ca
commit
d50b844476
1 file changed
+13
-1
@@ -4,7 +4,7 @@
|
|||||||
//! total credits. Entries are born as drafts, validated, then posted. Posting
|
//! total credits. Entries are born as drafts, validated, then posted. Posting
|
||||||
//! is one-way; a posted entry can only be corrected by a reversing entry.
|
//! is one-way; a posted entry can only be corrected by a reversing entry.
|
||||||
|
|
||||||
use crate::{AccountId, ChartOfAccounts, Currency, LedgerError, Money, Side};
|
use crate::{AccountId, ChartOfAccounts, ClassId, Currency, LedgerError, Money, Side};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use rust_decimal::Decimal;
|
use rust_decimal::Decimal;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -41,6 +41,12 @@ pub struct JournalLine {
|
|||||||
/// base-currency lines.
|
/// base-currency lines.
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub foreign_amount: Option<Decimal>,
|
pub foreign_amount: Option<Decimal>,
|
||||||
|
/// Divisional tracking: which class (department, location, job) this
|
||||||
|
/// line belongs to. `None` means unclassified. Set on drafts only via
|
||||||
|
/// [`crate::Ledger::set_line_class`]; posted lines are immutable, so
|
||||||
|
/// their classes are frozen.
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub class_id: Option<ClassId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A balanced set of journal lines with a date and a description.
|
/// A balanced set of journal lines with a date and a description.
|
||||||
@@ -103,6 +109,12 @@ impl JournalEntry {
|
|||||||
self.lines.push(line);
|
self.lines.push(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tag a line with a class (or clear it). Only while drafted; only via
|
||||||
|
/// [`crate::Ledger::set_line_class`].
|
||||||
|
pub(crate) fn set_line_class(&mut self, index: usize, class_id: Option<ClassId>) {
|
||||||
|
self.lines[index].class_id = class_id;
|
||||||
|
}
|
||||||
|
|
||||||
/// Mark posted. Only via [`crate::Ledger`], after [`Self::validate`].
|
/// Mark posted. Only via [`crate::Ledger`], after [`Self::validate`].
|
||||||
pub(crate) fn mark_posted(&mut self) {
|
pub(crate) fn mark_posted(&mut self) {
|
||||||
self.status = EntryStatus::Posted;
|
self.status = EntryStatus::Posted;
|
||||||
|
|||||||
Reference in new issue
Block a user