Commit 059ca4d4 by guanghui.cui

折扣信息表写入数据

parent fdda3cd9
...@@ -247,7 +247,7 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order) ...@@ -247,7 +247,7 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
OpenStationRef,OpenEmp,CloseTime,ClosePeriod,CloseStation,CloseEmp,PrintCount,LastPrintTime,CheckTot,ItemTot,DiscBefore,PayTot,IsPaid,SCRate1,\ OpenStationRef,OpenEmp,CloseTime,ClosePeriod,CloseStation,CloseEmp,PrintCount,LastPrintTime,CheckTot,ItemTot,DiscBefore,PayTot,IsPaid,SCRate1,\
IsModified,LastModifiedTime)\ IsModified,LastModifiedTime)\
VALUES('%s',%d,'%s',%d,1,'1',4,'%s',3,99,99,4,'%s',4,99,4,1,'%s',%.2f,%.2f,%.2f,%.2f,'1',0.1,1,'%s')", \ VALUES('%s',%d,'%s',%d,1,'1',4,'%s',3,99,99,4,'%s',4,99,4,1,'%s',%.2f,%.2f,%.2f,%.2f,'1',0.1,1,'%s')", \
strDate.data(),orderId,orderIdStr,iOutlet,chTime,chTime,chTime,merchantTot,order.shop_fee/100.00,discount,merchantTot,chTime); strDate.data(),orderId,orderIdStr,iOutlet,chTime,chTime,chTime,merchantTot,order.shop_fee/100.00,-discount,merchantTot,chTime);
nErrCode = mysql->insert(); nErrCode = mysql->insert();
if(nErrCode != EC_OK) if(nErrCode != EC_OK)
{ {
...@@ -397,6 +397,23 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order) ...@@ -397,6 +397,23 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
pthread_mutex_unlock(&mutex); //解锁 pthread_mutex_unlock(&mutex); //解锁
return EC_EX_SQL_FAILED; return EC_EX_SQL_FAILED;
} }
//写入折扣信息表
//VALUES('2017-10-26',1234567,1390,1,7,'takeout discount','takeout discount','ÍâÂôÕÛ¿Û',2,0,15,'2017-10-26 18:23:08',99,2,'1',-0.1000,-20.08);
float disRate=(order.service_fee+order.dis_shop_fee*1.00)/order.products_fee;
snprintf(mysql->sqlStr,SQL_BUFFER_SIZE, "INSERT INTO tbl_Disc(`Date`,`Check`,Outlet,DiscIdx,DiscNo,Name1,Name2,Name3,ItemIdx,StartLevel,EndLevel,ApplyTime,\
ApplyStation,ApplyEmp,IsDiscBefore,Rate,DiscTot)\
VALUES('%s',%d,%d,1,0,'takeout discount','takeout discount','ÍâÂôÕÛ¿Û',%d,0,15,'%s',99,2,'1',%.2f,%.2f)", \
strDate.data(),orderId,iOutlet,itemIndex,chTime,-disRate,-discount);
nErrCode = mysql->insert();
if(nErrCode != EC_OK)
{
rollbackData(orderIdStr);
pthread_mutex_unlock(&mutex); //解锁
return EC_EX_SQL_FAILED;
}
pthread_mutex_unlock(&mutex); //解锁 pthread_mutex_unlock(&mutex); //解锁
return 0; return 0;
} }
...@@ -433,6 +450,8 @@ int COrderInfo::CancleTakeaway(TakeawayOrder &order) ...@@ -433,6 +450,8 @@ int COrderInfo::CancleTakeaway(TakeawayOrder &order)
nErrCode = mysql->remove(); nErrCode = mysql->remove();
snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Payment WHERE `Check`=%d;",iOrderId); snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Payment WHERE `Check`=%d;",iOrderId);
nErrCode = mysql->remove(); nErrCode = mysql->remove();
snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Disc WHERE `Check`=%d;",iOrderId);
nErrCode = mysql->remove();
//更新外卖订单记录为已退单,同时修改订单orderid ,规则,orderid后加‘_1’ //更新外卖订单记录为已退单,同时修改订单orderid ,规则,orderid后加‘_1’
std::string newOrderId = strOrderId+"_1"; std::string newOrderId = strOrderId+"_1";
...@@ -707,6 +726,9 @@ void COrderInfo::rollbackData(std::string orderid) ...@@ -707,6 +726,9 @@ void COrderInfo::rollbackData(std::string orderid)
snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Payment WHERE `Check`=%d;",iOrderId); snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Payment WHERE `Check`=%d;",iOrderId);
mysql->remove(); mysql->remove();
snprintf(mysql->sqlStr,SQL_BUFFER_SIZE,"DELETE FROM tbl_Disc WHERE `Check`=%d;",iOrderId);
mysql->remove();
} }
//需要导出的函数,即用户在外部可以调用的接口 //需要导出的函数,即用户在外部可以调用的接口
......
...@@ -16,10 +16,12 @@ ...@@ -16,10 +16,12 @@
#include "SQLiteOperate.h" #include "SQLiteOperate.h"
#include "PayProcess.h" #include "PayProcess.h"
#include "json.h" #include "json.h"
#include "../3rdParty/easylogging/easylogging++.h"
#include "../utility/utility.h" #include "../utility/utility.h"
#include "../utility/zini.h" #include "../utility/zini.h"
#define ELPP_NO_DEFAULT_LOG_FILE
#include "../3rdParty/easylogging/easylogging++.h"
#define BUFFER_SIZE 1024 //缓冲区大小 #define BUFFER_SIZE 1024 //缓冲区大小
void InitSystem(); void InitSystem();
...@@ -39,7 +41,9 @@ int main() ...@@ -39,7 +41,9 @@ int main()
return FALSE; return FALSE;
}*/ }*/
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck); el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
el::Configurations conf("log.conf"); std::string strLogPath = GetProcDir();
strLogPath.append("log.conf");
el::Configurations conf(strLogPath.data());
/// 设置全部logger的配置 /// 设置全部logger的配置
el::Loggers::reconfigureAllLoggers(conf); el::Loggers::reconfigureAllLoggers(conf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment