Fixed assets, fully featured: tags, serials, acquisition links, label sheets, the fixed asset register, and an Assets section in the viewer; fix a flaky verify
- core: asset tags (generated PREFIX-0001 or the human's own; unique ignoring case; never reused by another asset) and serial numbers (rules.md B-24); a journaled link from an asset to the entry that acquired it (posted, unreversed, debiting the cost account); fixed_asset_register(as_of), reconciled to the GL (unposted depreciation, unregistered cost) - store: asset.tagged, asset.serial_set, asset.acquisition_linked journaled, replayed, projected (schema v9); differs_from now also compares control roles and tag history - config: [books] asset_tag_prefix, default the company's initials without legal-form words - import: Avery 5160/8160 label sheets with QR codes (geometry vendored from Avery, docs/spec/sources/avery-5160.md); the register as XLSX and PDF - mcp: register_asset tags (and links) automatically; books.label_asset, books.asset_labels; asset tools take a tag; books.show asset / assets page / register report; export fixed_asset_register (json, csv, xlsx, pdf) and in the CPA package - viewer: Assets page (register, reconciliation), asset page (identity, schedule posted vs not, entries, documents), Fixed asset register report, global search by tag/serial/description, journal text, needs-attention items - fix: verify compared snapshot amounts as strings; a zero total summed in hash-map order could print "0" or "0.00", so agreeing books failed verify at random. Now by value (regression test) - tests: spec-blind suites for tags, register, prefix, store, MCP; label and register PDF/XLSX tests; viewer tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
4e96b5f54d
commit
cd085108c1
53 files changed
+7872
-104
No files matched your search
@@ -108,6 +108,58 @@ pub struct BooksSettings {
|
||||
/// statement treats as investing (loans the company makes, investments
|
||||
/// it buys: ASC 230-10-20). Registered fixed assets need not be listed.
|
||||
pub investing_accounts: Vec<String>,
|
||||
/// `[books] asset_tag_prefix`: the prefix of generated asset tags
|
||||
/// ("FL" for "FL-0001"). Unset: [`BooksSettings::asset_tag_prefix`]
|
||||
/// derives it from the company name.
|
||||
pub asset_tag_prefix: Option<String>,
|
||||
}
|
||||
|
||||
impl BooksSettings {
|
||||
/// The prefix generated asset tags use: `[books] asset_tag_prefix`, or
|
||||
/// else the initials of the company name's words, legal-form words
|
||||
/// (LLC, Inc, Corp, ...) left out, at most 8 ("Fernhill Labs LLC" →
|
||||
/// "FL"); "FA" (fixed asset) when the name gives none.
|
||||
pub fn asset_tag_prefix(&self) -> String {
|
||||
if let Some(p) = &self.asset_tag_prefix {
|
||||
return p.clone();
|
||||
}
|
||||
const FORMS: &[&str] = &[
|
||||
"llc",
|
||||
"l",
|
||||
"c",
|
||||
"inc",
|
||||
"incorporated",
|
||||
"corp",
|
||||
"corporation",
|
||||
"co",
|
||||
"company",
|
||||
"ltd",
|
||||
"limited",
|
||||
"llp",
|
||||
"lp",
|
||||
"pllc",
|
||||
"pc",
|
||||
"pa",
|
||||
"the",
|
||||
"and",
|
||||
"of",
|
||||
];
|
||||
let initials: String = self
|
||||
.company
|
||||
.name
|
||||
.split(|c: char| !c.is_ascii_alphanumeric())
|
||||
.filter(|w| !w.is_empty() && !FORMS.contains(&w.to_ascii_lowercase().as_str()))
|
||||
.filter_map(|w| w.chars().next())
|
||||
.filter(char::is_ascii_alphabetic)
|
||||
.map(|c| c.to_ascii_uppercase())
|
||||
.take(8)
|
||||
.collect();
|
||||
if initials.is_empty() || self.company.name == Company::default().name {
|
||||
"FA".to_string()
|
||||
} else {
|
||||
initials
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -149,6 +201,7 @@ struct BooksSection {
|
||||
financing_accounts: Vec<String>,
|
||||
#[serde(default)]
|
||||
investing_accounts: Vec<String>,
|
||||
asset_tag_prefix: Option<String>,
|
||||
}
|
||||
|
||||
/// The return a federal tax classification files (docs/spec/sources/
|
||||
@@ -444,6 +497,21 @@ pub fn parse(text: &str) -> Result<BooksSettings, String> {
|
||||
cash_accounts: codes("cash_accounts", raw.books.cash_accounts)?,
|
||||
financing_accounts: codes("financing_accounts", raw.books.financing_accounts)?,
|
||||
investing_accounts: codes("investing_accounts", raw.books.investing_accounts)?,
|
||||
asset_tag_prefix: match raw.books.asset_tag_prefix {
|
||||
Some(p)
|
||||
if !p.is_empty()
|
||||
&& p.len() <= 8
|
||||
&& p.chars().all(|c| c.is_ascii_alphanumeric()) =>
|
||||
{
|
||||
Some(p)
|
||||
}
|
||||
Some(p) => {
|
||||
return Err(format!(
|
||||
"[books] asset_tag_prefix {p:?}: 1 to 8 letters or digits"
|
||||
));
|
||||
}
|
||||
None => None,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user