pub struct DocumentHeader {Show 18 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 currency: String,
pub reference: Option<String>,
pub header_text: Option<String>,
pub journal_entry_id: Option<String>,
pub document_references: Vec<DocumentReference>,
}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
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
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 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
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 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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DocumentHeader
impl RefUnwindSafe for DocumentHeader
impl Send for DocumentHeader
impl Sync for DocumentHeader
impl Unpin 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
Mutably borrows from an owned value. Read more