Skip to content

Revenue & Productivity Report Bug #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GeneMosher opened this issue Sep 16, 2018 · 3 comments · Fixed by #63
Closed

Revenue & Productivity Report Bug #60

GeneMosher opened this issue Sep 16, 2018 · 3 comments · Fixed by #63

Comments

@GeneMosher
Copy link
Member

GeneMosher commented Sep 16, 2018

One of the few remaining bugs is in the "Reports" area when selecting "Accounting: Receipts Balance & Cash Deposit" report. Selecting this causes the program to crash.

@NeroBurner
Copy link
Contributor

I've narrowed the problem in 'Revenue & Productivity Report' down

When cycling through the report periods the period_view variable is incremented

case 9: // nextperiod
printf("report_zone : nextperiod\n");
period_view = NextValue(period_view, ReportPeriodValue);
Draw(t, 1);
return SIGNAL_OKAY;

period_view can take the following values:

int ReportPeriodValue[] = {
    SP_NONE, SP_DAY, SP_WEEK, SP_2WEEKS, SP_MONTH, SP_QUARTER, SP_YTD, -1 };

When period_view is of value SP_YTD the next value is SP_NONE. This is when things turn bad

1  raise                                           0x7fb39a126d7f 
2  abort                                           0x7fb39a111672 
3  __assert_fail_base.cold.0                       0x7fb39a111548 
4  __assert_fail                                   0x7fb39a11f396 
5  TimeInfo::operator>       time_info.cc     426  0x5623c0a853f6 
6  WorkEntry::Overlap        labor.cc         370  0x5623c09cc645 
7  LaborDB::FigureLabor      labor.cc         1313 0x5623c09d0bc2 
8  BalanceReportWorkFn       system_report.cc 1557 0x5623c09e5271 
9  ??                                              0x7fb39b189c2e 
10 XtAppNextEvent                                  0x7fb39b18b493 
11 StartSystem               manager.cc       944  0x5623c092c999 
12 main                      manager.cc       454  0x5623c092a4cf 

The overlap between start and end should be calculated. But the member variable start is compared to the function variable st with the > operator. The variable st is not valid (st.IsSet() is false) and then the assert in TimeInfo hits

viewtouch/main/labor.cc

Lines 366 to 372 in f72b113

int WorkEntry::Overlap(TimeInfo &st, TimeInfo &et)
{
FnTrace("WorkEntry::Overlap()");
TimeInfo s, e;
if (start > st)
s = start;
else

FigureLabor checks the end time for validity, but not the start time

viewtouch/main/labor.cc

Lines 1290 to 1313 in f72b113

int LaborDB::FigureLabor(Settings *s, TimeInfo &start, TimeInfo &end_time,
int job, int &mins, int &cost, int &otmins, int &otcost)
{
FnTrace("LaborDB::FigureLabor()");
mins = 0;
cost = 0;
otmins = 0;
otcost = 0;
TimeInfo end;
if (!end_time.IsSet() || end_time > SystemTime)
end = SystemTime; // end time can't be ahead of actual time
else
end = end_time;
LaborPeriod *lp = PeriodList();
while (lp)
{
WorkEntry *work_entry = lp->WorkList();
while (work_entry)
{
if ((job <= 0 || work_entry->job == job) && work_entry->pay_rate == PERIOD_HOUR)
{
int m = work_entry->Overlap(start, end);

The issue was silent before my changes, but is now hitting the new asserts. I don't know where start and end are set (or should be set) or how to resolve this issue.

@NeroBurner
Copy link
Contributor

report bug probably fixed, but new image still available -> reopen

@NeroBurner NeroBurner reopened this Sep 24, 2018
@GeneMosher GeneMosher changed the title New Raspberry Pi image is available as of September 15, 2018 New Raspberry Pi image available: April 13, 2019POS Version 19.04.1 Apr 13, 2019
@GeneMosher GeneMosher changed the title New Raspberry Pi image available: April 13, 2019POS Version 19.04.1 New Raspberry Pi image: April 13, 2019 POS Version 19.04.1 Apr 13, 2019
@GeneMosher GeneMosher changed the title New Raspberry Pi image: April 13, 2019 POS Version 19.04.1 Revenue & Productivity Report Bug Apr 16, 2019
@NeroBurner
Copy link
Contributor

title changed, therefore closing this bugreport as fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants