Commit Graph

261 Commits

Author SHA1 Message Date
80fa2fe0e2 Extend computation of time steps in GetTimeSteps() for the case
of dynamic time steps (e.g. for Neuhauser, Galtuer (745)).
2024-01-18 14:57:04 +01:00
89e0f2137b Add handling of pun_duration_min and pun_duration_max 2024-01-18 14:56:20 +01:00
f68d8816c0 Add handling of pop_carry_over_time_range_id and pop_time_step_config. 2024-01-18 14:55:16 +01:00
7ce93ddd7a Extend handling of TimeRangeType. 2024-01-18 14:53:57 +01:00
7f8ed9165d Add handling for TimeStepConfig. 2024-01-18 14:53:01 +01:00
0b901954aa Add members m_start and m_timeStepCompensation (used for Neuhauser, Galtuer (745) at the moment).
Add several setters/getters.
2024-01-18 14:49:56 +01:00
9f4b10bb9a Add and fill
multimap<int, ATBTimeRange> TimeRange;
multimap<int, ATBTimeStepConfig> TimeStepConfig;
when parsing json-file.
2024-01-18 14:43:08 +01:00
2f939d607d Add
include/mobilisis/tariff_timebase.h
include/mobilisis/tariff_timestep_config.h
2024-01-18 14:41:54 +01:00
283e970be4 Add pun_duration_min and pun_duration_max 2024-01-18 14:41:12 +01:00
e14edea07f Add TimeRangeType and TimeStepConfigType. 2024-01-18 14:39:57 +01:00
e520965c6b Add pop_carry_over_time_range_id and pop_time_step_config 2024-01-18 14:38:13 +01:00
6a781f0d3b Minor: add debug output 2024-01-18 14:37:13 +01:00
c357cbbbe0 Add descrption file for tariff time step config 2024-01-18 14:36:28 +01:00
44a94b7007 Minor: add comment 2024-01-16 11:56:54 +01:00
7c13d8b88c Added pun_duration_min and pun_duration_max in case we dont have to pay for a full time range 2024-01-16 11:56:12 +01:00
f1f5ac8900 Add operator << for printing 2023-12-15 13:28:34 +01:00
ddded411aa Add operator << for printing 2023-12-15 13:28:19 +01:00
96587229e2 Add operator << for printing 2023-12-15 13:28:04 +01:00
3d3794ea4e Add multimap for dailly ticket.w 2023-12-15 13:27:02 +01:00
bb83ae3074 Fix: add a 'break' in swich/case. 2023-12-15 13:25:09 +01:00
c598014dd0 Add parsing of
ATBDailyTicket DailyTicket;
        ATBTimeBase TimeBase;
        ATBCustomer Customer;
        ATBTimeRange TimeRange;
