Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
21657956
Commit
21657956
authored
Jan 27, 2016
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小数位数处理
parent
609c0b6b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
25 deletions
+44
-25
IBTCommon.h
XFFruit/Utilities/IBTUIKit/IBTCommon.h
+1
-1
IBTCommon.m
XFFruit/Utilities/IBTUIKit/IBTCommon.m
+20
-1
PasengerCell.m
XFFruit/ViewControllers/Report/Views/PasengerCell.m
+6
-6
RPassgerView.m
XFFruit/ViewControllers/Report/Views/RPassgerView.m
+9
-9
RSaleView.m
XFFruit/ViewControllers/Report/Views/RSaleView.m
+5
-5
SaleViewCell.m
XFFruit/ViewControllers/Report/Views/SaleViewCell.m
+3
-3
No files found.
XFFruit/Utilities/IBTUIKit/IBTCommon.h
View file @
21657956
...
...
@@ -52,5 +52,5 @@
+
(
NSString
*
)
weekdayStringFromDate
:(
NSDate
*
)
inputDate
;
+
(
NSString
*
)
countNumAndChangeformat
:(
NSString
*
)
num
;
+
(
NSString
*
)
getWeekFromDateStr
:(
NSString
*
)
dataStr
;
+
(
NSString
*
)
stringDisposeWithFloat
:(
float
)
floatValue
;
@end
XFFruit/Utilities/IBTUIKit/IBTCommon.m
View file @
21657956
...
...
@@ -388,6 +388,25 @@
[
newstring
insertString
:
string
atIndex
:
0
];
return
newstring
;
}
+
(
NSString
*
)
stringDisposeWithFloat
:
(
float
)
floatValue
{
NSString
*
str
=
[
NSString
stringWithFormat
:
@"%.2f"
,
floatValue
];
NSInteger
len
=
str
.
length
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
!
[
str
hasSuffix
:
@"0"
])
break
;
else
str
=
[
str
substringToIndex
:[
str
length
]
-
1
];
}
if
([
str
hasSuffix
:
@"."
])
//避免像2.0000这样的被解析成2.
{
return
[
str
substringToIndex
:[
str
length
]
-
1
];
//s.substring(0, len - i - 1);
}
else
{
return
str
;
}
}
@end
XFFruit/ViewControllers/Report/Views/PasengerCell.m
View file @
21657956
...
...
@@ -100,7 +100,7 @@
self
.
dqLabel
.
text
=
sale
.
orgCode
;
self
.
nameLabel
.
text
=
sale
.
orgName
;
//客单价
self
.
saleLabel
.
text
=
[
sale
.
persales
stringValue
];
self
.
saleLabel
.
text
=
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
persales
floatValue
]
];
//客单价比变化率
if
([
sale
.
persalesChainSign
isEqualToString
:
ReportChainSignPlus
])
{
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainPlusImage
]
forState
:
UIControlStateDisabled
];
...
...
@@ -113,7 +113,7 @@
self
.
saleLabel
.
textColor
=
GXF_NAVIGAYION_COLOR
;
}
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
sale
.
persalesChainRate
];
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
persalesChainRate
floatValue
]]
];
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
[
self
setColorAndFont
:
sale
.
level
];
}
...
...
@@ -125,7 +125,7 @@
self
.
dqLabel
.
text
=
sale
.
orgCode
;
self
.
nameLabel
.
text
=
sale
.
orgName
;
//客流量
self
.
saleLabel
.
text
=
[
IBTCommon
countNumAndChangeformat
:[
sale
.
passenger
stringValue
]];
self
.
saleLabel
.
text
=
[
IBTCommon
countNumAndChangeformat
:[
IBTCommon
stringDisposeWithFloat
:[
sale
.
passenger
floatValue
]
]];
//客流量比变化率
if
([
sale
.
passengerChainSign
isEqualToString
:
ReportChainSignPlus
])
{
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainPlusImage
]
forState
:
UIControlStateDisabled
];
...
...
@@ -138,7 +138,7 @@
self
.
saleLabel
.
textColor
=
GXF_NAVIGAYION_COLOR
;
}
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
sale
.
passengerChainRate
];
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
passengerChainRate
floatValue
]]
];
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
[
self
setColorAndFont
:
sale
.
level
];
...
...
@@ -150,7 +150,7 @@
self
.
dqLabel
.
text
=
sale
.
orgCode
;
self
.
nameLabel
.
text
=
sale
.
orgName
;
//毛利率
self
.
saleLabel
.
text
=
[
sale
.
grossprofit
stringValue
];
self
.
saleLabel
.
text
=
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
grossprofit
floatValue
]
];
//毛利率比变化率
if
([
sale
.
grossprofitChainSign
isEqualToString
:
ReportChainSignPlus
])
{
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainPlusImage
]
forState
:
UIControlStateDisabled
];
...
...
@@ -163,7 +163,7 @@
self
.
saleLabel
.
textColor
=
GXF_NAVIGAYION_COLOR
;
}
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
sale
.
grossprofitChainRate
];
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
grossprofitChainRate
floatValue
]]
];
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
[
self
setColorAndFont
:
sale
.
level
];
...
...
XFFruit/ViewControllers/Report/Views/RPassgerView.m
View file @
21657956
...
...
@@ -121,7 +121,7 @@
-
(
void
)
setPassengerWithCompass
:
(
Compass
*
)
compass
{
//客流数
self
.
centerLabel
.
text
=
compass
.
passenger
?[
IBTCommon
countNumAndChangeformat
:[
compass
.
passenger
stringValue
]]:
@"---"
;
self
.
centerLabel
.
text
=
compass
.
passenger
?[
IBTCommon
countNumAndChangeformat
:[
IBTCommon
stringDisposeWithFloat
:[
compass
.
passenger
floatValue
]
]]:
@"---"
;
//客流统计时间
NSString
*
weekday
=
@""
;
...
...
@@ -137,7 +137,7 @@
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastWeekLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
salesYoStr
=
compass
.
passengerChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
passengerChainRate
]:
@"---"
;
NSString
*
salesYoStr
=
compass
.
passengerChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
passengerChainRate
floatValue
]]
]:
@"---"
;
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
//客流数同比变化率
...
...
@@ -148,13 +148,13 @@
[
self
.
lastYearLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastYearLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
passengerYoYRateStr
=
compass
.
passengerYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
passengerYoYRate
]:
@"---"
;
NSString
*
passengerYoYRateStr
=
compass
.
passengerYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
passengerYoYRate
floatValue
]]
]:
@"---"
;
[
self
.
lastYearLabel
setTitle
:
passengerYoYRateStr
forState
:
UIControlStateNormal
];
}
//客单价
-
(
void
)
setPersalesWithCompass
:
(
Compass
*
)
compass
{
//客单价
self
.
centerLabel
.
text
=
compass
.
persales
?[
compass
.
persales
stringValue
]:
@"---"
;
self
.
centerLabel
.
text
=
compass
.
persales
?[
IBTCommon
stringDisposeWithFloat
:[
compass
.
persales
floatValue
]
]:
@"---"
;
//客单价统计时间
NSString
*
weekday
=
@""
;
...
...
@@ -170,7 +170,7 @@
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastWeekLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
salesYoStr
=
compass
.
persalesChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
persalesChainRate
]:
@"---"
;
NSString
*
salesYoStr
=
compass
.
persalesChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
persalesChainRate
floatValue
]]
]:
@"---"
;
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
//客单价同比变化率
...
...
@@ -181,13 +181,13 @@
[
self
.
lastYearLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastYearLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
passengerYoYRateStr
=
compass
.
persalesYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
persalesYoYRate
]:
@"---"
;
NSString
*
passengerYoYRateStr
=
compass
.
persalesYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
persalesYoYRate
floatValue
]]
]:
@"---"
;
[
self
.
lastYearLabel
setTitle
:
passengerYoYRateStr
forState
:
UIControlStateNormal
];
}
//毛利率
-
(
void
)
setGrossprofitWithCompass
:
(
Compass
*
)
compass
{
//毛利率
self
.
centerLabel
.
text
=
compass
.
grossprofit
?[
compass
.
grossprofit
stringValue
]:
@"---"
;
self
.
centerLabel
.
text
=
compass
.
grossprofit
?[
IBTCommon
stringDisposeWithFloat
:[
compass
.
grossprofit
floatValue
]
]:
@"---"
;
//毛利率统计时间
NSString
*
weekday
=
@""
;
...
...
@@ -203,7 +203,7 @@
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastWeekLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
salesYoStr
=
compass
.
grossprofitChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
grossprofitChainRate
]:
@"---"
;
NSString
*
salesYoStr
=
compass
.
grossprofitChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
grossprofitChainRate
floatValue
]]
]:
@"---"
;
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
//毛利率同比变化率
...
...
@@ -214,7 +214,7 @@
[
self
.
lastYearLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateDisabled
];
[
self
.
lastYearLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateDisabled
];
}
NSString
*
passengerYoYRateStr
=
compass
.
grossprofitYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
grossprofitYoYRate
]:
@"---"
;
NSString
*
passengerYoYRateStr
=
compass
.
grossprofitYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
grossprofitYoYRate
floatValue
]]
]:
@"---"
;
[
self
.
lastYearLabel
setTitle
:
passengerYoYRateStr
forState
:
UIControlStateNormal
];
}
...
...
XFFruit/ViewControllers/Report/Views/RSaleView.m
View file @
21657956
...
...
@@ -171,7 +171,7 @@
self
.
dateLabel
.
text
=
compass
.
dataScope
?[
NSString
stringWithFormat
:
@"%@%@累计销售额"
,
compass
.
dataScope
,
weekday
]:
@"无"
;
//销售额
self
.
centerLabel
.
text
=
compass
.
sales
?[
IBTCommon
countNumAndChangeformat
:[
compass
.
sales
stringValue
]]:
@"---"
;
self
.
centerLabel
.
text
=
compass
.
sales
?[
IBTCommon
countNumAndChangeformat
:[
IBTCommon
stringDisposeWithFloat
:[
compass
.
sales
floatValue
]
]]:
@"---"
;
//销售环比变化率
if
([
compass
.
salesChainSign
isEqualToString
:
ReportChainSignPlus
])
{
...
...
@@ -181,7 +181,7 @@
[
self
.
lastWeekLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateNormal
];
[
self
.
lastWeekLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateNormal
];
}
NSString
*
salesChainRateStr
=
compass
.
salesChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
salesChainRate
]:
@"---"
;
NSString
*
salesChainRateStr
=
compass
.
salesChainRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
salesChainRate
floatValue
]]
]:
@"---"
;
[
self
.
lastWeekLabel
setTitle
:
salesChainRateStr
forState
:
UIControlStateNormal
];
//销售同比变化率
if
([
compass
.
salesYoYSign
isEqualToString
:
ReportChainSignPlus
])
{
...
...
@@ -191,13 +191,13 @@
[
self
.
lastYearLabel
setImage
:[
UIImage
imageNamed
:
ReportChainMinusImage
]
forState
:
UIControlStateNormal
];
[
self
.
lastYearLabel
setTitleColor
:
GXF_SAVE_COLOR
forState
:
UIControlStateNormal
];
}
NSString
*
salesYoStr
=
compass
.
salesYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
salesYoYRate
]:
@"---"
;
NSString
*
salesYoStr
=
compass
.
salesYoYRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
salesYoYRate
floatValue
]]
]:
@"---"
;
[
self
.
lastYearLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
//销售目标达成率
NSString
*
salesTargetStr
=
compass
.
salesTargetRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
compass
.
salesTargetRate
]:
@"---"
;
NSString
*
salesTargetStr
=
compass
.
salesTargetRate
?[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
salesTargetRate
floatValue
]]
]:
@"---"
;
self
.
rateLabel
.
text
=
salesTargetStr
;
//单店日均销售
NSString
*
dailysalesPerStr
=
compass
.
dailysalesPerStore
?[
NSString
stringWithFormat
:
@"%@"
,
compass
.
dailysalesPerStore
]:
@"---"
;
NSString
*
dailysalesPerStr
=
compass
.
dailysalesPerStore
?[
NSString
stringWithFormat
:
@"%@"
,
[
IBTCommon
stringDisposeWithFloat
:[
compass
.
dailysalesPerStore
floatValue
]]
]:
@"---"
;
self
.
averageLabel
.
text
=
dailysalesPerStr
;
}
...
...
XFFruit/ViewControllers/Report/Views/SaleViewCell.m
View file @
21657956
...
...
@@ -122,12 +122,12 @@
self
.
saleLabel
.
textColor
=
GXF_NAVIGAYION_COLOR
;
}
//销售额
self
.
saleLabel
.
text
=
sale
.
sales
?[
IBTCommon
countNumAndChangeformat
:[
sale
.
sales
stringValue
]]
:
@"0"
;
self
.
saleLabel
.
text
=
sale
.
sales
?[
IBTCommon
countNumAndChangeformat
:[
IBTCommon
stringDisposeWithFloat
:[
sale
.
sales
floatValue
]
]]
:
@"0"
;
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,[
sale
.
salesChainRate
stringValue
]];
NSString
*
salesYoStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,[
IBTCommon
stringDisposeWithFloat
:[
sale
.
salesChainRate
floatValue
]
]];
[
self
.
lastWeekLabel
setTitle
:
salesYoStr
forState
:
UIControlStateNormal
];
//销售目标达成率
NSString
*
salesTargetRateStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
sale
.
salesTargetRate
];
NSString
*
salesTargetRateStr
=
[
NSString
stringWithFormat
:
@"%@%%"
,
[
IBTCommon
stringDisposeWithFloat
:[
sale
.
salesTargetRate
floatValue
]]
];
self
.
rateLabel
.
text
=
salesTargetRateStr
;
[
self
setColorAndFont
:
sale
.
level
];
}
...
...
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