zugferd_code_lists/zugferd_2_3_2/
allowance.rs1#![allow(non_camel_case_types)]
2
3#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
4pub enum Allowance {
5 BonusForWorksAheadSchedule,
7 OtherBonus,
9 ManufacturerSConsumerDiscount,
11 DueToMilitaryStatus,
13 DueToWorkAccident,
15 SpecialAgreement,
17 ProductionErrorDiscount,
19 NewOutletDiscount,
21 SampleDiscount,
23 EndRangeDiscount,
25 IncotermDiscount,
27 PointSalesThresholdAllowance,
29 MaterialSurchargeDeduction,
31 Discount,
33 SpecialRebate,
35 FixedLongTerm,
37 Temporary,
39 Standard,
41 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}