Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMDbMonitor_linux
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
FMDbMonitor_linux
Commits
059ca4d4
Commit
059ca4d4
authored
Oct 26, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
折扣信息表写入数据
parent
fdda3cd9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
pos_bft/OrderInfo.cpp
+23
-1
src/FMDbMonitor.cpp
+6
-2
No files found.
pos_bft/OrderInfo.cpp
View file @
059ca4d4
...
...
@@ -247,7 +247,7 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
OpenStationRef,OpenEmp,CloseTime,ClosePeriod,CloseStation,CloseEmp,PrintCount,LastPrintTime,CheckTot,ItemTot,DiscBefore,PayTot,IsPaid,SCRate1,\
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')"
,
\
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
();
if
(
nErrCode
!=
EC_OK
)
{
...
...
@@ -397,6 +397,23 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
pthread_mutex_unlock
(
&
mutex
);
//解锁
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
);
//解锁
return
0
;
}
...
...
@@ -433,6 +450,8 @@ int COrderInfo::CancleTakeaway(TakeawayOrder &order)
nErrCode
=
mysql
->
remove
();
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"DELETE FROM tbl_Payment WHERE `Check`=%d;"
,
iOrderId
);
nErrCode
=
mysql
->
remove
();
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"DELETE FROM tbl_Disc WHERE `Check`=%d;"
,
iOrderId
);
nErrCode
=
mysql
->
remove
();
//更新外卖订单记录为已退单,同时修改订单orderid ,规则,orderid后加‘_1’
std
::
string
newOrderId
=
strOrderId
+
"_1"
;
...
...
@@ -707,6 +726,9 @@ void COrderInfo::rollbackData(std::string orderid)
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"DELETE FROM tbl_Payment WHERE `Check`=%d;"
,
iOrderId
);
mysql
->
remove
();
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"DELETE FROM tbl_Disc WHERE `Check`=%d;"
,
iOrderId
);
mysql
->
remove
();
}
//需要导出的函数,即用户在外部可以调用的接口
...
...
src/FMDbMonitor.cpp
View file @
059ca4d4
...
...
@@ -16,10 +16,12 @@
#include "SQLiteOperate.h"
#include "PayProcess.h"
#include "json.h"
#include "../3rdParty/easylogging/easylogging++.h"
#include "../utility/utility.h"
#include "../utility/zini.h"
#define ELPP_NO_DEFAULT_LOG_FILE
#include "../3rdParty/easylogging/easylogging++.h"
#define BUFFER_SIZE 1024 //缓冲区大小
void
InitSystem
();
...
...
@@ -39,7 +41,9 @@ int main()
return FALSE;
}*/
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的配置
el
::
Loggers
::
reconfigureAllLoggers
(
conf
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment