Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyschedule.h
Context not available. | |||||
52 | KMM_MYMONEY_UNIT_TESTABLE | 52 | KMM_MYMONEY_UNIT_TESTABLE | ||
---|---|---|---|---|---|
53 | 53 | | |||
54 | public: | 54 | public: | ||
55 | /** | | |||
56 | * This enum is used to describe all the possible schedule frequencies. | | |||
57 | * The special entry, OCCUR_ANY, is used to combine all the other types. | | |||
58 | */ | | |||
59 | enum occurrenceE { OCCUR_ANY = 0, OCCUR_ONCE = 1, OCCUR_DAILY = 2, OCCUR_WEEKLY = 4, OCCUR_FORTNIGHTLY = 8, | | |||
60 | OCCUR_EVERYOTHERWEEK = 16, | | |||
61 | OCCUR_EVERYHALFMONTH = 18, | | |||
62 | OCCUR_EVERYTHREEWEEKS = 20, | | |||
63 | OCCUR_EVERYTHIRTYDAYS = 30, | | |||
64 | OCCUR_MONTHLY = 32, OCCUR_EVERYFOURWEEKS = 64, | | |||
65 | OCCUR_EVERYEIGHTWEEKS = 126, | | |||
66 | OCCUR_EVERYOTHERMONTH = 128, OCCUR_EVERYTHREEMONTHS = 256, | | |||
67 | OCCUR_TWICEYEARLY = 1024, OCCUR_EVERYOTHERYEAR = 2048, OCCUR_QUARTERLY = 4096, | | |||
68 | OCCUR_EVERYFOURMONTHS = 8192, OCCUR_YEARLY = 16384 | | |||
69 | }; | | |||
70 | | ||||
71 | /** | | |||
72 | * This enum is used to describe the schedule type. | | |||
73 | */ | | |||
74 | enum typeE { TYPE_ANY = 0, TYPE_BILL = 1, TYPE_DEPOSIT = 2, TYPE_TRANSFER = 4, TYPE_LOANPAYMENT = 5 }; | | |||
75 | | ||||
76 | /** | | |||
77 | * This enum is used to describe the schedule's payment type. | | |||
78 | */ | | |||
79 | enum paymentTypeE { STYPE_ANY = 0, STYPE_DIRECTDEBIT = 1, STYPE_DIRECTDEPOSIT = 2, | | |||
80 | STYPE_MANUALDEPOSIT = 4, STYPE_OTHER = 8, | | |||
81 | STYPE_WRITECHEQUE = 16, | | |||
82 | STYPE_STANDINGORDER = 32, | | |||
83 | STYPE_BANKTRANSFER = 64 | | |||
84 | }; | | |||
85 | | ||||
86 | /** | | |||
87 | * This enum is used by the auto-commit functionality. | | |||
88 | * | | |||
89 | * Depending upon the value of m_weekendOption the schedule can | | |||
90 | * be entered on a different date | | |||
91 | **/ | | |||
92 | enum weekendOptionE { MoveBefore = 0, MoveAfter = 1, MoveNothing = 2 }; | | |||
93 | | ||||
94 | enum elNameE { enPayment, enPayments }; | 55 | enum elNameE { enPayment, enPayments }; | ||
95 | Q_ENUM(elNameE) | 56 | Q_ENUM(elNameE) | ||
96 | 57 | | |||
Context not available. | |||||
114 | * | 75 | * | ||
115 | * @a startDate is not used anymore and internally set to QDate() | 76 | * @a startDate is not used anymore and internally set to QDate() | ||
116 | */ | 77 | */ | ||
117 | MyMoneySchedule(const QString& name, typeE type, occurrenceE occurrence, int occurrenceMultiplier, | 78 | MyMoneySchedule(const QString& name, eMyMoney::Schedule::Type type, eMyMoney::Schedule::Occurrence occurrence, int occurrenceMultiplier, | ||
118 | paymentTypeE paymentType, const QDate& startDate, const QDate& endDate, bool fixed, bool autoEnter); | 79 | eMyMoney::Schedule::PaymentType paymentType, const QDate& startDate, const QDate& endDate, bool fixed, bool autoEnter); | ||
119 | 80 | | |||
120 | explicit MyMoneySchedule(const QDomElement& node); | 81 | explicit MyMoneySchedule(const QDomElement& node); | ||
121 | 82 | | |||
Context not available. | |||||
129 | /** | 90 | /** | ||
130 | * Simple get method that returns the occurrence frequency. | 91 | * Simple get method that returns the occurrence frequency. | ||
131 | * | 92 | * | ||
132 | * @return occurrenceE The instance frequency. | 93 | * @return eMyMoney::Schedule::Occurrence The instance frequency. | ||
133 | */ | 94 | */ | ||
134 | occurrenceE occurrence() const; | 95 | eMyMoney::Schedule::Occurrence occurrence() const; | ||
135 | 96 | | |||
136 | /** | 97 | /** | ||
137 | * Simple get method that returns the occurrence period | 98 | * Simple get method that returns the occurrence period | ||
138 | * multiplier and occurrence | 99 | * multiplier and occurrence | ||
139 | * | 100 | * | ||
140 | * @return occurrenceE The instance period | 101 | * @return eMyMoney::Schedule::Occurrence The instance period | ||
141 | * | 102 | * | ||
142 | */ | 103 | */ | ||
143 | occurrenceE occurrencePeriod() const { | 104 | eMyMoney::Schedule::Occurrence occurrencePeriod() const { | ||
144 | return m_occurrence; | 105 | return m_occurrence; | ||
145 | } | 106 | } | ||
146 | 107 | | |||
Context not available. | |||||
156 | /** | 117 | /** | ||
157 | * Simple get method that returns the schedule type. | 118 | * Simple get method that returns the schedule type. | ||
158 | * | 119 | * | ||
159 | * @return typeE The instance type. | 120 | * @return eMyMoney::Schedule::Type The instance type. | ||
160 | */ | 121 | */ | ||
161 | typeE type() const { | 122 | eMyMoney::Schedule::Type type() const { | ||
162 | return m_type; | 123 | return m_type; | ||
163 | } | 124 | } | ||
164 | 125 | | |||
Context not available. | |||||
175 | /** | 136 | /** | ||
176 | * Simple get method that returns the schedule paymentType. | 137 | * Simple get method that returns the schedule paymentType. | ||
177 | * | 138 | * | ||
178 | * @return paymentTypeE The instance paymentType. | 139 | * @return eMyMoney::Schedule::PaymentType The instance paymentType. | ||
179 | */ | 140 | */ | ||
180 | paymentTypeE paymentType() const { | 141 | eMyMoney::Schedule::PaymentType paymentType() const { | ||
181 | return m_paymentType; | 142 | return m_paymentType; | ||
182 | } | 143 | } | ||
183 | 144 | | |||
Context not available. | |||||
284 | * | 245 | * | ||
285 | * @return QDate containing the adjusted date. | 246 | * @return QDate containing the adjusted date. | ||
286 | */ | 247 | */ | ||
287 | QDate adjustedDate(QDate date, weekendOptionE option) const; | 248 | QDate adjustedDate(QDate date, eMyMoney::Schedule::WeekendOption option) const; | ||
288 | 249 | | |||
289 | /** | 250 | /** | ||
290 | 251 | | |||
Context not available. | |||||
294 | * | 255 | * | ||
295 | * This not used by MyMoneySchedule but by the support code. | 256 | * This not used by MyMoneySchedule but by the support code. | ||
296 | **/ | 257 | **/ | ||
297 | weekendOptionE weekendOption() const { | 258 | eMyMoney::Schedule::WeekendOption weekendOption() const { | ||
298 | return m_weekendOption; | 259 | return m_weekendOption; | ||
299 | } | 260 | } | ||
300 | 261 | | |||
Context not available. | |||||
304 | * @param occ The new occurrence (frequency). | 265 | * @param occ The new occurrence (frequency). | ||
305 | * @return none | 266 | * @return none | ||
306 | */ | 267 | */ | ||
307 | void setOccurrence(occurrenceE occ); | 268 | void setOccurrence(eMyMoney::Schedule::Occurrence occ); | ||
308 | 269 | | |||
309 | /** | 270 | /** | ||
310 | * Simple method that sets the schedule period | 271 | * Simple method that sets the schedule period | ||
Context not available. | |||||
312 | * @param occ The new occurrence period (frequency) | 273 | * @param occ The new occurrence period (frequency) | ||
313 | * @return none | 274 | * @return none | ||
314 | */ | 275 | */ | ||
315 | void setOccurrencePeriod(occurrenceE occ); | 276 | void setOccurrencePeriod(eMyMoney::Schedule::Occurrence occ); | ||
316 | 277 | | |||
317 | /** | 278 | /** | ||
318 | * Simple method that sets the frequency multiplier for the schedule. | 279 | * Simple method that sets the frequency multiplier for the schedule. | ||
Context not available. | |||||
328 | * @param type The new type. | 289 | * @param type The new type. | ||
329 | * @return none | 290 | * @return none | ||
330 | */ | 291 | */ | ||
331 | void setType(typeE type); | 292 | void setType(eMyMoney::Schedule::Type type); | ||
332 | 293 | | |||
333 | /** | 294 | /** | ||
334 | * Simple method that sets the start date for the schedule. | 295 | * Simple method that sets the start date for the schedule. | ||
Context not available. | |||||
344 | * @param type The new payment type. | 305 | * @param type The new payment type. | ||
345 | * @return none | 306 | * @return none | ||
346 | */ | 307 | */ | ||
347 | void setPaymentType(paymentTypeE type); | 308 | void setPaymentType(eMyMoney::Schedule::PaymentType type); | ||
348 | 309 | | |||
349 | /** | 310 | /** | ||
350 | * Simple method to set whether the schedule is fixed or not. | 311 | * Simple method to set whether the schedule is fixed or not. | ||
Context not available. | |||||
419 | * | 380 | * | ||
420 | * @note This not used by MyMoneySchedule but by the support code. | 381 | * @note This not used by MyMoneySchedule but by the support code. | ||
421 | **/ | 382 | **/ | ||
422 | void setWeekendOption(const weekendOptionE option); | 383 | void setWeekendOption(const eMyMoney::Schedule::WeekendOption option); | ||
423 | 384 | | |||
424 | /** | 385 | /** | ||
425 | * Validates the schedule instance. | 386 | * Validates the schedule instance. | ||
Context not available. | |||||
567 | * | 528 | * | ||
568 | * @return QString representing the human readable format | 529 | * @return QString representing the human readable format | ||
569 | */ | 530 | */ | ||
570 | static QString occurrenceToString(occurrenceE type); | 531 | static QString occurrenceToString(eMyMoney::Schedule::Occurrence type); | ||
571 | 532 | | |||
572 | /** | 533 | /** | ||
573 | * This method is used to convert a multiplier and base occurrence type | 534 | * This method is used to convert a multiplier and base occurrence type | ||
Context not available. | |||||
580 | * | 541 | * | ||
581 | * @return QString representing the human readable format | 542 | * @return QString representing the human readable format | ||
582 | */ | 543 | */ | ||
583 | static QString occurrenceToString(int mult, occurrenceE type); | 544 | static QString occurrenceToString(int mult, eMyMoney::Schedule::Occurrence type); | ||
584 | 545 | | |||
585 | /** | 546 | /** | ||
586 | * This method is used to convert an occurrence period from | 547 | * This method is used to convert an occurrence period from | ||
Context not available. | |||||
591 | * | 552 | * | ||
592 | * @return QString representing the human readable format | 553 | * @return QString representing the human readable format | ||
593 | */ | 554 | */ | ||
594 | static QString occurrencePeriodToString(occurrenceE type); | 555 | static QString occurrencePeriodToString(eMyMoney::Schedule::Occurrence type); | ||
595 | 556 | | |||
596 | /** | 557 | /** | ||
597 | * This method is used to convert the payment type from its | 558 | * This method is used to convert the payment type from its | ||
Context not available. | |||||
602 | * | 563 | * | ||
603 | * @return QString representing the human readable format | 564 | * @return QString representing the human readable format | ||
604 | */ | 565 | */ | ||
605 | static QString paymentMethodToString(MyMoneySchedule::paymentTypeE paymentType); | 566 | static QString paymentMethodToString(eMyMoney::Schedule::PaymentType paymentType); | ||
606 | 567 | | |||
607 | /** | 568 | /** | ||
608 | * This method is used to convert the schedule weekend option from its | 569 | * This method is used to convert the schedule weekend option from its | ||
Context not available. | |||||
613 | * | 574 | * | ||
614 | * @return QString representing the human readable format | 575 | * @return QString representing the human readable format | ||
615 | */ | 576 | */ | ||
616 | static QString weekendOptionToString(MyMoneySchedule::weekendOptionE weekendOption); | 577 | static QString weekendOptionToString(eMyMoney::Schedule::WeekendOption weekendOption); | ||
617 | 578 | | |||
618 | /** | 579 | /** | ||
619 | * This method is used to convert the schedule type from its | 580 | * This method is used to convert the schedule type from its | ||
Context not available. | |||||
624 | * | 585 | * | ||
625 | * @return QString representing the human readable format | 586 | * @return QString representing the human readable format | ||
626 | */ | 587 | */ | ||
627 | static QString scheduleTypeToString(MyMoneySchedule::typeE type); | 588 | static QString scheduleTypeToString(eMyMoney::Schedule::Type type); | ||
628 | 589 | | |||
629 | int variation() const; | 590 | int variation() const; | ||
630 | void setVariation(int var); | 591 | void setVariation(int var); | ||
Context not available. | |||||
639 | * | 600 | * | ||
640 | * @return int Number of days between events | 601 | * @return int Number of days between events | ||
641 | */ | 602 | */ | ||
642 | static int eventsPerYear(MyMoneySchedule::occurrenceE occurrence); | 603 | static int eventsPerYear(eMyMoney::Schedule::Occurrence occurrence); | ||
643 | 604 | | |||
644 | /** | 605 | /** | ||
645 | * | 606 | * | ||
Context not available. | |||||
651 | * | 612 | * | ||
652 | * @return int Number of days between events | 613 | * @return int Number of days between events | ||
653 | */ | 614 | */ | ||
654 | static int daysBetweenEvents(MyMoneySchedule::occurrenceE occurrence); | 615 | static int daysBetweenEvents(eMyMoney::Schedule::Occurrence occurrence); | ||
655 | 616 | | |||
656 | /** | 617 | /** | ||
657 | * Helper method to convert simple occurrence to compound occurrence + multiplier | 618 | * Helper method to convert simple occurrence to compound occurrence + multiplier | ||
Context not available. | |||||
659 | * @param multiplier Returned by reference. Adjusted multiplier | 620 | * @param multiplier Returned by reference. Adjusted multiplier | ||
660 | * @param occurrence Returned by reference. Occurrence type | 621 | * @param occurrence Returned by reference. Occurrence type | ||
661 | */ | 622 | */ | ||
662 | static void simpleToCompoundOccurrence(int& multiplier, occurrenceE& occurrence); | 623 | static void simpleToCompoundOccurrence(int& multiplier, eMyMoney::Schedule::Occurrence& occurrence); | ||
663 | 624 | | |||
664 | /** | 625 | /** | ||
665 | * Helper method to convert compound occurrence + multiplier to simple occurrence | 626 | * Helper method to convert compound occurrence + multiplier to simple occurrence | ||
Context not available. | |||||
667 | * @param multiplier Returned by reference. Adjusted multiplier | 628 | * @param multiplier Returned by reference. Adjusted multiplier | ||
668 | * @param occurrence Returned by reference. Occurrence type | 629 | * @param occurrence Returned by reference. Occurrence type | ||
669 | */ | 630 | */ | ||
670 | static void compoundToSimpleOccurrence(int& multiplier, occurrenceE& occurrence); | 631 | static void compoundToSimpleOccurrence(int& multiplier, eMyMoney::Schedule::Occurrence& occurrence); | ||
671 | 632 | | |||
672 | /** | 633 | /** | ||
673 | * This method is used to set the static point to relevant | 634 | * This method is used to set the static point to relevant | ||
Context not available. | |||||
708 | 669 | | |||
709 | /** | 670 | /** | ||
710 | * This method adds a number of Half Months to the given Date. | 671 | * This method adds a number of Half Months to the given Date. | ||
711 | * This is used for OCCUR_EVERYHALFMONTH occurrences. | 672 | * This is used for EveryHalfMonth occurrences. | ||
712 | * The addition uses the following rules to add a half month: | 673 | * The addition uses the following rules to add a half month: | ||
713 | * Day 1-13: add 15 days | 674 | * Day 1-13: add 15 days | ||
714 | * Day 14: add 15 days (except February: the last day of the month) | 675 | * Day 14: add 15 days (except February: the last day of the month) | ||
Context not available. | |||||
744 | 705 | | |||
745 | private: | 706 | private: | ||
746 | /// Its occurrence | 707 | /// Its occurrence | ||
747 | occurrenceE m_occurrence; | 708 | eMyMoney::Schedule::Occurrence m_occurrence; | ||
748 | 709 | | |||
749 | /// Its occurrence multiplier | 710 | /// Its occurrence multiplier | ||
750 | int m_occurrenceMultiplier; | 711 | int m_occurrenceMultiplier; | ||
751 | 712 | | |||
752 | /// Its type | 713 | /// Its type | ||
753 | typeE m_type; | 714 | eMyMoney::Schedule::Type m_type; | ||
754 | 715 | | |||
755 | /// The date the schedule commences | 716 | /// The date the schedule commences | ||
756 | QDate m_startDate; | 717 | QDate m_startDate; | ||
757 | 718 | | |||
758 | /// The payment type | 719 | /// The payment type | ||
759 | paymentTypeE m_paymentType; | 720 | eMyMoney::Schedule::PaymentType m_paymentType; | ||
760 | 721 | | |||
761 | /// Can the amount vary | 722 | /// Can the amount vary | ||
762 | bool m_fixed; | 723 | bool m_fixed; | ||
Context not available. | |||||
780 | QList<QDate> m_recordedPayments; | 741 | QList<QDate> m_recordedPayments; | ||
781 | 742 | | |||
782 | /// The weekend option | 743 | /// The weekend option | ||
783 | weekendOptionE m_weekendOption; | 744 | eMyMoney::Schedule::WeekendOption m_weekendOption; | ||
784 | }; | 745 | }; | ||
785 | 746 | | |||
786 | /** | 747 | /** | ||
Context not available. |