zugferd_code_lists/zugferd_2_3_2/
allowance.rs1#![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 BonusForWorksAheadSchedule,
8 OtherBonus,
10 ManufacturerSConsumerDiscount,
12 DueToMilitaryStatus,
14 DueToWorkAccident,
16 SpecialAgreement,
18 ProductionErrorDiscount,
20 NewOutletDiscount,
22 SampleDiscount,
24 EndRangeDiscount,
26 IncotermDiscount,
28 PointSalesThresholdAllowance,
30 MaterialSurchargeDeduction,
32 Discount,
34 SpecialRebate,
36 FixedLongTerm,
38 Temporary,
40 Standard,
42 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}