// // CustomerCurrentAccountSummaryReportVC.m // IBOSS // // Created by 关宏厚 on 2021/2/24. // Copyright © 2021 elongtian. All rights reserved. // #import "CustomerCurrentAccountSummaryReportVC.h" #import "DateFormat.h" @interface CustomerCurrentAccountSummaryReportVC () { UIView *headView; UIButton *btnAdvance; UIButton *btnReceivable; UIButton *btnBalance; CAShapeLayer *btnAdvanceMaskLayer; CAShapeLayer *btnBalanceMaskLayer; UIView *advanceView; UIView *receivableView; UIView *balanceTotalView; UIView *totalTitleView; UIView *advanceListTitleView; UIView *advanceListTitleView1; UIView *advanceListTitleView2; NSMutableDictionary *_cellHeight; } @end @implementation CustomerCurrentAccountSummaryReportVC - (void)viewDidLoad { [super viewDidLoad]; _customerCurrentSummaryList=[[NSMutableArray alloc]init]; _customerCurrentSummaryFilterList=[[NSMutableArray alloc]init]; _cellHeight = [[NSMutableDictionary alloc] init]; _startDate=[DateFormat getCurrentDate]; _endDate=[DateFormat getCurrentDate]; [self initSlideSlip]; [self initUI]; [self loadNavStyle]; _advanceFlag=@"1"; _startDate=[DateFormat getCurrentDate]; _endDate=[DateFormat getCurrentDate]; _isFilterZeroAmount=YES; [self startLoading]; [self loadData]; } /** 抽屉初始化 */ - (void)initSlideSlip{ // 抽屉对象 __weak typeof(self) weakself=self; self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) { for (SideSlipModel *model in dataList) { model.selectedItemList = nil; model.customDict = nil; } } commitBlock:^(NSArray *dataList) { // 查询条件 SideSlipModel *model = dataList[0]; self->_currentSummarySearchModel = [model.customDict objectForKey:CUSTOMER_CURRENT_SUMMARY_SEARCH_MODEL]; self->_channelId=self->_currentSummarySearchModel.channelId; self->_organizationCode=self->_currentSummarySearchModel.organizationCode; self->_startDate=self->_currentSummarySearchModel.startDate; self->_endDate=self->_currentSummarySearchModel.endDate; self->_customerCode=self->_currentSummarySearchModel.customerCode; self->_customerName=self->_currentSummarySearchModel.customerName; self->_customerTelephone=self->_currentSummarySearchModel.customerTelephone; self->_customerAddress=self->_currentSummarySearchModel.customerAddress; self->_isFilterZeroAmount=self->_currentSummarySearchModel.isFilterZeroAmount; if(self->_customerCurrentSummaryList!=nil&&self->_customerCurrentSummaryList.count>0) { [self->_customerCurrentSummaryList removeAllObjects]; } if(self->_customerCurrentSummaryFilterList!=nil&&self->_customerCurrentSummaryFilterList.count>0) { [self->_customerCurrentSummaryFilterList removeAllObjects]; [self->_vTableView reloadData]; } [self startLoading]; [self clearData]; [self loadData]; [weakself.filterController dismiss]; }]; _filterController.animationDuration = AnimationDuration; _filterController.hasHeadView = YES; _filterController.sideSlipLeading = 0.1*[UIScreen mainScreen].bounds.size.width; _filterController.dataList = [self packageDataList]; } -(void)clearData { _lblLastDepositReceived.text=@"0.00"; _lblNextDepositReceived.text=@"0.00"; _lblLastAccountReceivable.text=@"0.00"; _lblSalesAmount.text=@"0.00"; _lblRefundAmount.text=@"0.00"; _lblAdjustAmount.text=@"0.00"; _lblVerificationSum.text=@"0.00"; _lblNextAccountReceivable.text=@"0.00"; _lblBalanceAmount.text=@"0.00"; _lblDepositReceivedEarnest.text=@"0.00"; } -(void)initUI { CGFloat topMargin=10; headView=[UIView new]; headView.frame=CGRectMake(0, 0,Screen_Width,0); [headView setBackgroundColor:[UIColor whiteColor]]; [self.view addSubview:headView]; btnAdvance= [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-105-10,topMargin, 70, 25)]; [btnAdvance setTitle:@"预收" forState:UIControlStateNormal]; btnAdvance.tag=1000; [btnAdvance setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; btnAdvance.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [btnAdvance addTarget:self action:@selector(selectAmount:) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:btnAdvance.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.frame = btnAdvance.bounds; maskLayer.path = maskPath.CGPath; btnAdvance.layer.mask = maskLayer; [headView addSubview:btnAdvance]; btnAdvanceMaskLayer = [CAShapeLayer layer]; btnAdvanceMaskLayer.frame = btnAdvance.bounds; btnAdvanceMaskLayer.path = maskPath.CGPath; btnAdvanceMaskLayer.fillColor=[UIColor clearColor].CGColor; btnAdvanceMaskLayer.strokeColor=[UIColor redColor].CGColor; btnAdvanceMaskLayer.lineWidth=1; [btnAdvance.layer addSublayer:btnAdvanceMaskLayer]; btnReceivable = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(btnAdvance.frame),topMargin, 70, 25)]; [btnReceivable setTitle:@"应收" forState:UIControlStateNormal]; btnReceivable.layer.cornerRadius=0; btnReceivable.layer.borderWidth=1; btnReceivable.tag=1001; [btnReceivable addTarget:self action:@selector(selectAmount:) forControlEvents:UIControlEventTouchUpInside]; [btnReceivable setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [btnReceivable.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡 btnReceivable.layer.borderColor=[UIColor lightGrayColor].CGColor; btnReceivable.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [headView addSubview:btnReceivable]; btnBalance= [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(btnReceivable.frame),topMargin, 70, 25)]; [btnBalance setTitle:@"余额" forState:UIControlStateNormal]; btnBalance.tag=1002; btnBalance.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [btnBalance addTarget:self action:@selector(selectAmount:) forControlEvents:UIControlEventTouchUpInside]; [btnBalance setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; UIBezierPath *maskPath2 = [UIBezierPath bezierPathWithRoundedRect:btnBalance.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer2 = [CAShapeLayer layer]; maskLayer2.frame = btnBalance.bounds; maskLayer2.path = maskPath2.CGPath; btnBalance.layer.mask = maskLayer2; [headView addSubview:btnBalance]; btnBalanceMaskLayer = [CAShapeLayer layer]; btnBalanceMaskLayer.frame = btnBalance.bounds; btnBalanceMaskLayer.path = maskPath2.CGPath; btnBalanceMaskLayer.fillColor=[UIColor clearColor].CGColor; btnBalanceMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnBalanceMaskLayer.lineWidth=1; [btnBalance.layer addSublayer:btnBalanceMaskLayer]; totalTitleView = [[UIView alloc]init]; totalTitleView.frame = CGRectMake(0,CGRectGetMaxY(btnAdvance.frame)+topMargin ,Screen_Width, 45); [headView addSubview:totalTitleView]; UIView *totalImgView=[UIImageView new]; totalImgView.frame=CGRectMake(10, 10,10 , 25); [totalImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [totalTitleView addSubview:totalImgView]; UILabel *titleTotal = [[UILabel alloc]init]; titleTotal.frame = CGRectMake(CGRectGetMaxX(totalImgView.frame)+10, 10, 90, 25); titleTotal.text = @"合计"; titleTotal.textColor = [UIColor blackColor]; titleTotal.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [totalTitleView addSubview:titleTotal]; UIView *separator=[UIView new]; separator.frame=CGRectMake(0,totalTitleView.frame.size.height-1, totalTitleView.frame.size.width, 0.5); [separator setBackgroundColor:[UIColor lightGrayColor]]; [totalTitleView addSubview:separator ]; int rowHeight=50; advanceView=[UIView new]; advanceView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame), Screen_Width, 0); [headView addSubview:advanceView]; UIView *lastDepositReceivedView = [[UIView alloc]init]; lastDepositReceivedView.frame = CGRectMake(0,topMargin,Screen_Width/2, rowHeight); _lblLastDepositReceived= [[UILabel alloc]init]; _lblLastDepositReceived.frame = CGRectMake(0, 0,lastDepositReceivedView.frame.size.width, 25); _lblLastDepositReceived.textAlignment=UITextAlignmentCenter; _lblLastDepositReceived.textColor = [UIColor blackColor]; _lblLastDepositReceived.text=@"0.00"; _lblLastDepositReceived.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [lastDepositReceivedView addSubview:_lblLastDepositReceived]; UILabel *lblTitleLastDepositReceived= [[UILabel alloc]init]; lblTitleLastDepositReceived.frame = CGRectMake(0,CGRectGetMaxY(_lblLastDepositReceived.frame),lastDepositReceivedView.frame.size.width, 25); lblTitleLastDepositReceived.text = @"预存期初额"; lblTitleLastDepositReceived.textColor = [UIColor blackColor]; lblTitleLastDepositReceived.textAlignment=UITextAlignmentCenter; lblTitleLastDepositReceived.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [lastDepositReceivedView addSubview:lblTitleLastDepositReceived]; [advanceView addSubview:lastDepositReceivedView]; UIView *middleSeparator=[UIView new]; middleSeparator.frame=CGRectMake(Screen_Width/2,topMargin, 0.5, 50); middleSeparator.backgroundColor=[UIColor lightGrayColor]; [advanceView addSubview:middleSeparator]; //预存余额 UIView *nextDepositReceivedView = [[UIView alloc]init]; nextDepositReceivedView.frame = CGRectMake(Screen_Width/2,topMargin, Screen_Width/2, rowHeight); _lblNextDepositReceived = [[UILabel alloc]init]; _lblNextDepositReceived.frame = CGRectMake(0, 0, nextDepositReceivedView.frame.size.width, 25); _lblNextDepositReceived.textAlignment=UITextAlignmentCenter; _lblNextDepositReceived.text=@"0.00"; _lblNextDepositReceived.textColor = [UIColor blackColor]; _lblNextDepositReceived.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [nextDepositReceivedView addSubview:_lblNextDepositReceived]; UILabel *lblNextDepositReceivedTitle = [[UILabel alloc]init]; lblNextDepositReceivedTitle.frame = CGRectMake(0,CGRectGetMaxY(_lblNextDepositReceived.frame), nextDepositReceivedView.frame.size.width, 25); lblNextDepositReceivedTitle.text = @"预存余额"; lblNextDepositReceivedTitle.textAlignment=UITextAlignmentCenter; lblNextDepositReceivedTitle.textColor = [UIColor blackColor]; lblNextDepositReceivedTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [nextDepositReceivedView addSubview:lblNextDepositReceivedTitle]; [advanceView addSubview:nextDepositReceivedView]; advanceListTitleView = [[UIView alloc]init]; advanceListTitleView.frame = CGRectMake(0,CGRectGetMaxY(lastDepositReceivedView.frame)+topMargin ,Screen_Width, 45); [advanceView addSubview:advanceListTitleView]; UIView *advanceListImgView=[UIImageView new]; advanceListImgView.frame=CGRectMake(10, 10,10 , 25); [advanceListImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [advanceListTitleView addSubview:advanceListImgView]; UILabel *titleAdvanceList = [[UILabel alloc]init]; titleAdvanceList.frame = CGRectMake(CGRectGetMaxX(advanceListImgView.frame)+10, 10, 90, 25); titleAdvanceList.text = @"列表"; titleAdvanceList.textColor = [UIColor blackColor]; titleAdvanceList.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [advanceListTitleView addSubview:titleAdvanceList]; advanceView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(advanceView.frame)); advanceView.hidden=NO; receivableView=[UIView new]; receivableView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame), Screen_Width, 0); [headView addSubview:receivableView]; UIView *lastAccountReceivableView = [[UIView alloc]init]; lastAccountReceivableView.frame = CGRectMake(0,10,Screen_Width/2, rowHeight); _lblLastAccountReceivable= [[UILabel alloc]init]; _lblLastAccountReceivable.frame = CGRectMake(0, 0,lastAccountReceivableView.frame.size.width, 25); _lblLastAccountReceivable.textAlignment=UITextAlignmentCenter; _lblLastAccountReceivable.textColor = [UIColor blackColor]; _lblLastAccountReceivable.text=@"0.00"; _lblLastAccountReceivable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [lastAccountReceivableView addSubview:_lblLastAccountReceivable]; UILabel *lblTitleLastAccountReceivable= [[UILabel alloc]init]; lblTitleLastAccountReceivable.frame = CGRectMake(0,CGRectGetMaxY(_lblLastAccountReceivable.frame),lastAccountReceivableView.frame.size.width, 25); lblTitleLastAccountReceivable.text = @"应收期初额"; lblTitleLastAccountReceivable.textColor = [UIColor blackColor]; lblTitleLastAccountReceivable.textAlignment=UITextAlignmentCenter; lblTitleLastAccountReceivable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [lastAccountReceivableView addSubview:lblTitleLastAccountReceivable]; [receivableView addSubview:lastAccountReceivableView]; UIView *refundAmountView = [[UIView alloc]init]; refundAmountView.frame = CGRectMake(0,CGRectGetMaxY(lastAccountReceivableView.frame)+10, Screen_Width/2, rowHeight); [receivableView addSubview:refundAmountView]; _lblRefundAmount = [[UILabel alloc]init]; _lblRefundAmount.frame = CGRectMake(0, 0,refundAmountView.frame.size.width, 25); _lblRefundAmount.textAlignment=UITextAlignmentCenter; _lblRefundAmount.textColor = [UIColor blackColor]; _lblRefundAmount.text=@"0.00"; _lblRefundAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [refundAmountView addSubview:_lblRefundAmount]; UILabel *lblTitleRefundAmount = [[UILabel alloc]init]; lblTitleRefundAmount.frame = CGRectMake(0, CGRectGetMaxY(_lblRefundAmount.frame),refundAmountView.frame.size.width , 25); lblTitleRefundAmount.text = @"回款额"; lblTitleRefundAmount.textAlignment=UITextAlignmentCenter; lblTitleRefundAmount.textColor = [UIColor blackColor]; lblTitleRefundAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [refundAmountView addSubview:lblTitleRefundAmount]; UIView *verificationAmountView = [[UIView alloc]init]; verificationAmountView.frame = CGRectMake(0,CGRectGetMaxY(refundAmountView.frame)+10, Screen_Width/2, rowHeight); [receivableView addSubview:verificationAmountView]; _lblVerificationSum = [[UILabel alloc]init]; _lblVerificationSum.frame = CGRectMake(0, 0,verificationAmountView.frame.size.width, 25); _lblVerificationSum.textAlignment=UITextAlignmentCenter; _lblVerificationSum.textColor = [UIColor blackColor]; _lblVerificationSum.text=@"0.00"; _lblVerificationSum.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [verificationAmountView addSubview:_lblVerificationSum]; UILabel *lblTitleVerificationSum = [[UILabel alloc]init]; lblTitleVerificationSum.frame = CGRectMake(0, CGRectGetMaxY(_lblVerificationSum.frame),verificationAmountView.frame.size.width , 25); lblTitleVerificationSum.text = @"核销额"; lblTitleVerificationSum.textAlignment=UITextAlignmentCenter; lblTitleVerificationSum.textColor = [UIColor blackColor]; lblTitleVerificationSum.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [verificationAmountView addSubview:lblTitleVerificationSum]; UIView *middleSeparator1=[UIView new]; middleSeparator1.frame=CGRectMake(Screen_Width/2, 10, 0.5, 150); middleSeparator1.backgroundColor=[UIColor lightGrayColor]; [receivableView addSubview:middleSeparator1]; UIView *salesAmountView = [[UIView alloc]init]; salesAmountView.frame = CGRectMake(Screen_Width/2,10, Screen_Width/2, rowHeight); _lblSalesAmount = [[UILabel alloc]init]; _lblSalesAmount.frame = CGRectMake(0, 0, salesAmountView.frame.size.width, 25); _lblSalesAmount.textAlignment=UITextAlignmentCenter; _lblSalesAmount.text=@"0.00"; _lblSalesAmount.textColor = [UIColor blackColor]; _lblSalesAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [salesAmountView addSubview:_lblSalesAmount]; UILabel *lblSalesAmountTitle = [[UILabel alloc]init]; lblSalesAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(_lblSalesAmount.frame), salesAmountView.frame.size.width, 25); lblSalesAmountTitle.text = @"销售额"; lblSalesAmountTitle.textAlignment=UITextAlignmentCenter; lblSalesAmountTitle.textColor = [UIColor blackColor]; lblSalesAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [salesAmountView addSubview:lblSalesAmountTitle]; [receivableView addSubview:salesAmountView]; UIView *adjustAmountView = [[UIView alloc]init]; adjustAmountView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(salesAmountView.frame)+10, Screen_Width/2, rowHeight); _lblAdjustAmount = [[UILabel alloc]init]; _lblAdjustAmount.frame = CGRectMake(0, 0, adjustAmountView.frame.size.width, 25); _lblAdjustAmount.textAlignment=UITextAlignmentCenter; _lblAdjustAmount.text=@"0.00"; _lblAdjustAmount.textColor = [UIColor blackColor]; _lblAdjustAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [adjustAmountView addSubview:_lblAdjustAmount]; UILabel *lblAdjustAmountTitle = [[UILabel alloc]init]; lblAdjustAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(_lblAdjustAmount.frame), adjustAmountView.frame.size.width, 25); lblAdjustAmountTitle.text = @"调账额"; lblAdjustAmountTitle.textAlignment=UITextAlignmentCenter; lblAdjustAmountTitle.textColor = [UIColor blackColor]; lblAdjustAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [adjustAmountView addSubview:lblAdjustAmountTitle]; [receivableView addSubview:adjustAmountView]; UIView *nextAccountReceivableView = [[UIView alloc]init]; nextAccountReceivableView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(adjustAmountView.frame)+10, Screen_Width/2, rowHeight); _lblNextAccountReceivable = [[UILabel alloc]init]; _lblNextAccountReceivable.frame = CGRectMake(0, 0, nextAccountReceivableView.frame.size.width, 25); _lblNextAccountReceivable.textAlignment=UITextAlignmentCenter; _lblNextAccountReceivable.text=@"0.00"; _lblNextAccountReceivable.textColor = [UIColor blackColor]; _lblNextAccountReceivable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [nextAccountReceivableView addSubview:_lblNextAccountReceivable]; UILabel *lblNextAccountReceivableTitle = [[UILabel alloc]init]; lblNextAccountReceivableTitle.frame = CGRectMake(0,CGRectGetMaxY(_lblNextAccountReceivable.frame), nextAccountReceivableView.frame.size.width, 25); lblNextAccountReceivableTitle.text = @"期末应收"; lblNextAccountReceivableTitle.textAlignment=UITextAlignmentCenter; lblNextAccountReceivableTitle.textColor = [UIColor blackColor]; lblNextAccountReceivableTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [nextAccountReceivableView addSubview:lblNextAccountReceivableTitle]; [receivableView addSubview:nextAccountReceivableView]; advanceListTitleView1 = [[UIView alloc]init]; advanceListTitleView1.frame = CGRectMake(0,CGRectGetMaxY(nextAccountReceivableView.frame)+topMargin ,Screen_Width, 45); [receivableView addSubview:advanceListTitleView1]; advanceListImgView=[UIImageView new]; advanceListImgView.frame=CGRectMake(10, 10,10 , 25); [advanceListImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [advanceListTitleView1 addSubview:advanceListImgView]; titleAdvanceList = [[UILabel alloc]init]; titleAdvanceList.frame = CGRectMake(CGRectGetMaxX(advanceListImgView.frame)+10, 10, 90, 25); titleAdvanceList.text = @"列表"; titleAdvanceList.textColor = [UIColor blackColor]; titleAdvanceList.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [advanceListTitleView1 addSubview:titleAdvanceList]; receivableView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView1.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(receivableView.frame)); receivableView.hidden=YES; balanceTotalView=[UIView new]; balanceTotalView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame), Screen_Width, 0); [headView addSubview:balanceTotalView]; UIView *balanceView = [[UIView alloc]init]; balanceView.frame = CGRectMake(0,10,Screen_Width/2, rowHeight); _lblBalanceAmount= [[UILabel alloc]init]; _lblBalanceAmount.frame = CGRectMake(0, 0,balanceView.frame.size.width, 25); _lblBalanceAmount.textAlignment=UITextAlignmentCenter; _lblBalanceAmount.textColor = [UIColor blackColor]; _lblBalanceAmount.text=@"0.00"; _lblBalanceAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [balanceView addSubview:_lblBalanceAmount]; UILabel *lblTitleBalanceAmount= [[UILabel alloc]init]; lblTitleBalanceAmount.frame = CGRectMake(0,CGRectGetMaxY(_lblBalanceAmount.frame),balanceView.frame.size.width, 25); lblTitleBalanceAmount.text = @"余额"; lblTitleBalanceAmount.textColor = [UIColor blackColor]; lblTitleBalanceAmount.textAlignment=UITextAlignmentCenter; lblTitleBalanceAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [balanceView addSubview:lblTitleBalanceAmount]; [balanceTotalView addSubview:balanceView]; UIView *middleSeparator2=[UIView new]; middleSeparator2.frame=CGRectMake(Screen_Width/2, 10, 0.5, 50); middleSeparator2.backgroundColor=[UIColor lightGrayColor]; [balanceTotalView addSubview:middleSeparator2]; // //未用定金 UIView *depositReceivedEarnestView = [[UIView alloc]init]; depositReceivedEarnestView.frame = CGRectMake(Screen_Width/2,10, Screen_Width/2, rowHeight); _lblDepositReceivedEarnest = [[UILabel alloc]init]; _lblDepositReceivedEarnest.frame = CGRectMake(0, 0, depositReceivedEarnestView.frame.size.width, 25); _lblDepositReceivedEarnest.textAlignment=UITextAlignmentCenter; _lblDepositReceivedEarnest.text=@"0.00"; _lblDepositReceivedEarnest.textColor = [UIColor blackColor]; _lblDepositReceivedEarnest.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [depositReceivedEarnestView addSubview:_lblDepositReceivedEarnest]; UILabel *lblDepositReceivedEarnestTitle = [[UILabel alloc]init]; lblDepositReceivedEarnestTitle.frame = CGRectMake(0,CGRectGetMaxY(_lblDepositReceivedEarnest.frame), depositReceivedEarnestView.frame.size.width, 25); lblDepositReceivedEarnestTitle.text = @"未用定金"; lblDepositReceivedEarnestTitle.textAlignment=UITextAlignmentCenter; lblDepositReceivedEarnestTitle.textColor = [UIColor blackColor]; lblDepositReceivedEarnestTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize16]; [depositReceivedEarnestView addSubview:lblDepositReceivedEarnestTitle]; [balanceTotalView addSubview:depositReceivedEarnestView]; advanceListTitleView2 = [[UIView alloc]init]; advanceListTitleView2.frame = CGRectMake(0,CGRectGetMaxY(depositReceivedEarnestView.frame)+topMargin ,Screen_Width, 45); [balanceTotalView addSubview:advanceListTitleView2]; advanceListImgView=[UIImageView new]; advanceListImgView.frame=CGRectMake(10, 10,10 , 25); [advanceListImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [advanceListTitleView2 addSubview:advanceListImgView]; titleAdvanceList = [[UILabel alloc]init]; titleAdvanceList.frame = CGRectMake(CGRectGetMaxX(advanceListImgView.frame)+10, 10, 90, 25); titleAdvanceList.text = @"列表"; titleAdvanceList.textColor = [UIColor blackColor]; titleAdvanceList.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [advanceListTitleView2 addSubview:titleAdvanceList]; balanceTotalView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView2.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(balanceTotalView.frame)); balanceTotalView.hidden=YES; _vTableView=[[UITableView alloc]init]; _vTableView.frame=CGRectZero; _vTableView.separatorStyle=UITableViewCellSeparatorStyleNone; _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight; _vTableView.dataSource=self; _vTableView.delegate = self; [self.view addSubview:_vTableView]; } -(void)selectAmount:(UIButton*)sender { [self changeButtonColor]; if(_customerCurrentSummaryFilterList!=nil&&_customerCurrentSummaryFilterList.count>0) { [_customerCurrentSummaryFilterList removeAllObjects]; [_vTableView reloadData]; } NSArray *customerCurrentSummaryFilterTempList= [_customerCurrentSummaryList subarrayWithRange:NSMakeRange(0, _customerCurrentSummaryList.count)]; [_customerCurrentSummaryFilterList removeAllObjects]; [_customerCurrentSummaryFilterList addObjectsFromArray:customerCurrentSummaryFilterTempList]; if(sender.tag==1000) { btnAdvanceMaskLayer.strokeColor=[UIColor redColor].CGColor; btnAdvance.layer.borderColor=[UIColor redColor].CGColor; [btnAdvance setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; _advanceFlag=@"1"; advanceView.hidden=NO; receivableView.hidden=YES; balanceTotalView.hidden=YES; advanceView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(advanceView.frame)); _vTableView.frame=CGRectMake(0,CGRectGetMaxY(headView.frame)+5, self.view.frame.size.width, self.view.frame.size.height-CGRectGetMaxY(headView.frame)); [_vTableView reloadData]; } if(sender.tag==1001) { _advanceFlag=@"2"; btnReceivable.layer.borderColor=[UIColor redColor].CGColor; [btnReceivable setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; advanceView.hidden=YES; receivableView.hidden=NO; balanceTotalView.hidden=YES; receivableView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView1.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(receivableView.frame)); _vTableView.frame=CGRectMake(0,CGRectGetMaxY(headView.frame)+5, self.view.frame.size.width, self.view.frame.size.height-CGRectGetMaxY(headView.frame)); [_vTableView reloadData]; } if(sender.tag==1002) { _advanceFlag=@"3"; btnBalanceMaskLayer.strokeColor=[UIColor redColor].CGColor; btnBalance.layer.borderColor=[UIColor redColor].CGColor; [btnBalance setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; advanceView.hidden=YES; receivableView.hidden=YES; balanceTotalView.hidden=NO; balanceTotalView.frame=CGRectMake(0, CGRectGetMaxY(totalTitleView.frame),Screen_Width,CGRectGetMaxY(advanceListTitleView2.frame)); headView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(balanceTotalView.frame)); _vTableView.frame=CGRectMake(0,CGRectGetMaxY(headView.frame)+5, self.view.frame.size.width, self.view.frame.size.height-CGRectGetMaxY(headView.frame)); [_vTableView reloadData]; } } -(void)changeButtonColor { btnAdvanceMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnAdvance.layer.borderColor=[UIColor lightGrayColor].CGColor; btnReceivable.layer.borderColor=[UIColor lightGrayColor].CGColor; btnBalanceMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnBalance.layer.borderColor=[UIColor lightGrayColor].CGColor; [btnAdvance setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [btnReceivable setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [btnBalance setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; } /** 导航按钮样式 */ - (void)loadNavStyle { self.navigationItem.title = @"客户往来账汇总表"; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(0, 0,45,22); UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.leftBarButtonItem = menuButton; // 右边 UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 12)]; UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom]; [btnfilter addTarget:self action:@selector(search) forControlEvents:UIControlEventTouchUpInside]; btnfilter.frame = CGRectMake(0, 0,16, 16); [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal]; [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"] forState:UIControlStateNormal]; [v addSubview:btnfilter]; UIButton *filterLbl = [[UIButton alloc]init]; filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16); [filterLbl setTitle:@"筛选" forState:UIControlStateNormal]; [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize]; [filterLbl addTarget:self action:@selector(search) forControlEvents:UIControlEventTouchUpInside]; [v addSubview:filterLbl]; UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v]; self.navigationItem.rightBarButtonItem = menubtnAdd; } -(void)search { [_filterController show]; } /** 数据源 @return <#return value description#> */ - (NSArray *)packageDataList { NSMutableArray *dataArray = [NSMutableArray array]; SideSlipModel *model = [[SideSlipModel alloc] init]; model.containerCellClass = @"CustomerCurrentAccountSummarySearchCell"; model.regionTitle = @"查询条件"; [dataArray addObject:model]; return [dataArray mutableCopy]; } -(void)loadData { NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetCustomerSummary" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:@"0" forKey:@"CustomerID"]; [dict setObject:_customerCode forKeyedSubscript:@"CustomerCode"]; [dict setObject:_customerName forKeyedSubscript:@"CustomerName"]; [dict setObject:_startDate forKeyedSubscript:@"AccountDateFrom"]; [dict setObject:_endDate forKeyedSubscript:@"AccountDateTo"]; [dict setObject:_customerTelephone forKeyedSubscript:@"Telephone"]; [dict setObject:_customerAddress forKeyedSubscript:@"Address"]; [dict setObject:_channelId forKeyedSubscript:@"ChannelID"]; [dict setObject:_isFilterZeroAmount?@ "1":@"0" forKeyedSubscript:@"FilterZero"]; [dict setObject:_organizationCode forKeyedSubscript:@"OrganizationCode"]; _downManager = [[ASIDownManager alloc] init]; _downManager.delegate = self; _downManager.onRequestSuccess = @selector(onDataLoadFinish:); _downManager.onRequestFail = @selector(onDataLoadFail:); [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil]; } -(void)onDataLoadFinish:(ASIDownManager*)sender { // 服务器返回数据 RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; [self stopLoading]; // 服务器返回数据状态值 int iStatus = resultModel.status; // 服务器返回数据消息 NSString *message = resultModel.message; if (iStatus == 0) { NSDictionary *dic=(NSDictionary*)resultModel.result; NSArray *resultArray= [dic objectForKey:@"Table"]; if(resultArray!=nil&&resultArray.count>0) { double totalLastDepositReceived=0; double totalNextDepositReceived=0; double totalLastAccountReceivable=0; double totalRefundAmount=0; double totalVerificationSum=0; double totalSalesAmount=0; double totalAdjustAmount=0; double totalNextAccountReceivable =0; double totalBalance=0; double totalDepositReceivedEarnest = 0.0; for(int i=0;i @param section <#section description#> @return <#return value description#> */ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _customerCurrentSummaryFilterList.count; } /** tableview的分区数 @param tableView <#tableView description#> @return <#return value description#> */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } /** 获取tableview cell @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"CurrentSummaryCellId"; CustomerCurrentListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[CustomerCurrentListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; cell.selectionStyle=UITableViewCellSelectionStyleNone; } else //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免 { while ([cell.contentView.subviews lastObject] != nil) { [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview]; } } NSUInteger row = [indexPath row]; CustomerCurrentSummaryListModel *summaryListModel = [_customerCurrentSummaryFilterList objectAtIndex:row]; [cell setCustomerCurrentListCell:summaryListModel advanceFlag:_advanceFlag]; _cellHeight[@(indexPath.row)] = @(cell.cellHeight); return cell; } /** 预防高度 @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ -(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 250; } /** tableview的高度 @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return [_cellHeight[@(indexPath.row)] floatValue]; } @end