pub struct JournalEntryHeader {Show 46 fields
pub document_id: Uuid,
pub company_code: String,
pub fiscal_year: u16,
pub fiscal_period: u8,
pub posting_date: NaiveDate,
pub document_date: NaiveDate,
pub created_at: DateTime<Utc>,
pub document_type: String,
pub currency: String,
pub exchange_rate: Decimal,
pub reference: Option<String>,
pub header_text: Option<String>,
pub created_by: String,
pub user_persona: String,
pub source: TransactionSource,
pub sap_source_code: Option<String>,
pub trading_partner: Option<String>,
pub business_process: Option<BusinessProcess>,
pub ledger: String,
pub is_fraud: bool,
pub fraud_type: Option<FraudType>,
pub is_fraud_propagated: bool,
pub fraud_source_document_id: Option<String>,
pub is_anomaly: bool,
pub anomaly_id: Option<String>,
pub anomaly_type: Option<String>,
pub batch_id: Option<Uuid>,
pub is_manual: bool,
pub is_post_close: bool,
pub source_system: String,
pub created_date: Option<NaiveDateTime>,
pub control_ids: Vec<String>,
pub sox_relevant: bool,
pub control_status: ControlStatus,
pub sod_violation: bool,
pub sod_conflict_type: Option<SodConflictType>,
pub is_elimination: bool,
pub ic_pair_id: Option<IcPairId>,
pub ic_partner_entity: Option<String>,
pub approval_workflow: Option<ApprovalWorkflow>,
pub source_document: Option<DocumentRef>,
pub approved_by: Option<String>,
pub approval_date: Option<NaiveDate>,
pub ocpm_event_ids: Vec<Uuid>,
pub ocpm_object_ids: Vec<Uuid>,
pub ocpm_case_id: Option<Uuid>,
}Expand description
Header information for a journal entry document.
Contains all metadata about the posting including timing, user, and organizational assignment.
Fields§
§document_id: UuidUnique identifier for this journal entry (UUID v7 for time-ordering)
company_code: StringCompany code this entry belongs to
fiscal_year: u16Fiscal year (4-digit)
fiscal_period: u8Fiscal period (1-12, or 13-16 for special periods)
posting_date: NaiveDatePosting date (when the entry affects the books)
document_date: NaiveDateDocument date (date on source document)
created_at: DateTime<Utc>Entry timestamp (when created in system)
document_type: StringDocument type code
currency: StringTransaction currency (ISO 4217)
exchange_rate: DecimalExchange rate to local currency (1.0 if same currency)
reference: Option<String>Reference document number (external reference)
header_text: Option<String>Header text/description
created_by: StringUser who created the entry
user_persona: StringUser persona classification for behavioral analysis
source: TransactionSourceTransaction source (manual vs automated)
sap_source_code: Option<String>SP3.6 — canonical SAP source code drawn from industry priors
(KR, RV, DZ, SA, …). Some only when priors are loaded;
None on the priors-disabled path (in which case the CSV source
column falls back to the TransactionSource debug label).
trading_partner: Option<String>SP3.9 — JE-level trading partner. When priors are loaded, drawn
once per JE from per_source_attribute[sap_source_code]["trading_partner"]
and inherited by all lines. Matches corpus SAP semantics
(one TP per document).
business_process: Option<BusinessProcess>Business process reference
ledger: StringLedger (0L = Leading Ledger)
is_fraud: boolIs this entry part of a fraud scenario
fraud_type: Option<FraudType>Fraud type if applicable
is_fraud_propagated: boolWhether is_fraud was propagated from a source document (document-level
fraud injection) rather than injected directly onto this line.
Used by downstream consumers to distinguish scheme-level from
slip-level fraud patterns.
fraud_source_document_id: Option<String>When is_fraud_propagated is true, the external document ID
(PO number, invoice number, etc.) that was the origin of the fraud.
is_anomaly: boolWhether this entry has an injected anomaly
anomaly_id: Option<String>Unique anomaly identifier for label linkage
anomaly_type: Option<String>Type of anomaly if applicable (serialized enum name)
batch_id: Option<Uuid>Simulation batch ID for traceability
is_manual: boolWhether this is a manual journal entry (vs automated/system-generated). Manual entries are higher fraud risk per ISA 240.32(a).
is_post_close: boolWhether this entry was posted after the period-end close date. Post-closing entries require additional scrutiny per ISA 240.
source_system: StringSource system/module that originated this entry. Examples: “SAP-FI”, “SAP-MM”, “SAP-SD”, “manual”, “interface”, “spreadsheet”
created_date: Option<NaiveDateTime>Timestamp when the entry was created (may differ from posting_date). For automated entries this is typically before posting_date; for manual entries created_date and posting_date are often on the same day.
control_ids: Vec<String>Internal control IDs that apply to this transaction
sox_relevant: boolWhether this is a SOX-relevant transaction
control_status: ControlStatusControl status for this transaction
sod_violation: boolWhether a Segregation of Duties violation occurred
sod_conflict_type: Option<SodConflictType>Type of SoD conflict if violation occurred
is_elimination: boolWhether this is a consolidation elimination entry
ic_pair_id: Option<IcPairId>Intercompany pair identifier. Set on both seller-side and buyer-side JEs
that are two halves of the same IC transaction. Aggregate-phase matching
joins JEs on this value. None for non-IC transactions.
ic_partner_entity: Option<String>Entity code of the IC counterparty. For a seller JE, this is the
buyer’s entity; for a buyer JE, the seller’s. None for non-IC transactions.
approval_workflow: Option<ApprovalWorkflow>Approval workflow for high-value transactions
source_document: Option<DocumentRef>Typed reference to the source document (derived from reference field prefix)
approved_by: Option<String>Employee ID of the approver (for SOD analysis)
approval_date: Option<NaiveDate>Date of approval
ocpm_event_ids: Vec<Uuid>OCPM event IDs that triggered this journal entry
ocpm_object_ids: Vec<Uuid>OCPM object IDs involved in this journal entry
ocpm_case_id: Option<Uuid>OCPM case ID for process instance tracking
Implementations§
Source§impl JournalEntryHeader
impl JournalEntryHeader
Sourcepub fn new(company_code: String, posting_date: NaiveDate) -> Self
pub fn new(company_code: String, posting_date: NaiveDate) -> Self
Create a new journal entry header with default values.
Sourcepub fn with_deterministic_id(
company_code: String,
posting_date: NaiveDate,
document_id: Uuid,
) -> Self
pub fn with_deterministic_id( company_code: String, posting_date: NaiveDate, document_id: Uuid, ) -> Self
Create a new journal entry header with a deterministic document ID.
Used for reproducible generation where the document ID is derived from a seed and counter.
Sourcepub fn propagate_fraud_from_documents(
&mut self,
fraud_map: &HashMap<String, FraudType>,
) -> bool
pub fn propagate_fraud_from_documents( &mut self, fraud_map: &HashMap<String, FraudType>, ) -> bool
Look up this header’s source document id in a fraud map (keyed by
document id → fraud type) and, if found, mark this header as
propagated fraud. Returns true when the header was tagged.
Unlike direct line-level fraud injection, this sets
is_fraud_propagated = true and records fraud_source_document_id
so downstream consumers can distinguish scheme-level fraud (many
correlated lines tagged by one document) from slip-level fraud (a
single tagged line with no document origin).
Trait Implementations§
Source§impl Clone for JournalEntryHeader
impl Clone for JournalEntryHeader
Source§fn clone(&self) -> JournalEntryHeader
fn clone(&self) -> JournalEntryHeader
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 JournalEntryHeader
impl Debug for JournalEntryHeader
Source§impl<'de> Deserialize<'de> for JournalEntryHeader
impl<'de> Deserialize<'de> for JournalEntryHeader
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 JournalEntryHeader
impl RefUnwindSafe for JournalEntryHeader
impl Send for JournalEntryHeader
impl Sync for JournalEntryHeader
impl Unpin for JournalEntryHeader
impl UnsafeUnpin for JournalEntryHeader
impl UnwindSafe for JournalEntryHeader
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.