pub struct DocumentHeader {Show 21 fields
pub document_id: String,
pub document_type: DocumentType,
pub company_code: String,
pub fiscal_year: u16,
pub fiscal_period: u8,
pub document_date: NaiveDate,
pub posting_date: Option<NaiveDate>,
pub entry_date: NaiveDate,
pub entry_timestamp: NaiveDateTime,
pub status: DocumentStatus,
pub created_by: String,
pub changed_by: Option<String>,
pub changed_at: Option<NaiveDateTime>,
pub created_by_employee_id: Option<String>,
pub currency: String,
pub reference: Option<String>,
pub header_text: Option<String>,
pub journal_entry_id: Option<String>,
pub document_references: Vec<DocumentReference>,
pub is_fraud: bool,
pub fraud_type: Option<FraudType>,
}Expand description
Common document header fields.
Fields§
§document_id: StringUnique document ID
document_type: DocumentTypeDocument type
company_code: StringCompany code
fiscal_year: u16Fiscal year
fiscal_period: u8Fiscal period
document_date: NaiveDateDocument date
posting_date: Option<NaiveDate>Posting date (if applicable)
entry_date: NaiveDateEntry date (when document was created)
entry_timestamp: NaiveDateTimeEntry timestamp
status: DocumentStatusDocument status
created_by: StringCreated by user
changed_by: Option<String>Last changed by user
changed_at: Option<NaiveDateTime>Last change timestamp
created_by_employee_id: Option<String>Employee ID of the creator (bridges user_id ↔ employee_id)
created_by stores the user login (e.g. “JSMITH”) while
employee nodes use employee_id (e.g. “E-001234”). This
field stores the employee_id when it is known at generation
time, allowing the export pipeline to emit
DOC_CREATED_BY edges directly without an expensive lookup.
currency: StringCurrency
reference: Option<String>Reference number (external)
header_text: Option<String>Header text
journal_entry_id: Option<String>Related journal entry ID (if posted to GL)
document_references: Vec<DocumentReference>References to other documents
is_fraud: boolWhether this document is part of a fraud scenario. Propagated from the corresponding journal entry after anomaly injection.
fraud_type: Option<FraudType>Fraud type if applicable (propagated from journal entry).
Implementations§
Source§impl DocumentHeader
impl DocumentHeader
Sourcepub fn new(
document_id: impl Into<String>,
document_type: DocumentType,
company_code: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
document_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new( document_id: impl Into<String>, document_type: DocumentType, company_code: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new document header.
Sourcepub fn propagate_fraud(
&mut self,
fraud_map: &HashMap<String, FraudType>,
) -> bool
pub fn propagate_fraud( &mut self, fraud_map: &HashMap<String, FraudType>, ) -> bool
Propagate fraud labels from a fraud map (document_id/journal_entry_id -> FraudType). Returns true if this document was tagged as fraudulent.
Sourcepub fn with_created_by_employee_id(self, employee_id: impl Into<String>) -> Self
pub fn with_created_by_employee_id(self, employee_id: impl Into<String>) -> Self
Set the employee ID of the document creator.
Sourcepub fn with_posting_date(self, date: NaiveDate) -> Self
pub fn with_posting_date(self, date: NaiveDate) -> Self
Set posting date.
Sourcepub fn with_currency(self, currency: impl Into<String>) -> Self
pub fn with_currency(self, currency: impl Into<String>) -> Self
Set currency.
Sourcepub fn with_reference(self, reference: impl Into<String>) -> Self
pub fn with_reference(self, reference: impl Into<String>) -> Self
Set reference.
Sourcepub fn with_header_text(self, text: impl Into<String>) -> Self
pub fn with_header_text(self, text: impl Into<String>) -> Self
Set header text.
Sourcepub fn add_reference(&mut self, reference: DocumentReference)
pub fn add_reference(&mut self, reference: DocumentReference)
Add a document reference.
Sourcepub fn update_status(
&mut self,
new_status: DocumentStatus,
user: impl Into<String>,
)
pub fn update_status( &mut self, new_status: DocumentStatus, user: impl Into<String>, )
Update status and record change.
Sourcepub fn generate_id(
doc_type: DocumentType,
company_code: &str,
sequence: u64,
) -> String
pub fn generate_id( doc_type: DocumentType, company_code: &str, sequence: u64, ) -> String
Generate a deterministic document ID.
Trait Implementations§
Source§impl Clone for DocumentHeader
impl Clone for DocumentHeader
Source§fn clone(&self) -> DocumentHeader
fn clone(&self) -> DocumentHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DocumentHeader
impl Debug for DocumentHeader
Source§impl<'de> Deserialize<'de> for DocumentHeader
impl<'de> Deserialize<'de> for DocumentHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DocumentHeader
impl RefUnwindSafe for DocumentHeader
impl Send for DocumentHeader
impl Sync for DocumentHeader
impl Unpin for DocumentHeader
impl UnsafeUnpin for DocumentHeader
impl UnwindSafe for DocumentHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.