zugferd_code_lists/zugferd_2_3_3/
allowance.rs

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