pub struct PurchaseRequisition {Show 23 fields
pub header: DocumentHeader,
pub pr_type: PurchaseRequisitionType,
pub priority: RequisitionPriority,
pub requester_id: String,
pub requester_name: Option<String>,
pub requester_email: Option<String>,
pub requester_department: Option<String>,
pub approver_id: Option<String>,
pub purchasing_org: String,
pub purchasing_group: Option<String>,
pub items: Vec<PurchaseRequisitionItem>,
pub total_net_amount: Decimal,
pub total_tax_amount: Decimal,
pub total_gross_amount: Decimal,
pub is_approved: bool,
pub is_converted: bool,
pub is_closed: bool,
pub purchase_order_ids: Vec<String>,
pub justification: Option<String>,
pub budget_code: Option<String>,
pub workflow_id: Option<String>,
pub notes: Option<String>,
pub desired_vendor: Option<String>,
}Expand description
Purchase Requisition document.
Fields§
§header: DocumentHeaderDocument header
pr_type: PurchaseRequisitionTypePR type
priority: RequisitionPriorityPriority
requester_id: StringRequester user ID (document-level)
requester_name: Option<String>Requester name
requester_email: Option<String>Requester email
requester_department: Option<String>Requester department
approver_id: Option<String>Approver user ID (document-level)
purchasing_org: StringPurchasing organization
purchasing_group: Option<String>Default purchasing group
items: Vec<PurchaseRequisitionItem>Line items
total_net_amount: DecimalTotal net amount
total_tax_amount: DecimalTotal tax amount
total_gross_amount: DecimalTotal gross amount
is_approved: boolIs this PR fully approved?
is_converted: boolIs this PR fully converted to PO(s)?
is_closed: boolIs this PR closed?
purchase_order_ids: Vec<String>Related PO IDs (multiple POs can be created from one PR)
justification: Option<String>Business justification (document-level)
budget_code: Option<String>Budget code for approval routing
workflow_id: Option<String>Approval workflow ID
notes: Option<String>Notes/comments
desired_vendor: Option<String>Desired vendor (document-level preference)
Implementations§
Source§impl PurchaseRequisition
impl PurchaseRequisition
Sourcepub fn new(
pr_id: impl Into<String>,
company_code: impl Into<String>,
requester_id: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
document_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new( pr_id: impl Into<String>, company_code: impl Into<String>, requester_id: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new purchase requisition.
Sourcepub fn with_pr_type(self, pr_type: PurchaseRequisitionType) -> Self
pub fn with_pr_type(self, pr_type: PurchaseRequisitionType) -> Self
Set PR type.
Sourcepub fn with_priority(self, priority: RequisitionPriority) -> Self
pub fn with_priority(self, priority: RequisitionPriority) -> Self
Set priority.
Sourcepub fn with_purchasing_org(self, org: impl Into<String>) -> Self
pub fn with_purchasing_org(self, org: impl Into<String>) -> Self
Set purchasing organization.
Sourcepub fn with_purchasing_group(self, group: impl Into<String>) -> Self
pub fn with_purchasing_group(self, group: impl Into<String>) -> Self
Set purchasing group.
Sourcepub fn with_requester_details(
self,
name: impl Into<String>,
email: impl Into<String>,
department: impl Into<String>,
) -> Self
pub fn with_requester_details( self, name: impl Into<String>, email: impl Into<String>, department: impl Into<String>, ) -> Self
Set requester details.
Sourcepub fn with_justification(self, justification: impl Into<String>) -> Self
pub fn with_justification(self, justification: impl Into<String>) -> Self
Set justification.
Sourcepub fn with_budget_code(self, code: impl Into<String>) -> Self
pub fn with_budget_code(self, code: impl Into<String>) -> Self
Set budget code.
Sourcepub fn with_desired_vendor(self, vendor: impl Into<String>) -> Self
pub fn with_desired_vendor(self, vendor: impl Into<String>) -> Self
Set desired vendor.
Sourcepub fn add_item(&mut self, item: PurchaseRequisitionItem)
pub fn add_item(&mut self, item: PurchaseRequisitionItem)
Add a line item.
Sourcepub fn recalculate_totals(&mut self)
pub fn recalculate_totals(&mut self)
Recalculate totals from items.
Sourcepub fn reject(&mut self, approver: impl Into<String>, reason: impl Into<String>)
pub fn reject(&mut self, approver: impl Into<String>, reason: impl Into<String>)
Reject the entire PR.
Sourcepub fn convert_to_po(
&mut self,
po_id: impl Into<String>,
user: impl Into<String>,
)
pub fn convert_to_po( &mut self, po_id: impl Into<String>, user: impl Into<String>, )
Convert to PO (mark as converted).
Sourcepub fn open_amount(&self) -> Decimal
pub fn open_amount(&self) -> Decimal
Get total open amount (not yet converted to PO).
Sourcepub fn approved_item_count(&self) -> usize
pub fn approved_item_count(&self) -> usize
Get count of approved items.
Sourcepub fn rejected_item_count(&self) -> usize
pub fn rejected_item_count(&self) -> usize
Get count of rejected items.
Sourcepub fn converted_item_count(&self) -> usize
pub fn converted_item_count(&self) -> usize
Get count of converted items.
Sourcepub fn all_items_approved(&self) -> bool
pub fn all_items_approved(&self) -> bool
Check if all items are approved.
Sourcepub fn has_convertible_items(&self) -> bool
pub fn has_convertible_items(&self) -> bool
Check if any items can be converted.
Trait Implementations§
Source§impl Clone for PurchaseRequisition
impl Clone for PurchaseRequisition
Source§fn clone(&self) -> PurchaseRequisition
fn clone(&self) -> PurchaseRequisition
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 PurchaseRequisition
impl Debug for PurchaseRequisition
Source§impl<'de> Deserialize<'de> for PurchaseRequisition
impl<'de> Deserialize<'de> for PurchaseRequisition
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 PurchaseRequisition
impl RefUnwindSafe for PurchaseRequisition
impl Send for PurchaseRequisition
impl Sync for PurchaseRequisition
impl Unpin for PurchaseRequisition
impl UnsafeUnpin for PurchaseRequisition
impl UnwindSafe for PurchaseRequisition
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.