pub struct Vendor {Show 21 fields
pub vendor_id: String,
pub name: String,
pub vendor_type: VendorType,
pub country: String,
pub payment_terms: PaymentTerms,
pub payment_terms_days: u8,
pub typical_amount_range: (Decimal, Decimal),
pub is_active: bool,
pub account_number: Option<String>,
pub tax_id: Option<String>,
pub bank_accounts: Vec<BankAccount>,
pub is_intercompany: bool,
pub intercompany_code: Option<String>,
pub behavior: VendorBehavior,
pub currency: String,
pub reconciliation_account: Option<String>,
pub auxiliary_gl_account: Option<String>,
pub withholding_tax_applicable: bool,
pub withholding_tax_rate: Option<Decimal>,
pub is_one_time: bool,
pub purchasing_org: Option<String>,
}Expand description
Vendor master data.
Fields§
§vendor_id: StringVendor ID (e.g., “V-001234”)
name: StringVendor name
vendor_type: VendorTypeType of vendor
country: StringCountry code (ISO 3166-1 alpha-2)
payment_terms: PaymentTermsPayment terms (structured)
payment_terms_days: u8Payment terms in days (legacy, computed from payment_terms)
typical_amount_range: (Decimal, Decimal)Typical invoice amount range (min, max)
is_active: boolIs this vendor active
account_number: Option<String>Vendor account number in sub-ledger
tax_id: Option<String>Tax ID / VAT number
bank_accounts: Vec<BankAccount>Bank accounts for payment
is_intercompany: boolIs this an intercompany vendor?
intercompany_code: Option<String>Related company code (if intercompany)
behavior: VendorBehaviorVendor behavior for payment follow-up
currency: StringCurrency for transactions
reconciliation_account: Option<String>Reconciliation account in GL
auxiliary_gl_account: Option<String>Auxiliary GL sub-account for French PCG / German SKR04 frameworks. French: 401XXXX, German: AP_CONTROL + counter.
withholding_tax_applicable: boolWithholding tax applicable
withholding_tax_rate: Option<Decimal>Withholding tax rate
is_one_time: boolOne-time vendor (no master data)
purchasing_org: Option<String>Purchasing organization
Implementations§
Source§impl Vendor
impl Vendor
Sourcepub fn new(vendor_id: &str, name: &str, vendor_type: VendorType) -> Self
pub fn new(vendor_id: &str, name: &str, vendor_type: VendorType) -> Self
Create a new vendor.
Sourcepub fn new_intercompany(
vendor_id: &str,
name: &str,
related_company_code: &str,
) -> Self
pub fn new_intercompany( vendor_id: &str, name: &str, related_company_code: &str, ) -> Self
Create an intercompany vendor.
Sourcepub fn with_country(self, country: &str) -> Self
pub fn with_country(self, country: &str) -> Self
Set country.
Sourcepub fn with_payment_terms_structured(self, terms: PaymentTerms) -> Self
pub fn with_payment_terms_structured(self, terms: PaymentTerms) -> Self
Set structured payment terms.
Sourcepub fn with_payment_terms(self, days: u8) -> Self
pub fn with_payment_terms(self, days: u8) -> Self
Set payment terms (legacy, by days).
Sourcepub fn with_amount_range(self, min: Decimal, max: Decimal) -> Self
pub fn with_amount_range(self, min: Decimal, max: Decimal) -> Self
Set amount range.
Sourcepub fn with_intercompany(self, related_company_code: &str) -> Self
pub fn with_intercompany(self, related_company_code: &str) -> Self
Set as intercompany vendor.
Sourcepub fn with_bank_account(self, account: BankAccount) -> Self
pub fn with_bank_account(self, account: BankAccount) -> Self
Add a bank account.
Sourcepub fn with_behavior(self, behavior: VendorBehavior) -> Self
pub fn with_behavior(self, behavior: VendorBehavior) -> Self
Set vendor behavior.
Sourcepub fn with_currency(self, currency: &str) -> Self
pub fn with_currency(self, currency: &str) -> Self
Set currency.
Sourcepub fn with_reconciliation_account(self, account: &str) -> Self
pub fn with_reconciliation_account(self, account: &str) -> Self
Set reconciliation account.
Sourcepub fn with_withholding_tax(self, rate: Decimal) -> Self
pub fn with_withholding_tax(self, rate: Decimal) -> Self
Set withholding tax.
Sourcepub fn primary_bank_account(&self) -> Option<&BankAccount>
pub fn primary_bank_account(&self) -> Option<&BankAccount>
Get the primary bank account.
Sourcepub fn generate_amount(&self, rng: &mut impl Rng) -> Decimal
pub fn generate_amount(&self, rng: &mut impl Rng) -> Decimal
Generate a random amount within the typical range.
Sourcepub fn calculate_due_date(&self, invoice_date: NaiveDate) -> NaiveDate
pub fn calculate_due_date(&self, invoice_date: NaiveDate) -> NaiveDate
Calculate due date for an invoice.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vendor
impl<'de> Deserialize<'de> for Vendor
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 Vendor
impl RefUnwindSafe for Vendor
impl Send for Vendor
impl Sync for Vendor
impl Unpin for Vendor
impl UnsafeUnpin for Vendor
impl UnwindSafe for Vendor
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.