Skip to main content

Vendor

Struct Vendor 

Source
pub struct Vendor {
Show 20 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 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: String

Vendor ID (e.g., “V-001234”)

§name: String

Vendor name

§vendor_type: VendorType

Type of vendor

§country: String

Country code (ISO 3166-1 alpha-2)

§payment_terms: PaymentTerms

Payment terms (structured)

§payment_terms_days: u8

Payment terms in days (legacy, computed from payment_terms)

§typical_amount_range: (Decimal, Decimal)

Typical invoice amount range (min, max)

§is_active: bool

Is 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: bool

Is this an intercompany vendor?

§intercompany_code: Option<String>

Related company code (if intercompany)

§behavior: VendorBehavior

Vendor behavior for payment follow-up

§currency: String

Currency for transactions

§reconciliation_account: Option<String>

Reconciliation account in GL

§withholding_tax_applicable: bool

Withholding tax applicable

§withholding_tax_rate: Option<Decimal>

Withholding tax rate

§is_one_time: bool

One-time vendor (no master data)

§purchasing_org: Option<String>

Purchasing organization

Implementations§

Source§

impl Vendor

Source

pub fn new(vendor_id: &str, name: &str, vendor_type: VendorType) -> Self

Create a new vendor.

Source

pub fn new_intercompany( vendor_id: &str, name: &str, related_company_code: &str, ) -> Self

Create an intercompany vendor.

Source

pub fn with_country(self, country: &str) -> Self

Set country.

Source

pub fn with_payment_terms_structured(self, terms: PaymentTerms) -> Self

Set structured payment terms.

Source

pub fn with_payment_terms(self, days: u8) -> Self

Set payment terms (legacy, by days).

Source

pub fn with_amount_range(self, min: Decimal, max: Decimal) -> Self

Set amount range.

Source

pub fn with_intercompany(self, related_company_code: &str) -> Self

Set as intercompany vendor.

Source

pub fn with_bank_account(self, account: BankAccount) -> Self

Add a bank account.

Source

pub fn with_behavior(self, behavior: VendorBehavior) -> Self

Set vendor behavior.

Source

pub fn with_currency(self, currency: &str) -> Self

Set currency.

Source

pub fn with_reconciliation_account(self, account: &str) -> Self

Set reconciliation account.

Source

pub fn with_withholding_tax(self, rate: Decimal) -> Self

Set withholding tax.

Source

pub fn primary_bank_account(&self) -> Option<&BankAccount>

Get the primary bank account.

Source

pub fn generate_amount(&self, rng: &mut impl Rng) -> Decimal

Generate a random amount within the typical range.

Source

pub fn calculate_due_date(&self, invoice_date: NaiveDate) -> NaiveDate

Calculate due date for an invoice.

Trait Implementations§

Source§

impl Clone for Vendor

Source§

fn clone(&self) -> Vendor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Vendor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Vendor

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Vendor

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Vendor

§

impl RefUnwindSafe for Vendor

§

impl Send for Vendor

§

impl Sync for Vendor

§

impl Unpin for Vendor

§

impl UnwindSafe for Vendor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,