2023-12-15 13:24:29 +01:00
ad534eef09 Add 4 new data type for IdentifyJsonMember(). 2023-12-15 13:22:49 +01:00
5ee73bf804 IdentifyJsonMember(): add 4 new data types:
DailyTicket, TimeBase, Customer and TimeRange.
2023-12-15 13:20:42 +01:00
ea2dfa144f Add new menber types: dailly ticket, timebase, time range and customer. 2023-12-12 17:56:26 +01:00
f56979a61a Minor: rename to ATBCustomer. 2023-12-12 17:55:44 +01:00
cc07b8f20e Minor: rename to ATBTimeBase 2023-12-12 17:55:06 +01:00
81459f7ab4 Minor: remove 'pragma onc' 2023-12-12 17:50:23 +01:00
08e89df5a5 Include 3 new header files. 2023-12-12 12:14:34 +01:00
d6324f03a8 Add drafts for 3 new haeder files. 2023-12-12 12:14:14 +01:00
2b3ee3f384 Renamed again. 2023-12-12 12:11:32 +01:00
08f8f3a9fd "" 2023-12-12 12:10:55 +01:00
a80bc7294a Removed tartiff_csutomer. 2023-12-12 12:00:04 +01:00
3a0baf266b Add first draft. 2023-12-12 11:59:35 +01:00
31193336cf Define daily ticket structure. 2023-12-12 11:53:22 +01:00
4fbc2c502b Header for definition of daily ticket. 2023-12-12 11:36:58 +01:00
8d7d175b51 GetDailyTicketDuration():
replace ZellersAlgorithm by qts build in method dayOfWeek().
2023-12-12 11:34:04 +01:00
ebb5bad7c5 Minor: replace call to LOG_ERROR() using qCritical(). 2023-12-12 11:30:30 +01:00
b122206a94 Minor add some json files under OTHER_FILES for documentation. 2023-12-12 11:08:10 +01:00
3006e64b37 private_GetDurationFromCost():
set static variables using helpers moved to namespace Utilities.
2023-12-12 10:58:08 +01:00
c8218bd7af private_GetDurationFromCost():
remove superfluous check if there are special days listed in
json-tariff-file.
2023-12-12 10:56:58 +01:00
ba3dfcd3d6 Minor: private_GetCostFromDuration():
define static variables using helpers moved to namespace Utilities.
2023-12-12 10:55:19 +01:00
c51d350618 Minor: Moved
getMinimalParkingTime(), getMaximalParkingTime(), getMinimalParkingPrice()
computeWeekDaysPrice() and   computeWeekDaysDurationUnit() to Utilities
namespace.
2023-12-12 10:53:10 +01:00
a95a39a557 GetCostFromDuration():
1: Get payment method from tariff file.
  2: Use tariffIs24_7() helper (Tariff for Schoenau is such a case)
  3: Add new code for neuhauser/linsinger maschinenbau:
     Very similar to Schoenau, but here there are extra operating times
     6.00-18.00 during the week, 6-12 on Saturday.
     Check if the current time is inside such time ranges and return
     associated price.
2023-12-12 10:52:16 +01:00
67b12f4b33 Private GetCostFromDuration() and GetCostFromDuration() helpers:
Use pyament method id (=4) as condition for if(...).
The other condition (tariffIs24_7()) is used in calling functions.
2023-12-12 10:49:51 +01:00
60002404da GetDurationFromCost():
1: Get payment method from tariff file.
2: Use tariffIs24_7() helper (Tariff for Schoenau is such a case)
3: Add new code for neuhauser/linsinger maschinenbau:
   Very similar to Schoenau, but here there are extra operating times
   6.00-18.00 during the week, 6-12 on Saturday.
   Check if the current time is inside such time ranges and return
   associated price.
2023-12-12 10:43:16 +01:00
d4e03a51dd Moved
uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id) const;
    double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id) const;
to namespace Utilities.
2023-12-12 10:41:21 +01:00
723b3530cc Added helpers GetPriceForStep() and GetStepForPrice() to make source
more readable.
2023-12-12 10:40:20 +01:00
63f508fb95 Moved
PaymentMethod getPaymentMethodId(Configuration const *cfg);
    int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);

to namespace Utilities.
2023-12-12 10:38:31 +01:00
6e0a74c8cc Add helpers GetSteps(), noSpecialDays(), specialDays() and tariffIs24_7()
to make the source more readable.
2023-12-12 10:36:22 +01:00
d11cffb8bd Set pop_business_hours when parsing json-tariff-file. 2023-12-12 10:34:39 +01:00
15f552a973 Minor: Add header tariff_business_hours.h 2023-12-12 10:33:03 +01:00
52ad1c3ba8 Minor: add constructor taking some parameters.. 2023-12-12 10:31:54 +01:00
43b8a8d3bf Add member pop_business_hours. Add default constructor. 2023-12-12 10:30:55 +01:00
ceef73195d Add helper structure
enum BusinessHours
{
    NoRestriction_24_7          = 0,
    OnlyWorkingDays             = 1,    // [Monday-Friday]
    OnlyWeekDays                = 2,    // [Monday-Saturday]
    OnlyWeekEnd                 = 4,    // [Saturday+Sunday]
    OnlyOfficialHolidays        = 8,
    OnlySpecialDays             = 16,
    OnlySchoolHolidays          = 32,
    SpecialAndSchoolHolidays    = 48,
    OnlyOpenForBusinessDays     = 64,   // verkaufsoffen
    NoBusinessHoursDefined      = 255
};

