zugferd_code_lists/zugferd_2_3_3/
allowance.rs

1#![allow(non_camel_case_types)]
2
3#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
4pub enum Allowance {
5    /// Bonus for works ahead of schedule
6    BonusForWorksAheadSchedule,
7    /// Other bonus
8    OtherBonus,
9    /// Manufacturer’s consumer discount
10    ManufacturerSConsumerDiscount,
11    /// Due to military status
12    DueToMilitaryStatus,
13    /// Due to work accident
14    DueToWorkAccident,
15    /// Special agreement
16    SpecialAgreement,
17    /// Production error discount
18    ProductionErrorDiscount,
19    /// New outlet discount
20    NewOutletDiscount,
21    /// Sample discount
22    SampleDiscount,
23    /// End-of-range discount
24    EndRangeDiscount,
25    /// Incoterm discount
26    IncotermDiscount,
27    /// Point of sales threshold allowance
28    PointSalesThresholdAllowance,
29    /// Material surcharge/deduction
30    MaterialSurchargeDeduction,
31    /// Discount
32    Discount,
33    /// Special rebate
34    SpecialRebate,
35    /// Fixed long term
36    FixedLongTerm,
37    /// Temporary
38    Temporary,
39    /// Standard
40    Standard,
41    /// Yearly turnover
42    YearlyTurnover,
43}
44
45impl crate::Code for Allowance {
46    fn code(&self) -> &str {
47        match self {
48            Allowance::BonusForWorksAheadSchedule => "41",
49            Allowance::OtherBonus => "42",
50            Allowance::ManufacturerSConsumerDiscount => "60",
51            Allowance::DueToMilitaryStatus => "62",
52            Allowance::DueToWorkAccident => "63",
53            Allowance::SpecialAgreement => "64",
54            Allowance::ProductionErrorDiscount => "65",
55            Allowance::NewOutletDiscount => "66",
56            Allowance::SampleDiscount => "67",
57            Allowance::EndRangeDiscount => "68",
58            Allowance::IncotermDiscount => "70",
59            Allowance::PointSalesThresholdAllowance => "71",
60            Allowance::MaterialSurchargeDeduction => "88",
61            Allowance::Discount => "95",
62            Allowance::SpecialRebate => "100",
63            Allowance::FixedLongTerm => "102",
64            Allowance::Temporary => "103",
65            Allowance::Standard => "104",
66            Allowance::YearlyTurnover => "105",
67        }
68    }
69}
70
71impl crate::Description for Allowance {
72    fn description(&self) -> &str {
73        match self {
74            Allowance::BonusForWorksAheadSchedule => "Bonus for works ahead of schedule",
75            Allowance::OtherBonus => "Other bonus",
76            Allowance::ManufacturerSConsumerDiscount => "Manufacturer’s consumer discount",
77            Allowance::DueToMilitaryStatus => "Due to military status",
78            Allowance::DueToWorkAccident => "Due to work accident",
79            Allowance::SpecialAgreement => "Special agreement",
80            Allowance::ProductionErrorDiscount => "Production error discount",
81            Allowance::NewOutletDiscount => "New outlet discount",
82            Allowance::SampleDiscount => "Sample discount",
83            Allowance::EndRangeDiscount => "End-of-range discount",
84            Allowance::IncotermDiscount => "Incoterm discount",
85            Allowance::PointSalesThresholdAllowance => "Point of sales threshold allowance",
86            Allowance::MaterialSurchargeDeduction => "Material surcharge/deduction",
87            Allowance::Discount => "Discount",
88            Allowance::SpecialRebate => "Special rebate",
89            Allowance::FixedLongTerm => "Fixed long term",
90            Allowance::Temporary => "Temporary",
91            Allowance::Standard => "Standard",
92            Allowance::YearlyTurnover => "Yearly turnover",
93        }
94    }
95}
96
97impl crate::FromCode for Allowance {
98    fn from_code(code: &str) -> Option<Self>
99    where
100        Self: Sized,
101    {
102        match code {
103            "41" => Some(Allowance::BonusForWorksAheadSchedule),
104            "42" => Some(Allowance::OtherBonus),
105            "60" => Some(Allowance::ManufacturerSConsumerDiscount),
106            "62" => Some(Allowance::DueToMilitaryStatus),
107            "63" => Some(Allowance::DueToWorkAccident),
108            "64" => Some(Allowance::SpecialAgreement),
109            "65" => Some(Allowance::ProductionErrorDiscount),
110            "66" => Some(Allowance::NewOutletDiscount),
111            "67" => Some(Allowance::SampleDiscount),
112            "68" => Some(Allowance::EndRangeDiscount),
113            "70" => Some(Allowance::IncotermDiscount),
114            "71" => Some(Allowance::PointSalesThresholdAllowance),
115            "88" => Some(Allowance::MaterialSurchargeDeduction),
116            "95" => Some(Allowance::Discount),
117            "100" => Some(Allowance::SpecialRebate),
118            "102" => Some(Allowance::FixedLongTerm),
119            "103" => Some(Allowance::Temporary),
120            "104" => Some(Allowance::Standard),
121            "105" => Some(Allowance::YearlyTurnover),
122            _ => None,
123        }
124    }
125}