Commit 6de087fe authored by Sandy's avatar Sandy

调整金额显示

parent a8d95938
......@@ -26,7 +26,7 @@ pod 'IQKeyboardManager', '~> 3.2.3'
#pod 'BaiduMapAPI', '~> 2.7.0'
#pod 'iVersion','~>1.11.4'
#pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod 'DZNEmptyDataSet'
pod 'CustomBadge', '~> 3.0.0'
#should be removed later
......
......@@ -28,6 +28,8 @@
1912FCE51CCDF1F6004CF976 /* SalesInputCommitView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1912FCE41CCDF1F6004CF976 /* SalesInputCommitView.xib */; };
1912FCE81CCDF20F004CF976 /* SalesInputCommitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1912FCE71CCDF20F004CF976 /* SalesInputCommitView.m */; };
1912FCF41CCF1493004CF976 /* ChooseProjectTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1912FCF31CCF1493004CF976 /* ChooseProjectTableViewController.m */; };
1936D3971D3CF99900CE35BF /* StatementDetailItems.m in Sources */ = {isa = PBXBuildFile; fileRef = 1936D3941D3CF99900CE35BF /* StatementDetailItems.m */; };
1936D3981D3CF99900CE35BF /* StatementDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1936D3961D3CF99900CE35BF /* StatementDetailModel.m */; };
19605F8B1D37597300C20590 /* StatementListParamModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 19605F7E1D37597300C20590 /* StatementListParamModel.m */; };
19605F8C1D37597300C20590 /* StatementDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19605F811D37597300C20590 /* StatementDetailViewController.m */; };
19605F8D1D37597300C20590 /* StatementViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19605F831D37597300C20590 /* StatementViewController.m */; };
......@@ -56,8 +58,9 @@
19B34CD21D3C832B0060E272 /* GalleryCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CD11D3C832B0060E272 /* GalleryCollectionViewCell.m */; };
19B34CD51D3C83D20060E272 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CD41D3C83D20060E272 /* SingleScrollView.m */; };
19B34CD81D3C8AF80060E272 /* GalleryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CD71D3C8AF80060E272 /* GalleryViewController.m */; };
19B34CDD1D3CA93B0060E272 /* Items.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CDA1D3CA93B0060E272 /* Items.m */; };
19B34CDE1D3CA93B0060E272 /* StatementModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CDC1D3CA93B0060E272 /* StatementModel.m */; };
19B34CE51D3CCE9F0060E272 /* StatementModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CE01D3CCE9F0060E272 /* StatementModel.m */; };
19B34CE61D3CCE9F0060E272 /* StatementPaging.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CE21D3CCE9F0060E272 /* StatementPaging.m */; };
19B34CE71D3CCE9F0060E272 /* StatementRecords.m in Sources */ = {isa = PBXBuildFile; fileRef = 19B34CE41D3CCE9F0060E272 /* StatementRecords.m */; };
19D76A881D265A1B006245D6 /* TZAssetCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 19D76A761D265A1B006245D6 /* TZAssetCell.m */; };
19D76A891D265A1B006245D6 /* TZAssetModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 19D76A781D265A1B006245D6 /* TZAssetModel.m */; };
19D76A8A1D265A1B006245D6 /* TZImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 19D76A7A1D265A1B006245D6 /* TZImageManager.m */; };
......@@ -809,6 +812,10 @@
1912FCE71CCDF20F004CF976 /* SalesInputCommitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SalesInputCommitView.m; sourceTree = "<group>"; };
1912FCF21CCF1493004CF976 /* ChooseProjectTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseProjectTableViewController.h; sourceTree = "<group>"; };
1912FCF31CCF1493004CF976 /* ChooseProjectTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseProjectTableViewController.m; sourceTree = "<group>"; };
1936D3931D3CF99900CE35BF /* StatementDetailItems.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementDetailItems.h; sourceTree = "<group>"; };
1936D3941D3CF99900CE35BF /* StatementDetailItems.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementDetailItems.m; sourceTree = "<group>"; };
1936D3951D3CF99900CE35BF /* StatementDetailModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementDetailModel.h; sourceTree = "<group>"; };
1936D3961D3CF99900CE35BF /* StatementDetailModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementDetailModel.m; sourceTree = "<group>"; };
19605F7D1D37597300C20590 /* StatementListParamModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementListParamModel.h; sourceTree = "<group>"; };
19605F7E1D37597300C20590 /* StatementListParamModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementListParamModel.m; sourceTree = "<group>"; };
19605F801D37597300C20590 /* StatementDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementDetailViewController.h; sourceTree = "<group>"; };
......@@ -863,10 +870,12 @@
19B34CD41D3C83D20060E272 /* SingleScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleScrollView.m; sourceTree = "<group>"; };
19B34CD61D3C8AF80060E272 /* GalleryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryViewController.h; sourceTree = "<group>"; };
19B34CD71D3C8AF80060E272 /* GalleryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryViewController.m; sourceTree = "<group>"; };
19B34CD91D3CA93B0060E272 /* Items.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Items.h; sourceTree = "<group>"; };
19B34CDA1D3CA93B0060E272 /* Items.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Items.m; sourceTree = "<group>"; };
19B34CDB1D3CA93B0060E272 /* StatementModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementModel.h; sourceTree = "<group>"; };
19B34CDC1D3CA93B0060E272 /* StatementModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementModel.m; sourceTree = "<group>"; };
19B34CDF1D3CCE9F0060E272 /* StatementModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementModel.h; sourceTree = "<group>"; };
19B34CE01D3CCE9F0060E272 /* StatementModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementModel.m; sourceTree = "<group>"; };
19B34CE11D3CCE9F0060E272 /* StatementPaging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementPaging.h; sourceTree = "<group>"; };
19B34CE21D3CCE9F0060E272 /* StatementPaging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementPaging.m; sourceTree = "<group>"; };
19B34CE31D3CCE9F0060E272 /* StatementRecords.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatementRecords.h; sourceTree = "<group>"; };
19B34CE41D3CCE9F0060E272 /* StatementRecords.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatementRecords.m; sourceTree = "<group>"; };
19D76A751D265A1B006245D6 /* TZAssetCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TZAssetCell.h; sourceTree = "<group>"; };
19D76A761D265A1B006245D6 /* TZAssetCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TZAssetCell.m; sourceTree = "<group>"; };
19D76A771D265A1B006245D6 /* TZAssetModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TZAssetModel.h; sourceTree = "<group>"; };
......@@ -2219,10 +2228,16 @@
19605F7C1D37597300C20590 /* Models */ = {
isa = PBXGroup;
children = (
19B34CD91D3CA93B0060E272 /* Items.h */,
19B34CDA1D3CA93B0060E272 /* Items.m */,
19B34CDB1D3CA93B0060E272 /* StatementModel.h */,
19B34CDC1D3CA93B0060E272 /* StatementModel.m */,
1936D3931D3CF99900CE35BF /* StatementDetailItems.h */,
1936D3941D3CF99900CE35BF /* StatementDetailItems.m */,
1936D3951D3CF99900CE35BF /* StatementDetailModel.h */,
1936D3961D3CF99900CE35BF /* StatementDetailModel.m */,
19B34CDF1D3CCE9F0060E272 /* StatementModel.h */,
19B34CE01D3CCE9F0060E272 /* StatementModel.m */,
19B34CE11D3CCE9F0060E272 /* StatementPaging.h */,
19B34CE21D3CCE9F0060E272 /* StatementPaging.m */,
19B34CE31D3CCE9F0060E272 /* StatementRecords.h */,
19B34CE41D3CCE9F0060E272 /* StatementRecords.m */,
19605F7D1D37597300C20590 /* StatementListParamModel.h */,
19605F7E1D37597300C20590 /* StatementListParamModel.m */,
);
......@@ -4947,6 +4962,7 @@
19994DAC1D34D99F0089A129 /* SaleViewCell.m in Sources */,
C1A026241C12C9B400737937 /* VankeSettlementSubjectListAPI.m in Sources */,
C1D598941BB44B2000D297FE /* Bee_UICapability.m in Sources */,
19B34CE71D3CCE9F0060E272 /* StatementRecords.m in Sources */,
C1D599721BB44B2100D297FE /* ASIDataCompressor.m in Sources */,
C1D599111BB44B2000D297FE /* Bee_UITemplateParserAndroid.m in Sources */,
C12804E01BC2D0BD001ECBAA /* VankeUserModel.m in Sources */,
......@@ -5112,7 +5128,6 @@
C1D599911BB44B2100D297FE /* zip.c in Sources */,
C1D599551BB44B2100D297FE /* Bee_HTTPClient.m in Sources */,
C1D5995A1BB44B2100D297FE /* NSObject+BeeHTTPRequest.m in Sources */,
19B34CDE1D3CA93B0060E272 /* StatementModel.m in Sources */,
C1D598A71BB44B2000D297FE /* Bee_UINavigationBar.m in Sources */,
C10F161E1BF77CA00065F18C /* ICRModifyPwdViewController.m in Sources */,
19B34CBE1D3A124E0060E272 /* CalculateHelper.m in Sources */,
......@@ -5156,6 +5171,7 @@
C10F18311BF7ACA80065F18C /* ICRSyncCellContentView.m in Sources */,
C19ADE381BC80DD400206213 /* VankeSaleVolumeAPI.m in Sources */,
C10F18301BF7ACA80065F18C /* ICRPlaceholderTextView.m in Sources */,
1936D3971D3CF99900CE35BF /* StatementDetailItems.m in Sources */,
C16BA6271BD39491001ACB26 /* VankePassengerFlowModel.m in Sources */,
C1D599141BB44B2100D297FE /* Bee_UITemplateParserXMLImpl_v1.m in Sources */,
C1D598631BB44B2000D297FE /* BeeUIBoard+Traversing.m in Sources */,
......@@ -5192,7 +5208,6 @@
C1D599501BB44B2100D297FE /* Bee_Language.m in Sources */,
19B34CC61D3B35BB0060E272 /* SaleInputPicCollectionViewController.m in Sources */,
19000E861CC6215000DF8D71 /* ChooseShopViewController.m in Sources */,
19B34CDD1D3CA93B0060E272 /* Items.m in Sources */,
C1D5993E1BB44B2100D297FE /* NSArray+BeeExtension.mm in Sources */,
C10F18331BF7ACA80065F18C /* IBTRefreshTableView.m in Sources */,
C10F18421BF7ACA80065F18C /* IBTTableViewCell.m in Sources */,
......@@ -5250,6 +5265,7 @@
C1D599611BB44B2100D297FE /* Bee_HTTPServer2.m in Sources */,
C19BBC101BBE861700831290 /* VankeFloorDetailBoardPhoto_iPhone.m in Sources */,
C1D5996B1BB44B2100D297FE /* Bee_MIME2.m in Sources */,
19B34CE61D3CCE9F0060E272 /* StatementPaging.m in Sources */,
C18A95291C01E7C100429BF7 /* ICRAnnouncementViewController.m in Sources */,
C10F18121BF7ACA80065F18C /* NSDate+FormatterAdditions.m in Sources */,
C1D598951BB44B2000D297FE /* NSObject+UIPropertyMapping.m in Sources */,
......@@ -5296,6 +5312,7 @@
C1D598AC1BB44B2000D297FE /* Bee_UIScrollView.m in Sources */,
C1D599191BB44B2100D297FE /* UITextField+XMLParser.m in Sources */,
C1D599521BB44B2100D297FE /* Bee_Network.m in Sources */,
1936D3981D3CF99900CE35BF /* StatementDetailModel.m in Sources */,
C1D5991B1BB44B2100D297FE /* UIView+XMLParser.m in Sources */,
C12804DA1BC12A67001ECBAA /* VankeWeatherController.m in Sources */,
C1D599211BB44B2100D297FE /* Bee_FileCache.mm in Sources */,
......@@ -5366,6 +5383,7 @@
C1D598C91BB44B2000D297FE /* Bee_UIFootLoader.m in Sources */,
19D76A8D1D265A1B006245D6 /* TZPhotoPickerController.m in Sources */,
C1D5984E1BB44B2000D297FE /* BeeMessage+BeeXML.mm in Sources */,
19B34CE51D3CCE9F0060E272 /* StatementModel.m in Sources */,
C1D598A91BB44B2000D297FE /* Bee_UIPageViewController.m in Sources */,
C1D599851BB44B2100D297FE /* CXMLDocument_PrivateExtensions.m in Sources */,
C10F18601BF8ED5D0065F18C /* VankeStatementMonthCell_iPhone.m in Sources */,
......
......@@ -38,4 +38,10 @@ typedef NS_ENUM(NSInteger, CalculateType) {
+ (NSDecimalNumber *)calculateNum1:(id)num1 num2:(id)num2 type:(CalculateType)type roundingType:(NSRoundingMode)roundingType cutLenth:(NSInteger)coutLenth;
/** 一百倍 */
+ (NSDecimalNumber *)oneHundredTimes:(id)num;
/** 计算百分比 */
+ (NSString *)getPercent:(id)num1 num:(id)num2;
/** 获取金额 */
+ (NSString *)getMoneyStringFrom:(id)num;
+ (NSString *)getMoneyStringFromString:(NSString *)originString;
@end
......@@ -51,8 +51,13 @@
break;
}
case CalculateTypeDiv: {
if ([decimalNum2 isEqualToNumber:@0]) {
decimalResult = [NSDecimalNumber decimalNumberWithString:@"0"];
}else{
decimalResult = [decimalNum1 decimalNumberByDividingBy:decimalNum2 withBehavior:roundUp];
result = [decimalResult stringValue];
}
break;
}
}
......@@ -61,6 +66,7 @@
return decimalResult;
}
//把传入的类型变成NSDecimalNumber
+ (NSDecimalNumber *)changeType:(id)num1 {
NSDecimalNumber *decimalNum1;
if ([num1 isKindOfClass:[NSDecimalNumber class]]) {
......@@ -78,4 +84,50 @@
+ (NSDecimalNumber *)oneHundredTimes:(id)num {
return [self calculateNum1:num num2:@100 type:CalculateTypeMul roundingType:NSRoundBankers cutLenth:10];
}
+ (NSString *)getPercent:(id)num1 num:(id)num2 {
[self calculateNum1:num1 num2:num1 type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:4];
NSDecimalNumber *result = [self oneHundredTimes:[self calculateNum1:num1 num2:num2 type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:4]];
return [NSString stringWithFormat:@"%@%%",[self getMoneyStringFromString:result.stringValue]];
}
+ (NSString *)getMoneyStringFrom:(id)num Lenth:(NSInteger)cutLenth {
NSDecimalNumberHandler *roundUp = [NSDecimalNumberHandler
decimalNumberHandlerWithRoundingMode:NSRoundBankers
scale:cutLenth ? cutLenth : 2
raiseOnExactness:NO
raiseOnOverflow:NO
raiseOnUnderflow:NO
raiseOnDivideByZero:YES];
NSDecimalNumber *decimal = [self changeType:num];
NSDecimalNumber *result = [decimal decimalNumberByAdding:[NSDecimalNumber decimalNumberWithString:@"0"] withBehavior:roundUp];
return [result stringValue];
}
+ (NSString *)getMoneyStringFrom:(id)num{
NSString *originString = [self getMoneyStringFrom:num Lenth:2];
return [self getMoneyStringFromString:originString];
}
+ (NSString *)getMoneyStringFromString:(NSString *)originString {
NSArray *array = [originString componentsSeparatedByString:@"."];
NSString *top = [array[0] stringByAppendingString:@"."];
NSString *result;
if (array.count == 1) {
result = [NSString stringWithFormat:@"%@00",top];
}else if(array.count == 2){
NSString *bottom = array[1];
if (bottom.length == 2) {
result = originString;
}
for (NSInteger i = bottom.length; i < 2; i++) {
result = [originString stringByAppendingString:@"0"];
}
}
return result;
}
@end
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow_down_purple@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow_down_purple@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "bill_no_image_default.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "checked_checkbox.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "unchecked_checkbox.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.3</string>
<string>1.3.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -32,7 +32,19 @@
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_LEFTSIX_COLOR HexColor(@"666666")
/**
* colors
*/
#define kSysWhite [UIColor whiteColor]
//红 #ED1B23
#define kMainRedColor [UIColor colorWithRed:0.929 green:0.106 blue:0.137 alpha:1.000]
//蓝 #478FF1
#define kMainBlueColor [UIColor colorWithRed:0.278 green:0.561 blue:0.945 alpha:1.000]
//橙 #EA6402
#define kMainOrangeColor [UIColor colorWithRed:0.918 green:0.392 blue:0.008 alpha:1.000]
//紫 #5435AD
#define kMainPurpleColor [UIColor colorWithRed:0.329 green:0.208 blue:0.678 alpha:1.000]
//报表统一颜色
#define ReportColor GXF_NAVIGAYION_COLOR
#define ReportContentColor HexColor(@"f4422e")
......
......@@ -103,5 +103,7 @@
@property (nonatomic, copy) NSString *enterprise;
@property (nonatomic, copy) NSString *lastModify_id;
@property (nonatomic, strong) NSNumber *area;
@end
......@@ -9,6 +9,7 @@
#import "ReportBoardsViewController.h"
#import "ReportBoardTableViewCell.h"
#import "ReportViewController.h"
#import "VankeAppBoard_iPhone.h"
static NSString *const cellId = @"cellId";
@interface ReportBoardsViewController ()<UITableViewDelegate, UITableViewDataSource>
......@@ -47,8 +48,10 @@ ON_DID_APPEAR( signal )
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[VankeAppBoard_iPhone sharedInstance] showMenu];
}
......@@ -61,7 +64,7 @@ ON_DID_APPEAR( signal )
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
ReportViewController *reportVC = [[ReportViewController alloc] init];
reportVC.hidesBottomBarWhenPushed = YES;
switch (indexPath.row) {
case 0:
{
......
......@@ -16,6 +16,7 @@
//#import "SearchReportViewController.h"
#import "QueryOrder.h"
#import "CalculateHelper.h"
#import "VankeAppBoard_iPhone.h"
//#import "ReportDetailViewController.h"
@interface ReportViewController ()<UIScrollViewDelegate,CustomSegViewDelegate,FinishTimeViewDelegate>
{
......@@ -85,14 +86,14 @@ ON_CREATE_VIEWS( signal )
- (void)viewDidLoad {
[super viewDidLoad];
[[VankeAppBoard_iPhone sharedInstance] hideMenu];
//布局
#if 1
self.dataArr = [NSMutableArray array];
self.totalArr = [NSMutableArray array];
self.selectArr = [NSMutableArray array];
[self bulidLayout];
UIBarButtonItem *searchItem = [[UIBarButtonItem alloc]initWithTitle:@"切换日期" style:UIBarButtonItemStyleDone target:self action:@selector(customSegTwoClick:)];
UIBarButtonItem *searchItem = [[UIBarButtonItem alloc]initWithTitle:@"历史" style:UIBarButtonItemStyleDone target:self action:@selector(customSegTwoClick:)];
self.navigationItem.rightBarButtonItem = searchItem;
self.dayType = @"day";
......@@ -153,17 +154,6 @@ ON_CREATE_VIEWS( signal )
[arrAuthordCode addObject:org.code];
}
NSString *authorCodes = [arrAuthordCode componentsJoinedByString:@","];
NSDictionary *dict = @{
@"dataScopeType":self.dayType,
@"dataType":@"biz",
@"orgCodes":authorCodes,
@"dataScope":self.scopeType,
@"queryOrders":orderArr,
@"pageNumber":@0,
@"pageSize":@100
};
NSString *json = [dict JSONString];
NSDictionary *testParams = @{@"dataType" : self.reportType,
@"dataScopeType" : self.dayType,
@"dataScope" : self.scopeType,
......@@ -199,19 +189,14 @@ ON_CREATE_VIEWS( signal )
if (success == 1) {
NSDictionary *compassDict = data[ @"data" ][@"salesData"];
NSArray *arr = compassDict[@"records"];
// if (arr.count > 0) {
// for (NSDictionary *comDict in arr) {
// Compass *com = [[Compass alloc]init];
// [com setValuesForKeysWithDictionary:comDict];
// self.compass = com;
// }
// }
//计算顶部总的数据
Compass *com = nil;
for (NSDictionary *comDict in arr) {
if (!com) {
com = [[Compass alloc] init];
[com setValuesForKeysWithDictionary:comDict];
com.area = [CalculateHelper calculateNum1:com.sales num2:com.groundEffect type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:10];
}else{
Compass *obj = [[Compass alloc]init];
[obj setValuesForKeysWithDictionary:comDict];
......@@ -219,6 +204,8 @@ ON_CREATE_VIEWS( signal )
com.sales = [CalculateHelper calculateNum1:com.sales num2:obj.sales type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:2];
com.salesChain = [CalculateHelper calculateNum1:com.salesChain num2:obj.salesChain type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:2];
com.salesYoY = [CalculateHelper calculateNum1:com.salesYoY num2:obj.salesYoY type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:2];
NSDecimalNumber *area = [CalculateHelper calculateNum1:obj.sales num2:obj.groundEffect type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:10];
com.area = [CalculateHelper calculateNum1:com.area num2:area type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
}
}
......@@ -241,7 +228,7 @@ ON_CREATE_VIEWS( signal )
//获取底部详情数据
- (void)getBottomData:(NSIndexPath *)indexPath{
__weak typeof(self)weakSelf = self;
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSArray *arr = [[VankeCommonModel sharedInstance] getAuthOrgs];
NSMutableArray *arrAuthordCode = [NSMutableArray array];
for (AuthorizedOrg *org in arr) {
......@@ -251,7 +238,7 @@ ON_CREATE_VIEWS( signal )
NSDictionary *testParams = @{@"dataType" : self.reportType,
@"dataScopeType" : self.dayType,
@"dataScope" : self.scopeType,
@"orgCodes" : self.orgScope ? [NSNull null] : @"HSCQ,NTJY",
@"orgCodes" : self.orgScope ? [NSNull null] : authorCodes,
@"upperOrgCode" : self.orgScope ? self.orgScope : [NSNull null],
@"queryOrders" : @[@{@"field" : @"salesInfo.orgCode",
@"direction" : @"asc"}],
......@@ -264,9 +251,11 @@ ON_CREATE_VIEWS( signal )
//赋值
[IBTLoadingView hideHUDWithText:nil];
[strongSelf downLoadData:data indexPath:indexPath];
[hud hide:YES];
} failure:^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
[hud hide:YES];
}];
}
......
......@@ -166,14 +166,16 @@
}
self.dateLabel.text = compass.dataScope?[NSString stringWithFormat:@"%@%@累计销售额",compass.dataScope,weekday]:@"无";
//销售额
self.centerLabel.text = compass.sales?[IBTCommon countNumAndChangeformat:[IBTCommon stringDisposeWithFloat:[compass.sales floatValue]]]:@"---" ;
NSString *strSale = [IBTCommon countNumAndChangeformat:[IBTCommon stringDisposeWithFloat:[compass.sales floatValue]]];
self.centerLabel.text = compass.sales?[CalculateHelper getMoneyStringFromString:strSale] :@"---";
//销售环比变化率 比上周
NSDecimalNumber *saleDifference = [CalculateHelper calculateNum1:compass.sales num2:compass.salesChain type:CalculateTypeSub roundingType:NSRoundBankers cutLenth:4];
NSDecimalNumber *decimalSaleRate = [CalculateHelper calculateNum1:saleDifference num2:compass.salesChain type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:4];
decimalSaleRate = [CalculateHelper oneHundredTimes:decimalSaleRate];
NSString *salesChainRateStr = decimalSaleRate?[NSString stringWithFormat:@"%@%%", [decimalSaleRate stringValue]]:@"---";
NSString *salesChainRateStr = decimalSaleRate?[NSString stringWithFormat:@"%@%%", [CalculateHelper getMoneyStringFromString:[decimalSaleRate stringValue]]]:@"---";
if (![salesChainRateStr hasPrefix:@"-"] && ![salesChainRateStr isEqualToString:@"0"] && ![salesChainRateStr hasPrefix:@"--"]) {
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainPlusImage] forState:UIControlStateNormal];
......@@ -181,6 +183,9 @@
}else if ([salesChainRateStr hasPrefix:@"-"] && ![salesChainRateStr isEqualToString:@"0"] && ![salesChainRateStr hasPrefix:@"--"]){
[self.lastWeekLabel setImage:[UIImage imageNamed:ReportChainMinusImage] forState:UIControlStateNormal];
[self.lastWeekLabel setTitleColor:GXF_SAVE_COLOR forState:UIControlStateNormal];
}else{
[self.lastWeekLabel setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
[self.lastWeekLabel setImage:nil forState:UIControlStateNormal];
}
[self.lastWeekLabel setTitle:salesChainRateStr forState:UIControlStateNormal];
......@@ -197,11 +202,16 @@
}else if ([salesYoStr hasPrefix:@"-"] && ![salesYoStr isEqualToString:@"0"] && ![salesYoStr hasPrefix:@"--"]){
[self.lastYearLabel setImage:[UIImage imageNamed:ReportChainMinusImage] forState:UIControlStateNormal];
[self.lastYearLabel setTitleColor:GXF_SAVE_COLOR forState:UIControlStateNormal];
}else{
[self.lastYearLabel setImage:nil forState:UIControlStateNormal];
[self.lastYearLabel setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
}
[self.lastYearLabel setTitle:salesYoStr forState:UIControlStateNormal];
//销售目标达成率
NSString *salesTargetStr = compass.salesTargetRate?[NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[compass.salesTargetRate floatValue]]]:@"---";
//坪效
NSDecimalNumber *groundEffect = [CalculateHelper calculateNum1:compass.sales num2:compass.area type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:2];
NSString *salesTargetStr = compass.area?[NSString stringWithFormat:@"%@",[groundEffect stringValue]]:@"---";
self.rateLabel.text = salesTargetStr;
// //单店日均销售
// NSString *dailysalesPerStr = compass.dailysalesPerStore?[NSString stringWithFormat:@"%@",[IBTCommon stringDisposeWithFloat:[compass.dailysalesPerStore floatValue]]]:@"---";
......
......@@ -7,7 +7,7 @@
//
#import "SaleViewCell.h"
#import "CalculateHelper.h"
#define Sale_Cell_Height 50
#define Left_Width 120
#define Left_margin 5
......@@ -133,16 +133,16 @@
self.saleLabel.textColor = GXF_NAVIGAYION_COLOR;
}
//销售额
self.saleLabel.text = sale.sales?[IBTCommon countNumAndChangeformat:[IBTCommon stringDisposeWithFloat:[sale.sales floatValue]]] : @"0";
self.saleLabel.text = sale.sales?[CalculateHelper getMoneyStringFrom:sale.sales] : @"0";
NSString *salesYoStr = [NSString stringWithFormat:@"%@%%",[IBTCommon stringDisposeWithFloat:[sale.salesChainRate floatValue]]];
NSString *salesYoStr = [NSString stringWithFormat:@"%@%%",[CalculateHelper getMoneyStringFrom:sale.salesChainRate]];
[self.lastWeekLabel setTitle:salesYoStr forState:UIControlStateNormal];
//坪效
NSString *salesTargetRateStr = [NSString stringWithFormat:@"%@",[IBTCommon stringDisposeWithFloat:[sale.groundEffect floatValue]]];
NSString *salesTargetRateStr = [NSString stringWithFormat:@"%@",[CalculateHelper getMoneyStringFrom:sale.groundEffect]];
self.rateLabel.text = salesTargetRateStr;
//日均销售
self.dailySaleLabel.text = [NSString stringWithFormat:@"%@", [sale.dailysalesPerStore stringValue]];
self.dailySaleLabel.text = [NSString stringWithFormat:@"%@", [CalculateHelper getMoneyStringFrom:sale.dailysalesPerStore]];
[self setColorAndFont:sale.level];
......
......@@ -151,12 +151,11 @@
}else{
row = tap.view.tag;
}
picVC.title = self.arrRecords[row][@"salesDate"];
picVC.attachmentUuid = self.arrRecords[row][@"attachmentUuid"];
[self.navigationController pushViewController:picVC animated:YES];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
for (int i = 0; i < self.titles.count; i++) {
......@@ -260,6 +259,7 @@
if (self.shop == nil) {
}else{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
WS(weakSelf)
NSDateFormatter *f = [[NSDateFormatter alloc] init];
......@@ -342,11 +342,22 @@
}
}
//添加附件那一行
NSMutableArray *arrAttachment = [NSMutableArray array];
for (int i = 0; i < [arrData[0] count]; i++) {
if (i == 0) {
[arrAttachment addObject:@"附件"];
}else{
[arrAttachment addObject:@"点击查看"];
}
}
[arrData addObject:arrAttachment];
[arrBottom addObject:@""];
[weakSelf setUpScrollViewWithDataArr:arrData bottomArr:arrBottom];
[hud hide:YES];
NSLog(@"d");
} failure:^(id data) {
[hud hide:YES];
}];
}
......
......@@ -24,6 +24,7 @@
#import "SaleInputPictureTableViewCell.h"
#import "TZImagePickerController.h"
#import "UIImage+Helper.h"
#import "NSDate+FormatterAdditions.h"
#define kCellCount 20
#define kCellID @"SalesInputTableViewCell.h"
#define kPicCellId @"SaleInputPictureTableViewCell.h"
......@@ -425,8 +426,9 @@ ON_WILL_APPEAR( signal )
}
- (void)httpPostAttachments {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
NSString *string = [NSString stringWithFormat:@"attachment/upload_by_file?entity_type=%@&entity_uuid=%@",@"salesInput",self.shop.uuid];
NSString *string = [NSString stringWithFormat:@"attachment/upload_by_file?entity_type=%@&entity_uuid=%@",@"salesInput",[NSString stringWithFormat:@"%@%@",self.shop.code, self.topView.textfieldDate.text]];
WS(weakSelf);
[self.arrPics removeLastObject];
[httpCtrl POST:string pictures:self.arrPics param:nil complete:^(id responseObject, NSError *error) {
......@@ -443,6 +445,7 @@ ON_WILL_APPEAR( signal )
WS(weakSelf)
[httpCtrl postUrl:utf8String params:params success:^(id data) {
weakSelf.arrPics = nil;
[hud hide:YES];
[weakSelf.selectedAssets removeAllObjects];
[weakSelf.cellDataDic removeAllObjects];
[weakSelf.tableView reloadData];
......
//
// Items.h
// StatementDetailItems.h
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
......@@ -9,14 +9,14 @@
@interface Items : NSObject <NSCoding, NSCopying>
@interface StatementDetailItems : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double amount;
@property (nonatomic, strong) NSString *remark;
@property (nonatomic, assign) double endDate;
@property (nonatomic, assign) id remark;
@property (nonatomic, strong) NSString *endDate;
@property (nonatomic, assign) double unpaid;
@property (nonatomic, strong) NSString *subject;
@property (nonatomic, assign) double beginDate;
@property (nonatomic, strong) NSString *beginDate;
@property (nonatomic, assign) double direction;
@property (nonatomic, assign) double paid;
......
//
// Items.m
// StatementDetailItems.m
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Items.h"
#import "StatementDetailItems.h"
NSString *const kItemsAmount = @"amount";
NSString *const kItemsRemark = @"remark";
NSString *const kItemsEndDate = @"endDate";
NSString *const kItemsUnpaid = @"unpaid";
NSString *const kItemsSubject = @"subject";
NSString *const kItemsBeginDate = @"beginDate";
NSString *const kItemsDirection = @"direction";
NSString *const kItemsPaid = @"paid";
NSString *const kStatementDetailItemsAmount = @"amount";
NSString *const kStatementDetailItemsRemark = @"remark";
NSString *const kStatementDetailItemsEndDate = @"endDate";
NSString *const kStatementDetailItemsUnpaid = @"unpaid";
NSString *const kStatementDetailItemsSubject = @"subject";
NSString *const kStatementDetailItemsBeginDate = @"beginDate";
NSString *const kStatementDetailItemsDirection = @"direction";
NSString *const kStatementDetailItemsPaid = @"paid";
@interface Items ()
@interface StatementDetailItems ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Items
@implementation StatementDetailItems
@synthesize amount = _amount;
@synthesize remark = _remark;
......@@ -48,14 +48,14 @@ NSString *const kItemsPaid = @"paid";
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.amount = [[self objectOrNilForKey:kItemsAmount fromDictionary:dict] doubleValue];
self.remark = [self objectOrNilForKey:kItemsRemark fromDictionary:dict];
self.endDate = [[self objectOrNilForKey:kItemsEndDate fromDictionary:dict] doubleValue];
self.unpaid = [[self objectOrNilForKey:kItemsUnpaid fromDictionary:dict] doubleValue];
self.subject = [self objectOrNilForKey:kItemsSubject fromDictionary:dict];
self.beginDate = [[self objectOrNilForKey:kItemsBeginDate fromDictionary:dict] doubleValue];
self.direction = [[self objectOrNilForKey:kItemsDirection fromDictionary:dict] doubleValue];
self.paid = [[self objectOrNilForKey:kItemsPaid fromDictionary:dict] doubleValue];
self.amount = [[self objectOrNilForKey:kStatementDetailItemsAmount fromDictionary:dict] doubleValue];
self.remark = [self objectOrNilForKey:kStatementDetailItemsRemark fromDictionary:dict];
self.endDate = [self objectOrNilForKey:kStatementDetailItemsEndDate fromDictionary:dict];
self.unpaid = [[self objectOrNilForKey:kStatementDetailItemsUnpaid fromDictionary:dict] doubleValue];
self.subject = [self objectOrNilForKey:kStatementDetailItemsSubject fromDictionary:dict];
self.beginDate = [self objectOrNilForKey:kStatementDetailItemsBeginDate fromDictionary:dict];
self.direction = [[self objectOrNilForKey:kStatementDetailItemsDirection fromDictionary:dict] doubleValue];
self.paid = [[self objectOrNilForKey:kStatementDetailItemsPaid fromDictionary:dict] doubleValue];
}
......@@ -66,14 +66,14 @@ NSString *const kItemsPaid = @"paid";
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kItemsAmount];
[mutableDict setValue:self.remark forKey:kItemsRemark];
[mutableDict setValue:[NSNumber numberWithDouble:self.endDate] forKey:kItemsEndDate];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaid] forKey:kItemsUnpaid];
[mutableDict setValue:self.subject forKey:kItemsSubject];
[mutableDict setValue:[NSNumber numberWithDouble:self.beginDate] forKey:kItemsBeginDate];
[mutableDict setValue:[NSNumber numberWithDouble:self.direction] forKey:kItemsDirection];
[mutableDict setValue:[NSNumber numberWithDouble:self.paid] forKey:kItemsPaid];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kStatementDetailItemsAmount];
[mutableDict setValue:self.remark forKey:kStatementDetailItemsRemark];
[mutableDict setValue:self.endDate forKey:kStatementDetailItemsEndDate];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaid] forKey:kStatementDetailItemsUnpaid];
[mutableDict setValue:self.subject forKey:kStatementDetailItemsSubject];
[mutableDict setValue:self.beginDate forKey:kStatementDetailItemsBeginDate];
[mutableDict setValue:[NSNumber numberWithDouble:self.direction] forKey:kStatementDetailItemsDirection];
[mutableDict setValue:[NSNumber numberWithDouble:self.paid] forKey:kStatementDetailItemsPaid];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -97,42 +97,42 @@ NSString *const kItemsPaid = @"paid";
{
self = [super init];
self.amount = [aDecoder decodeDoubleForKey:kItemsAmount];
self.remark = [aDecoder decodeObjectForKey:kItemsRemark];
self.endDate = [aDecoder decodeDoubleForKey:kItemsEndDate];
self.unpaid = [aDecoder decodeDoubleForKey:kItemsUnpaid];
self.subject = [aDecoder decodeObjectForKey:kItemsSubject];
self.beginDate = [aDecoder decodeDoubleForKey:kItemsBeginDate];
self.direction = [aDecoder decodeDoubleForKey:kItemsDirection];
self.paid = [aDecoder decodeDoubleForKey:kItemsPaid];
self.amount = [aDecoder decodeDoubleForKey:kStatementDetailItemsAmount];
self.remark = [aDecoder decodeObjectForKey:kStatementDetailItemsRemark];
self.endDate = [aDecoder decodeObjectForKey:kStatementDetailItemsEndDate];
self.unpaid = [aDecoder decodeDoubleForKey:kStatementDetailItemsUnpaid];
self.subject = [aDecoder decodeObjectForKey:kStatementDetailItemsSubject];
self.beginDate = [aDecoder decodeObjectForKey:kStatementDetailItemsBeginDate];
self.direction = [aDecoder decodeDoubleForKey:kStatementDetailItemsDirection];
self.paid = [aDecoder decodeDoubleForKey:kStatementDetailItemsPaid];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_amount forKey:kItemsAmount];
[aCoder encodeObject:_remark forKey:kItemsRemark];
[aCoder encodeDouble:_endDate forKey:kItemsEndDate];
[aCoder encodeDouble:_unpaid forKey:kItemsUnpaid];
[aCoder encodeObject:_subject forKey:kItemsSubject];
[aCoder encodeDouble:_beginDate forKey:kItemsBeginDate];
[aCoder encodeDouble:_direction forKey:kItemsDirection];
[aCoder encodeDouble:_paid forKey:kItemsPaid];
[aCoder encodeDouble:_amount forKey:kStatementDetailItemsAmount];
[aCoder encodeObject:_remark forKey:kStatementDetailItemsRemark];
[aCoder encodeObject:_endDate forKey:kStatementDetailItemsEndDate];
[aCoder encodeDouble:_unpaid forKey:kStatementDetailItemsUnpaid];
[aCoder encodeObject:_subject forKey:kStatementDetailItemsSubject];
[aCoder encodeObject:_beginDate forKey:kStatementDetailItemsBeginDate];
[aCoder encodeDouble:_direction forKey:kStatementDetailItemsDirection];
[aCoder encodeDouble:_paid forKey:kStatementDetailItemsPaid];
}
- (id)copyWithZone:(NSZone *)zone
{
Items *copy = [[Items alloc] init];
StatementDetailItems *copy = [[StatementDetailItems alloc] init];
if (copy) {
copy.amount = self.amount;
copy.remark = [self.remark copyWithZone:zone];
copy.endDate = self.endDate;
copy.endDate = [self.endDate copyWithZone:zone];
copy.unpaid = self.unpaid;
copy.subject = [self.subject copyWithZone:zone];
copy.beginDate = self.beginDate;
copy.beginDate = [self.beginDate copyWithZone:zone];
copy.direction = self.direction;
copy.paid = self.paid;
}
......
//
// StatementDetailModel.h
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface StatementDetailModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double amount;
@property (nonatomic, strong) NSString *settle;
@property (nonatomic, assign) double unpaid;
@property (nonatomic, assign) id picture;
@property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *shopName;
@property (nonatomic, strong) NSString *shopCode;
@property (nonatomic, assign) double paid;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSArray *items;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// StatementDetailModel.m
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "StatementDetailModel.h"
#import "StatementDetailItems.h"
NSString *const kStatementDetailModelAmount = @"amount";
NSString *const kStatementDetailModelSettle = @"settle";
NSString *const kStatementDetailModelUnpaid = @"unpaid";
NSString *const kStatementDetailModelPicture = @"picture";
NSString *const kStatementDetailModelContract = @"contract";
NSString *const kStatementDetailModelShopName = @"shopName";
NSString *const kStatementDetailModelShopCode = @"shopCode";
NSString *const kStatementDetailModelPaid = @"paid";
NSString *const kStatementDetailModelState = @"state";
NSString *const kStatementDetailModelItems = @"items";
@interface StatementDetailModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation StatementDetailModel
@synthesize amount = _amount;
@synthesize settle = _settle;
@synthesize unpaid = _unpaid;
@synthesize picture = _picture;
@synthesize contract = _contract;
@synthesize shopName = _shopName;
@synthesize shopCode = _shopCode;
@synthesize paid = _paid;
@synthesize state = _state;
@synthesize items = _items;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.amount = [[self objectOrNilForKey:kStatementDetailModelAmount fromDictionary:dict] doubleValue];
self.settle = [self objectOrNilForKey:kStatementDetailModelSettle fromDictionary:dict];
self.unpaid = [[self objectOrNilForKey:kStatementDetailModelUnpaid fromDictionary:dict] doubleValue];
self.picture = [self objectOrNilForKey:kStatementDetailModelPicture fromDictionary:dict];
self.contract = [self objectOrNilForKey:kStatementDetailModelContract fromDictionary:dict];
self.shopName = [self objectOrNilForKey:kStatementDetailModelShopName fromDictionary:dict];
self.shopCode = [self objectOrNilForKey:kStatementDetailModelShopCode fromDictionary:dict];
self.paid = [[self objectOrNilForKey:kStatementDetailModelPaid fromDictionary:dict] doubleValue];
self.state = [self objectOrNilForKey:kStatementDetailModelState fromDictionary:dict];
NSObject *receivedStatementDetailItems = [dict objectForKey:kStatementDetailModelItems];
NSMutableArray *parsedStatementDetailItems = [NSMutableArray array];
if ([receivedStatementDetailItems isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedStatementDetailItems) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedStatementDetailItems addObject:[StatementDetailItems modelObjectWithDictionary:item]];
}
}
} else if ([receivedStatementDetailItems isKindOfClass:[NSDictionary class]]) {
[parsedStatementDetailItems addObject:[StatementDetailItems modelObjectWithDictionary:(NSDictionary *)receivedStatementDetailItems]];
}
self.items = [NSArray arrayWithArray:parsedStatementDetailItems];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kStatementDetailModelAmount];
[mutableDict setValue:self.settle forKey:kStatementDetailModelSettle];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaid] forKey:kStatementDetailModelUnpaid];
[mutableDict setValue:self.picture forKey:kStatementDetailModelPicture];
[mutableDict setValue:self.contract forKey:kStatementDetailModelContract];
[mutableDict setValue:self.shopName forKey:kStatementDetailModelShopName];
[mutableDict setValue:self.shopCode forKey:kStatementDetailModelShopCode];
[mutableDict setValue:[NSNumber numberWithDouble:self.paid] forKey:kStatementDetailModelPaid];
[mutableDict setValue:self.state forKey:kStatementDetailModelState];
NSMutableArray *tempArrayForItems = [NSMutableArray array];
for (NSObject *subArrayObject in self.items) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForItems addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForItems addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForItems] forKey:kStatementDetailModelItems];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.amount = [aDecoder decodeDoubleForKey:kStatementDetailModelAmount];
self.settle = [aDecoder decodeObjectForKey:kStatementDetailModelSettle];
self.unpaid = [aDecoder decodeDoubleForKey:kStatementDetailModelUnpaid];
self.picture = [aDecoder decodeObjectForKey:kStatementDetailModelPicture];
self.contract = [aDecoder decodeObjectForKey:kStatementDetailModelContract];
self.shopName = [aDecoder decodeObjectForKey:kStatementDetailModelShopName];
self.shopCode = [aDecoder decodeObjectForKey:kStatementDetailModelShopCode];
self.paid = [aDecoder decodeDoubleForKey:kStatementDetailModelPaid];
self.state = [aDecoder decodeObjectForKey:kStatementDetailModelState];
self.items = [aDecoder decodeObjectForKey:kStatementDetailModelItems];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_amount forKey:kStatementDetailModelAmount];
[aCoder encodeObject:_settle forKey:kStatementDetailModelSettle];
[aCoder encodeDouble:_unpaid forKey:kStatementDetailModelUnpaid];
[aCoder encodeObject:_picture forKey:kStatementDetailModelPicture];
[aCoder encodeObject:_contract forKey:kStatementDetailModelContract];
[aCoder encodeObject:_shopName forKey:kStatementDetailModelShopName];
[aCoder encodeObject:_shopCode forKey:kStatementDetailModelShopCode];
[aCoder encodeDouble:_paid forKey:kStatementDetailModelPaid];
[aCoder encodeObject:_state forKey:kStatementDetailModelState];
[aCoder encodeObject:_items forKey:kStatementDetailModelItems];
}
- (id)copyWithZone:(NSZone *)zone
{
StatementDetailModel *copy = [[StatementDetailModel alloc] init];
if (copy) {
copy.amount = self.amount;
copy.settle = [self.settle copyWithZone:zone];
copy.unpaid = self.unpaid;
copy.picture = [self.picture copyWithZone:zone];
copy.contract = [self.contract copyWithZone:zone];
copy.shopName = [self.shopName copyWithZone:zone];
copy.shopCode = [self.shopCode copyWithZone:zone];
copy.paid = self.paid;
copy.state = [self.state copyWithZone:zone];
copy.items = [self.items copyWithZone:zone];
}
return copy;
}
@end
......@@ -6,21 +6,17 @@
//
#import <Foundation/Foundation.h>
#import "StatementRecords.h"
#import "StatementPaging.h"
@class StatementPaging;
@interface StatementModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray *records;
@property (nonatomic, assign) double amount;
@property (nonatomic, strong) NSString *settle;
@property (nonatomic, assign) double unpaid;
@property (nonatomic, strong) NSString *picture;
@property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *shopName;
@property (nonatomic, strong) NSString *shopCode;
@property (nonatomic, assign) double paid;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSArray *items;
@property (nonatomic, assign) double unpaidTotal;
@property (nonatomic, assign) double paidTotal;
@property (nonatomic, strong) StatementPaging *paging;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
......@@ -6,19 +6,15 @@
//
#import "StatementModel.h"
#import "Items.h"
#import "StatementRecords.h"
#import "StatementPaging.h"
NSString *const kStatementModelRecords = @"records";
NSString *const kStatementModelAmount = @"amount";
NSString *const kStatementModelSettle = @"settle";
NSString *const kStatementModelUnpaid = @"unpaid";
NSString *const kStatementModelPicture = @"picture";
NSString *const kStatementModelContract = @"contract";
NSString *const kStatementModelShopName = @"shopName";
NSString *const kStatementModelShopCode = @"shopCode";
NSString *const kStatementModelPaid = @"paid";
NSString *const kStatementModelState = @"state";
NSString *const kStatementModelItems = @"items";
NSString *const kStatementModelUnpaidTotal = @"unpaidTotal";
NSString *const kStatementModelPaidTotal = @"paidTotal";
NSString *const kStatementModelPaging = @"paging";
@interface StatementModel ()
......@@ -29,16 +25,11 @@ NSString *const kStatementModelItems = @"items";
@implementation StatementModel
@synthesize records = _records;
@synthesize amount = _amount;
@synthesize settle = _settle;
@synthesize unpaid = _unpaid;
@synthesize picture = _picture;
@synthesize contract = _contract;
@synthesize shopName = _shopName;
@synthesize shopCode = _shopCode;
@synthesize paid = _paid;
@synthesize state = _state;
@synthesize items = _items;
@synthesize unpaidTotal = _unpaidTotal;
@synthesize paidTotal = _paidTotal;
@synthesize paging = _paging;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
......@@ -53,28 +44,23 @@ NSString *const kStatementModelItems = @"items";
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.amount = [[self objectOrNilForKey:kStatementModelAmount fromDictionary:dict] doubleValue];
self.settle = [self objectOrNilForKey:kStatementModelSettle fromDictionary:dict];
self.unpaid = [[self objectOrNilForKey:kStatementModelUnpaid fromDictionary:dict] doubleValue];
self.picture = [self objectOrNilForKey:kStatementModelPicture fromDictionary:dict];
self.contract = [self objectOrNilForKey:kStatementModelContract fromDictionary:dict];
self.shopName = [self objectOrNilForKey:kStatementModelShopName fromDictionary:dict];
self.shopCode = [self objectOrNilForKey:kStatementModelShopCode fromDictionary:dict];
self.paid = [[self objectOrNilForKey:kStatementModelPaid fromDictionary:dict] doubleValue];
self.state = [self objectOrNilForKey:kStatementModelState fromDictionary:dict];
NSObject *receivedItems = [dict objectForKey:kStatementModelItems];
NSMutableArray *parsedItems = [NSMutableArray array];
if ([receivedItems isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedItems) {
NSObject *receivedStatementRecords = [dict objectForKey:kStatementModelRecords];
NSMutableArray *parsedStatementRecords = [NSMutableArray array];
if ([receivedStatementRecords isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedStatementRecords) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedItems addObject:[Items modelObjectWithDictionary:item]];
[parsedStatementRecords addObject:[StatementRecords modelObjectWithDictionary:item]];
}
}
} else if ([receivedItems isKindOfClass:[NSDictionary class]]) {
[parsedItems addObject:[Items modelObjectWithDictionary:(NSDictionary *)receivedItems]];
} else if ([receivedStatementRecords isKindOfClass:[NSDictionary class]]) {
[parsedStatementRecords addObject:[StatementRecords modelObjectWithDictionary:(NSDictionary *)receivedStatementRecords]];
}
self.items = [NSArray arrayWithArray:parsedItems];
self.records = [NSArray arrayWithArray:parsedStatementRecords];
self.amount = [[self objectOrNilForKey:kStatementModelAmount fromDictionary:dict] doubleValue];
self.unpaidTotal = [[self objectOrNilForKey:kStatementModelUnpaidTotal fromDictionary:dict] doubleValue];
self.paidTotal = [[self objectOrNilForKey:kStatementModelPaidTotal fromDictionary:dict] doubleValue];
self.paging = [StatementPaging modelObjectWithDictionary:[dict objectForKey:kStatementModelPaging]];
}
......@@ -85,26 +71,21 @@ NSString *const kStatementModelItems = @"items";
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kStatementModelAmount];
[mutableDict setValue:self.settle forKey:kStatementModelSettle];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaid] forKey:kStatementModelUnpaid];
[mutableDict setValue:self.picture forKey:kStatementModelPicture];
[mutableDict setValue:self.contract forKey:kStatementModelContract];
[mutableDict setValue:self.shopName forKey:kStatementModelShopName];
[mutableDict setValue:self.shopCode forKey:kStatementModelShopCode];
[mutableDict setValue:[NSNumber numberWithDouble:self.paid] forKey:kStatementModelPaid];
[mutableDict setValue:self.state forKey:kStatementModelState];
NSMutableArray *tempArrayForItems = [NSMutableArray array];
for (NSObject *subArrayObject in self.items) {
NSMutableArray *tempArrayForRecords = [NSMutableArray array];
for (NSObject *subArrayObject in self.records) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForItems addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
[tempArrayForRecords addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForItems addObject:subArrayObject];
[tempArrayForRecords addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForItems] forKey:kStatementModelItems];
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForRecords] forKey:kStatementModelRecords];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kStatementModelAmount];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaidTotal] forKey:kStatementModelUnpaidTotal];
[mutableDict setValue:[NSNumber numberWithDouble:self.paidTotal] forKey:kStatementModelPaidTotal];
[mutableDict setValue:[self.paging dictionaryRepresentation] forKey:kStatementModelPaging];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -128,32 +109,22 @@ NSString *const kStatementModelItems = @"items";
{
self = [super init];
self.records = [aDecoder decodeObjectForKey:kStatementModelRecords];
self.amount = [aDecoder decodeDoubleForKey:kStatementModelAmount];
self.settle = [aDecoder decodeObjectForKey:kStatementModelSettle];
self.unpaid = [aDecoder decodeDoubleForKey:kStatementModelUnpaid];
self.picture = [aDecoder decodeObjectForKey:kStatementModelPicture];
self.contract = [aDecoder decodeObjectForKey:kStatementModelContract];
self.shopName = [aDecoder decodeObjectForKey:kStatementModelShopName];
self.shopCode = [aDecoder decodeObjectForKey:kStatementModelShopCode];
self.paid = [aDecoder decodeDoubleForKey:kStatementModelPaid];
self.state = [aDecoder decodeObjectForKey:kStatementModelState];
self.items = [aDecoder decodeObjectForKey:kStatementModelItems];
self.unpaidTotal = [aDecoder decodeDoubleForKey:kStatementModelUnpaidTotal];
self.paidTotal = [aDecoder decodeDoubleForKey:kStatementModelPaidTotal];
self.paging = [aDecoder decodeObjectForKey:kStatementModelPaging];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_records forKey:kStatementModelRecords];
[aCoder encodeDouble:_amount forKey:kStatementModelAmount];
[aCoder encodeObject:_settle forKey:kStatementModelSettle];
[aCoder encodeDouble:_unpaid forKey:kStatementModelUnpaid];
[aCoder encodeObject:_picture forKey:kStatementModelPicture];
[aCoder encodeObject:_contract forKey:kStatementModelContract];
[aCoder encodeObject:_shopName forKey:kStatementModelShopName];
[aCoder encodeObject:_shopCode forKey:kStatementModelShopCode];
[aCoder encodeDouble:_paid forKey:kStatementModelPaid];
[aCoder encodeObject:_state forKey:kStatementModelState];
[aCoder encodeObject:_items forKey:kStatementModelItems];
[aCoder encodeDouble:_unpaidTotal forKey:kStatementModelUnpaidTotal];
[aCoder encodeDouble:_paidTotal forKey:kStatementModelPaidTotal];
[aCoder encodeObject:_paging forKey:kStatementModelPaging];
}
- (id)copyWithZone:(NSZone *)zone
......@@ -162,16 +133,11 @@ NSString *const kStatementModelItems = @"items";
if (copy) {
copy.records = [self.records copyWithZone:zone];
copy.amount = self.amount;
copy.settle = [self.settle copyWithZone:zone];
copy.unpaid = self.unpaid;
copy.picture = [self.picture copyWithZone:zone];
copy.contract = [self.contract copyWithZone:zone];
copy.shopName = [self.shopName copyWithZone:zone];
copy.shopCode = [self.shopCode copyWithZone:zone];
copy.paid = self.paid;
copy.state = [self.state copyWithZone:zone];
copy.items = [self.items copyWithZone:zone];
copy.unpaidTotal = self.unpaidTotal;
copy.paidTotal = self.paidTotal;
copy.paging = [self.paging copyWithZone:zone];
}
return copy;
......
//
// StatementPaging.h
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface StatementPaging : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double pageCount;
@property (nonatomic, assign) double recordCount;
@property (nonatomic, assign) double pageSize;
@property (nonatomic, assign) double page;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// StatementPaging.m
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "StatementPaging.h"
NSString *const kStatementPagingPageCount = @"pageCount";
NSString *const kStatementPagingRecordCount = @"recordCount";
NSString *const kStatementPagingPageSize = @"pageSize";
NSString *const kStatementPagingPage = @"page";
@interface StatementPaging ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation StatementPaging
@synthesize pageCount = _pageCount;
@synthesize recordCount = _recordCount;
@synthesize pageSize = _pageSize;
@synthesize page = _page;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.pageCount = [[self objectOrNilForKey:kStatementPagingPageCount fromDictionary:dict] doubleValue];
self.recordCount = [[self objectOrNilForKey:kStatementPagingRecordCount fromDictionary:dict] doubleValue];
self.pageSize = [[self objectOrNilForKey:kStatementPagingPageSize fromDictionary:dict] doubleValue];
self.page = [[self objectOrNilForKey:kStatementPagingPage fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.pageCount] forKey:kStatementPagingPageCount];
[mutableDict setValue:[NSNumber numberWithDouble:self.recordCount] forKey:kStatementPagingRecordCount];
[mutableDict setValue:[NSNumber numberWithDouble:self.pageSize] forKey:kStatementPagingPageSize];
[mutableDict setValue:[NSNumber numberWithDouble:self.page] forKey:kStatementPagingPage];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.pageCount = [aDecoder decodeDoubleForKey:kStatementPagingPageCount];
self.recordCount = [aDecoder decodeDoubleForKey:kStatementPagingRecordCount];
self.pageSize = [aDecoder decodeDoubleForKey:kStatementPagingPageSize];
self.page = [aDecoder decodeDoubleForKey:kStatementPagingPage];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_pageCount forKey:kStatementPagingPageCount];
[aCoder encodeDouble:_recordCount forKey:kStatementPagingRecordCount];
[aCoder encodeDouble:_pageSize forKey:kStatementPagingPageSize];
[aCoder encodeDouble:_page forKey:kStatementPagingPage];
}
- (id)copyWithZone:(NSZone *)zone
{
StatementPaging *copy = [[StatementPaging alloc] init];
if (copy) {
copy.pageCount = self.pageCount;
copy.recordCount = self.recordCount;
copy.pageSize = self.pageSize;
copy.page = self.page;
}
return copy;
}
@end
//
// StatementRecords.h
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface StatementRecords : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double amount;
@property (nonatomic, strong) NSString *settle;
@property (nonatomic, assign) double unpaid;
@property (nonatomic, assign) id picture;
@property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *shopName;
@property (nonatomic, strong) NSString *shopCode;
@property (nonatomic, assign) double paid;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSArray *items;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// StatementRecords.m
//
// Created by 杰 张 on 16/7/18
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "StatementRecords.h"
NSString *const kStatementRecordsAmount = @"amount";
NSString *const kStatementRecordsSettle = @"settle";
NSString *const kStatementRecordsUnpaid = @"unpaid";
NSString *const kStatementRecordsPicture = @"picture";
NSString *const kStatementRecordsContract = @"contract";
NSString *const kStatementRecordsShopName = @"shopName";
NSString *const kStatementRecordsShopCode = @"shopCode";
NSString *const kStatementRecordsPaid = @"paid";
NSString *const kStatementRecordsState = @"state";
NSString *const kStatementRecordsItems = @"items";
@interface StatementRecords ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation StatementRecords
@synthesize amount = _amount;
@synthesize settle = _settle;
@synthesize unpaid = _unpaid;
@synthesize picture = _picture;
@synthesize contract = _contract;
@synthesize shopName = _shopName;
@synthesize shopCode = _shopCode;
@synthesize paid = _paid;
@synthesize state = _state;
@synthesize items = _items;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.amount = [[self objectOrNilForKey:kStatementRecordsAmount fromDictionary:dict] doubleValue];
self.settle = [self objectOrNilForKey:kStatementRecordsSettle fromDictionary:dict];
self.unpaid = [[self objectOrNilForKey:kStatementRecordsUnpaid fromDictionary:dict] doubleValue];
self.picture = [self objectOrNilForKey:kStatementRecordsPicture fromDictionary:dict];
self.contract = [self objectOrNilForKey:kStatementRecordsContract fromDictionary:dict];
self.shopName = [self objectOrNilForKey:kStatementRecordsShopName fromDictionary:dict];
self.shopCode = [self objectOrNilForKey:kStatementRecordsShopCode fromDictionary:dict];
self.paid = [[self objectOrNilForKey:kStatementRecordsPaid fromDictionary:dict] doubleValue];
self.state = [self objectOrNilForKey:kStatementRecordsState fromDictionary:dict];
self.items = [self objectOrNilForKey:kStatementRecordsItems fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kStatementRecordsAmount];
[mutableDict setValue:self.settle forKey:kStatementRecordsSettle];
[mutableDict setValue:[NSNumber numberWithDouble:self.unpaid] forKey:kStatementRecordsUnpaid];
[mutableDict setValue:self.picture forKey:kStatementRecordsPicture];
[mutableDict setValue:self.contract forKey:kStatementRecordsContract];
[mutableDict setValue:self.shopName forKey:kStatementRecordsShopName];
[mutableDict setValue:self.shopCode forKey:kStatementRecordsShopCode];
[mutableDict setValue:[NSNumber numberWithDouble:self.paid] forKey:kStatementRecordsPaid];
[mutableDict setValue:self.state forKey:kStatementRecordsState];
NSMutableArray *tempArrayForItems = [NSMutableArray array];
for (NSObject *subArrayObject in self.items) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForItems addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForItems addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForItems] forKey:kStatementRecordsItems];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.amount = [aDecoder decodeDoubleForKey:kStatementRecordsAmount];
self.settle = [aDecoder decodeObjectForKey:kStatementRecordsSettle];
self.unpaid = [aDecoder decodeDoubleForKey:kStatementRecordsUnpaid];
self.picture = [aDecoder decodeObjectForKey:kStatementRecordsPicture];
self.contract = [aDecoder decodeObjectForKey:kStatementRecordsContract];
self.shopName = [aDecoder decodeObjectForKey:kStatementRecordsShopName];
self.shopCode = [aDecoder decodeObjectForKey:kStatementRecordsShopCode];
self.paid = [aDecoder decodeDoubleForKey:kStatementRecordsPaid];
self.state = [aDecoder decodeObjectForKey:kStatementRecordsState];
self.items = [aDecoder decodeObjectForKey:kStatementRecordsItems];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_amount forKey:kStatementRecordsAmount];
[aCoder encodeObject:_settle forKey:kStatementRecordsSettle];
[aCoder encodeDouble:_unpaid forKey:kStatementRecordsUnpaid];
[aCoder encodeObject:_picture forKey:kStatementRecordsPicture];
[aCoder encodeObject:_contract forKey:kStatementRecordsContract];
[aCoder encodeObject:_shopName forKey:kStatementRecordsShopName];
[aCoder encodeObject:_shopCode forKey:kStatementRecordsShopCode];
[aCoder encodeDouble:_paid forKey:kStatementRecordsPaid];
[aCoder encodeObject:_state forKey:kStatementRecordsState];
[aCoder encodeObject:_items forKey:kStatementRecordsItems];
}
- (id)copyWithZone:(NSZone *)zone
{
StatementRecords *copy = [[StatementRecords alloc] init];
if (copy) {
copy.amount = self.amount;
copy.settle = [self.settle copyWithZone:zone];
copy.unpaid = self.unpaid;
copy.picture = [self.picture copyWithZone:zone];
copy.contract = [self.contract copyWithZone:zone];
copy.shopName = [self.shopName copyWithZone:zone];
copy.shopCode = [self.shopCode copyWithZone:zone];
copy.paid = self.paid;
copy.state = [self.state copyWithZone:zone];
copy.items = [self.items copyWithZone:zone];
}
return copy;
}
@end
......@@ -21,15 +21,15 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8bJ-rv-ZUZ" userLabel="顶部">
<rect key="frame" x="0.0" y="20" width="375" height="135"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ql4-b1-gim">
<rect key="frame" x="187" y="0.0" width="1" height="135"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ql4-b1-gim">
<rect key="frame" x="188" y="0.0" width="1" height="135"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="0.47067307689999999" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="Rjf-MX-TGa"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xeh-VE-GvH">
<rect key="frame" x="0.0" y="0.0" width="187" height="135"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xeh-VE-GvH">
<rect key="frame" x="0.0" y="0.0" width="188" height="135"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2016" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v9Q-me-Myt">
<rect key="frame" x="36" y="33" width="50" height="27"/>
......@@ -55,19 +55,22 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down" translatesAutoresizingMaskIntoConstraints="NO" id="3JP-fj-3A5">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down_purple" translatesAutoresizingMaskIntoConstraints="NO" id="3JP-fj-3A5">
<rect key="frame" x="148" y="42" width="19" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="19" id="9Ls-3x-rwd"/>
<constraint firstAttribute="height" constant="16" id="Tv2-mN-fGt"/>
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zvp-Uj-Jhu">
<rect key="frame" x="9" y="9" width="169" height="52"/>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zvp-Uj-Jhu">
<rect key="frame" x="9" y="9" width="170" height="52"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="1"/>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="8Fg-8B-jG3" id="my3-48-LaE"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2016" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iRY-yA-9rv">
<rect key="frame" x="36" y="69" width="50" height="27"/>
......@@ -93,7 +96,7 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down" translatesAutoresizingMaskIntoConstraints="NO" id="JTN-Sg-b09">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down_purple" translatesAutoresizingMaskIntoConstraints="NO" id="JTN-Sg-b09">
<rect key="frame" x="148" y="78" width="19" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="JTP-tl-uLp"/>
......@@ -106,8 +109,8 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="wJ9-Lt-hSf">
<rect key="frame" x="9" y="67" width="169" height="32"/>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="wJ9-Lt-hSf">
<rect key="frame" x="9" y="67" width="170" height="32"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="eYL-d0-Lg3"/>
......@@ -115,6 +118,9 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="1"/>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="8Fg-8B-jG3" id="5y6-JT-Zva"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="从" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yt5-RT-vjB">
<rect key="frame" x="15" y="39" width="17" height="21"/>
......@@ -195,16 +201,16 @@
</mask>
</variation>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zqy-Jj-Iug">
<rect key="frame" x="188" y="0.0" width="187" height="135"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zqy-Jj-Iug">
<rect key="frame" x="189" y="0.0" width="186" height="135"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="共0家" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lKf-LH-THs">
<rect key="frame" x="4" y="4" width="50" height="25"/>
<rect key="frame" x="4" y="4" width="47" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="7Bl-NY-SSV"/>
<constraint firstAttribute="height" constant="21" id="ZeM-3H-z5T"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
......@@ -213,12 +219,6 @@
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="应缴:1253623.90" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iAE-TG-QRU">
<rect key="frame" x="4" y="29" width="154" height="35"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="元" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yxo-8I-MDG">
<rect key="frame" x="159" y="36" width="20" height="21"/>
<constraints>
......@@ -258,15 +258,38 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="60%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7wc-Tg-iC6">
<rect key="frame" x="125" y="6" width="42" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="60.00%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7wc-Tg-iC6">
<rect key="frame" x="60" y="6" width="127" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="yJE-JC-DRq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="21"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.25098039220000001" green="0.50196078430000002" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EGs-m2-n8k">
<rect key="frame" x="55" y="6" width="5" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="H9f-em-mxz"/>
<constraint firstAttribute="width" constant="5" id="Hat-py-scU"/>
<constraint firstAttribute="height" constant="25" id="IY4-v9-MLO"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="H9f-em-mxz"/>
<exclude reference="IY4-v9-MLO"/>
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="应缴:1253623.90" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iAE-TG-QRU">
<rect key="frame" x="4" y="29" width="154" height="35"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="lKf-LH-THs" firstAttribute="top" secondItem="Zqy-Jj-Iug" secondAttribute="top" constant="4" id="2mk-OS-LjG"/>
......@@ -281,11 +304,14 @@
<constraint firstItem="cmV-Nl-JTX" firstAttribute="leading" secondItem="xYD-uh-jS6" secondAttribute="trailing" constant="1" id="HeD-dh-b3j"/>
<constraint firstAttribute="trailing" secondItem="OLq-gm-qMR" secondAttribute="trailing" constant="8" id="I7S-pZ-LwJ"/>
<constraint firstItem="xYD-uh-jS6" firstAttribute="top" secondItem="1bf-tO-CaQ" secondAttribute="bottom" id="KFM-RY-WoR"/>
<constraint firstItem="7wc-Tg-iC6" firstAttribute="leading" secondItem="EGs-m2-n8k" secondAttribute="trailing" id="KZt-ml-xMZ"/>
<constraint firstItem="EGs-m2-n8k" firstAttribute="centerY" secondItem="7wc-Tg-iC6" secondAttribute="centerY" id="M3J-LG-STi"/>
<constraint firstAttribute="trailing" secondItem="cmV-Nl-JTX" secondAttribute="trailing" constant="8" id="TGY-uO-pmu"/>
<constraint firstItem="Yxo-8I-MDG" firstAttribute="centerY" secondItem="iAE-TG-QRU" secondAttribute="centerY" id="TSa-8P-aow"/>
<constraint firstItem="7wc-Tg-iC6" firstAttribute="centerY" secondItem="lKf-LH-THs" secondAttribute="centerY" id="Tz2-VF-eoi"/>
<constraint firstItem="cmV-Nl-JTX" firstAttribute="centerY" secondItem="xYD-uh-jS6" secondAttribute="centerY" id="W2v-nY-YID"/>
<constraint firstItem="OLq-gm-qMR" firstAttribute="centerY" secondItem="1bf-tO-CaQ" secondAttribute="centerY" id="Y0A-4e-22c"/>
<constraint firstAttribute="trailing" secondItem="7wc-Tg-iC6" secondAttribute="trailing" id="YRV-NE-L8T"/>
<constraint firstItem="1bf-tO-CaQ" firstAttribute="height" secondItem="iAE-TG-QRU" secondAttribute="height" id="YpG-xA-2Jv"/>
<constraint firstAttribute="bottom" secondItem="xYD-uh-jS6" secondAttribute="bottom" id="ZBs-mr-2Rv"/>
<constraint firstItem="xYD-uh-jS6" firstAttribute="leading" secondItem="1bf-tO-CaQ" secondAttribute="leading" id="axv-MT-miv"/>
......@@ -294,13 +320,16 @@
<constraint firstItem="Yxo-8I-MDG" firstAttribute="leading" secondItem="iAE-TG-QRU" secondAttribute="trailing" constant="1" id="eCw-DO-M8i"/>
<constraint firstItem="1bf-tO-CaQ" firstAttribute="leading" secondItem="iAE-TG-QRU" secondAttribute="leading" id="l4R-Y0-UVp"/>
<constraint firstItem="xYD-uh-jS6" firstAttribute="height" secondItem="iAE-TG-QRU" secondAttribute="height" id="mkx-dC-DZf"/>
<constraint firstItem="EGs-m2-n8k" firstAttribute="leading" secondItem="lKf-LH-THs" secondAttribute="trailing" constant="4" id="mxC-gY-Gly"/>
<constraint firstItem="EGs-m2-n8k" firstAttribute="height" secondItem="7wc-Tg-iC6" secondAttribute="height" id="sCG-y6-gSx"/>
<constraint firstItem="xYD-uh-jS6" firstAttribute="top" secondItem="1bf-tO-CaQ" secondAttribute="bottom" constant="4" id="t0g-tj-V0H"/>
<constraint firstAttribute="trailing" secondItem="7wc-Tg-iC6" secondAttribute="trailing" constant="20" id="tkQ-ZG-9fa"/>
<constraint firstAttribute="trailing" secondItem="7wc-Tg-iC6" secondAttribute="trailing" id="tkQ-ZG-9fa"/>
<constraint firstItem="iAE-TG-QRU" firstAttribute="top" secondItem="lKf-LH-THs" secondAttribute="bottom" id="xpv-Mi-7V7"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="Fi6-it-fMZ"/>
<exclude reference="tkQ-ZG-9fa"/>
<exclude reference="6lI-ZA-ziN"/>
<exclude reference="9tf-qH-bf1"/>
<exclude reference="AX7-jL-Qbm"/>
......@@ -357,9 +386,9 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="106"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Dty-co-xso">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bill_no_image_default" translatesAutoresizingMaskIntoConstraints="NO" id="Dty-co-xso">
<rect key="frame" x="10" y="23" width="60" height="60"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="B8f-bn-Lsy"/>
<constraint firstAttribute="height" constant="60" id="nfw-2a-Wfl"/>
......@@ -377,8 +406,8 @@
<color key="textColor" red="0.25098040700000002" green="0.50196081400000003" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="A01-01 星巴克" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eoV-ug-BwJ">
<rect key="frame" x="78" y="18" width="112" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="A01-01 星巴克" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eoV-ug-BwJ">
<rect key="frame" x="78" y="18" width="289" height="21"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -410,6 +439,7 @@
<constraint firstItem="Dty-co-xso" firstAttribute="centerY" secondItem="Gmk-Kr-RRS" secondAttribute="centerY" id="3Sn-vd-Qwj"/>
<constraint firstItem="ZxP-vP-jg0" firstAttribute="centerY" secondItem="tYe-gT-7Ke" secondAttribute="centerY" id="3xk-le-VWq"/>
<constraint firstItem="bZD-Rx-SkM" firstAttribute="width" secondItem="tYe-gT-7Ke" secondAttribute="width" id="6Ye-4y-p7z"/>
<constraint firstItem="eoV-ug-BwJ" firstAttribute="trailing" secondItem="Gmk-Kr-RRS" secondAttribute="trailingMargin" id="8Ey-dA-xGd"/>
<constraint firstItem="ZxP-vP-jg0" firstAttribute="width" secondItem="tYe-gT-7Ke" secondAttribute="width" id="8rx-Rt-kXt"/>
<constraint firstItem="om4-cp-cn3" firstAttribute="leading" secondItem="tYe-gT-7Ke" secondAttribute="leading" id="8vL-bd-R1l"/>
<constraint firstAttribute="trailingMargin" secondItem="bZD-Rx-SkM" secondAttribute="trailing" id="9tT-l9-Ha4"/>
......@@ -475,11 +505,13 @@
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections>
<outlet property="btnIsClear" destination="xOc-qx-bQd" id="2Pi-jV-b4M"/>
<outlet property="finishTextField" destination="wJ9-Lt-hSf" id="wzW-JL-fnB"/>
<outlet property="labelFinishMonth" destination="QNL-vp-FTK" id="4aZ-3R-JiV"/>
<outlet property="labelFinishYear" destination="iRY-yA-9rv" id="GJd-Ua-Eiw"/>
<outlet property="labelMonth" destination="Bnj-Mq-sn7" id="Swa-Kc-GY8"/>
<outlet property="labelTotalPaidIn" destination="1bf-tO-CaQ" id="kZ7-jR-Dbj"/>
<outlet property="labelTotalPaidPercent" destination="7wc-Tg-iC6" id="wOK-qr-h9v"/>
<outlet property="labelTotalShop" destination="lKf-LH-THs" id="e2p-b8-ndn"/>
<outlet property="labelTotalShouldPay" destination="iAE-TG-QRU" id="WEK-u1-eZ7"/>
<outlet property="labelTotalUnPaid" destination="xYD-uh-jS6" id="gZY-Mu-IrG"/>
......@@ -491,7 +523,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="RVD-1S-Uuk" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-706.5" y="2723.5"/>
<point key="canvasLocation" x="-664.5" y="2672.5"/>
</scene>
<!--Statement Detail View Controller-->
<scene sceneID="VuM-mH-kRs">
......@@ -542,7 +574,7 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down" translatesAutoresizingMaskIntoConstraints="NO" id="gB1-Me-OSZ">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down_purple" translatesAutoresizingMaskIntoConstraints="NO" id="gB1-Me-OSZ">
<rect key="frame" x="132" y="33" width="19" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="19" id="AYt-4a-Syv"/>
......@@ -580,7 +612,7 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down" translatesAutoresizingMaskIntoConstraints="NO" id="8bN-ET-Vi0">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow_down_purple" translatesAutoresizingMaskIntoConstraints="NO" id="8bN-ET-Vi0">
<rect key="frame" x="132" y="78" width="19" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="UAI-mE-u0s"/>
......@@ -630,7 +662,7 @@
<rect key="frame" x="188" y="0.0" width="187" height="135"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="元" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jyd-PI-c1m">
<rect key="frame" x="159" y="12" width="20" height="21"/>
<rect key="frame" x="159" y="34" width="20" height="34"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="Nzp-rG-iF5"/>
</constraints>
......@@ -639,7 +671,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="元" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Trd-Yd-Gm3">
<rect key="frame" x="159" y="57" width="20" height="21"/>
<rect key="frame" x="159" y="74" width="20" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="oz3-Bm-zbl"/>
</constraints>
......@@ -648,7 +680,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="元" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="daL-Yf-tTB">
<rect key="frame" x="159" y="102" width="20" height="21"/>
<rect key="frame" x="159" y="108" width="20" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="CiV-fW-x31"/>
</constraints>
......@@ -657,7 +689,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="应缴:22253623.90" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eJv-sv-XDs">
<rect key="frame" x="5" y="0.0" width="153" height="45"/>
<rect key="frame" x="5" y="34" width="153" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="41" id="IY4-HW-dzZ"/>
</constraints>
......@@ -671,7 +703,7 @@
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="未缴:253623.90" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QgT-zZ-E08">
<rect key="frame" x="5" y="90" width="153" height="45"/>
<rect key="frame" x="5" y="101" width="153" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="jPt-o7-riX"/>
</constraints>
......@@ -685,7 +717,7 @@
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="已缴:253623.90" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7SS-iX-tyV">
<rect key="frame" x="5" y="45" width="153" height="45"/>
<rect key="frame" x="5" y="68" width="153" height="33"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="9ge-AY-vga"/>
</constraints>
......@@ -698,25 +730,61 @@
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="缴款率:" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Glk-rK-jEl">
<rect key="frame" x="5" y="0.0" width="56" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="41" id="etL-HG-Fo7"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="etL-HG-Fo7"/>
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="34%" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BWq-Ig-eYR">
<rect key="frame" x="61" y="0.0" width="34" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="41" id="NhJ-JI-C1E"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.25098040700000002" green="0.50196081400000003" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="NhJ-JI-C1E"/>
</mask>
</variation>
</label>
</subviews>
<constraints>
<constraint firstItem="daL-Yf-tTB" firstAttribute="centerY" secondItem="QgT-zZ-E08" secondAttribute="centerY" id="0FM-qi-RsA"/>
<constraint firstItem="QgT-zZ-E08" firstAttribute="leading" secondItem="eJv-sv-XDs" secondAttribute="leading" id="2GU-ps-iTu"/>
<constraint firstItem="jyd-PI-c1m" firstAttribute="top" secondItem="Glk-rK-jEl" secondAttribute="bottom" id="2qu-Ns-ugW"/>
<constraint firstItem="eJv-sv-XDs" firstAttribute="centerY" secondItem="jZY-CC-1TB" secondAttribute="centerY" id="2t8-n4-qhY"/>
<constraint firstItem="BWq-Ig-eYR" firstAttribute="height" secondItem="Glk-rK-jEl" secondAttribute="height" id="3jW-of-ext"/>
<constraint firstItem="jyd-PI-c1m" firstAttribute="centerY" secondItem="eJv-sv-XDs" secondAttribute="centerY" id="6pv-MQ-dKp"/>
<constraint firstAttribute="trailing" secondItem="Trd-Yd-Gm3" secondAttribute="trailing" constant="8" id="8l0-Cv-BVK"/>
<constraint firstItem="daL-Yf-tTB" firstAttribute="leading" secondItem="QgT-zZ-E08" secondAttribute="trailing" constant="1" id="Aen-hb-7K7"/>
<constraint firstItem="QgT-zZ-E08" firstAttribute="leading" secondItem="jZY-CC-1TB" secondAttribute="leading" id="Dob-X6-Kj0"/>
<constraint firstItem="eJv-sv-XDs" firstAttribute="top" secondItem="Glk-rK-jEl" secondAttribute="bottom" id="H93-Ot-cCq"/>
<constraint firstItem="QgT-zZ-E08" firstAttribute="height" secondItem="eJv-sv-XDs" secondAttribute="height" id="HXC-He-CPE"/>
<constraint firstAttribute="bottom" secondItem="QgT-zZ-E08" secondAttribute="bottom" constant="5" id="J4g-bf-ln9"/>
<constraint firstItem="Glk-rK-jEl" firstAttribute="leading" secondItem="eJv-sv-XDs" secondAttribute="leading" id="Mai-Hk-3Fr"/>
<constraint firstAttribute="bottom" secondItem="QgT-zZ-E08" secondAttribute="bottom" id="N8h-ED-7kA"/>
<constraint firstAttribute="trailing" secondItem="daL-Yf-tTB" secondAttribute="trailing" constant="8" id="TuY-sp-1IN"/>
<constraint firstItem="7SS-iX-tyV" firstAttribute="centerY" secondItem="jZY-CC-1TB" secondAttribute="centerY" constant="5" id="Vn2-vv-KKi"/>
<constraint firstItem="QgT-zZ-E08" firstAttribute="top" secondItem="7SS-iX-tyV" secondAttribute="bottom" constant="4" id="XBt-ao-mh6"/>
<constraint firstItem="BWq-Ig-eYR" firstAttribute="centerY" secondItem="Glk-rK-jEl" secondAttribute="centerY" id="YqT-uk-IVO"/>
<constraint firstItem="Glk-rK-jEl" firstAttribute="top" secondItem="jZY-CC-1TB" secondAttribute="top" id="aq8-Bv-28v"/>
<constraint firstItem="Glk-rK-jEl" firstAttribute="height" secondItem="QgT-zZ-E08" secondAttribute="height" id="byZ-LS-KiL"/>
<constraint firstItem="7SS-iX-tyV" firstAttribute="leading" secondItem="eJv-sv-XDs" secondAttribute="leading" id="cGH-9Z-uwI"/>
<constraint firstItem="Trd-Yd-Gm3" firstAttribute="centerY" secondItem="7SS-iX-tyV" secondAttribute="centerY" id="exl-ha-qzL"/>
<constraint firstItem="7SS-iX-tyV" firstAttribute="top" secondItem="eJv-sv-XDs" secondAttribute="bottom" id="fFh-Sz-yLG"/>
<constraint firstItem="eJv-sv-XDs" firstAttribute="top" secondItem="jZY-CC-1TB" secondAttribute="top" id="it3-ds-Dx4"/>
<constraint firstItem="BWq-Ig-eYR" firstAttribute="leading" secondItem="Glk-rK-jEl" secondAttribute="trailing" id="g3Z-G8-Guw"/>
<constraint firstItem="eJv-sv-XDs" firstAttribute="top" secondItem="jZY-CC-1TB" secondAttribute="top" constant="30" id="it3-ds-Dx4"/>
<constraint firstItem="eJv-sv-XDs" firstAttribute="leading" secondItem="jZY-CC-1TB" secondAttribute="leading" constant="5" id="mPx-L9-FYr"/>
<constraint firstItem="jyd-PI-c1m" firstAttribute="leading" secondItem="eJv-sv-XDs" secondAttribute="trailing" constant="1" id="oNt-fe-HiL"/>
<constraint firstItem="QgT-zZ-E08" firstAttribute="top" secondItem="7SS-iX-tyV" secondAttribute="bottom" id="pjl-bP-ivR"/>
......@@ -728,6 +796,7 @@
<variation key="default">
<mask key="constraints">
<exclude reference="2t8-n4-qhY"/>
<exclude reference="it3-ds-Dx4"/>
<exclude reference="Vn2-vv-KKi"/>
<exclude reference="tF3-4D-MC7"/>
<exclude reference="Dob-X6-Kj0"/>
......@@ -770,9 +839,9 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="92"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dMV-L1-5ad">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="money_add.png" translatesAutoresizingMaskIntoConstraints="NO" id="dMV-L1-5ad">
<rect key="frame" x="10" y="16" width="60" height="60"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="Fcs-hR-dXD"/>
<constraint firstAttribute="width" constant="60" id="zEb-Tx-bvE"/>
......@@ -877,9 +946,10 @@
</variation>
</tableViewCellContentView>
<connections>
<outlet property="img" destination="dMV-L1-5ad" id="9fW-iG-WIt"/>
<outlet property="labelDate" destination="H8s-On-f4k" id="khq-NB-ekS"/>
<outlet property="labelPaidIn" destination="BKB-5O-ZDd" id="eCO-U0-qVb"/>
<outlet property="labelShouldPay" destination="5ui-xz-3m3" id="zPV-vR-mtW"/>
<outlet property="labelShouldPay" destination="XLd-Hq-TCp" id="hZC-Hp-2MK"/>
<outlet property="labelTitle" destination="qW1-s4-dCc" id="Cib-dm-0P8"/>
<outlet property="labelUnPaid" destination="Ddk-tD-p9f" id="Q5Y-Q7-cBN"/>
</connections>
......@@ -904,7 +974,17 @@
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections>
<outlet property="labelMontEnd" destination="691-sk-b04" id="jwl-Mf-czp"/>
<outlet property="labelMonthStart" destination="zhK-cM-4OX" id="mrP-tP-Tgy"/>
<outlet property="labelPaid" destination="7SS-iX-tyV" id="KR4-9o-E7X"/>
<outlet property="labelPaidRate" destination="BWq-Ig-eYR" id="qNd-5X-Go5"/>
<outlet property="labelShoudPay" destination="eJv-sv-XDs" id="vts-8Z-wpa"/>
<outlet property="labelUnpaid" destination="QgT-zZ-E08" id="7Rh-CK-PMM"/>
<outlet property="labelYearEnd" destination="4Fu-fM-WA5" id="uZf-U0-Jlq"/>
<outlet property="labelYearStart" destination="vIJ-wd-iLE" id="0Ga-5q-emv"/>
<outlet property="tableView" destination="hmH-WP-Z0p" id="bfF-B7-VlK"/>
<outlet property="textFieldEnd" destination="5jO-f7-jHx" id="RBj-Lh-sxj"/>
<outlet property="textFieldStart" destination="yqi-ff-dhn" id="Izc-4I-FfZ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="llf-hx-tX7" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -913,8 +993,10 @@
</scene>
</scenes>
<resources>
<image name="arrow_down" width="640" height="1136"/>
<image name="checked_checkbox" width="640" height="1136"/>
<image name="unchecked_checkbox" width="640" height="1136"/>
<image name="arrow_down_purple" width="13" height="9"/>
<image name="bill_no_image_default" width="147" height="147"/>
<image name="checked_checkbox" width="128" height="128"/>
<image name="money_add.png" width="26" height="29"/>
<image name="unchecked_checkbox" width="128" height="128"/>
</resources>
</document>
......@@ -7,7 +7,12 @@
//
#import "BaseViewController.h"
#import "StatementRecords.h"
@interface StatementDetailViewController : BaseViewController
@property (nonatomic, copy) NSString *startDate;
@property (nonatomic, copy) NSString *endDate;
@property (nonatomic, strong) StatementRecords *record;
@end
......@@ -8,8 +8,34 @@
#import "StatementDetailViewController.h"
#import "StatementDetailCell.h"
@interface StatementDetailViewController ()<UITableViewDelegate, UITableViewDataSource>
#import "StatementDetailModel.h"
#import "SRMonthPicker.h"
#import "UIScrollView+EmptyDataSet.h"
#import "CalculateHelper.h"
@interface StatementDetailViewController ()<UITableViewDelegate, UITableViewDataSource,SRMonthPickerDelegate, UITextFieldDelegate, DZNEmptyDataSetDelegate, DZNEmptyDataSetSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, strong) StatementDetailModel *detailModel;
/** 应缴 */
@property (weak, nonatomic) IBOutlet UILabel *labelShoudPay;
/** 已缴 */
@property (weak, nonatomic) IBOutlet UILabel *labelPaid;
/** 未缴 */
@property (weak, nonatomic) IBOutlet UILabel *labelUnpaid;
/** year start */
@property (weak, nonatomic) IBOutlet UILabel *labelYearStart;
/** month start */
@property (weak, nonatomic) IBOutlet UILabel *labelMonthStart;
/** year start */
@property (weak, nonatomic) IBOutlet UILabel *labelYearEnd;
/** month end */
@property (weak, nonatomic) IBOutlet UILabel *labelMontEnd;
/** textfield start */
@property (weak, nonatomic) IBOutlet UITextField *textFieldStart;
/** textfield end */
@property (weak, nonatomic) IBOutlet UITextField *textFieldEnd;
/** 缴款率 */
@property (weak, nonatomic) IBOutlet UILabel *labelPaidRate;
@end
......@@ -17,6 +43,76 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSDate *selectStart = [self getDateFromString:self.startDate];
NSDate *selectEnd = [self getDateFromString:self.endDate];
[self setStart:selectStart];
[self setEnd:selectEnd];
self.textFieldStart.delegate = self;
self.textFieldEnd.delegate = self;
[self setUpDatePicker];
[self setUpData];
}
/** 设置开始时间 */
- (void)setStart:(NSDate *)date {
self.labelYearStart.text = date.yearString;
self.labelMonthStart.text = date.monthString;
}
/** 设置结束时间 */
- (void)setEnd:(NSDate *)date {
self.labelYearEnd.text = date.yearString;
self.labelMontEnd.text = date.monthString;
}
- (void)setUpDatePicker {
SRMonthPicker *datePicker = [[SRMonthPicker alloc] initWithDate:[NSDate date]];
datePicker.monthPickerDelegate = self;
datePicker.yearFirst = YES;
self.textFieldStart.inputView = datePicker;
self.textFieldEnd.inputView = datePicker;
}
#pragma mark - SRMonthPickerDelegate
- (void)monthPickerDidChangeDate:(SRMonthPicker *)monthPicker {
NSString *strDate = [monthPicker.date stringWithFormatter:@"%Y%m"];
NSString *year = monthPicker.date.yearString;
NSString *month = monthPicker.date.monthString;
//判断是开始时间还是结束时间
if ([self.textFieldStart isFirstResponder]) {
self.startDate = strDate;
self.labelYearStart.text = year;
self.labelMonthStart.text = month;
}else{
self.endDate = strDate;
self.labelYearEnd.text = year;
self.labelMontEnd.text = month;
}
}
- (void)setUpData {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSString *url = [NSString stringWithFormat:@"statement?contract=%@&beginSettle=%@&endSettle=%@",self.record.contract,self.startDate, self.endDate];
WS(weakSelf);
[[ICRHTTPController sharedController] getUrl:url params:nil success:^(id data) {
NSDictionary *dic = data;
weakSelf.detailModel = [StatementDetailModel modelObjectWithDictionary:dic[@"data"]];
weakSelf.title = weakSelf.detailModel.shopName;
weakSelf.labelShoudPay.text = [NSString stringWithFormat:@"应缴:%.2f", weakSelf.detailModel.amount];
weakSelf.labelPaid.text = [NSString stringWithFormat:@"已缴:%.2f",weakSelf.detailModel.paid];
weakSelf.labelUnpaid.text = [NSString stringWithFormat:@"未缴:%.2f",weakSelf.detailModel.unpaid];
//缴款率
NSString *paidRate = [CalculateHelper getPercent:[NSNumber numberWithDouble:weakSelf.detailModel.paid] num:[NSNumber numberWithDouble:weakSelf.detailModel.amount]];
weakSelf.labelPaidRate.text = paidRate;
[weakSelf.tableView reloadData];
[hud hide:YES];
CLog(@"%@", dic.JSONString);
} failure:^(id data) {
}];
}
......@@ -26,14 +122,45 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
return self.detailModel.items.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
StatementDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StatementDetailCell" forIndexPath:indexPath];
[cell setUpCellWithModelArray:self.detailModel.items index:indexPath];
return cell;
}
- (NSDate *)getDateFromString:(NSString *)string {
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyyMM"];
return [f dateFromString:string];
}
#pragma mark - empty state
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
return [UIImage imageNamed:@"no_data"];
}
- (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView {
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath: @"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0.0, 0.0, 1.0)];
animation.duration = 0.25;
animation.cumulative = YES;
animation.repeatCount = MAXFLOAT;
return animation;
}
#pragma mark - textfield delegate
- (void)textFieldDidEndEditing:(UITextField *)textField {
[self setUpData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -13,9 +13,14 @@
#import "StatementListParamModel.h"
#import "StatementModel.h"
#import "VankeAppBoard_iPhone.h"
@interface StatementViewController ()<UITableViewDelegate, UITableViewDataSource, SRMonthPickerDelegate, UISearchBarDelegate>
#import "CalculateHelper.h"
#import "StatementDetailViewController.h"
#import "UIScrollView+EmptyDataSet.h"
@interface StatementViewController ()<UITableViewDelegate, UITableViewDataSource, SRMonthPickerDelegate, UISearchBarDelegate, UITextFieldDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
/** 已缴百分比 */
@property (weak, nonatomic) IBOutlet UILabel *labelTotalPaidPercent;
/** 共?家商铺 */
@property (weak, nonatomic) IBOutlet UILabel *labelTotalShop;
/** 应缴合计 */
......@@ -37,6 +42,11 @@
/** 截止 月 */
@property (weak, nonatomic) IBOutlet UILabel *labelFinishMonth;
@property (weak, nonatomic) IBOutlet UISearchBar *searchBar;
@property (nonatomic, strong) NSArray *arrFilter;
@property (nonatomic, strong) NSMutableArray *arrClear;
@property (weak, nonatomic) IBOutlet UIButton *btnIsClear;
/** 当前选中的日期 */
@property (nonatomic, copy) NSString *startDate;
@property (nonatomic, copy) NSString *endDate;
......@@ -44,7 +54,7 @@
/** 网络请求参数 */
@property (nonatomic, strong) StatementListParamModel *paramModel;
@property (nonatomic, strong) NSMutableArray *arrData;
@property (nonatomic, strong) StatementModel *statementModel;
@end
@implementation StatementViewController
......@@ -56,7 +66,8 @@
[self setUpDatePicker];
self.paramModel = [[StatementListParamModel alloc] init];
self.title = @"商铺对账单";
// self.paramModel.authorizedOrgIn = [[UserInfo shareInstance].authorizedOrgs[0] uuid];
self.tableView.emptyDataSetSource = self;
self.tableView.emptyDataSetDelegate = self;
self.paramModel.pageSize = 999;
self.paramModel.pageNumber = 0;
[self setUpData];
......@@ -66,12 +77,12 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// self.navigationController.navigationBar.barTintColor = kMainPurpleColor;
self.navigationController.navigationBar.backgroundImage = [UIImage imageWithColor:kMainPurpleColor];
}
- (void)setDefaults {
NSDate *currentDate = [NSDate date];
self.startDate = currentDate.yearMonthString;
self.startDate = [currentDate stringWithFormatter:@"%Y%m"];
self.endDate = [currentDate stringWithFormatter:@"%Y%m"];
self.labelYear.text = currentDate.yearString;
self.labelMonth.text = currentDate.monthString;
......@@ -90,11 +101,12 @@
/** 显示结清账户 */
- (IBAction)showSettleShop:(UIButton *)sender {
sender.selected = !sender.isSelected;
[self.tableView reloadData];
}
#pragma mark - SRMonthPickerDelegate
- (void)monthPickerDidChangeDate:(SRMonthPicker *)monthPicker {
NSString *strDate = monthPicker.date.yearMonthString;
NSString *strDate = [monthPicker.date stringWithFormatter:@"%Y%m"];
NSString *year = monthPicker.date.yearString;
NSString *month = monthPicker.date.monthString;
//判断是开始时间还是结束时间
......@@ -112,12 +124,20 @@
#pragma mark - UISearchBarDelegate
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
searchBar.showsCancelButton = YES;
[self.tableView reloadData];
return YES;
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
NSPredicate *pred = [NSPredicate predicateWithFormat:@"shopName contains [cd] %@ OR shopCode contains [cd] %@", searchText, searchText];
self.arrFilter = [self.statementModel.records filteredArrayUsingPredicate:pred];
[self.tableView reloadData];
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
searchBar.showsCancelButton = NO;
searchBar.text = nil;
[self.tableView reloadData];
HIDE_KEYBOARD;
}
......@@ -128,34 +148,55 @@
/** 网络请求 */
- (void)setUpData {
NSString *url = [NSString stringWithFormat:@"statement/query/%@~%@?authorizedOrgIn=%@&pageNumber=%@&pageSize=%@", @"201509", self.endDate, self.org.code, @0, @999];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSString *url = [NSString stringWithFormat:@"statement/query/%@~%@?authorizedOrgIn=%@&pageNumber=%@&pageSize=%@", self.startDate, self.endDate, self.org.code, @0, @999];
WS(weakSelf);
[[ICRHTTPController sharedController] getUrl:url params:nil success:^(id data) {
NSDictionary *dict = data;
CLog(@"%@", dict.JSONString);
NSInteger count = dict[@"paging"][@"recordCount"];
weakSelf.labelTotalShop.text = [NSString stringWithFormat:@"%ld",(long)count];
for (NSDictionary *dic in data[@"data"][@"records"]) {
[self.arrData addObject:[StatementModel modelObjectWithDictionary:dic]];
weakSelf.statementModel = [StatementModel modelObjectWithDictionary:dict[@"data"]];
weakSelf.labelTotalShop.text = [NSString stringWithFormat:@"共%@家",[NSNumber numberWithDouble:weakSelf.statementModel.paging.recordCount]];
weakSelf.labelTotalShouldPay.text = [NSString stringWithFormat:@"应缴:%@",[CalculateHelper getMoneyStringFrom:[NSNumber numberWithDouble:weakSelf.statementModel.amount]]];
weakSelf.labelTotalPaidIn.text = [NSString stringWithFormat:@"已缴:%@",[CalculateHelper getMoneyStringFrom:[NSNumber numberWithDouble:weakSelf.statementModel.paidTotal]]];
weakSelf.labelTotalUnPaid.text = [NSString stringWithFormat:@"未缴:%@",[CalculateHelper getMoneyStringFrom:[NSNumber numberWithDouble:weakSelf.statementModel.unpaidTotal]]];
weakSelf.labelTotalPaidPercent.text = [CalculateHelper getPercent:[NSNumber numberWithDouble:weakSelf.statementModel.paidTotal] num:[NSNumber numberWithDouble:weakSelf.statementModel.amount]];
[weakSelf.tableView reloadData];
for (StatementRecords *records in weakSelf.statementModel.records) {
if (records.unpaid == 0) {
[weakSelf.arrClear addObject:records];
}
[self.tableView reloadData];
}
[hud hide:YES];
} failure:^(id data) {
[hud hide:YES];
}];
}
#pragma mark - tableView DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.arrData.count;
if (self.searchBar.isFirstResponder) {
return self.arrFilter.count;
}else if(self.btnIsClear.isSelected){
return self.arrClear.count;
}else{
return self.statementModel.records.count;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
StatementTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StatementCell" forIndexPath:indexPath];
[cell setUpCellWithArray:self.arrData index:indexPath];
if (self.searchBar.isFirstResponder) {
[cell setUpCellWithArray:self.arrFilter index:indexPath];
}else if(self.btnIsClear.isSelected){
[cell setUpCellWithArray:self.arrClear index:indexPath];
}else{
[cell setUpCellWithArray:self.statementModel.records index:indexPath];
}
return cell;
}
......@@ -164,16 +205,54 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self PushToStoryBoardVCWithIdentifier:@"StatementDetailViewController" isHideTabbar:YES animate:YES];
StatementDetailViewController *detailVC = [self controllerWithIdentifier:@"StatementDetailViewController"];
detailVC.startDate = self.startDate;
detailVC.endDate = self.endDate;
if (self.searchBar.isFirstResponder) {
detailVC.record = self.arrFilter[indexPath.row];
}else if(self.btnIsClear.isSelected){
detailVC.record = self.arrClear[indexPath.row];
}else{
detailVC.record = self.statementModel.records[indexPath.row];
}
[self.navigationController pushViewController:detailVC animated:YES];
}
- (NSMutableArray *)arrData {
if (!_arrData) {
_arrData = [NSMutableArray array];
}
return _arrData;
- (void)textFieldDidEndEditing:(UITextField *)textField {
[self setUpData];
}
#pragma mark - empty state
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
return [UIImage imageNamed:@"no_data"];
}
- (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView {
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath: @"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0.0, 0.0, 1.0)];
animation.duration = 0.25;
animation.cumulative = YES;
animation.repeatCount = MAXFLOAT;
return animation;
}
- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView {
return [UIColor whiteColor];
}
#pragma mark - lazyloading
- (NSMutableArray *)arrClear {
if (!_arrClear) {
_arrClear = [NSMutableArray array];
}
return _arrClear;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -10,4 +10,5 @@
@interface StatementDetailCell : UITableViewCell
- (void)setUpCellWithModelArray:(NSArray *)array index:(NSIndexPath *)indexPath;
@end
......@@ -7,7 +7,7 @@
//
#import "StatementDetailCell.h"
#import "StatementDetailItems.h"
@interface StatementDetailCell ()
/** 标题 */
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
......@@ -20,6 +20,7 @@
@property (weak, nonatomic) IBOutlet UILabel *labelPaidIn;
/** 未缴 */
@property (weak, nonatomic) IBOutlet UILabel *labelUnPaid;
@property (weak, nonatomic) IBOutlet UIImageView *img;
@end
@implementation StatementDetailCell
......@@ -28,6 +29,20 @@
// Initialization code
}
- (void)setUpCellWithModelArray:(NSArray *)array index:(NSIndexPath *)indexPath {
StatementDetailItems *item = array[indexPath.row];
self.labelTitle.text = item.subject;
self.labelDate.text = [NSString stringWithFormat:@"%@~%@",item.beginDate,item.endDate];
self.labelShouldPay.text = [NSString stringWithFormat:@"%.2f",item.amount];
self.labelPaidIn.text = [NSString stringWithFormat:@"[已缴]%.2f",item.paid];
self.labelUnPaid.text = [NSString stringWithFormat:@"[未缴]%.2f",item.unpaid];
if (item.direction < 0) {
self.img.image = [UIImage imageNamed:@"money_reduce"];
}else{
self.img.image = [UIImage imageNamed:@"money_add"];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -26,8 +26,8 @@
}
- (void)setUpCellWithArray:(NSArray *)array index:(NSIndexPath *)indexPath {
StatementModel *model = array[indexPath.row];
self.labelTitle.text = model.shopName;
StatementRecords *model = array[indexPath.row];
self.labelTitle.text = [NSString stringWithFormat:@"%@ %@",model.shopCode, model.shopName];
self.labelShouldPay.text = [NSString stringWithFormat:@"%.2f",model.amount];
self.labelPaidIn.text = [NSString stringWithFormat:@"[已缴]%.2f",model.paid];
self.labelUnPaid.text = [NSString stringWithFormat:@"[未缴]%.2f",model.unpaid];
......
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