to define inside of tariff-file what operating hours a PSA has.
2023-12-12 10:26:13 +01:00
282a412ef5 IsYearPeriodActive(): return true, even if no YearPeriod is given in tariff-json-file. 2023-12-12 10:23:45 +01:00
9dcf7a8f30 Implement added helpers. 2023-12-12 10:22:34 +01:00
4187598edf Add helpers for collecting them in Utilities namespave.
BusinessHours getBusinessHours(Configuration const *cfg, PaymentMethod methodId);
uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id);
double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id);
2023-12-12 10:20:02 +01:00
88e92dddb9 Fix: nextTimeStep must be between minParkingTime and maxParkingTime. 2023-12-11 09:00:24 +01:00
0f05a1a784 (1) Fix debug output.
(2) Use UpDown-Argument for calculation of next tiem step.
2023-12-08 10:16:52 +01:00
2d696941a5 Fix: use second.pun_duration instead of second.pun_id
Minor: add debug output.
2023-12-08 10:14:48 +01:00
5598b02816 Make distinction base on PaymentMethod, not on some
other data contained in json-tariff-file.
2023-12-07 17:00:28 +01:00
548447af1f set -O option to calm down compiler because of FORTIFY_SOURCE=2 option 2023-12-07 17:00:03 +01:00
b9a7c04db9 Add compute_next_timestep() computing timesteps if PaymentMethod = Steps.
Add additional code for computing time steps dynamically if PaymentMethod = Linear.
2023-12-07 16:28:17 +01:00
5b8d9c62cc Add and implement utilities:
int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
    uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId);
