diff --git a/devices/Printers/DP25/DP25.cpp b/devices/Printers/DP25/DP25.cpp index 7821b92..d3ccb74 100644 --- a/devices/Printers/DP25/DP25.cpp +++ b/devices/Printers/DP25/DP25.cpp @@ -22,9 +22,9 @@ #include "DP25.h" //#include "tools.h" -#include "stdTools.h" -#include "mathTools.h" -#include "ascii.h" +#include "lib/stdTools.h" +#include "lib/mathTools.h" +#include "lib/ascii.h" //#include "mathTools.h" #ifdef _WIN32 @@ -299,7 +299,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri { memset(buffer, 0, sizeof(buffer)); - if (m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "REPEAT SENDING", true); + if (m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","REPEAT SENDING", true); //Отправляю запрос на принтер "<01><05><03>" usleep(5); //Эксперимент @@ -333,7 +333,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri } if (ch == 0x15) { - if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "NACK"); + if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","NACK"); cntRead = 1000; //Запрос заново } if (ch == 0x01) { @@ -370,7 +370,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri crc0 = MakeINT(crc0); unsigned int crc1 = *((unsigned int*)&buffer[size - 4]); if (crc0 != crc1) { - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "CRC ERROR"); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","CRC ERROR"); memset(buffer, 0, sizeof(buffer)); //break; } @@ -382,14 +382,14 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri } } else { - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "NOT READ ALL DATA", true); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","NOT READ ALL DATA", true); } } } } } else { - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Port is closed!", true); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Port is closed!", true); } if (answer.length() == 0) @@ -429,7 +429,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri { memset(buffer, 0, sizeof(buffer)); - if (m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "REPEAT SENDING",true); + if (m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","REPEAT SENDING",true); //Отправляю запрос на принтер "<01><05><03>" csPort->WriteChar(0x01); //Признак начала сообшения @@ -547,7 +547,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri if (answer.length() == 0) rez = false; //dwStart = GetTickCount() - dwStart; - //if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Time = "+Utility::IntToStdStr(dwStart)); + //if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Time = "+Utility::IntToStdStr(dwStart)); if (rez){ return 0; @@ -579,12 +579,12 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri int len=csPort->Read(buffer,sizeof(buffer)); if(len>0) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","WASTE IN SERIAL! "+toHexString(buffer,len)); + if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","WASTE IN SERIAL! "+toHexString(buffer,len)); std::cout << "WASTE! "+toHexString(buffer,len) << std::endl; } memset(buffer,0,sizeof(buffer)); - if(m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","REPEAT"); + if(m_SaveLog && i>0) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","REPEAT"); if(i>0) std::cout << "REPEAT SEND!" << std::endl; //Отправляю запрос на принтер @@ -612,7 +612,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri { if(buffer[k]==0x15) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","NACK"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","NACK"); usleep(1200); NACK=true; break; @@ -629,7 +629,7 @@ int DP25::SendPMessage(unsigned int cmd, unsigned char* msg, int size, std::stri { pos=k; if(buffer[k]==0x01) break; //Чтобы не затёрло данные - //if(buffer[j]==0x16 && m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","WAIT"); //SYN комманда подождать данные посылается каждые 60ms + //if(buffer[j]==0x16 && m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","WAIT"); //SYN комманда подождать данные посылается каждые 60ms } if(pos>0) @@ -716,7 +716,7 @@ bool DP25::CloseCOMPort() { csPort->Close(); delete csPort; - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Close Serial.", true); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Close Serial.", true); } csPort = NULL; return true; @@ -750,7 +750,7 @@ bool DP25::CloseSocket() csPort->Close(); delete csPort; csPort = NULL; - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Close Socket.", true); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Close Socket.", true); } return true; } @@ -759,7 +759,7 @@ bool DP25::CloseSocket() ///Если открыт фискальный чек и Sw3 в положении OFF, очищается только нижняя строка. MyError DP25::DisplayClear() { - if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","Start DisplayClear();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Start DisplayClear();"); std::string answer; MyError result; @@ -792,7 +792,7 @@ MyError DP25::DisplayClear() std::stringstream ss; ss << "DisplayClear()"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -802,7 +802,7 @@ MyError DP25::DisplayClear() //Text - До 20 символов текста MyError DP25::DisplayLower(std::string Text) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start DisplayLower();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start DisplayLower();"); std::string msg; msg += fromASCIItoDOS(Text) + '\t'; //кракозябры так @@ -839,7 +839,7 @@ MyError DP25::DisplayLower(std::string Text) std::stringstream ss; ss << "DisplayLower(Text=" << Text << ")"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -848,7 +848,7 @@ MyError DP25::DisplayLower(std::string Text) ///Открытие нефискального чека MyError DP25::OpenServiceInv(int& ShiftNumber,int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start OpenServiceInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start OpenServiceInv();"); ShiftNumber = 0; DocNumber = 0; @@ -892,7 +892,7 @@ MyError DP25::OpenServiceInv(int& ShiftNumber,int& DocNumber) std::stringstream ss; ss << "OpenServiceInv(ShiftNumber=" << ShiftNumber << ",DocNumber="<< DocNumber <<")"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -902,7 +902,7 @@ MyError DP25::OpenServiceInv(int& ShiftNumber,int& DocNumber) ///Ответ: Текущий номер чека MyError DP25::CloseServiceInv(int& ShiftNumber, int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start CloseServiceInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start CloseServiceInv();"); ShiftNumber = 0; DocNumber = 0; std::string msg; @@ -943,7 +943,7 @@ MyError DP25::CloseServiceInv(int& ShiftNumber, int& DocNumber) std::stringstream ss; ss << "CloseServiceInv(ShiftNumber=" << ShiftNumber << ",DocNumber="<< DocNumber <<")"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -957,7 +957,7 @@ MyError DP25::CloseServiceInv(int& ShiftNumber, int& DocNumber) // 3 - ИИН/БИН покупателя MyError DP25::SetFiscalInvParam(int Type, std::string Data) { - if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Start SetFiscalInvParam();"); + if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Start SetFiscalInvParam();"); std::string msg; msg += Utility::IntToStdStr(Type); msg += '\t'; @@ -1005,7 +1005,7 @@ MyError DP25::SetFiscalInvParam(int Type, std::string Data) std::stringstream ss; ss << "SetFiscalInvParam(Type=" << Type << ",Data=" << Data << ")"; if (m_LastErrorCode != 0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", ss.str()); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info", ss.str()); } return result; @@ -1020,7 +1020,7 @@ MyError DP25::SetFiscalInvParam(int Type, std::string Data) //Alignment - 0, 1 or 2. 0=left alignment, 1=center, 2=right; empty field = left alignment; MyError DP25::PrintFreeTextInServiceInv(std::string Text,char Bold,char Italic,char Height,char Underline,char Alignment) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrintFreeTextInServiceInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrintFreeTextInServiceInv();"); std::string msg; @@ -1068,7 +1068,7 @@ MyError DP25::PrintFreeTextInServiceInv(std::string Text,char Bold,char Italic,c std::stringstream ss; ss << "PrintFreeTextInServiceInv(Text=" << Text << ",Bold="<< (int)Bold << ",Italic=" << (int)Italic << ",DoubleH=" << (int)Height << ",Underline=" << (int)Underline << ",alignment=" << (int)Alignment <<")"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1084,7 +1084,7 @@ MyError DP25::PrintFreeTextInServiceInv(std::string Text,char Bold,char Italic,c // DevNumber – Заводской номер устройства (Две цифры (01) и десять цифр (xxxxxxxxxx=уникальный заводской номер: 01xxxxxxxxxx) ); MyError DP25::DiagnosticInfo(std::string& Name,std::string& FwRev,std::string& FwDate,std::string& FwTime,std::string& Checksum,std::string& Sw,std::string& DevNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start DiagnosticInfo();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start DiagnosticInfo();"); std::string msg; msg+='1'; msg+='\t'; @@ -1142,7 +1142,7 @@ MyError DP25::DiagnosticInfo(std::string& Name,std::string& FwRev,std::string& F std::stringstream ss; ss << "DiagnosticInfo(Name="+Name+",FwRev="+FwRev+",FwDate="+FwDate+",FwTime"+FwTime+",Checksum"+Checksum+",Sw="+Sw+",DevNumber="+DevNumber+"); v3.13.0.14"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; } @@ -1151,7 +1151,7 @@ MyError DP25::DiagnosticInfo(std::string& Name,std::string& FwRev,std::string& F ///\param count Количество строк MyError DP25::FeedPaper(int count) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start FeedPaper();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start FeedPaper();"); std::string msg; msg+=Utility::IntToStdStr(count); msg+='\t'; @@ -1186,7 +1186,7 @@ MyError DP25::FeedPaper(int count) std::stringstream ss; ss << "FeedPaper(count="+Utility::IntToStdStr(count)+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1195,7 +1195,7 @@ MyError DP25::FeedPaper(int count) //Проверяет режим соединения с ПК MyError DP25::CheckConnection() { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start CheckConnection();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start CheckConnection();"); std::string msg; std::string answer; @@ -1228,7 +1228,7 @@ MyError DP25::CheckConnection() std::stringstream ss; ss << "CheckConnection();"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } @@ -1237,7 +1237,7 @@ MyError DP25::CheckConnection() //--------------------------------------------------------------------------- ///< 0 - disable printout MyError DP25::EnablePrinting(bool val) { - if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt", "Start EnablePrinting();"); + if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info","Start EnablePrinting();"); std::string msg; if(val) @@ -1276,7 +1276,7 @@ MyError DP25::EnablePrinting(bool val) { std::stringstream ss; ss << "EnablePrinting(val="<< val <<");"; if (m_LastErrorCode != 0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath + sp3() + "log.txt", ss.str()); + Utility::logrotate(m_LogFilePath + sp3() + "log.txt","main","info", ss.str()); } return result; } @@ -1284,7 +1284,7 @@ MyError DP25::EnablePrinting(bool val) { ///Обрезка ленты MyError DP25::CutPaper() { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start CutPaper();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start CutPaper();"); std::string msg; std::string answer; @@ -1317,7 +1317,7 @@ MyError DP25::CutPaper() std::stringstream ss; ss << "CutPaper();"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1327,7 +1327,7 @@ MyError DP25::CutPaper() ///Text - До 20 символов текста MyError DP25::DisplayUpper(std::string Text) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start DisplayUpper();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start DisplayUpper();"); std::string msg; msg+=Text+"\t"; @@ -1362,7 +1362,7 @@ MyError DP25::DisplayUpper(std::string Text) std::stringstream ss; ss << "DisplayUpper(Text="+Text+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1376,7 +1376,7 @@ MyError DP25::DisplayUpper(std::string Text) ///SlipNumber – Текущий номер чека продажи или чека возврата (1...99999999); MyError DP25::OpenFiscalInv(int OpCode,std::string OpPwd,int TillNmb,char ReceiptType,int& ShiftNumber,int& SlipNumber,int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start OpenFiscalInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start OpenFiscalInv();"); SlipNumber=0; @@ -1421,7 +1421,7 @@ MyError DP25::OpenFiscalInv(int OpCode,std::string OpPwd,int TillNmb,char Receip std::stringstream ss; ss << "OpenFiscalInv(OpCode="+Utility::IntToStdStr(OpCode)+",OpPwd="+OpPwd+",TillNmb="+Utility::IntToStdStr(TillNmb)+",ReceiptType="+std::string("")+ReceiptType + ",ShiftNumber=" + Utility::IntToStdStr(ShiftNumber)+",SlipNumber="+Utility::IntToStdStr(SlipNumber)+",DocNumber="+ Utility::IntToStdStr(DocNumber) +");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1454,7 +1454,7 @@ MyError DP25::RegisterSale(std::string PluName, char TaxCode, double Price, doub Programming("Dept_name",Utility::IntToStdStr(Department-1), PluName); } - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start RegisterSale();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start RegisterSale();"); if(Price > 100.0f && !(m_activated1==147443647)) //Устанавливается время от времени (2147443647 если то - активированно) { @@ -1557,7 +1557,7 @@ MyError DP25::RegisterSale(std::string PluName, char TaxCode, double Price, doub std::stringstream ss; ss << "RegisterSale(PluName=\""+PluName+"\", TaxCd='"+ TaxCode +"', Price="+Utility::FloatToStdStr(Price,2,'.')+", Quantity="+Utility::FloatToStdStr(Quantity,3,'.')<<", DiscountType="<< DiscountType << ", DiscountValue=" << Utility::FloatToStdStr(DiscountValue, 2, '.') <<", Department="+Utility::IntToStdStr(Department)+", MarkStamp='"+ MarkStamp +"', RoundPrice="+Utility::FloatToStdStr(RoundPrice,2,'.')+", UnitCode="<< UnitCode << ", ProductID=" << ProductID << ", BarCode=" << BarCode << ", SlipNumber=" << SlipNumber << ", DocNumber=" << DocNumber << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -1569,7 +1569,7 @@ MyError DP25::RegisterSale(std::string PluName, char TaxCode, double Price, doub // EntryDate – Дата ввода (формат "DD-MM-YY"); MyError DP25::ReportOnTaxRates(int& NZreport,double& TaxA,double& TaxB,double& TaxC,std::string& EntryDate) ///<Отчет по налоговым ставкам и положению десятичной точки за период { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start ReportOnTaxRates();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start ReportOnTaxRates();"); NZreport=0; TaxA=0; TaxB=0; TaxC=0; EntryDate=""; @@ -1619,7 +1619,7 @@ MyError DP25::ReportOnTaxRates(int& NZreport,double& TaxA,double& TaxB,double& T std::stringstream ss; ss << "ReportOnTaxRates(NZreport="+Utility::IntToStdStr(NZreport)+",TaxA="+Utility::FloatToStdStr(TaxA,2,'.')+",TaxB="+Utility::FloatToStdStr(TaxB,2,'.')+",TaxC="+Utility::FloatToStdStr(TaxC,2,'.')+",EntryDate="+EntryDate+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } @@ -1628,7 +1628,7 @@ MyError DP25::ReportOnTaxRates(int& NZreport,double& TaxA,double& TaxB,double& T //--------------------------------------------------------------------------- int DP25::ReadingError(int Code, int& ECode, std::string& ErrorMessage) { - if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3()+"log.txt" , "Start ReadingError();"); + if (m_SaveLog) Utility::logrotate(m_LogFilePath + sp3()+"log.txt","main","info","Start ReadingError();"); ECode = 0; std::string msg; @@ -1950,7 +1950,7 @@ int DP25::ReadingError(int Code, int& ECode, std::string& ErrorMessage) std::stringstream ss; ss << "ReadingError(ECode=" << ECode << ",ErrorMessage=" << ErrorMessage << ");"; if (m_LastErrorCode != 0) ss << " ErrorCode: " << m_LastErrorCode; - Utility::logrotate(m_LogFilePath + sp3()+"log.txt", ss.str()); + Utility::logrotate(m_LogFilePath + sp3()+"log.txt","main","info", ss.str()); } return result; } @@ -1960,7 +1960,7 @@ int DP25::ReadingError(int Code, int& ECode, std::string& ErrorMessage) //{ErrorCode}{FiscalSignType}{FiscalSign}{ShiftNumber}{SlipNumber}{DocNumber} MyError DP25::CloseFiscalInv(int& FiscalSignType,std::string& FiscalSign,int& ShiftNumber,int& SlipNumber,int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start CloseFiscalInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start CloseFiscalInv();"); SlipNumber=0; @@ -2003,7 +2003,7 @@ MyError DP25::CloseFiscalInv(int& FiscalSignType,std::string& FiscalSign,int& Sh std::stringstream ss; ss << "CloseFiscalInv(FiscalSignType="<< FiscalSignType<<",FiscalSign=" << FiscalSign<< ",ShiftNumber="<< ShiftNumber <<",SlipNumber="+Utility::IntToStdStr(SlipNumber)+",DocNumber="<< DocNumber <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2017,7 +2017,7 @@ MyError DP25::CloseFiscalInv(int& FiscalSignType,std::string& FiscalSign,int& Sh // SlipNumber - Текущий номер чека продажи или чека возврата (1...99999999); MyError DP25::RegisterArticleSale(int PluCode, double Quantity, double Price, char DiscountType, double DiscountValue, std::string MarkStamp, int& SlipNumber, int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start RegisterArticleSale();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start RegisterArticleSale();"); SlipNumber=0; @@ -2071,7 +2071,7 @@ MyError DP25::RegisterArticleSale(int PluCode, double Quantity, double Price, ch std::stringstream ss; ss << "RegisterArticleSale(PluCode="+Utility::IntToStdStr(PluCode)+",Quantity="+Utility::FloatToStdStr(Quantity,3,'.')+",DiscountType="+DiscountType+",DiscountValue="+Utility::FloatToStdStr(DiscountValue,2,'.')+",MarkStamp="<< MarkStamp <<"SlipNumber="+Utility::IntToStdStr(SlipNumber)<<",DocNumber="<< DocNumber <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } @@ -2081,7 +2081,7 @@ MyError DP25::RegisterArticleSale(int PluCode, double Quantity, double Price, ch ///Аннуляция (сторно) фискального чека MyError DP25::CancelFiscalInv(int& ShiftNumber, int& DocNumber) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start CancelFiscalInv();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start CancelFiscalInv();"); ShiftNumber = 0; DocNumber = 0; @@ -2119,7 +2119,7 @@ MyError DP25::CancelFiscalInv(int& ShiftNumber, int& DocNumber) std::stringstream ss; ss << "CancelFiscalInv(ShiftNumber="+Utility::IntToStdStr(ShiftNumber)+",DocNumber="<< Utility::IntToStdStr(DocNumber) <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2132,7 +2132,7 @@ MyError DP25::CancelFiscalInv(int& ShiftNumber, int& DocNumber) // Date – Дата фискальной записи (формат "DD-MM-YY"); MyError DP25::LatestFiscalRecord(char Type, int& NRep, double& SumA,double& SumB,double& SumC,std::string& Date) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start LatestFiscalRecord();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start LatestFiscalRecord();"); NRep=0; SumA=0; SumB=0; SumC=0; @@ -2181,7 +2181,7 @@ MyError DP25::LatestFiscalRecord(char Type, int& NRep, double& SumA,double& SumB std::stringstream ss; ss << "LatestFiscalRecord(Type="+std::string("")+Type+",NRep="+Utility::IntToStdStr(NRep)+",SumA="+Utility::FloatToStdStr(SumA,2,'.')+",SumB="+Utility::FloatToStdStr(SumB,2,'.')+",SumC="+Utility::FloatToStdStr(SumC,2,'.')+",Date="+Date+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } @@ -2194,7 +2194,7 @@ MyError DP25::LatestFiscalRecord(char Type, int& NRep, double& SumA,double& SumB // SumX - Оборот или сумма НДС группы X определенного в Type типа (0.00...9999999.99); MyError DP25::AmountOfSavingsPerDay(char Type, int& NRep, double& SumA,double& SumB,double& SumC) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start AmountOfSavingsPerDay();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start AmountOfSavingsPerDay();"); NRep=0; SumA=0; SumB=0; SumC=0; @@ -2241,7 +2241,7 @@ MyError DP25::AmountOfSavingsPerDay(char Type, int& NRep, double& SumA,double& S std::stringstream ss; ss << "AmountOfSavingsPerDay(Type="+std::string("")+Type+",NRep="+Utility::IntToStdStr(NRep)+",SumA="+Utility::FloatToStdStr(SumA,2,'.')+",SumB="+Utility::FloatToStdStr(SumB,2,'.')+",SumC="+Utility::FloatToStdStr(SumC,2,'.')+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2249,7 +2249,7 @@ MyError DP25::AmountOfSavingsPerDay(char Type, int& NRep, double& SumA,double& S //--------------------------------------------------------------------------- MyError DP25::TurnoversOfSavingsPerDay(int& nRep, double& DailySales, double& DailyRetOfSales, double& DailyPurchases, double& DailyRetOfPurchases, double& NonNullSales, double& NonNullRetOfSales, double& NonNullPurchases, double& NonNullRetOfPurchases) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start TurnoversOfSavingsPerDay();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start TurnoversOfSavingsPerDay();"); nRep=0;DailySales=0;DailyRetOfSales=0;DailyPurchases=0;DailyRetOfPurchases=0;NonNullSales=0;NonNullRetOfSales=0;NonNullPurchases=0;NonNullRetOfPurchases=0; @@ -2305,7 +2305,7 @@ MyError DP25::TurnoversOfSavingsPerDay(int& nRep, double& DailySales, double& Da std::stringstream ss; ss << "TurnoversOfSavingsPerDay(nRep=" << nRep << ",DailySales=" << Utility::FloatToStdStr(DailySales,2,'.') << ",DailyRetOfSales=" << Utility::FloatToStdStr(DailyRetOfSales,2,'.') << ",DailyPurchases=" << Utility::FloatToStdStr(DailyPurchases,2,'.') << ",DailyRetOfPurchases=" << Utility::FloatToStdStr(DailyRetOfPurchases,2,'.') << ",NonNullSales=" << Utility::FloatToStdStr(NonNullSales,2,'.') << ",NonNullRetOfSales=" << Utility::FloatToStdStr(NonNullRetOfSales,2,'.') << ",NonNullPurchases=" << Utility::FloatToStdStr(NonNullPurchases,2,'.') << ".NonNullRetOfPurchases=" << Utility::FloatToStdStr(NonNullRetOfPurchases,2,'.') << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2314,7 +2314,7 @@ MyError DP25::TurnoversOfSavingsPerDay(int& nRep, double& DailySales, double& Da //Получение статуса принтера MyError DP25::GetStatusFP(std::string& StatusBytes) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start GetStatusFP();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start GetStatusFP();"); std::string msg; @@ -2423,7 +2423,7 @@ MyError DP25::GetStatusFP(std::string& StatusBytes) std::stringstream ss; ss << "GetStatusFP(StatusBytes="+StatusBytes+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2448,7 +2448,7 @@ MyError DP25::FiscalTransactionsStatus(char& IsOpen,int& Items,double& Amount,do { IsOpen=0; Items=0; Amount=0; Payed=0; SlipNumber=0; SlipNumberFiscal=0; - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start FiscalTransactionsStatus();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start FiscalTransactionsStatus();"); std::string msg; @@ -2497,7 +2497,7 @@ MyError DP25::FiscalTransactionsStatus(char& IsOpen,int& Items,double& Amount,do std::stringstream ss; ss << "FiscalTransactionsStatus(IsOpen=" << IsOpen << ",Items="+Utility::IntToStdStr(Items)+",Amount="+Utility::FloatToStdStr(Amount,2,'.')+",Payed="+Utility::FloatToStdStr(Payed,2,'.')+",SlipNumber="+Utility::IntToStdStr(SlipNumber)+",SlipNumberFiscal="+Utility::IntToStdStr(SlipNumberFiscal)+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2508,7 +2508,7 @@ MyError DP25::FiscalTransactionsStatus(char& IsOpen,int& Items,double& Amount,do ///\param mSec Милисекунд MyError DP25::Beep(int Hz,int mSec) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start Beep();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start Beep();"); std::string msg; msg+=Utility::IntToStdStr(Hz)+"\t"; @@ -2543,7 +2543,7 @@ MyError DP25::Beep(int Hz,int mSec) std::stringstream ss; ss << "Beep(Hz="+Utility::IntToStdStr(Hz)+",mSec="+Utility::IntToStdStr(mSec)+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } @@ -2555,7 +2555,7 @@ MyError DP25::Beep(int Hz,int mSec) // DD - День; MM - Месяц; YY - Год; hh - Час; mm - Минута; ss - Секунда; MyError DP25::SetDateTime(std::string DateTime) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start SetDateTime();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start SetDateTime();"); std::string msg; msg+=DateTime+"\t"; @@ -2590,7 +2590,7 @@ MyError DP25::SetDateTime(std::string DateTime) std::stringstream ss; ss << "SetDateTime(DateTime="+DateTime+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2601,7 +2601,7 @@ MyError DP25::SetDateTime(std::string DateTime) ///\param time - врремя в формате "HH:MM:SS" MyError DP25::GetDateTime(std::string &DateTime) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start GetDateTime();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start GetDateTime();"); std::string answer; MyError result; @@ -2633,7 +2633,7 @@ MyError DP25::GetDateTime(std::string &DateTime) std::stringstream ss; ss << "GetDateTime(DateTime="+DateTime+");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -2642,7 +2642,7 @@ MyError DP25::GetDateTime(std::string &DateTime) ///{PLU}{TaxGr}{Dep}{Group}{PriceType}{Price}{AddQty}{Quantity}{Bar1}{Bar2}{Bar3}{Bar4}{Name} std::string msg; @@ -4253,7 +4253,7 @@ MyError DP25::PrgAndReadArticleP(int PLU,char TaxGr,int Dep,int Group,char Price std::stringstream ss; ss << "PrgAndReadArticleP(PLU="<< PLU <<",char TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",AddQty=" << AddQty << ",Quantity=" << Quantity << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType=" << MarkType << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4265,7 +4265,7 @@ MyError DP25::PrgAndReadArticleP(int PLU,char TaxGr,int Dep,int Group,char Price //Error DP25::PrgAndReadArticleP(int PLU,char TaxGr,int Dep,int Group,char PriceType,double Price,char AddQty,double Quantity,std::string Bar1,std::string Bar2,std::string Bar3,std::string Bar4,std::string Name) MyError DP25::PrgAndReadArticleA(int PLU,double Quantity) ///<Программирование и считывание параметров товаров { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleA();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleA();"); //{Option}{PLU}{Quantity} std::string msg; @@ -4305,7 +4305,7 @@ MyError DP25::PrgAndReadArticleA(int PLU,double Quantity) ///<Программи std::stringstream ss; ss << "PrgAndReadArticleA(PLU="<{firstPLU}{lastPLU} std::string msg; @@ -4360,7 +4360,7 @@ MyError DP25::PrgAndReadArticleD(int FirstPLU,int LastPLU) ///<Программ std::stringstream ss; ss << "PrgAndReadArticleD(FirstPLU="<< FirstPLU <<",LastPLU="<< LastPLU <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4380,7 +4380,7 @@ MyError DP25::PrgAndReadArticleD(int FirstPLU,int LastPLU) ///<Программ // Name – Наименование товара (до 32 символов); MyError DP25::PrgAndReadArticleR(int PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name,int& UnitCode,int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleR();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleR();"); std::string msg; msg+='R'; msg+='\t'; @@ -4446,7 +4446,7 @@ MyError DP25::PrgAndReadArticleR(int PLU,char& TaxGr,int& Dep,int& Group,char& P std::stringstream ss; ss << "PrgAndReadArticleR(PLU="<< PLU <<",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType=" << MarkType << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4455,7 +4455,7 @@ MyError DP25::PrgAndReadArticleR(int PLU,char& TaxGr,int& Dep,int& Group,char& P /// Возврат данных первого найденного запрограммированного товара MyError DP25::PrgAndReadArticleF(int& PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleF();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleF();"); std::string msg; msg+='F'; msg+='\t'; @@ -4522,7 +4522,7 @@ MyError DP25::PrgAndReadArticleF(int& PLU,char& TaxGr,int& Dep,int& Group,char& std::stringstream ss; ss << "PrgAndReadArticleF(PLU=" << PLU << ",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType="<< MarkType <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4531,7 +4531,7 @@ MyError DP25::PrgAndReadArticleF(int& PLU,char& TaxGr,int& Dep,int& Group,char& /// Возврат данных последнего найденного запрограммированного товара MyError DP25::PrgAndReadArticleL(int PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleL();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleL();"); std::string msg; msg+='L'; msg+='\t'; @@ -4598,7 +4598,7 @@ MyError DP25::PrgAndReadArticleL(int PLU,char& TaxGr,int& Dep,int& Group,char& P std::stringstream ss; ss << "PrgAndReadArticleL(PLU="<< PLU <<",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType=" << MarkType << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4607,7 +4607,7 @@ MyError DP25::PrgAndReadArticleL(int PLU,char& TaxGr,int& Dep,int& Group,char& P //Возврат данных последнего найденного товара имеющего обороты продаж MyError DP25::PrgAndReadArticleLL(int PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleLL();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleLL();"); std::string msg; msg+='l'; msg+='\t'; @@ -4674,7 +4674,7 @@ MyError DP25::PrgAndReadArticleLL(int PLU,char& TaxGr,int& Dep,int& Group,char& std::stringstream ss; ss << "PrgAndReadArticleLL(PLU=" << PLU << ",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType="<< MarkType <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4683,7 +4683,7 @@ MyError DP25::PrgAndReadArticleLL(int PLU,char& TaxGr,int& Dep,int& Group,char& /// Возврат данных последнего найденного запрограммированного товара MyError DP25::PrgAndReadArticleN(int& PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleN();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleN();"); std::string msg; msg+='N'; msg+='\t'; @@ -4749,7 +4749,7 @@ MyError DP25::PrgAndReadArticleN(int& PLU,char& TaxGr,int& Dep,int& Group,char& std::stringstream ss; ss << "PrgAndReadArticleN(PLU=" << PLU << ",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType="<< MarkType <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4758,7 +4758,7 @@ MyError DP25::PrgAndReadArticleN(int& PLU,char& TaxGr,int& Dep,int& Group,char& //Возврат данных следующего найденного товара имеющего обороты продаж MyError DP25::PrgAndReadArticleNN(int& PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleNN();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleNN();"); std::string msg; msg+='n'; msg+='\t'; @@ -4824,7 +4824,7 @@ MyError DP25::PrgAndReadArticleNN(int& PLU,char& TaxGr,int& Dep,int& Group,char& std::stringstream ss; ss << "PrgAndReadArticleNN(PLU=" << PLU << ",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType="<< MarkType <<");"; if (m_LastErrorCode != 0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4833,7 +4833,7 @@ MyError DP25::PrgAndReadArticleNN(int& PLU,char& TaxGr,int& Dep,int& Group,char& /// Возврат данных первого найденного товара имеющего обороты продаж MyError DP25::PrgAndReadArticleFF(int PLU,char& TaxGr,int& Dep,int& Group,char& PriceType,double& Price,double& Turnover,double& SoldQty,double& StockQty,std::string& Bar1,std::string& Bar2,std::string& Bar3,std::string& Bar4,std::string& Name, int& UnitCode, int& MarkType) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleFF();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleFF();"); std::string msg; msg+='f'; msg+='\t'; @@ -4900,7 +4900,7 @@ MyError DP25::PrgAndReadArticleFF(int PLU,char& TaxGr,int& Dep,int& Group,char& std::stringstream ss; ss << "PrgAndReadArticleFF(PLU=" << PLU << ",TaxGr=" << TaxGr << ",Dep=" << Dep << ",Group=" << Group << ",PriceType=" << PriceType << ",Price=" << Price << ",Turnover=" << Turnover << ",SoldQty=" << SoldQty << ",StockQty=" << StockQty << ",Bar1=" << Bar1 << ",Bar2=" << Bar2 << ",Bar3=" << Bar3 << ",Bar4=" << Bar4 << ",Name=" << Name << ",UnitCode=" << UnitCode << ",MarkType="<< MarkType <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4910,7 +4910,7 @@ MyError DP25::PrgAndReadArticleFF(int PLU,char& TaxGr,int& Dep,int& Group,char& //PLU - Код товара (1...3000). По умолчанию: 0 MyError DP25::PrgAndReadArticleX(int PLU,int& FirstPLU) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleX();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleX();"); std::string msg; msg+='X'; msg+='\t'; @@ -4952,7 +4952,7 @@ MyError DP25::PrgAndReadArticleX(int PLU,int& FirstPLU) std::stringstream ss; ss << "PrgAndReadArticleX(PLU=" << PLU << ",FirstPLU="<< FirstPLU <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -4962,7 +4962,7 @@ MyError DP25::PrgAndReadArticleX(int PLU,int& FirstPLU) //PLU - Код товара (1...3000). По умолчанию: 3000 MyError DP25::PrgAndReadArticleXX(int PLU,int& LastPLU) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start PrgAndReadArticleXX();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start PrgAndReadArticleXX();"); std::string msg; msg+='x'; msg+='\t'; @@ -5004,7 +5004,7 @@ MyError DP25::PrgAndReadArticleXX(int PLU,int& LastPLU) std::stringstream ss; ss << "PrgAndReadArticleXX(PLU="<< PLU <<",LastPLU="<< LastPLU << ");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -5042,7 +5042,7 @@ MyError DP25::PrgAndReadArticleXX(int PLU,int& LastPLU) // CashOut – Сумма выплат; MyError DP25::ReportByOperators(int Operator,int& Receipts,double& Total,int& nDiscount,double& Discount,int& nSurcharge,double& Surcharge,int& nVoid,double& Void,int& nAllVoided,double& AllVoided,int& nCancelled,double& Cancelled,int& RetReceipts,double& RetTotal,int& RetnDiscount,double& RetDiscount,int& RetnSurcharge,double& RetSurcharge,int& RetnVoid,double& RetVoid,int& RetnAllVoided,double& RetAllVoided,int& RetnCancelled,double& RetCancelled,int& nCashIn,double& CashIn,int& nCashOut,double& CashOut) { - if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","Start ReportByOperators();"); + if(m_SaveLog) Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info","Start ReportByOperators();"); std::string msg; msg+=Utility::IntToStdStr(Operator); msg+='\t'; @@ -5138,7 +5138,7 @@ MyError DP25::ReportByOperators(int Operator,int& Receipts,double& Total,int& nD std::stringstream ss; ss << "ReportByOperators(Operator=" << Operator << ",Receipts=" << Receipts << ",Total=" << Total << ",nDiscount=" << nDiscount << ",Discount=" << Discount << ",nSurcharge=" << nSurcharge << ",Surcharge=" << Surcharge << ",nVoid=" << nVoid << ",Void=" << Void << ",nAllVoided=" << nAllVoided << ",AllVoided=" << AllVoided << ",nCancelled=" << nCancelled << ",Cancelled=" << Cancelled << ",RetReceipts=" << RetReceipts << ",RetTotal=" << RetTotal << ",RetnDiscount=" << RetnDiscount << ",RetDiscount=" << RetDiscount << ",RetnSurcharge=" << RetnSurcharge << ",RetSurcharge=" << RetSurcharge << ",RetnVoid=" << RetnVoid << ",RetVoid=" << RetVoid << ",RetnAllVoided=" << RetnAllVoided << ",RetAllVoided=" << RetAllVoided << ",RetnCancelled=" << RetnCancelled << ",RetCancelled=" << RetCancelled << ",nCashIn=" << nCashIn << ",CashIn=" << CashIn << ",nCashOut=" << nCashOut << ",CashOut="<< CashOut <<");"; if(m_LastErrorCode!=0) ss << " ErrorCode: " << m_LastErrorCode << " ErrorDescription: " << m_LastErrorDescription; - Utility::logrotate(m_LogFilePath+sp3()+"log.txt",ss.str()); + Utility::logrotate(m_LogFilePath+sp3()+"log.txt","main","info",ss.str()); } return result; @@ -5147,7 +5147,7 @@ MyError DP25::ReportByOperators(int Operator,int& Receipts,double& Total,int& nD /// #include // std::ifstream #include +#include // For std::towlower +#include #include "inifile.h" #include "stdTools.h" @@ -374,6 +376,7 @@ JSON::JSON(std::wstring data) Utility::CutBeforeWFirst(data, '"'); std::wstring ident = Utility::CutBeforeWFirst(data, '"'); + std::transform(ident.begin(), ident.end(), ident.begin(), ::tolower); std::wstring value; size_t startpos = data.find_first_not_of(L" :\t\f\n\r"); @@ -438,9 +441,11 @@ std::string JSON::ReadAString(std::wstring Ident,std::wstring Default) //------------------------------------------------------------------------------ std::wstring JSON::ReadString(std::wstring Ident,std::wstring Default) { + std::transform(Ident.begin(), Ident.end(), Ident.begin(), ::tolower); + TIniWStruct* inistr = first; while (inistr!=NULL) - { + { if (inistr->ident==Ident) { return inistr->value; diff --git a/lib/stdTools.cpp b/lib/stdTools.cpp index 2f18834..18aa70a 100644 --- a/lib/stdTools.cpp +++ b/lib/stdTools.cpp @@ -1531,7 +1531,7 @@ namespace Utility //Преобразовать строку в число //str - Исходная строка с числом //cutInt - вырезать из строки только цифры - int StdStrToUInt(std::string& str, bool cutInt) + uint32_t StdStrToUInt(std::string& str, bool cutInt, uint32_t def) { if(cutInt) { @@ -1541,10 +1541,10 @@ namespace Utility if(str[i]=='0' || str[i]=='1' || str[i]=='2' || str[i]=='3' || str[i]=='4' || str[i]=='5' || str[i]=='6' || str[i]=='7' || str[i]=='8' || str[i]=='9') val+=str[i]; } - if(val=="") return 0; + if(val=="") return def; return fromString(val); } - if(str=="") return 0; + if(str=="") return def; return fromString(str); } //--------------------------------------------------------------------------- @@ -2220,12 +2220,13 @@ namespace Utility } //--------------------------------------------------------------------------- //Создать папку - bool createFolder(std::string directory,mode_t mode) + bool createFolder(std::string directory,int mode) { #if defined(_WIN32) || defined(_WINDOWS) || defined(_BORLAND) CreateDirectoryA(directory.c_str(), NULL); return true; #else + mode_t tmp = mode; //На винде тен типа mode_t int rez=0; if(!dirExists(directory)){ rez=mkdir(directory.c_str(), mode); //Если папки нет то создать её diff --git a/lib/stdTools.h b/lib/stdTools.h index 2fb874c..fee09f2 100644 --- a/lib/stdTools.h +++ b/lib/stdTools.h @@ -127,7 +127,7 @@ namespace Utility bool fileExists(std::string name); bool dirExists(std::string path); - bool createFolder(std::string directory,mode_t mode=0776); //Создать директорию + bool createFolder(std::string directory,int mode=0776); //Создать директорию long getFileSize(std::string filename); @@ -154,7 +154,7 @@ namespace Utility template T fromString(const std::string& s); int StdStrToInt(std::string& str, bool cutInt = false, int def = 0); - int StdStrToUInt(std::string& str, bool cutInt = false); + uint32_t StdStrToUInt(std::string& str, bool cutInt = false, int def = 0); float StdStrToFloat(std::string& str); double StdStrToDouble(std::string& str,double defval = 0); double StdWStrToDouble(std::wstring str, double defval = 0);