Делаем счетчики

This commit is contained in:
Dmitriy 2025-05-19 22:53:14 +03:00
parent 81de1f3048
commit b03d399c49
5 changed files with 111 additions and 12 deletions

View File

@ -298,6 +298,7 @@ enum{
#if defined(BOARD_SOLARIUM_VLAD) #if defined(BOARD_SOLARIUM_VLAD)
EVENT_FINISH_PAYMENT_ABONEMENT, EVENT_FINISH_PAYMENT_ABONEMENT,
EVENT_FINISH_PAYMENT_ABONEMENT_SOLARIUM,
#endif #endif
}; };

View File

@ -117,7 +117,7 @@ void IncSolarCounters(CPU_INT08U ch, CPU_INT08U mode, CPU_INT32U worktime, CPU_I
} }
counters.common_money += money; counters.common_money += money;
if (card) if (card != 2 && card)
{ {
counters.card_money += money; counters.card_money += money;
} }
@ -911,7 +911,7 @@ void AppVladEventProcess(CPU_INT32U event)
SetAcceptedMoney(app_state.moneytopay); SetAcceptedMoney(app_state.moneytopay);
SaveEventRecord(app_state.ch_index, JOURNAL_EVENT_CARD_ACCEPTED, app_state.moneytopay); SaveEventRecord(app_state.ch_index, JOURNAL_EVENT_CARD_ACCEPTED, app_state.moneytopay);
app_state.user_menu = USER_MENU_CARD_OK; app_state.user_menu = USER_MENU_CARD_OK;
PostUserEvent(EVENT_FINISH_PAYMENT); PostUserEvent(EVENT_FINISH_PAYMENT_ABONEMENT_SOLARIUM);
} }
} }
else else
@ -1603,11 +1603,84 @@ void AppVladEventProcess(CPU_INT32U event)
break; break;
} }
// íàïå÷àòàåì ÷åê
/*if (IsFiscalConnected())
{
CPU_INT32U format;
char service_name[48];
GetData(&BillFormatDesc, &format, 0, DATA_FLAG_SYSTEM_INDEX);
GetDataStr(&ServiceNameDesc, (CPU_INT08U*)service_name, 0, DATA_FLAG_SYSTEM_INDEX);
sprintf(&service_name[strlen(service_name)], ". Àáîíåìåíò %d", app_state.current_abonement + 1);
if (format == 0)
{
strcat(service_name, ", ðóá.");
}
if (PrintFiscalBill(accmoney, ChannelsPayedTime[app_state.ch_index], app_state.user_menu == USER_MENU_CARD_OK, service_name, price) == 0)
{
SaveEventRecord(app_state.ch_index, JOURNAL_EVENT_PRINT_BILL, GetTimeSec());
}
else
{
// îøèáêà ïå÷àòè ÷åêà
}
}*/
// ïîïîëíåíèå êàðòû çàêîí÷èëè - ñîîáùèì îá ýòîì // ïîïîëíåíèå êàðòû çàêîí÷èëè - ñîîáùèì îá ýòîì
PrintInsertBonusCardMenu(); PrintInsertBonusCardMenu();
RefreshMenu(); RefreshMenu();
} }
break; break;
case EVENT_FINISH_PAYMENT_ABONEMENT_SOLARIUM:
{
CPU_INT32U price, accmoney;
CPU_INT32U min_time;
if (app_state.user_menu != USER_MENU_CARD_OK)
{
break;
}
accmoney = GetAcceptedMoney();
price = GetPricePerMin(app_state.ch_index, app_state.mode_index);
GetData(&SolarMinimumTimeMinutesDesc, &min_time, app_state.ch_index, DATA_FLAG_DIRECT_INDEX);
if ((accmoney * 60) / price < (min_time * 60))
{
break;
}
ChannelsPayedTime[app_state.ch_index] = (accmoney * 60) / price;
IncCounter(app_state.ch_index, ChannelsPayedTime[app_state.ch_index], accmoney, 2);
IncSolarCounters(app_state.ch_index, app_state.mode_index, ChannelsPayedTime[app_state.ch_index], accmoney, 2);
SetAcceptedMoney(0);
// ñîõðàíèì îïëà÷åííîå âðåìÿ è äåíüãè
SaveTimeMoneyForChannel(app_state.ch_index, ChannelsPayedTime[app_state.ch_index], accmoney);
// çàïóñêàåì òàéìàóò äî ñòàðòà ñîëÿðèÿ
app_state.solar_state[app_state.ch_index] = SOLAR_STATE_TIMEOUT_PRE;
GetData(&SolarTimeoutBeforeMinutesDesc, &app_state.timetoend[app_state.ch_index], app_state.ch_index, DATA_FLAG_DIRECT_INDEX);
app_state.timetoend[app_state.ch_index] *= 60;
app_state.sunburn_mode[app_state.ch_index] = app_state.mode_index;
SetControl(app_state.ch_index, CONTROL_STATE_OFF);
// ñîõðàíÿåì çàïèñü ñîáûòèÿ
SaveEventRecord(app_state.ch_index, JOURNAL_EVENT_START_SESSION, ChannelsPayedTime[app_state.ch_index]);
// îòêðîåì äâåðü
PostUserEvent(EVENT_OPEN_RELAY1 + app_state.ch_index);
PlayMusicFile(19);
app_state.user_menu = USER_MENU_SHOW_THANKS;
if (MusicEnabled()) app_state.menu_timeout = 0;
else app_state.menu_timeout = MENU_THANKS_TIMEOUT;
PrintThanksMenu();
RefreshMenu();
}
break;
case EVENT_FINISH_PAYMENT: case EVENT_FINISH_PAYMENT:
{ {
CPU_INT32U price, accmoney; CPU_INT32U price, accmoney;

View File

@ -387,8 +387,14 @@ void IncCounter(CPU_INT08U ch, CPU_INT32U time, CPU_INT32U money, CPU_INT08U car
t+=time; t+=time;
WriteArrayFram(offsetof(TFramMap, Counters.CounterChannelRun)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&r); WriteArrayFram(offsetof(TFramMap, Counters.CounterChannelRun)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&r);
WriteArrayFram(offsetof(TFramMap, Counters.CounterChannelTime)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&t); WriteArrayFram(offsetof(TFramMap, Counters.CounterChannelTime)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&t);
if (card) if (card == 2)
{
ReadArrayFram(offsetof(TFramMap, Counters.CounterChannelAbonement)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&m);
m+=money;
WriteArrayFram(offsetof(TFramMap, Counters.CounterChannelAbonement)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&m);
}
else if (card)
{ {
ReadArrayFram(offsetof(TFramMap, Counters.CounterChannelCard)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&m); ReadArrayFram(offsetof(TFramMap, Counters.CounterChannelCard)+sizeof(CPU_INT32U)*ch, sizeof(CPU_INT32U), (unsigned char*)&m);
m+=money; m+=money;
@ -409,7 +415,13 @@ void IncCounter(CPU_INT08U ch, CPU_INT32U time, CPU_INT32U money, CPU_INT08U car
WriteArrayFram(offsetof(TFramMap, Counters.CounterRun), sizeof(CPU_INT32U), (unsigned char*)&r); WriteArrayFram(offsetof(TFramMap, Counters.CounterRun), sizeof(CPU_INT32U), (unsigned char*)&r);
WriteArrayFram(offsetof(TFramMap, Counters.CounterTime), sizeof(CPU_INT32U), (unsigned char*)&t); WriteArrayFram(offsetof(TFramMap, Counters.CounterTime), sizeof(CPU_INT32U), (unsigned char*)&t);
if (card) if (card == 2)
{
ReadArrayFram(offsetof(TFramMap, Counters.CounterAbonement), sizeof(CPU_INT32U), (unsigned char*)&m);
m+=money;
WriteArrayFram(offsetof(TFramMap, Counters.CounterAbonement), sizeof(CPU_INT32U), (unsigned char*)&m);
}
else if (card)
{ {
ReadArrayFram(offsetof(TFramMap, Counters.CounterCard), sizeof(CPU_INT32U), (unsigned char*)&m); ReadArrayFram(offsetof(TFramMap, Counters.CounterCard), sizeof(CPU_INT32U), (unsigned char*)&m);
m+=money; m+=money;
@ -429,7 +441,12 @@ void IncCounter(CPU_INT08U ch, CPU_INT32U time, CPU_INT32U money, CPU_INT08U car
long_ctrs.CounterRunLong++; long_ctrs.CounterRunLong++;
long_ctrs.CounterTimeLong += time; long_ctrs.CounterTimeLong += time;
if (card) if (card == 2)
{
long_ctrs.CounterChannelAbonementLong[ch] += money;
long_ctrs.CounterAbonementLong += money;
}
else if (card)
{ {
long_ctrs.CounterChannelCardLong[ch] += money; long_ctrs.CounterChannelCardLong[ch] += money;
long_ctrs.CounterCardLong += money; long_ctrs.CounterCardLong += money;

View File

@ -196,6 +196,8 @@ typedef struct{
CPU_INT32U CounterChannelMoney[CHANNELS_NUM]; CPU_INT32U CounterChannelMoney[CHANNELS_NUM];
// Ñóììà áåçíàëà ïîêàíàëüíî // Ñóììà áåçíàëà ïîêàíàëüíî
CPU_INT32U CounterChannelCard[CHANNELS_NUM]; CPU_INT32U CounterChannelCard[CHANNELS_NUM];
// Ñóììà ïî àáîíåìåíòó
CPU_INT32U CounterChannelAbonement[CHANNELS_NUM];
// îáùåå ÷èñëî çàïóñêîâ // îáùåå ÷èñëî çàïóñêîâ
CPU_INT32U CounterRun; CPU_INT32U CounterRun;
@ -205,7 +207,9 @@ typedef struct{
CPU_INT32U CounterMoney; CPU_INT32U CounterMoney;
// îáùåå Ñóììà áåçíàëà // îáùåå Ñóììà áåçíàëà
CPU_INT32U CounterCard; CPU_INT32U CounterCard;
// îáùåå Ñóììà ïî àáîíåìåíòó
CPU_INT32U CounterAbonement;
// ñ÷åò÷èêè êóïþð â êóïþðíèêå ïî íîìèíàëàì // ñ÷åò÷èêè êóïþð â êóïþðíèêå ïî íîìèíàëàì
CPU_INT32U CounterBillNominals[24]; CPU_INT32U CounterBillNominals[24];
// îáùèé ñ÷åò÷èê êóïþð (âñåãî â êàññåòå) // îáùèé ñ÷åò÷èê êóïþð (âñåãî â êàññåòå)
@ -223,11 +227,15 @@ typedef struct{
CPU_INT32U CounterChannelMoneyLong[CHANNELS_NUM]; CPU_INT32U CounterChannelMoneyLong[CHANNELS_NUM];
// Ñóììà áåçíàëà ïîêàíàëüíî // Ñóììà áåçíàëà ïîêàíàëüíî
CPU_INT32U CounterChannelCardLong[CHANNELS_NUM]; CPU_INT32U CounterChannelCardLong[CHANNELS_NUM];
// Ñóììà ïî àáîíåìåíòó
CPU_INT32U CounterChannelAbonementLong[CHANNELS_NUM];
CPU_INT32U CounterRunLong; CPU_INT32U CounterRunLong;
CPU_INT32U CounterTimeLong; CPU_INT32U CounterTimeLong;
CPU_INT32U CounterMoneyLong; CPU_INT32U CounterMoneyLong;
CPU_INT32U CounterCardLong; CPU_INT32U CounterCardLong;
CPU_INT32U CounterAbonementLong;
CPU_INT16U crc; CPU_INT16U crc;
}TCountersLong; }TCountersLong;

File diff suppressed because one or more lines are too long