2023-12-07 16:27:09 +01:00
56e2843ddb Add compute_next_timestep(). 2023-12-07 16:26:09 +01:00
54e9a0f86d Minor: add debug ouput (and commnt it out) 2023-12-06 10:51:46 +01:00
d7beb3b41b Fix: replace 'continue' with 'break' to return first fitting time-range
in findNextWorkTimeRange().
2023-12-06 10:49:33 +01:00
9d220df52e Mainly removed debug output. Regression tests with szeged looking good. 2023-12-05 17:31:56 +01:00
e97ad17b09 removed typo 2023-12-01 14:24:51 +01:00
19428ce46c implemented both cost and duration functions. to be tested 2023-12-01 14:24:15 +01:00
4c268e6693 Added draft implementation of private_GetDurationFromCost(). 2023-11-28 16:43:03 +01:00
cc5c52c1a0 Added private_getDurationFromCost() 2023-11-28 16:42:29 +01:00
602ff5f94e Added State for invalid price 2023-11-28 16:41:27 +01:00
64c005cd70 Implement private_GetCostFromDuration() using a loop and not using
recursive calls.
2023-11-28 15:25:37 +01:00
9abc165a7c Implemented computeWeekDaysPrice() and computeWeekDaysDurationUnit() 2023-11-28 15:20:31 +01:00
57ec82a2fc Added helpers computeWeekDaysPrice() and computeWeekDaysDurationUnit() 2023-11-28 15:18:05 +01:00
a49236c1de Removed parameters in private_GetCostFromDuration() and checkDurationMinutes() 2023-11-28 15:17:27 +01:00
9a19320ee5 Minor: removed debug output. 2023-11-28 15:15:13 +01:00
7a5d797ae0 Start reimplementation of
private_GetCostFromDuration() in terms of ticket.
2023-11-27 16:21:28 +01:00
215667af61 Implement findWorkTimeRange() and indNextWorkTimeRange(). 2023-11-27 16:19:39 +01:00
2b6d116200 Implement GetCostFromDuration() in terms of private_GetCostFromDuration()
using a ticket as return value.
2023-11-27 16:18:06 +01:00
9ca45e613f Return a ticket from private_GetCostFromDuration().
Add helpers findWorkTimeRange() and findNextWorkTimeRange().
2023-11-27 16:15:18 +01:00
6a3d183129 Minor: overload constructor 2023-11-27 16:14:27 +01:00
684de4acd1 Reformat to Unix.
Add overload for IsYearPeriodActive().
Add several helpers.
2023-11-27 16:12:07 +01:00
e9047f995a Minor: format to Unix. 2023-11-27 16:09:38 +01:00
20cdb8b07f Add overload for IsYearPeriodActive().
Add helpers WeekDaysWorkTimeFrom(), WeekDaysWorkTimeUntil(), isCarryOverSet()
sCarryOverNotSet() and getPaymentMethodId().
2023-11-27 16:07:30 +01:00
b84970fd12 Add class Ticket for future use. 2023-11-26 19:56:38 +01:00
7ac033720e Started re-implementation of GetCostFromDuration() using
private_GetCostFromDuration().
2023-11-26 19:55:21 +01:00
c749de2bf9 Add private_GetCostFromDuration() and helpers
getMinimalParkingTime(), getMaximalParkingTime(), checkDurationMinutes().
2023-11-26 19:53:29 +01:00
c4cec1c04b Added overload for CheckSpecialDay().
Added helpers SpecialDaysWorkTimeFrom() and SpecialDaysWorkTimeUntil().
2023-11-26 19:51:37 +01:00
a53cb37291 Add explicit include guard. 2023-11-26 19:50:23 +01:00
b1a98a20c5 Add class ticket 2023-11-26 19:48:29 +01:00
d765997ca5 dos2unix. add TODO comment 2023-11-24 13:52:49 +01:00
36478e111e start changes for neuhauser 2023-11-24 13:23:59 +01:00
8f2609c4ae
Fix: GetDurationFromCost for PaymentMethod::Steps 2023-11-23 11:14:21 +01:00
453ca266a5
Merge remote-tracking branch 'origin/schoenau_23112023' 2023-11-23 09:46:42 +01:00
0217bb8918 GetTimeStep() and GetPriceForTimeStep(): use getPaymentOptions(). 2023-11-23 09:41:40 +01:00
4b35b1ffb7 Implement GetDurationForPrice(). 2023-11-23 09:41:02 +01:00
80e228b498 GetCostFromDuration(): don't use condiftion PaymentMethod::Steps,
but the multimap YearPeriod, which must be empty.
2023-11-23 09:39:26 +01:00
574161ff76 Call getDurationForPrice() in GetDurationForCost(). 2023-11-23 09:38:34 +01:00
b80cd5e6ef Remove parameter paymentMethod.
Add GetDurationForPrice().
2023-11-23 09:36:50 +01:00
ccbf07a654
Use new getPaymentOptions interface 2023-11-23 08:42:35 +01:00
3a2e521345
Add interface to access 'PaymentOptions' 2023-11-22 16:27:41 +01:00
cd77e380ef
Read project/version-info from tariff-config ...
... if available
2023-11-22 11:27:09 +01:00
aaa4348a9a
Add ATBProject to configuration 2023-11-22 11:14:48 +01:00
17c4aac452
Add header file atb_project.h 2023-11-22 11:14:38 +01:00
68c438bfe0
Add header file for project-variables 2023-11-22 11:13:37 +01:00
509bc29d7e
Fix: read tariff configuration file 2023-11-22 10:17:40 +01:00
f7e462188f
Add methods for PaymentMethod::Steps 2023-11-22 09:53:07 +01:00
cb8cd5dead
Merge branch 'moransBranch' 2023-06-14 11:28:27 +02:00
eefdde4693 Removed section whith superfluous 'price_per_unit < 0' check.
Removed calc_price-caculation followed by shift of inputDate.
2023-06-13 12:12:23 +02:00
6157861d62 Monday starts with 1 2023-06-13 12:11:09 +02:00
23748966de
Merge branch 'moransBranch' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator into moransBranch 2023-05-19 15:49:38 +02:00
7bd7f66666 Fixed pra_payment_unit_id 2023-05-17 10:08:02 +02:00
268d43cdea
GetDailyTicketDuration: use QDateTime for timestamps 2023-05-16 16:43:45 +02:00
eef94a3fb3
Change interface: use QDateTime
- use QDateTime instead of char*-string
 - GetCostFromDuration: add end_datetime as a return value
2023-05-16 15:31:53 +02:00
3097819c01
Update interface for 'compute_duration_for_daily_ticket() 2023-05-16 11:07:21 +02:00
3bf71f84d5
Merge branch 'moransBranch' 2023-05-15 17:33:51 +02:00
29986e0451
Merge branch 'moransBranch' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator into moransBranch 2023-05-15 16:58:48 +02:00
1146db743c
Add explaining comments 2023-05-15 16:58:28 +02:00
617eee39ed Daily ticket 2023-05-15 14:05:55 +02:00
6b3c1cbf0c Fix with min time in GetDurationFromCost 2023-05-14 17:19:24 +02:00
1142efaec2 Rounding minutes seems to be fixed ... 2023-05-14 16:15:37 +02:00
6d001f1501
Fix: QDateTime.addSecs() creates a new object 2023-05-12 14:28:30 +02:00
de32022b89
Merge branch 'moransBranch' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator into moransBranch 2023-05-12 14:10:57 +02:00
1e2f1589ac
Fix: QDateTime::fromString() 2023-05-12 14:10:16 +02:00
2f8c8cab4c Another small fix on GetDurationFromCost() 2023-05-12 13:02:10 +02:00
2599513ef9 Minor fixes with +/- 1 minute offset. 2023-05-12 12:40:25 +02:00
ef66c1f0c0 Fixed GetDurationFromCost() 2023-05-12 11:55:35 +02:00
219d820104 GetCostFromDuration fixed 2023-05-12 09:20:46 +02:00
ed9166c226 Windows: set timezone as -3600. 2023-05-11 13:58:33 +02:00
818c67ad63 Windows debug: for init-Tariff, do not read zone_ne, but use the path given directly. 2023-05-11 13:57:31 +02:00
4a076e1dad
Fix: string to QDateTime 2023-05-11 09:59:37 +02:00
62426e60d5
Fix: use toSecsSinceEpoch() 2023-05-11 09:58:54 +02:00
c28351b1bf
Add debug messages 2023-05-11 09:58:15 +02:00
69c469c918
Merge branch 'master' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator 2023-05-10 16:27:34 +02:00
e7606b6568 Added overoaded versions for compute_price_for_parking_ticket() and
compute_duration_for_parking_ticket() using QDateTime parameters.
Added new error code WRONG_ISO_TIME_FORMAT.
2023-05-10 16:16:24 +02:00
fe0ebb409a
Merge branch 'master' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator 2023-05-10 13:34:18 +02:00
3d88c8e67e
Fix: setting calcState description 2023-05-10 13:33:28 +02:00
eebb6d926e Merge branch 'master' of https://git.mimbach49.de/GerhardHoffmann/MOBILISIS-Calculator 2023-05-10 13:11:47 +02:00
69c48e3acc Correction for argument-value of localtime_r()-function
(expects UTC-time instead of local time.)
2023-05-10 13:08:28 +02:00
5c0bbf1502
Fix: init_tariff(): cleanup on error 2023-05-09 13:05:02 +02:00
889fceaae0 Use strftime to get ISO time format for valid ticket end time. 2023-05-09 13:03:51 +02:00
136e6687b8 remove wrong debug-out-put. Use ceil() instead on floor() to prevent rounding error.:w 2023-05-09 11:52:17 +02:00
b02115bf75 Prepare the use of ceil() instead of floor(). 2023-05-09 11:41:41 +02:00
ceb545b432 Implemented compute_duration_for_parking_ticket(). 2023-05-09 11:40:14 +02:00
01f2dc07ce Added INVALID_START_DATE.
Added compute_duration_for_parking_ticket().
2023-05-09 11:38:39 +02:00
c5960a031e init_tariff, compute_price_for_parking_ticket:
return instance of CalcState as info for errors or success status.
2023-05-08 12:34:01 +02:00
1c03745333 Add CalcState to be used as return type of tarif_init and compute_price_for_parking_ticket. 2023-05-08 12:32:44 +02:00
b422f82dea
Add debug messages on tariff config initialisation 2023-05-05 13:19:36 +02:00