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: 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
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.