STDMETHODIMP CRegistrator::DoReturn(BSTR FirmID, BSTR ReturnText, LONG Quantity, LONG Price, LONG DepNo, LONG* ErrorCode) { *ErrorCode = E_SUCCESS; CRegistratorInfo* regInfo = m_RegistratorList.GetInfo(FirmID); if(!regInfo) { *ErrorCode = E_NOT_FOUND; return S_OK; } LONG nAmount = 0; // проверяем состояние документа BYTE nDocumentStatus; if(!GetDocumentStatus(regInfo->hCommPort, &nDocumentStatus, ErrorCode)) return S_OK; // если документ не открыт if((nDocumentStatus & 0x0F) == 0) { // открываем документ if(!OpenDocument(regInfo->hCommPort, DepNo, '3', szCashierStoredName, ErrorCode)) return CheckPaperStatus(regInfo, ErrorCode); if(!PrintBuffer(FirmID, ErrorCode)) return CheckPaperStatus(regInfo, ErrorCode); m_nReturnAmount = 0; } if(RegisterInternal(regInfo->hCommPort, ReturnText, Quantity, Price, DepNo, &nAmount, ErrorCode)) m_nReturnAmount += nAmount; return CheckPaperStatus(regInfo, ErrorCode); }
void RegisterIfNew(const String& name, const T& item) { boost::mutex::scoped_lock lock(m_Mutex); if (m_Items.find(name) != m_Items.end()) return; RegisterInternal(name, item, lock); }
void Register(const String& name, const T& item) { boost::mutex::scoped_lock lock(m_Mutex); RegisterInternal(name, item, lock); }