ExpenseListViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. //
  2. // ExpenseListViewController.m
  3. // IBOSS
  4. //
  5. // Created by apple on 2017/7/10.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:费用明细表控制器
  9. //
  10. #import "ExpenseListViewController.h"
  11. #import "ExpenseDetailViewController.h"
  12. #import "SideSlipModel.h"
  13. #import "ExpenseSearchModel.h"
  14. #import "ExpenseCell.h"
  15. #import "DateFormat.h"
  16. @interface ExpenseListViewController ()<UITableViewDelegate,UITableViewDataSource>{
  17. //TableView对象
  18. UITableView *_vTableView;
  19. // 头视图
  20. UIView *_headView;
  21. }
  22. /**
  23. 原始数据源
  24. */
  25. @property (strong,nonatomic) NSMutableArray *dataList;
  26. /**
  27. 请求数据对象
  28. */
  29. @property (nonatomic,strong) ASIDownManager *downManager;
  30. /**
  31. 抽屉对象
  32. */
  33. @property (strong,nonatomic) SideSlipFilterController *filterController;
  34. @end
  35. @implementation ExpenseListViewController
  36. #pragma mark - 公共函数
  37. /**
  38. viewDidLoad
  39. */
  40. - (void)viewDidLoad {
  41. [super viewDidLoad];
  42. [self loadNavStyle];
  43. [self initUI];
  44. [self initSlideSlip];
  45. }
  46. /**
  47. 安全区视图发生变化
  48. */
  49. -(void)viewSafeAreaInsetsDidChange{
  50. _vTableView.frame=self.view.safeAreaLayoutGuide.layoutFrame;
  51. [super viewSafeAreaInsetsDidChange];
  52. }
  53. /**
  54. didReceiveMemoryWarning
  55. */
  56. - (void)didReceiveMemoryWarning {
  57. [super didReceiveMemoryWarning];
  58. }
  59. #pragma mark - 数据源属性
  60. /**
  61. 原始数据源
  62. @return return value description
  63. */
  64. - (NSMutableArray *)dataList{
  65. if(_dataList == nil){
  66. _dataList = [[NSMutableArray alloc]init];
  67. }
  68. return _dataList;
  69. }
  70. #pragma mark - 委托回调函数
  71. /**
  72. 调用接口成功回调
  73. @param sender <#sender description#>
  74. */
  75. - (void)onLoadFinish:(ASIDownManager *)sender {
  76. // 取消进度条
  77. [self cancel];
  78. // 服务器返回数据
  79. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  80. // 服务器返回数据状态值
  81. int iStatus = resultModel.status;
  82. // 服务器返回数据消息
  83. NSString *message = resultModel.message;
  84. _vTableView.tableHeaderView = nil;
  85. _vTableView.backgroundView = nil;
  86. // 服务器返回数据状态值正确
  87. if (iStatus == 0) {
  88. // 服务器返回数据结果
  89. NSArray *approvArr = (NSArray *)resultModel.result;
  90. [self.dataList removeAllObjects];
  91. // 是否有数据
  92. if(approvArr != nil && approvArr.count > 0)
  93. {
  94. [self.dataList addObjectsFromArray:approvArr];
  95. double totalFeeSumValue = 0;
  96. double totalPaySumValue = 0;
  97. _vTableView.tableHeaderView = _headView;
  98. // 合计信息
  99. for (int i = 0; i < self.dataList.count; i++) {
  100. NSDictionary *dicValue = self.dataList[i];
  101. totalFeeSumValue = totalFeeSumValue + [[dicValue objectForKey:@"FeeSum"] doubleValue];
  102. totalPaySumValue = totalPaySumValue + [[dicValue objectForKey:@"PaySum"] doubleValue];
  103. }
  104. self.lblFeeSum.text = [NSString stringWithFormat:@"¥%.2f",totalFeeSumValue];
  105. self.lblPaySum.text = [NSString stringWithFormat:@"¥%.2f",totalPaySumValue];
  106. // 重新刷新数据
  107. [_vTableView reloadData];
  108. }
  109. else{
  110. // 无数据
  111. // 无数据的view
  112. [_dataList removeAllObjects];
  113. [_vTableView reloadData];
  114. _vTableView.backgroundView = _noDataView;
  115. [self showAlertViewBackText:@"未找到匹配结果"];
  116. }
  117. }
  118. // 服务器返回数据状态值异常
  119. else if(iStatus == ActionResultStatusAuthError
  120. ||iStatus == ActionResultStatusNoLogin
  121. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  122. [self showReLoginDialog:message];
  123. }
  124. else {
  125. [_vTableView reloadData];
  126. [self showAlertViewText:message];
  127. }
  128. }
  129. /**
  130. 调用接口失败回调
  131. @param sender <#sender description#>
  132. */
  133. - (void)onLoadFail:(ASIDownManager *)sender {
  134. [self cancel];
  135. [_vTableView reloadData];
  136. [self showAlertViewText:@"网络异常"];
  137. }
  138. #pragma mark - tablview回调函数
  139. /**
  140. 行数
  141. @param tableView tableView description
  142. @param section section description
  143. @return return value description
  144. */
  145. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  146. {
  147. return [self.dataList count];
  148. }
  149. /**
  150. Sections数
  151. @param tableView <#tableView description#>
  152. @return <#return value description#>
  153. */
  154. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  155. return 1;
  156. }
  157. /**
  158. 高度
  159. @param tableView <#tableView description#>
  160. @param indexPath <#indexPath description#>
  161. @return <#return value description#>
  162. */
  163. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  164. return 135;
  165. }
  166. /**
  167. 单元格
  168. @param tableView <#tableView description#>
  169. @param indexPath <#indexPath description#>
  170. @return <#return value description#>
  171. */
  172. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  173. {
  174. static NSString *cellIdentifier = @"ExpenseCell";
  175. ExpenseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  176. // 初始化cell
  177. if (!cell) {
  178. cell = [[ExpenseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  179. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  180. }
  181. NSDictionary *dic = self.dataList[indexPath.row];
  182. if (dic) {
  183. cell.lblValueFeeDirection.text = [dic objectForKey:@"FeeDirectionName"];
  184. cell.lblValueFeeItem.text = [dic objectForKey:@"FeeItemName"];
  185. cell.lblValueStaff.text = [dic objectForKey:@"StaffName"];
  186. cell.lblValueOrg.text = [dic objectForKey:@"OrganizationName"];
  187. NSString *str = [NSString stringWithFormat:@"¥%.2f",[[dic objectForKey:@"FeeSum"]floatValue] ];
  188. cell.lblValueFeeSum.text = str;
  189. str = [NSString stringWithFormat:@"¥%.2f",[[dic objectForKey:@"PaySum"]floatValue]];
  190. cell.lblValuePaySum.text = str;
  191. }
  192. return cell;
  193. }
  194. /**
  195. 单元格选择进入详细界面
  196. @param tableView <#tableView description#>
  197. @param indexPath <#indexPath description#>
  198. */
  199. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  200. {
  201. NSDictionary *dic = self.dataList[indexPath.row];
  202. if(dic != nil)
  203. {
  204. self.hidesBottomBarWhenPushed=YES;
  205. // 格式化日期
  206. DateFormat *df = [DateFormat new];
  207. ExpenseDetailViewController *detailVC = [[ExpenseDetailViewController alloc]init];
  208. detailVC.objectTypeName = [dic objectForKey:@"ObjectTypeName"];
  209. detailVC.feeNo = [dic objectForKey:@"FeeNo"];
  210. detailVC.objectName = [dic objectForKey:@"ObjectName"];
  211. detailVC.accountOrganizationName = [dic objectForKey:@"AccountOrganizationName"];
  212. detailVC.feeDirectionName = [dic objectForKey:@"FeeDirectionName"];
  213. detailVC.feeItemName = [dic objectForKey:@"FeeItemName"];
  214. detailVC.statusName = [dic objectForKey:@"StatusName"];
  215. detailVC.organizationName = [dic objectForKey:@"OrganizationName"];
  216. detailVC.staffName = [dic objectForKey:@"StaffName"];
  217. detailVC.brandName = [dic objectForKey:@"BrandName"];
  218. detailVC.kindName = [dic objectForKey:@"KindName"];
  219. detailVC.seriesName = [dic objectForKey:@"SeriesName"];
  220. detailVC.reversedFeeNo = [dic objectForKey:@"ReversedFeeNo"];
  221. detailVC.feeSum = [NSString stringWithFormat:@"¥%.2f",[[dic objectForKey:@"FeeSum"]floatValue]];
  222. detailVC.confirmFeeSum = [NSString stringWithFormat:@"¥%.2f",[[dic objectForKey:@"ConfirmFeeSum"]floatValue]];
  223. detailVC.businessFunctionName = [dic objectForKey:@"BusinessFunctionName"];
  224. detailVC.invoiceNo = [dic objectForKey:@"InvoiceNo"];
  225. detailVC.customerCode = [dic objectForKey:@"CustomerCode"];
  226. detailVC.customerName = [dic objectForKey:@"CustomerName"];
  227. detailVC.feePayName = [dic objectForKey:@"FeePayName"];
  228. detailVC.paySum = [NSString stringWithFormat:@"¥%.2f",[[dic objectForKey:@"PaySum"]floatValue]];
  229. detailVC.checkUserName = [dic objectForKey:@"CheckUserName"];
  230. detailVC.checkTime = [dic objectForKey:@"CheckTime"];
  231. detailVC.suggestion = [dic objectForKey:@"Suggestion"];
  232. detailVC.remarks = [dic objectForKey:@"Remarks"];
  233. [self.navigationController pushViewController:detailVC animated:YES];
  234. }
  235. }
  236. #pragma mark - 私有函数
  237. /**
  238. 初始化ui
  239. */
  240. - (void)initUI {
  241. CGFloat height = 170;
  242. self.navigationItem.title = @"费用明细表";
  243. self.view.backgroundColor = [UIColor whiteColor];
  244. //分割线
  245. UIView *viewBackgroud = [UIView new];
  246. viewBackgroud.frame = CGRectMake(0, 0, Screen_Width, 0);
  247. viewBackgroud.backgroundColor = LineBackgroundColor;
  248. [self.view addSubview:viewBackgroud];
  249. _vTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, Screen_Width, Screen_Height)];
  250. _vTableView.rowHeight = UITableViewAutomaticDimension;
  251. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  252. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  253. _vTableView.backgroundColor = [UIColor whiteColor];
  254. _vTableView.delegate = self;
  255. _vTableView.dataSource = self;
  256. _vTableView.tableHeaderView = nil;
  257. _noDataView = [self noDataViewByFrame:_vTableView.bounds];
  258. _vTableView.backgroundView =[self backGroundPromptViewByFrame:_vTableView.bounds promptStr:@"请筛选后查询"];
  259. [self.view addSubview:_vTableView];
  260. //头布局
  261. _headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Screen_Width, height)];
  262. UIButton *btnHead = [UIButton buttonWithType:UIButtonTypeCustom];
  263. btnHead.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  264. CGFloat titleHeight = 50;
  265. CGFloat lblx = 20;
  266. CGFloat lblwidth = 130;
  267. CGFloat fontsize = 14;
  268. //CGFloat valuex = 125;
  269. CGFloat valuey = 10;
  270. CGFloat valuewidth = 200;
  271. CGFloat valueheight = 25;
  272. CGFloat heightLine =1;
  273. //总合计 —————————
  274. UIView *vtotal = [UIView new];
  275. vtotal.frame=CGRectMake(0, 0, Screen_Width, titleHeight);
  276. [_headView addSubview:vtotal];
  277. UILabel *lbtotal = [UILabel new];
  278. lbtotal.frame=CGRectMake(lblx, valuey, lblwidth, valueheight);
  279. lbtotal.font = [UIFont boldSystemFontOfSize:fontsize];
  280. lbtotal.text = @"合计";
  281. [vtotal addSubview:lbtotal];
  282. //分割线
  283. viewBackgroud = [UIView new];
  284. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotal.frame), Screen_Width, heightLine);
  285. viewBackgroud.backgroundColor = LineBackgroundColor;
  286. [_headView addSubview:viewBackgroud];
  287. //费用金额 —————————
  288. UIView *vtotalFeeSum = [UIView new];
  289. vtotalFeeSum.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  290. [_headView addSubview:vtotalFeeSum];
  291. UIImageView *imgview = [UIImageView new];
  292. imgview.frame=CGRectMake(lblx, valuey + 5, 21, 16);
  293. [imgview setImage:[UIImage imageNamed:@"discount_amount"]];
  294. [vtotalFeeSum addSubview:imgview];
  295. UILabel *lbtotalReceipt = [UILabel new];
  296. lbtotalReceipt.frame=CGRectMake(CGRectGetMaxX(imgview.frame)+5, valuey, lblwidth, valueheight);
  297. lbtotalReceipt.font = [UIFont systemFontOfSize:fontsize];
  298. lbtotalReceipt.text = @"费用金额";
  299. [vtotalFeeSum addSubview:lbtotalReceipt];
  300. self.lblFeeSum = [UILabel new];
  301. self.lblFeeSum.frame=CGRectMake(Screen_Width - valuewidth - lblx, valuey, valuewidth, valueheight);
  302. self.lblFeeSum.font = [UIFont systemFontOfSize:fontsize];
  303. //lblFeeSum = @"¥0";
  304. self.lblFeeSum.textAlignment = NSTextAlignmentRight;
  305. [vtotalFeeSum addSubview:self.lblFeeSum];
  306. viewBackgroud = [UIView new];
  307. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotalFeeSum.frame), Screen_Width, heightLine);
  308. viewBackgroud.backgroundColor = LineBackgroundColor;
  309. [_headView addSubview:viewBackgroud];
  310. //支付金额 —————————
  311. UIView *vtotalPaySum = [UIView new];
  312. vtotalPaySum.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  313. [_headView addSubview:vtotalPaySum];
  314. UIImageView *imgviewReceivable = [UIImageView new];
  315. imgviewReceivable.frame=CGRectMake(lblx, valuey+1, 20, 20);
  316. [imgviewReceivable setImage:[UIImage imageNamed:@"order_sale_total"]];
  317. [vtotalPaySum addSubview:imgviewReceivable];
  318. UILabel *lbtotalReceivable = [UILabel new];
  319. lbtotalReceivable.frame=CGRectMake(CGRectGetMaxX(imgviewReceivable.frame)+5, valuey, lblwidth, valueheight);
  320. lbtotalReceivable.font = [UIFont systemFontOfSize:fontsize];
  321. lbtotalReceivable.text = @"支付金额";
  322. [vtotalPaySum addSubview:lbtotalReceivable];
  323. self.lblPaySum = [UILabel new];
  324. self.lblPaySum.frame=CGRectMake(Screen_Width - valuewidth - lblx, valuey, valuewidth, valueheight);
  325. self.lblPaySum.font = [UIFont systemFontOfSize:fontsize];
  326. //lblPaySum = @"¥0";
  327. self.lblPaySum.textAlignment = NSTextAlignmentRight;
  328. [vtotalPaySum addSubview:self.lblPaySum];
  329. viewBackgroud = [UIView new];
  330. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotalPaySum.frame), Screen_Width, 10);
  331. viewBackgroud.backgroundColor = LineBackgroundColor;
  332. _headView.frame = CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(vtotalPaySum.frame));
  333. }
  334. /**
  335. 进度条隐藏
  336. */
  337. - (void)cancel {
  338. [self stopLoading];
  339. }
  340. /**
  341. 加载数据
  342. */
  343. - (void)reloadData
  344. {
  345. [self startLoading];
  346. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  347. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  348. [dict setObject:@"GetExpenseDetailIphone" forKey:@"Action"];
  349. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  350. [dict setObject:kkUserCode forKey:@"UserCode"];
  351. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  352. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  353. if(_departmentCode != nil){
  354. [dict setObject:_departmentCode forKey:@"OrganizationCode"];
  355. }
  356. if(_staffName != nil){
  357. [dict setObject:_staffName forKey:@"StaffName"];
  358. }
  359. if (_accountDateFrom != nil) {
  360. [dict setObject:_accountDateFrom forKey:@"AccountDateFrom"];
  361. }
  362. if (_accountDateTo!= nil) {
  363. [dict setObject:_accountDateTo forKey:@"AccountDateTo"];
  364. }
  365. if(_customerCode!=nil)
  366. {
  367. [dict setObject:_customerCode forKey:@"CustomerCode"];
  368. }
  369. if(_customerName!=nil)
  370. {
  371. [dict setObject:_customerName forKey:@"CustomerName"];
  372. }
  373. //创建日期
  374. // if (_createDateFrom != nil) {
  375. // [dict setObject:_createDateFrom forKey:@"CreateTimeFrom"];
  376. // }
  377. // if (_createDateTo != nil) {
  378. // [dict setObject:_createDateTo forKey:@"CreateTimeTo"];
  379. // }
  380. _downManager = [[ASIDownManager alloc] init];
  381. _downManager.delegate = self;
  382. _downManager.onRequestSuccess = @selector(onLoadFinish:);
  383. _downManager.onRequestFail = @selector(onLoadFail:);
  384. [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  385. }
  386. /**
  387. 返回
  388. */
  389. - (void)goBack
  390. {
  391. [self.navigationController popViewControllerAnimated:YES];
  392. }
  393. /**
  394. 导航按钮样式
  395. */
  396. - (void)loadNavStyle
  397. {
  398. //右边
  399. UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 16)];
  400. UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom];
  401. [btnfilter addTarget:self action:@selector(search)
  402. forControlEvents:UIControlEventTouchUpInside];
  403. btnfilter.frame = CGRectMake(0, 0, 16, 16);
  404. [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal];
  405. [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"]
  406. forState:UIControlStateNormal];
  407. [v addSubview:btnfilter];
  408. UIButton *filterLbl = [[UIButton alloc]init];
  409. filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16);
  410. [filterLbl setTitle:@"筛选" forState:UIControlStateNormal];
  411. [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  412. filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
  413. [filterLbl addTarget:self action:@selector(search)
  414. forControlEvents:UIControlEventTouchUpInside];
  415. [v addSubview:filterLbl];
  416. UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v];
  417. self.navigationItem.rightBarButtonItem = menubtnAdd;
  418. //返回
  419. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  420. [button setImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal];
  421. [button addTarget:self action:@selector(goBack)
  422. forControlEvents:UIControlEventTouchUpInside];
  423. button.frame = CGRectMake(0, 0,45,22);
  424. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  425. self.navigationItem.leftBarButtonItem = menuButton;
  426. }
  427. /**
  428. 抽屉弹出
  429. */
  430. - (void)search{
  431. [_filterController show];
  432. }
  433. /**
  434. 抽屉初始化
  435. */
  436. - (void)initSlideSlip{
  437. // 抽屉对象
  438. __weak typeof(self) weakself=self;
  439. self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) {
  440. for (SideSlipModel *model in dataList) {
  441. //selectedItem
  442. model.selectedItemList = nil;
  443. model.customDict = nil;
  444. }
  445. } commitBlock:^(NSArray *dataList) {
  446. // 查询条件
  447. SideSlipModel *serviceRegionModel = dataList[0];
  448. ExpenseSearchModel *m = [serviceRegionModel.customDict objectForKey:EXPENSE_SEARCH_RANGE_MODEL];
  449. self.departmentCode = m.sOrgCode;
  450. self.staffName = m.sStaffName;
  451. self.accountDateFrom = m.accountDateFrom;
  452. self.accountDateTo = m.accountDateTo;
  453. self.customerCode=m.customerCode;
  454. self.customerName=m.customerName;
  455. if(self.accountDateFrom == nil){
  456. self.accountDateFrom = @"";
  457. }
  458. if(self.accountDateTo == nil){
  459. self.accountDateTo = @"";
  460. }
  461. //校验账务时间是否成对选择
  462. if (self.accountDateFrom.length<=0&&self.accountDateTo.length>0) {
  463. [self showAlertViewText:@"请选择账务开始时间"];
  464. return;
  465. }
  466. if (self.accountDateFrom.length>0&&self.accountDateTo.length<=0) {
  467. [self showAlertViewText:@"请选择账务结束时间"];
  468. return;
  469. }
  470. NSUInteger result= [DateFormat compareDate:self.accountDateFrom withDate:self.accountDateTo];
  471. if(result == -1){
  472. [self showAlertViewText:@"账务开始日期不能大于结束日期"];
  473. return;
  474. }
  475. // NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
  476. // [dateFormat setDateFormat:@"yyyy-MM-dd"];//设定时间格式,这里可以设置成自己需要的格式
  477. //
  478. // NSDate *startD = [dateFormat dateFromString:self.accountDateFrom];
  479. // NSDate *endD = [dateFormat dateFromString:self.accountDateTo];
  480. // NSInteger days= [DateFormat calculateDaysFromBegin:startD end:endD];
  481. // if(days > 31){
  482. // [self showAlertViewText:@"日期间隔天数不能大于31天"];
  483. // return;
  484. // }
  485. //创建日期(2019-05-24)
  486. // if(self.createDateFrom == nil){
  487. // self.createDateFrom = @"";
  488. // }
  489. // if(self.createDateTo == nil){
  490. // self.createDateTo = @"";
  491. // }
  492. //
  493. // //校验创建时间是否成对选择
  494. // if (self.createDateFrom.length<=0&&self.createDateTo.length>0) {
  495. // [self showAlertViewText:@"请选择创建开始时间"];
  496. // return;
  497. // }
  498. // if (self.createDateFrom.length>0&&self.createDateTo.length<=0) {
  499. // [self showAlertViewText:@"请选择创建结束时间"];
  500. // return;
  501. // }
  502. // NSUInteger resultCreate = [DateFormat compareDate:self.createDateFrom withDate:self.createDateTo];
  503. // if(resultCreate == -1){
  504. // [self showAlertViewText:@"创建开始日期不能大于结束日期"];
  505. // return;
  506. // }
  507. [weakself.filterController dismiss];
  508. [self reloadData];
  509. }];
  510. _filterController.animationDuration = AnimationDuration;
  511. _filterController.hasHeadView = YES;
  512. _filterController.sideSlipLeading
  513. = UIScreenSideSlipLeading * [UIScreen mainScreen].bounds.size.width;
  514. _filterController.dataList = [self packageDataList];
  515. }
  516. /**
  517. 查询条件数据源
  518. @return <#return value description#>
  519. */
  520. - (NSArray *)packageDataList {
  521. NSMutableArray *dataArray = [NSMutableArray array];
  522. SideSlipModel *model = [[SideSlipModel alloc] init];
  523. model.containerCellClass = @"ExpenseSearchCell";
  524. model.regionTitle = @"查询条件";
  525. [dataArray addObject:model];
  526. return [dataArray mutableCopy];
  527. }
  528. @end