-
Notifications
You must be signed in to change notification settings - Fork 1
/
fiscal.cpp
45 lines (38 loc) · 1.23 KB
/
fiscal.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "fiscal.h"
#include "vikiprint.h"
#include "fiscalconfig.h"
Fiscal* FiscalFactory::fiscal = nullptr;
Fiscal* FiscalFactory::createFiscal(bool force)
{
if (FiscalFactory::fiscal != nullptr && !force)
return FiscalFactory::fiscal;
if (FiscalFactory::fiscal != nullptr)
FiscalFactory::fiscal->Finalize();
FiscalConfig* fc = Registry::getInstance()->getFiscalConfig();
switch (fc->getType()) {
case FISCAL_VIKIPRINT:
FiscalFactory::fiscal = (Fiscal*) new VikiPrint(fc->getPort(), fc->getSpeed()); break;
case FISCAL_ATOL:
FiscalFactory::fiscal = (Fiscal*) new Atol(fc->getPort(), fc->getSpeed()); break;
default:
break;
}
return FiscalFactory::fiscal;
}
void Fiscal::OpenDocument(byte type)
{
switch (Registry::getInstance()->getFiscalConfig()->getType()) {
case FISCAL_VIKIPRINT:
switch (type) {
case DOC_PRINT: _OpenDocument(1); break;
case DOC_PURCHASE: _OpenDocument(2); break;
}
break;
case FISCAL_ATOL:
switch (type) {
case DOC_PRINT: _OpenDocument(0); break;
case DOC_PURCHASE: _OpenDocument(1); break;
}
break;
}
}