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