// // StatisticsDataAnalysisVC.m // IBOSS-HJ // // Created by 关宏厚 on 2020/12/7. // Copyright © 2020 elongtian. All rights reserved. // #import "StatisticsDataAnalysisVC.h" #import "DateFormat.h" #import "Util.h" #import "MyView.h" #import "StatisticsDataAnalysisDetailVC.h" @interface StatisticsDataAnalysisVC () { NSMutableArray *salesIncomeYValues; NSMutableArray *salesProfitTitleArray; UIScrollView *scroll; UIView *content; UIView *salesProfitContent; UIView *currencyCapitalContent; UIView *currentSituationContent; UIView *payableContent; UIView *inventoryStatusContent; UIView *paymentFeesStatusContent; MyView *procurementStatusV; UIView *procurementSituationContent; UIView *titleView; UIView *debtSumView; UIView *depositAmountView; UIView *netMoneyInflowView; NSMutableArray *assetDebtyValues; NSMutableArray *netMoneyValues; NSMutableArray *receivableTitleArray; NSMutableArray *receivableXTitleArray; NSMutableArray *procurementStatusXTitleArray; NSMutableArray *procurementStatusTitleArray; NSMutableArray *inventoryAmountArray; NSMutableArray *inventoryQuantityArray; NSMutableArray *procurementStatusYArray; NSMutableArray *salesIncomeTitleArray; NSMutableArray *advancePaymentTitleArray; NSMutableArray *payableXTitleArray; NSMutableArray *inventoryTitleArray; NSMutableArray *paymentFeesXArray; NSMutableArray *paymentFeesYArray; NSMutableArray *paymentFeesYIdArray; NSMutableArray *accountArray; NSArray *fncArray; NSMutableArray *receivablesValuesArray; NSMutableArray *advancePaymentValuesArray; NSInteger height; NSInteger innerheight; NSString *accountId; NSString *accountCode; NSInteger topMargin; UILabel *lblNetProfitRate; UILabel *lblSalesIncome; UILabel *lblSalesCost; UILabel *lblFeeAmount; UILabel *lblNetProfit; UILabel *lblSalesMargin; UILabel *lblGrossProfitMargin; UILabel *lblMonetoryCapitalAmount; UILabel *lblCashInHand; UILabel *lblBankDeposit; UILabel *lblNetMoneyInflow; UILabel *lblReceivablesAmount; UILabel *lblDepositAmount; UILabel *lblAdvancePayment; UILabel *lblAccountsPayable; UILabel *lblAdvancePaymentAmount; UILabel *lblOtherMonetoryCaiptal; UILabel *lblReceivablesAdvanceDeposit; UILabel *lblInventoryAmount; UILabel *lblInventoryQuantity; UILabel *lblTitleInventoryAmount; UILabel *lblInventoryQuantityTitle; UILabel *lblPlanAmount; UILabel *lblProcuremmentPercent; UILabel *lblProcurementAmount; NSString *typeId; NSString *moneytoryAssetsDate; NSString *procurementStatusDate; NSString *paymentFeesDate; UIButton *btnFncAccount; UIView *advancePayment; UIView *netProfitRateView; CAShapeLayer *btnCustomMaskLayer; CAShapeLayer *btnRecentlyThirtyDaysMaskLayer; CAShapeLayer *btnChannelMaskLayer; CAShapeLayer *btnDepartmentMaskLayer; CAShapeLayer *moneytoryCapitalMaskLayer; CAShapeLayer *moneytoryCapitalCurrentMonthMaskLayer; CAShapeLayer *currentSituationChannelMaskLayer; CAShapeLayer *currentSituationDepartmentMaskLayer; CAShapeLayer *procurementCustomMonthMaskLayer; CAShapeLayer *procurementCurrentMonthMaskLayer; CAShapeLayer *paymentFeesCustomMonthMaskLayer; CAShapeLayer *paymentFeesCurrentMonthMaskLayer; UIView *netProfitContent; UILabel *lblFeesTotalAmount; int count; UIView *vDate; CustomBorderView *salesProfitBorderV; CustomBorderView *currencyCapitalBorderV; CustomBorderView *currentSituationBorderV; CustomBorderView *payableBorderV; CustomBorderView *procurementStatusPieBorderV; CustomBorderView *procurementStatusChartBorderV; CustomBorderView *inventoryStatusBorderV; CustomBorderView *paymentBorderV; int borderLineWidth; } @end @implementation StatisticsDataAnalysisVC - (void)viewDidLoad { [super viewDidLoad]; [self loadNavStyle]; typeId=@"0"; count=0; topMargin=15; borderLineWidth=1; salesIncomeYValues=[[NSMutableArray alloc]init]; accountArray=[[NSMutableArray alloc]init]; salesProfitTitleArray=[[NSMutableArray alloc]init]; receivablesValuesArray=[[NSMutableArray alloc]init]; receivableXTitleArray=[[NSMutableArray alloc]init]; procurementStatusTitleArray=[[NSMutableArray alloc]init]; [procurementStatusTitleArray addObject:@"计划额"]; [procurementStatusTitleArray addObject:@"完成额"]; advancePaymentValuesArray=[[NSMutableArray alloc]init]; procurementStatusYArray=[[NSMutableArray alloc]init]; payableXTitleArray=[[NSMutableArray alloc]init]; assetDebtyValues=[[NSMutableArray alloc]init]; [assetDebtyValues addObject:[NSNumber numberWithDouble:5760392.95]]; [assetDebtyValues addObject:[NSNumber numberWithDouble:1922981.77]]; netMoneyValues=[[NSMutableArray alloc]init]; procurementStatusXTitleArray=[[NSMutableArray alloc]init]; receivableTitleArray=[[NSMutableArray alloc]init]; [receivableTitleArray addObject:@"应收款"]; [receivableTitleArray addObject:@"预收款"]; salesIncomeTitleArray=[[NSMutableArray alloc]init]; [salesIncomeTitleArray addObject:@"销售收入金额"]; [salesIncomeTitleArray addObject:@"销售成本"]; [salesIncomeTitleArray addObject:@"费用金额"]; advancePaymentTitleArray=[[NSMutableArray alloc]init]; [advancePaymentTitleArray addObject:@"应付款"]; [advancePaymentTitleArray addObject:@"预付款"]; inventoryTitleArray=[[NSMutableArray alloc]init]; inventoryAmountArray=[[NSMutableArray alloc]init]; inventoryQuantityArray=[[NSMutableArray alloc]init]; paymentFeesXArray=[[NSMutableArray alloc]init]; paymentFeesYArray=[[NSMutableArray alloc]init]; paymentFeesYIdArray=[[NSMutableArray alloc]init]; _salesProfitStartDate =[DateFormat getCurrentDate]; _salesProfitEndDate=[DateFormat getCurrentDate]; moneytoryAssetsDate=[DateFormat getCurrentNoSeparateMonth]; procurementStatusDate=[DateFormat getCurrentNoSeparateMonth]; paymentFeesDate=[DateFormat getCurrentNoSeparateMonth]; [self initUI]; [self startLoading]; [self asyncConcurrent]; } #pragma mark - 私有函数 /** 初始化UI */ -(void)initUI { // titleView = [[UIView alloc]init]; // titleView.backgroundColor = NavigationBarTintColor; // titleView.frame = CGRectMake(0, 0, Screen_Width, 40); // UILabel *titleCustom = [[UILabel alloc]init]; // titleCustom.frame = CGRectMake(Screen_Width/4-35, 10, 70, 25); // titleCustom.text = @"自定义"; // titleCustom.textColor = [UIColor whiteColor]; // titleCustom.font = [UIFont systemFontOfSize:16]; // [titleView addSubview:titleCustom]; // [self.view addSubview:titleView]; // UIImageView *customImgView=[UIImageView new]; // customImgView.frame=CGRectMake(CGRectGetMaxX(titleCustom.frame), 10, 25, 25); // [customImgView setImage:[UIImage imageNamed:@"drop_down"]]; // [titleView addSubview:customImgView]; // UIView *separatorView=[UIView new]; // separatorView.frame=CGRectMake(Screen_Width/2, 10,2,20); // [separatorView setBackgroundColor:[UIColor lightGrayColor]]; // [titleView addSubview:separatorView]; // // UILabel *titleAll = [[UILabel alloc]init]; // titleAll.frame = CGRectMake(Screen_Width/4*3, 10, 50, 25); // titleAll.text = @"全部"; // titleAll.textColor = [UIColor whiteColor]; // titleAll.font = [UIFont systemFontOfSize:16]; // [titleView addSubview:titleAll]; // // UIImageView *customImgView1=[UIImageView new]; // customImgView1.frame=CGRectMake(CGRectGetMaxX(titleAll.frame), 10, 25, 25); // [customImgView1 setImage:[UIImage imageNamed:@"drop_down"]]; // [titleView addSubview:customImgView1]; int rowHeight=50; height=0; content=[UIView new]; content.frame=CGRectMake(0, 0,Screen_Width,0); scroll=[[UIScrollView alloc]init]; scroll.frame=CGRectMake(0,0, Screen_Width, Screen_Height); [self.view addSubview:scroll]; [scroll addSubview:content]; if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_SALES_PROFIT_IPHONE].location!=NSNotFound){ salesProfitContent=[UIView new]; salesProfitContent.frame=CGRectMake(10, 10,Screen_Width,0); salesProfitContent.backgroundColor=[UIColor whiteColor]; [content addSubview:salesProfitContent]; UIView *profitTitleView = [[UIView alloc]init]; profitTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45); UIView *profitView=[UIImageView new]; profitView.frame=CGRectMake(10, 10,10 , 25); [profitView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [profitTitleView addSubview:profitView]; UILabel *titleProfit = [[UILabel alloc]init]; titleProfit.frame = CGRectMake(CGRectGetMaxX(profitView.frame)+10, 10, 100, 25); titleProfit.text = @"销售利润"; titleProfit.textColor = [UIColor blackColor]; titleProfit.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [profitTitleView addSubview:titleProfit]; [salesProfitContent addSubview:profitTitleView]; UIView *separator=[UIView new]; separator.frame=CGRectMake(0,profitTitleView.frame.size.height-1, profitTitleView.frame.size.width-20, 0.5); [separator setBackgroundColor:[UIColor lightGrayColor]]; [profitTitleView addSubview:separator ]; _btnCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-175-10,CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)]; [_btnCustom setTitle:@"自定义" forState:UIControlStateNormal]; [_btnCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnCustom.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [_btnCustom addTarget:self action:@selector(selectCustomDateData) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_btnCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.frame = _btnCustom.bounds; maskLayer.path = maskPath.CGPath; _btnCustom.layer.mask = maskLayer; [salesProfitContent addSubview:_btnCustom]; btnCustomMaskLayer = [CAShapeLayer layer]; btnCustomMaskLayer.frame = _btnCustom.bounds; btnCustomMaskLayer.path = maskPath.CGPath; btnCustomMaskLayer.fillColor=[UIColor clearColor].CGColor; btnCustomMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnCustomMaskLayer.lineWidth=1; [_btnCustom.layer addSublayer:btnCustomMaskLayer]; _btnYesterday = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnCustom.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)]; [_btnYesterday setTitle:[DateFormat getDateBefore:1] forState:UIControlStateNormal]; _btnYesterday.layer.cornerRadius=0; _btnYesterday.layer.borderWidth=1; [_btnYesterday addTarget:self action:@selector(selectYesterdayDateData) forControlEvents:UIControlEventTouchUpInside]; [_btnYesterday setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [_btnYesterday.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡 _btnYesterday.layer.borderColor=[UIColor lightGrayColor].CGColor; _btnYesterday.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [salesProfitContent addSubview:_btnYesterday]; _btnToday = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnYesterday.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)]; [_btnToday setTitle: [DateFormat getCurrentDate]forState:UIControlStateNormal]; _btnToday.layer.cornerRadius=0; _btnToday.layer.borderWidth=1; _btnToday.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [_btnToday addTarget:self action:@selector(selectTodayDateData) forControlEvents:UIControlEventTouchUpInside]; [_btnToday setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [_btnToday.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡 _btnToday.layer.borderColor=[UIColor redColor].CGColor; [salesProfitContent addSubview:_btnToday]; _btnRecentlySevenDays = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnToday.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)]; [_btnRecentlySevenDays setTitle:@"近7天" forState:UIControlStateNormal]; _btnRecentlySevenDays.titleLabel.font = [UIFont systemFontOfSize: 10.0]; _btnRecentlySevenDays.layer.cornerRadius=0; _btnRecentlySevenDays.layer.borderWidth=1; [_btnRecentlySevenDays addTarget:self action:@selector(selectSevenDaysData) forControlEvents:UIControlEventTouchUpInside]; [_btnRecentlySevenDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [_btnRecentlySevenDays.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡 _btnRecentlySevenDays.layer.borderColor=[UIColor lightGrayColor].CGColor; [salesProfitContent addSubview:_btnRecentlySevenDays]; _btnRecentlyThirtyDays = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnRecentlySevenDays.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)]; [_btnRecentlyThirtyDays setTitle:@"近30天" forState:UIControlStateNormal]; _btnRecentlyThirtyDays.titleLabel.font = [UIFont systemFontOfSize: 10.0]; [_btnRecentlyThirtyDays addTarget:self action:@selector(selectThirtyDaysData) forControlEvents:UIControlEventTouchUpInside]; [_btnRecentlyThirtyDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; UIBezierPath *maskPath2 = [UIBezierPath bezierPathWithRoundedRect:_btnRecentlyThirtyDays.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer2 = [CAShapeLayer layer]; maskLayer2.frame = _btnRecentlyThirtyDays.bounds; maskLayer2.path = maskPath2.CGPath; _btnRecentlyThirtyDays.layer.mask = maskLayer2; [salesProfitContent addSubview:_btnRecentlyThirtyDays]; btnRecentlyThirtyDaysMaskLayer = [CAShapeLayer layer]; btnRecentlyThirtyDaysMaskLayer.frame = _btnRecentlyThirtyDays.bounds; btnRecentlyThirtyDaysMaskLayer.path = maskPath2.CGPath; btnRecentlyThirtyDaysMaskLayer.fillColor=[UIColor clearColor].CGColor; btnRecentlyThirtyDaysMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnRecentlyThirtyDaysMaskLayer.lineWidth=1; [_btnRecentlyThirtyDays.layer addSublayer:btnRecentlyThirtyDaysMaskLayer]; vDate =[UIView new]; vDate.frame=CGRectMake(0, CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, 0); [salesProfitContent addSubview:vDate]; vDate.hidden=YES; _btnSalesProfitStartDate = [UIButton buttonWithType:UIButtonTypeCustom]; [_btnSalesProfitStartDate setTitle:_salesProfitStartDate forState:UIControlStateNormal]; [_btnSalesProfitStartDate setBackgroundColor:[UIColor whiteColor]]; [_btnSalesProfitStartDate setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnSalesProfitStartDate.titleLabel.font= [UIFont systemFontOfSize:14]; [_btnSalesProfitStartDate addTarget:self action:@selector(btnSelectStartDate) forControlEvents:UIControlEventTouchUpInside]; _btnSalesProfitStartDate.frame = CGRectMake(Screen_Width/2-110 ,0 , 100, 25); [vDate addSubview:_btnSalesProfitStartDate]; UILabel *separatorLbl=[UILabel new]; separatorLbl.frame=CGRectMake(CGRectGetMaxX(_btnSalesProfitStartDate.frame), 0, 20, 25); separatorLbl.text=@"--"; separatorLbl.textColor = [UIColor blackColor]; separatorLbl.font = [UIFont systemFontOfSize: 14]; [vDate addSubview:separatorLbl]; _btnSalesProfitEndDate = [UIButton buttonWithType:UIButtonTypeCustom]; [_btnSalesProfitEndDate setTitle:_salesProfitEndDate forState:UIControlStateNormal]; [_btnSalesProfitEndDate setBackgroundColor:[UIColor whiteColor]]; [_btnSalesProfitEndDate setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnSalesProfitEndDate.titleLabel.font= [UIFont systemFontOfSize:14]; [_btnSalesProfitEndDate addTarget:self action:@selector(btnSelectEndDate) forControlEvents:UIControlEventTouchUpInside]; _btnSalesProfitEndDate.frame = CGRectMake(CGRectGetMaxX(separatorLbl.frame) ,0 , 100, 25); [vDate addSubview:_btnSalesProfitEndDate]; netProfitContent =[[UIView alloc]init]; netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, 0); [salesProfitContent addSubview:netProfitContent]; netProfitRateView= [[UIView alloc]init]; netProfitRateView.frame = CGRectMake(0,0, Screen_Width, 25); UILabel *lblTitleNetProfitRate = [[UILabel alloc]init]; lblTitleNetProfitRate.frame = CGRectMake(Screen_Width/2-90, 0, 90, 25); lblTitleNetProfitRate.text = @"净利率:"; lblTitleNetProfitRate.textColor = [UIColor redColor]; lblTitleNetProfitRate.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [netProfitRateView addSubview:lblTitleNetProfitRate]; lblNetProfitRate = [[UILabel alloc]init]; lblNetProfitRate.frame = CGRectMake(CGRectGetMaxX(lblTitleNetProfitRate.frame), 0, 150, 25); lblNetProfitRate.textColor = [UIColor redColor]; lblNetProfitRate.text=@"0.00%"; lblNetProfitRate.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [netProfitRateView addSubview:lblNetProfitRate]; [netProfitContent addSubview:netProfitRateView]; UIView *salesIncomeView = [[UIView alloc]init]; salesIncomeView.frame = CGRectMake(0,CGRectGetMaxY(netProfitRateView.frame),Screen_Width/2, rowHeight); lblSalesIncome= [[UILabel alloc]init]; lblSalesIncome.frame = CGRectMake(0, 0,salesIncomeView.frame.size.width, 25); lblSalesIncome.textAlignment=UITextAlignmentCenter; lblSalesIncome.textColor = [UIColor blackColor]; lblSalesIncome.text=@"0.00"; lblSalesIncome.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesIncomeView addSubview:lblSalesIncome]; UILabel *lblTitleSalesIncome = [[UILabel alloc]init]; lblTitleSalesIncome.frame = CGRectMake(0,CGRectGetMaxY(lblSalesIncome.frame),salesIncomeView.frame.size.width, 25); lblTitleSalesIncome.text = @"销售收入"; lblTitleSalesIncome.textColor = [UIColor blackColor]; lblTitleSalesIncome.textAlignment=UITextAlignmentCenter; lblTitleSalesIncome.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesIncomeView addSubview:lblTitleSalesIncome]; [netProfitContent addSubview:salesIncomeView]; UIView *salesCostView = [[UIView alloc]init]; salesCostView.frame = CGRectMake(0,CGRectGetMaxY(salesIncomeView.frame)+10, Screen_Width/2, rowHeight); lblSalesCost = [[UILabel alloc]init]; lblSalesCost.frame = CGRectMake(0, 0,salesCostView.frame.size.width, 25); lblSalesCost.textAlignment=UITextAlignmentCenter; lblSalesCost.textColor = [UIColor blackColor]; lblSalesCost.text=@"0.00"; lblSalesCost.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesCostView addSubview:lblSalesCost]; UILabel *lblTitleSalesCost = [[UILabel alloc]init]; lblTitleSalesCost.frame = CGRectMake(0, CGRectGetMaxY(lblSalesCost.frame),salesCostView.frame.size.width , 25); lblTitleSalesCost.text = @"销售成本"; lblTitleSalesCost.textAlignment=UITextAlignmentCenter; lblTitleSalesCost.textColor = [UIColor blackColor]; lblTitleSalesCost.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesCostView addSubview:lblTitleSalesCost]; [netProfitContent addSubview:salesCostView]; UIView *feeAmountView = [[UIView alloc]init]; feeAmountView.frame = CGRectMake(0,CGRectGetMaxY(salesCostView.frame)+10, Screen_Width/2, rowHeight); lblFeeAmount = [[UILabel alloc]init]; lblFeeAmount.frame = CGRectMake(0, 0,feeAmountView.frame.size.width , 25); lblFeeAmount.textAlignment=UITextAlignmentCenter; lblFeeAmount.textColor = [UIColor blackColor]; lblFeeAmount.text=@"0.00 "; lblFeeAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [feeAmountView addSubview:lblFeeAmount]; UILabel *lblTitleFeeAmount = [[UILabel alloc]init]; lblTitleFeeAmount.frame = CGRectMake(0, CGRectGetMaxY(lblFeeAmount.frame), feeAmountView.frame.size.width, 25); lblTitleFeeAmount.text = @"费用金额"; lblTitleFeeAmount.textAlignment=UITextAlignmentCenter; lblTitleFeeAmount.textColor = [UIColor blackColor]; lblTitleFeeAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [feeAmountView addSubview:lblTitleFeeAmount]; [netProfitContent addSubview:feeAmountView]; UIView *middleSeparator=[UIView new]; middleSeparator.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(netProfitRateView.frame)+topMargin, 0.5, 150); middleSeparator.backgroundColor=[UIColor lightGrayColor]; [netProfitContent addSubview:middleSeparator]; UIView *netProfitView = [[UIView alloc]init]; netProfitView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(netProfitRateView.frame), Screen_Width/2, rowHeight); lblNetProfit = [[UILabel alloc]init]; lblNetProfit.frame = CGRectMake(0, 0, netProfitView.frame.size.width, 25); lblNetProfit.textAlignment=UITextAlignmentCenter; lblNetProfit.text=@"0.00"; lblNetProfit.textColor = [UIColor blackColor]; lblNetProfit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [netProfitView addSubview:lblNetProfit]; UILabel *lblNetProfitTitle = [[UILabel alloc]init]; lblNetProfitTitle.frame = CGRectMake(0,CGRectGetMaxY(lblNetProfit.frame), netProfitView.frame.size.width, 25); lblNetProfitTitle.text = @"净利润"; lblNetProfitTitle.textAlignment=UITextAlignmentCenter; lblNetProfitTitle.textColor = [UIColor blackColor]; lblNetProfitTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [netProfitView addSubview:lblNetProfitTitle]; [netProfitContent addSubview:netProfitView]; UIView *salesMarginView = [[UIView alloc]init]; salesMarginView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(netProfitView.frame)+10,Screen_Width/2, rowHeight); lblSalesMargin = [[UILabel alloc]init]; lblSalesMargin.frame = CGRectMake(0, 0,salesMarginView.frame.size.width, 25); lblSalesMargin.textAlignment=UITextAlignmentCenter; lblSalesMargin.textColor = [UIColor blackColor]; lblSalesMargin.text=@"0.00"; lblSalesMargin.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesMarginView addSubview:lblSalesMargin]; UILabel *lblSalesMarginTitle = [[UILabel alloc]init]; lblSalesMarginTitle.frame = CGRectMake(0,CGRectGetMaxY(lblSalesMargin.frame), salesMarginView.frame.size.width, 25); lblSalesMarginTitle.text = @"销售毛利"; lblSalesMarginTitle.textColor = [UIColor blackColor]; lblSalesMarginTitle.textAlignment=UITextAlignmentCenter; lblSalesMarginTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [salesMarginView addSubview:lblSalesMarginTitle]; [netProfitContent addSubview:salesMarginView]; UIView *grossProfitMarginView = [[UIView alloc]init]; grossProfitMarginView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(salesMarginView.frame)+10,Screen_Width/2, rowHeight); lblGrossProfitMargin = [[UILabel alloc]init]; lblGrossProfitMargin.frame = CGRectMake(0, 0,grossProfitMarginView.frame.size.width, 25); lblGrossProfitMargin.textAlignment=UITextAlignmentCenter; lblGrossProfitMargin.textColor = [UIColor blackColor]; lblGrossProfitMargin.text=@"0.00"; lblGrossProfitMargin.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [grossProfitMarginView addSubview:lblGrossProfitMargin]; UILabel *lblGrossProfitMarginTitle = [[UILabel alloc]init]; lblGrossProfitMarginTitle.frame = CGRectMake(0,CGRectGetMaxY(lblGrossProfitMargin.frame), grossProfitMarginView.frame.size.width, 25); lblGrossProfitMarginTitle.text = @"毛利率"; lblGrossProfitMarginTitle.textAlignment=UITextAlignmentCenter; lblGrossProfitMarginTitle.textColor = [UIColor blackColor]; lblGrossProfitMarginTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [grossProfitMarginView addSubview:lblGrossProfitMarginTitle]; [netProfitContent addSubview:grossProfitMarginView]; _btnChannel = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(feeAmountView.frame)+topMargin, 70, 35)]; [_btnChannel setTitle:@"渠道" forState:UIControlStateNormal]; [_btnChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; _btnChannel.tag=1000; [_btnChannel addTarget:self action:@selector(goSalesProfit:) forControlEvents:UIControlEventTouchUpInside]; _btnChannel.titleLabel.font = [UIFont systemFontOfSize: 12.0]; UIBezierPath *maskPath5 = [UIBezierPath bezierPathWithRoundedRect:_btnChannel.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer5 = [CAShapeLayer layer]; maskLayer5.frame = _btnChannel.bounds; maskLayer5.path = maskPath5.CGPath; _btnChannel.layer.mask = maskLayer5; [netProfitContent addSubview:_btnChannel]; btnChannelMaskLayer = [CAShapeLayer layer]; btnChannelMaskLayer.frame = _btnChannel.bounds; btnChannelMaskLayer.path = maskPath5.CGPath; btnChannelMaskLayer.fillColor=[UIColor clearColor].CGColor; btnChannelMaskLayer.strokeColor=[UIColor redColor].CGColor; btnChannelMaskLayer.lineWidth=1; [_btnChannel.layer addSublayer:btnChannelMaskLayer]; _btnDepartment = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnChannel.frame),CGRectGetMaxY(feeAmountView.frame)+topMargin, 70, 35)]; [_btnDepartment setTitle:@"部门" forState:UIControlStateNormal]; [_btnDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnDepartment.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnDepartment addTarget:self action:@selector(goSalesProfit:) forControlEvents:UIControlEventTouchUpInside]; _btnDepartment.tag=1001; UIBezierPath *maskPath7 = [UIBezierPath bezierPathWithRoundedRect:_btnDepartment.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer8 = [CAShapeLayer layer]; maskLayer8.frame = _btnDepartment.bounds; maskLayer8.path = maskPath7.CGPath; _btnDepartment.layer.mask = maskLayer8; [netProfitContent addSubview:_btnDepartment]; btnDepartmentMaskLayer = [CAShapeLayer layer]; btnDepartmentMaskLayer.frame = _btnDepartment.bounds; btnDepartmentMaskLayer.path = maskPath7.CGPath; btnDepartmentMaskLayer.fillColor=[UIColor clearColor].CGColor; btnDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; btnDepartmentMaskLayer.lineWidth=1; [_btnDepartment.layer addSublayer:btnDepartmentMaskLayer]; netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+10, Screen_Width, CGRectGetMaxY(_btnDepartment.frame)); salesProfitBorderV=[CustomBorderView new]; salesProfitBorderV.frame=CGRectMake(5, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-30, 350); [salesProfitBorderV setBackgroundColor:[UIColor whiteColor]]; [salesProfitBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [salesProfitContent addSubview:salesProfitBorderV]; _chartView=[[BarChartView alloc]init]; _chartView.frame=CGRectMake(0,0,salesProfitBorderV.frame.size.width, 350); [salesProfitBorderV addSubview:_chartView]; salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10); height=CGRectGetMaxY(salesProfitContent.frame); salesProfitContent.layer.cornerRadius=CornerRadius; [content addSubview:salesProfitContent]; } // UIView *assetDebtTitleView = [[UIView alloc]init]; // // assetDebtTitleView.frame = CGRectMake(0,CGRectGetMaxY(_chartView.frame)+10 ,Screen_Width, 40); // // UIView *assetDebtView=[UIImageView new]; // assetDebtView.frame=CGRectMake(10, 10,10 , 25); // [assetDebtView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; // [assetDebtTitleView addSubview:assetDebtView]; // // // UILabel *titleAssetsDebt = [[UILabel alloc]init]; // titleAssetsDebt.frame = CGRectMake(CGRectGetMaxX(assetDebtView.frame)+10, 10, 70, 25); // titleAssetsDebt.text = @"资产负债"; // titleAssetsDebt.textColor = [UIColor blackColor]; // titleAssetsDebt.font = [UIFont systemFontOfSize:16]; // [assetDebtTitleView addSubview:titleAssetsDebt]; // [content addSubview:assetDebtTitleView]; // // // _btnAssetsCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-135,CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)]; // [_btnAssetsCustom setTitle:@"自定义" forState:UIControlStateNormal]; // [_btnAssetsCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // UIBezierPath *maskPath10 = [UIBezierPath bezierPathWithRoundedRect:_btnAssetsCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(10.0, 10.0)]; // CAShapeLayer *maskLayer10 = [CAShapeLayer layer]; // maskLayer10.frame = _btnAssetsCustom.bounds; // maskLayer10.path = maskPath10.CGPath; // _btnAssetsCustom.layer.mask = maskLayer10; // // CAShapeLayer *maskLayer12 = [CAShapeLayer layer]; // maskLayer12.frame = _btnAssetsCustom.bounds; // maskLayer12.path = maskPath10.CGPath; // maskLayer12.fillColor=[UIColor clearColor].CGColor; // maskLayer12.strokeColor=[UIColor lightGrayColor].CGColor; // maskLayer12.lineWidth=1; // [_btnAssetsCustom.layer addSublayer:maskLayer12]; // // [content addSubview:_btnAssetsCustom]; // // _btnLastYear = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnAssetsCustom.frame),CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)]; // // [_btnLastYear setTitle:@"2020-12" forState:UIControlStateNormal]; // _btnLastYear.layer.cornerRadius=0; // _btnLastYear.layer.borderWidth=1; // [_btnLastYear setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // [_btnLastYear.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡 // _btnLastYear.layer.borderColor=[UIColor lightGrayColor].CGColor; // [content addSubview:_btnLastYear]; // // _btnThisYear = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnLastYear.frame),CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)]; // [_btnThisYear setTitle:@"本年" forState:UIControlStateNormal]; // [_btnThisYear setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // UIBezierPath *maskPath11 = [UIBezierPath bezierPathWithRoundedRect:_btnThisYear.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(10.0, 10.0)]; // CAShapeLayer *maskLayer11 = [CAShapeLayer layer]; // maskLayer11.frame = _btnThisYear.bounds; // maskLayer11.path = maskPath11.CGPath; // _btnThisYear.layer.mask = maskLayer11; // // CAShapeLayer *maskLayer13 = [CAShapeLayer layer]; // maskLayer13.frame = _btnThisYear.bounds; // maskLayer13.path = maskPath11.CGPath; // maskLayer13.fillColor=[UIColor clearColor].CGColor; // maskLayer13.strokeColor=[UIColor lightGrayColor].CGColor; // maskLayer13.lineWidth=1; // [_btnThisYear.layer addSublayer:maskLayer13]; // // [content addSubview:_btnThisYear]; // // // UIView *debtRatioView = [[UIView alloc]init]; // // debtRatioView.frame = CGRectMake(0,CGRectGetMaxY(_btnAssetsCustom.frame)+5, Screen_Width, 40); // UILabel *lblTitleDebtRatio = [[UILabel alloc]init]; // lblTitleDebtRatio.frame = CGRectMake(Screen_Width/2-70, 10, 70, 25); // lblTitleDebtRatio.text = @"负债率:"; // lblTitleDebtRatio.textColor = [UIColor redColor]; // lblTitleDebtRatio.font = [UIFont systemFontOfSize:16]; // [debtRatioView addSubview:lblTitleDebtRatio]; // // UILabel *lblDebtRatio = [[UILabel alloc]init]; // lblDebtRatio.frame = CGRectMake(CGRectGetMaxX(lblTitleDebtRatio.frame), 10, 70, 25); // lblDebtRatio.text = @"42.45%"; // lblDebtRatio.textColor = [UIColor redColor]; // lblDebtRatio.font = [UIFont systemFontOfSize:16]; // [debtRatioView addSubview:lblDebtRatio]; // [content addSubview:debtRatioView]; // // // UIView *assetsTotalView = [[UIView alloc]init]; // // assetsTotalView.frame = CGRectMake(0,CGRectGetMaxY(debtRatioView.frame)+5, 100, 60); // UILabel *lblAssetsTotal = [[UILabel alloc]init]; // lblAssetsTotal.frame = CGRectMake(Screen_Width/4-35, 10, 200, 25); // lblAssetsTotal.text = @"7683374.82"; // lblAssetsTotal.textColor = [UIColor blackColor]; // lblAssetsTotal.font = [UIFont systemFontOfSize:16]; // [assetsTotalView addSubview:lblAssetsTotal]; // // UILabel *lblTitleAssetsTotal = [[UILabel alloc]init]; // lblTitleAssetsTotal.frame = CGRectMake(Screen_Width/4-35,CGRectGetMaxY(lblAssetsTotal.frame), 100, 25); // lblTitleAssetsTotal.text = @"资产总计"; // lblTitleAssetsTotal.textColor = [UIColor blackColor]; // lblTitleAssetsTotal.font = [UIFont systemFontOfSize:16]; // [assetsTotalView addSubview:lblTitleAssetsTotal]; // [content addSubview:assetsTotalView]; // // // UIView *middleSeparator1=[UIView new]; // // middleSeparator1.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(debtRatioView.frame)+15, 3, 60); // middleSeparator1.backgroundColor=[UIColor lightGrayColor]; // [content addSubview:middleSeparator1]; // // // debtSumView = [[UIView alloc]init]; // // debtSumView.frame = CGRectMake(Screen_Width/4*3,CGRectGetMaxY(debtRatioView.frame)+5, 200, 60); // UILabel *lblDebtSum = [[UILabel alloc]init]; // lblDebtSum.frame = CGRectMake(0, 10, 150, 25); // lblDebtSum.text = @"3261302.77"; // lblDebtSum.textColor = [UIColor blackColor]; // lblDebtSum.font = [UIFont systemFontOfSize:16]; // [debtSumView addSubview:lblDebtSum]; // // UILabel *lblDebtSumTitle = [[UILabel alloc]init]; // lblDebtSumTitle.frame = CGRectMake(0,CGRectGetMaxY(lblDebtSum.frame), 200, 25); // lblDebtSumTitle.text = @"负债总额"; // lblDebtSumTitle.textColor = [UIColor blackColor]; // lblDebtSumTitle.font = [UIFont systemFontOfSize:16]; // [debtSumView addSubview:lblDebtSumTitle]; // [content addSubview:debtSumView]; // height=CGRectGetMaxY(assetsTotalView.frame)+10; // AssetDebtAxisValueFormatter *debtAxisValueFormatter=[[AssetDebtAxisValueFormatter alloc]init]; // [self drawSingleBarchart:assetDebtyValues height:height axisValueFormatter:debtAxisValueFormatter xAxisLabelCount:2]; if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){ currencyCapitalContent=[UIView new]; currencyCapitalContent.backgroundColor=[UIColor whiteColor]; currencyCapitalContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0); [content addSubview:currencyCapitalContent]; UIView *monetoryCaiptalTitleView = [[UIView alloc]init]; monetoryCaiptalTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45); UIView *monetoryCapitalView=[UIImageView new]; monetoryCapitalView.frame=CGRectMake(10, 10,10 , 25); [monetoryCapitalView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [monetoryCaiptalTitleView addSubview:monetoryCapitalView]; UILabel *titleMonetoryCapital = [[UILabel alloc]init]; titleMonetoryCapital.frame = CGRectMake(CGRectGetMaxX(monetoryCapitalView.frame)+10, 10, 90, 25); titleMonetoryCapital.text = @"货币资金"; titleMonetoryCapital.textColor = [UIColor blackColor]; titleMonetoryCapital.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [monetoryCaiptalTitleView addSubview:titleMonetoryCapital]; UIView *separator1=[UIView new]; separator1.frame=CGRectMake(0,monetoryCaiptalTitleView.frame.size.height-1, monetoryCaiptalTitleView.frame.size.width-20, 0.5); [separator1 setBackgroundColor:[UIColor lightGrayColor]]; [monetoryCaiptalTitleView addSubview:separator1 ]; [currencyCapitalContent addSubview:monetoryCaiptalTitleView]; _btnMonetoryCaitalCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-90,CGRectGetMaxY(monetoryCaiptalTitleView.frame)+topMargin, 70, 35)]; [_btnMonetoryCaitalCustom setTitle:@"自定义" forState:UIControlStateNormal]; [_btnMonetoryCaitalCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnMonetoryCaitalCustom.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnMonetoryCaitalCustom addTarget:self action:@selector(selectCustomDate) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath13 = [UIBezierPath bezierPathWithRoundedRect:_btnMonetoryCaitalCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer14 = [CAShapeLayer layer]; maskLayer14.frame = _btnAssetsCustom.bounds; maskLayer14.path = maskPath13.CGPath; _btnMonetoryCaitalCustom.layer.mask = maskLayer14; moneytoryCapitalMaskLayer= [CAShapeLayer layer]; moneytoryCapitalMaskLayer.frame = _btnMonetoryCaitalCustom.bounds; moneytoryCapitalMaskLayer.path = maskPath13.CGPath; moneytoryCapitalMaskLayer.fillColor=[UIColor clearColor].CGColor; moneytoryCapitalMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; moneytoryCapitalMaskLayer.lineWidth=1; [_btnMonetoryCaitalCustom.layer addSublayer:moneytoryCapitalMaskLayer]; [currencyCapitalContent addSubview:_btnMonetoryCaitalCustom]; _btnMonetoryCaitalCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnMonetoryCaitalCustom.frame),CGRectGetMaxY(monetoryCaiptalTitleView.frame)+topMargin, 70, 35)]; _btnMonetoryCaitalCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnMonetoryCaitalCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal]; [_btnMonetoryCaitalCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [_btnMonetoryCaitalCurrentMonth addTarget:self action:@selector(getMoneytoryAssetsCurrentMonth) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath14 = [UIBezierPath bezierPathWithRoundedRect:_btnMonetoryCaitalCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer15 = [CAShapeLayer layer]; maskLayer15.frame = _btnMonetoryCaitalCurrentMonth.bounds; maskLayer15.path = maskPath14.CGPath; _btnMonetoryCaitalCurrentMonth.layer.mask = maskLayer15; moneytoryCapitalCurrentMonthMaskLayer= [CAShapeLayer layer]; moneytoryCapitalCurrentMonthMaskLayer.frame = _btnMonetoryCaitalCurrentMonth.bounds; moneytoryCapitalCurrentMonthMaskLayer.path = maskPath14.CGPath; moneytoryCapitalCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor; moneytoryCapitalCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor; moneytoryCapitalCurrentMonthMaskLayer.lineWidth=1; [_btnMonetoryCaitalCurrentMonth.layer addSublayer:moneytoryCapitalCurrentMonthMaskLayer]; [currencyCapitalContent addSubview:_btnMonetoryCaitalCurrentMonth]; UIView *monetoryCapitalAmountView = [[UIView alloc]init]; monetoryCapitalAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnMonetoryCaitalCustom.frame)+topMargin, Screen_Width, 25); UILabel *lblTitleMonetoryCapitalAmount = [[UILabel alloc]init]; lblTitleMonetoryCapitalAmount.frame = CGRectMake(Screen_Width/2-110, 0, 110, 25); lblTitleMonetoryCapitalAmount.text = @"货币资金:"; lblTitleMonetoryCapitalAmount.textColor = [UIColor redColor]; lblTitleMonetoryCapitalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [monetoryCapitalAmountView addSubview:lblTitleMonetoryCapitalAmount]; lblMonetoryCapitalAmount= [[UILabel alloc]init]; lblMonetoryCapitalAmount.frame = CGRectMake(CGRectGetMaxX(lblTitleMonetoryCapitalAmount.frame), 0, 150, 25); lblMonetoryCapitalAmount.text=@"0.00"; lblMonetoryCapitalAmount.textColor = [UIColor redColor]; lblMonetoryCapitalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [monetoryCapitalAmountView addSubview:lblMonetoryCapitalAmount]; [currencyCapitalContent addSubview:monetoryCapitalAmountView]; UIView *cashInHandView = [[UIView alloc]init]; cashInHandView.frame = CGRectMake(0,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3, rowHeight); lblCashInHand= [[UILabel alloc]init]; lblCashInHand.frame = CGRectMake(0, 0, cashInHandView.frame.size.width, 25); lblCashInHand.text = @"0.00"; lblCashInHand.textAlignment=UITextAlignmentCenter; lblCashInHand.textColor = [UIColor blackColor]; lblCashInHand.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [cashInHandView addSubview:lblCashInHand]; UILabel *lblTitleCashInHand = [[UILabel alloc]init]; lblTitleCashInHand.frame = CGRectMake(0,CGRectGetMaxY(lblCashInHand.frame), cashInHandView.frame.size.width, 25); lblTitleCashInHand.text = @"库存现金"; lblTitleCashInHand.textAlignment=UITextAlignmentCenter; lblTitleCashInHand.textColor = [UIColor blackColor]; lblTitleCashInHand.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [cashInHandView addSubview:lblTitleCashInHand]; [currencyCapitalContent addSubview:cashInHandView]; UIView *bankDepositView = [[UIView alloc]init]; bankDepositView.frame = CGRectMake(Screen_Width/3,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3, rowHeight); lblBankDeposit = [[UILabel alloc]init]; lblBankDeposit.frame = CGRectMake(0, 0, bankDepositView.frame.size.width, 25); lblBankDeposit.text = @"0.00"; lblBankDeposit.textAlignment=UITextAlignmentCenter; lblBankDeposit.textColor = [UIColor blackColor]; lblBankDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [bankDepositView addSubview:lblBankDeposit]; UILabel *lblTitleBankDeposit = [[UILabel alloc]init]; lblTitleBankDeposit.frame = CGRectMake(0,CGRectGetMaxY(lblBankDeposit.frame), bankDepositView.frame.size.width, 25); lblTitleBankDeposit.text = @"银行存款"; lblTitleBankDeposit.textColor = [UIColor blackColor]; lblTitleBankDeposit.textAlignment=UITextAlignmentCenter; lblTitleBankDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [bankDepositView addSubview:lblTitleBankDeposit]; [currencyCapitalContent addSubview:bankDepositView]; UIView *otherMonetoryCaiptalView = [[UIView alloc]init]; otherMonetoryCaiptalView.frame = CGRectMake(Screen_Width/3*2-10,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3+10, rowHeight); lblOtherMonetoryCaiptal = [[UILabel alloc]init]; lblOtherMonetoryCaiptal.frame = CGRectMake(0, 0, otherMonetoryCaiptalView.frame.size.width, 25); lblOtherMonetoryCaiptal.textAlignment=UITextAlignmentCenter; lblOtherMonetoryCaiptal.textColor = [UIColor blackColor]; lblOtherMonetoryCaiptal.text=@"0.00"; lblOtherMonetoryCaiptal.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [otherMonetoryCaiptalView addSubview:lblOtherMonetoryCaiptal]; UILabel *lblTitleOtherMonetoryCaiptal = [[UILabel alloc]init]; lblTitleOtherMonetoryCaiptal.frame = CGRectMake(0,CGRectGetMaxY(lblOtherMonetoryCaiptal.frame), otherMonetoryCaiptalView.frame.size.width, 25); lblTitleOtherMonetoryCaiptal.text = @"其他货币资金"; lblTitleOtherMonetoryCaiptal.textColor = [UIColor blackColor]; lblTitleOtherMonetoryCaiptal.textAlignment=UITextAlignmentCenter; lblTitleOtherMonetoryCaiptal.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [otherMonetoryCaiptalView addSubview:lblTitleOtherMonetoryCaiptal]; [currencyCapitalContent addSubview:otherMonetoryCaiptalView]; netMoneyInflowView = [[UIView alloc]init]; netMoneyInflowView.frame = CGRectMake(0,CGRectGetMaxY(cashInHandView.frame)+topMargin, Screen_Width, 25); UILabel *lblTitleNetMoneyInflow = [[UILabel alloc]init]; lblTitleNetMoneyInflow.frame = CGRectMake(Screen_Width/2-130, 0, 130, 25); lblTitleNetMoneyInflow.text = @"货币净流入:"; lblTitleNetMoneyInflow.textColor = [UIColor redColor]; lblTitleNetMoneyInflow.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [netMoneyInflowView addSubview:lblTitleNetMoneyInflow]; lblNetMoneyInflow = [[UILabel alloc]init]; lblNetMoneyInflow.frame = CGRectMake(CGRectGetMaxX(lblTitleNetMoneyInflow.frame), 0, 150, 25); lblNetMoneyInflow.textColor = [UIColor redColor]; lblNetMoneyInflow.text=@"0.00"; lblNetMoneyInflow.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [netMoneyInflowView addSubview:lblNetMoneyInflow]; [currencyCapitalContent addSubview:netMoneyInflowView]; currencyCapitalBorderV=[CustomBorderView new]; currencyCapitalBorderV.frame=CGRectMake(5, CGRectGetMaxY(netMoneyInflowView.frame)+topMargin,Screen_Width-30, 350); [currencyCapitalBorderV setBackgroundColor:[UIColor whiteColor]]; [currencyCapitalBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [currencyCapitalContent addSubview:currencyCapitalBorderV]; _singleChartView=[[BarChartView alloc]init]; _singleChartView.frame=CGRectMake(0,0,currencyCapitalBorderV.frame.size.width, 350); [currencyCapitalBorderV addSubview:_singleChartView]; currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame)); height=CGRectGetMaxY(currencyCapitalContent.frame); currencyCapitalContent.layer.cornerRadius=CornerRadius; } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){ //往来情况 currentSituationContent=[UIView new]; currentSituationContent.backgroundColor=[UIColor whiteColor]; currentSituationContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0); [content addSubview:currentSituationContent]; UIView *currentSituationTitleView = [[UIView alloc]init]; currentSituationTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45); UIView *currentSituationView=[UIImageView new]; currentSituationView.frame=CGRectMake(10, 10,10 , 25); [currentSituationView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [currentSituationTitleView addSubview:currentSituationView]; UILabel *titleCurrentSituation = [[UILabel alloc]init]; titleCurrentSituation.frame = CGRectMake(CGRectGetMaxX(currentSituationView.frame)+10, 10, 90, 25); titleCurrentSituation.text = @"往来情况"; titleCurrentSituation.textColor = [UIColor blackColor]; titleCurrentSituation.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [currentSituationTitleView addSubview:titleCurrentSituation]; UIView *separator3=[UIView new]; separator3.frame=CGRectMake(0,currentSituationTitleView.frame.size.height-1, currentSituationTitleView.frame.size.width-20, 0.5); [separator3 setBackgroundColor:[UIColor lightGrayColor]]; [currentSituationTitleView addSubview:separator3 ]; [currentSituationContent addSubview:currentSituationTitleView]; _btnCurrentChannel = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(currentSituationTitleView.frame)+topMargin, 70, 35)]; [_btnCurrentChannel setTitle:@"渠道" forState:UIControlStateNormal]; [_btnCurrentChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; _btnCurrentChannel.tag=1002; _btnCurrentChannel.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnCurrentChannel addTarget:self action:@selector(goCurrentSituation:) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath19 = [UIBezierPath bezierPathWithRoundedRect:_btnCurrentChannel.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer19 = [CAShapeLayer layer]; maskLayer19.frame = _btnCurrentChannel.bounds; maskLayer19.path = maskPath19.CGPath; _btnCurrentChannel.layer.mask = maskLayer19; [currentSituationContent addSubview:_btnCurrentChannel]; currentSituationChannelMaskLayer = [CAShapeLayer layer]; currentSituationChannelMaskLayer.frame = _btnCurrentChannel.bounds; currentSituationChannelMaskLayer.path = maskPath19.CGPath; currentSituationChannelMaskLayer.fillColor=[UIColor clearColor].CGColor; currentSituationChannelMaskLayer.strokeColor=[UIColor redColor].CGColor; currentSituationChannelMaskLayer.lineWidth=1; [_btnCurrentChannel.layer addSublayer:currentSituationChannelMaskLayer]; _btnCurrentDepartment = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnCurrentChannel.frame),CGRectGetMaxY(currentSituationTitleView.frame)+topMargin, 70, 35)]; [_btnCurrentDepartment setTitle:@"部门" forState:UIControlStateNormal]; _btnCurrentDepartment.tag=1003; [_btnCurrentDepartment addTarget:self action:@selector(goCurrentSituation:) forControlEvents:UIControlEventTouchUpInside]; [_btnCurrentDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnCurrentDepartment.titleLabel.font = [UIFont systemFontOfSize: 12.0]; UIBezierPath *maskPath20 = [UIBezierPath bezierPathWithRoundedRect:_btnCurrentDepartment.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer21 = [CAShapeLayer layer]; maskLayer21.frame = _btnCurrentDepartment.bounds; maskLayer21.path = maskPath20.CGPath; _btnCurrentDepartment.layer.mask = maskLayer21; [currentSituationContent addSubview:_btnCurrentDepartment]; currentSituationDepartmentMaskLayer = [CAShapeLayer layer]; currentSituationDepartmentMaskLayer.frame = _btnCurrentDepartment.bounds; currentSituationDepartmentMaskLayer.path = maskPath20.CGPath; currentSituationDepartmentMaskLayer.fillColor=[UIColor clearColor].CGColor; currentSituationDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; currentSituationDepartmentMaskLayer.lineWidth=1; [_btnCurrentDepartment.layer addSublayer:currentSituationDepartmentMaskLayer]; UIView *receivablesAmountView = [[UIView alloc]init]; receivablesAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin, Screen_Width/2, rowHeight); lblReceivablesAmount= [[UILabel alloc]init]; lblReceivablesAmount.frame = CGRectMake(0, 0, receivablesAmountView.frame.size.width, 25); lblReceivablesAmount.text = @"0.00"; lblReceivablesAmount.textAlignment=UITextAlignmentCenter; lblReceivablesAmount.textColor = [UIColor blackColor]; lblReceivablesAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [receivablesAmountView addSubview:lblReceivablesAmount]; UILabel *lblTitleReceivablesAmount = [[UILabel alloc]init]; lblTitleReceivablesAmount.frame = CGRectMake(0,CGRectGetMaxY(lblReceivablesAmount.frame), receivablesAmountView.frame.size.width, 25); lblTitleReceivablesAmount.text = @"应收款金额"; lblTitleReceivablesAmount.textColor = [UIColor blackColor]; lblTitleReceivablesAmount.textAlignment=UITextAlignmentCenter; lblTitleReceivablesAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [receivablesAmountView addSubview:lblTitleReceivablesAmount]; [currentSituationContent addSubview:receivablesAmountView]; UIView *depositAmountView = [[UIView alloc]init]; depositAmountView.frame = CGRectMake(0,CGRectGetMaxY(receivablesAmountView.frame)+10, Screen_Width/2, rowHeight); lblDepositAmount = [[UILabel alloc]init]; lblDepositAmount.frame = CGRectMake(0, 0, depositAmountView.frame.size.width, 25); lblDepositAmount.text = @"0.00"; lblDepositAmount.textAlignment=UITextAlignmentCenter; lblDepositAmount.textColor = [UIColor blackColor]; lblDepositAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [depositAmountView addSubview:lblDepositAmount]; UILabel *lblTitleDepositAmount = [[UILabel alloc]init]; lblTitleDepositAmount.frame = CGRectMake(0,CGRectGetMaxY(lblDepositAmount.frame), depositAmountView.frame.size.width, 25); lblTitleDepositAmount.text = @"定金金额"; lblTitleDepositAmount.textAlignment=UITextAlignmentCenter; lblTitleDepositAmount.textColor = [UIColor blackColor]; lblTitleDepositAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [depositAmountView addSubview:lblTitleDepositAmount]; [currentSituationContent addSubview:depositAmountView]; UIView *middleSeparator2=[UIView new]; middleSeparator2.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin,0.5, 110); middleSeparator2.backgroundColor=[UIColor lightGrayColor]; [currentSituationContent addSubview:middleSeparator2]; advancePayment= [[UIView alloc]init]; advancePayment.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin, Screen_Width/2, rowHeight); lblAdvancePayment= [[UILabel alloc]init]; lblAdvancePayment.frame = CGRectMake(0, 0, advancePayment.frame.size.width, 25); lblAdvancePayment.textAlignment=UITextAlignmentCenter; lblAdvancePayment.text=@"0.00"; lblAdvancePayment.textColor = [UIColor blackColor]; lblAdvancePayment.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [advancePayment addSubview:lblAdvancePayment]; UILabel *lblAdvancePaymentTitle = [[UILabel alloc]init]; lblAdvancePaymentTitle.frame = CGRectMake(0,CGRectGetMaxY(lblAdvancePayment.frame), advancePayment.frame.size.width, 25); lblAdvancePaymentTitle.text = @"预收款金额"; lblAdvancePaymentTitle.textAlignment=UITextAlignmentCenter; lblAdvancePaymentTitle.textColor = [UIColor blackColor]; lblAdvancePaymentTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [advancePayment addSubview:lblAdvancePaymentTitle]; [currentSituationContent addSubview:advancePayment]; UIView *receivablesAdvanceDepositView = [[UIView alloc]init]; receivablesAdvanceDepositView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(advancePayment.frame)+10, Screen_Width/2, rowHeight); lblReceivablesAdvanceDeposit = [[UILabel alloc]init]; lblReceivablesAdvanceDeposit.frame = CGRectMake(0, 0, receivablesAdvanceDepositView.frame.size.width, 25); lblReceivablesAdvanceDeposit.textAlignment=UITextAlignmentCenter; lblReceivablesAdvanceDeposit.text=@"0.00"; lblReceivablesAdvanceDeposit.textColor = [UIColor blackColor]; lblReceivablesAdvanceDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [receivablesAdvanceDepositView addSubview:lblReceivablesAdvanceDeposit]; UILabel *lblReceivablesAdvanceDepositTitle = [[UILabel alloc]init]; lblReceivablesAdvanceDepositTitle.frame = CGRectMake(0,CGRectGetMaxY(lblReceivablesAdvanceDeposit.frame),receivablesAdvanceDepositView.frame.size.width, 25); lblReceivablesAdvanceDepositTitle.text = @"应收-预收-定金"; lblReceivablesAdvanceDepositTitle.textColor = [UIColor blackColor]; lblReceivablesAdvanceDepositTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; lblReceivablesAdvanceDepositTitle.textAlignment=UITextAlignmentCenter; [receivablesAdvanceDepositView addSubview:lblReceivablesAdvanceDepositTitle]; [currentSituationContent addSubview:receivablesAdvanceDepositView]; currentSituationBorderV=[CustomBorderView new]; currentSituationBorderV.frame=CGRectMake(5, CGRectGetMaxY(depositAmountView.frame)+topMargin,Screen_Width-30, 350); [currentSituationBorderV setBackgroundColor:[UIColor whiteColor]]; [currentSituationBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [currentSituationContent addSubview:currentSituationBorderV]; _currentSituationChartView=[[BarChartView alloc]init]; _currentSituationChartView.frame=CGRectMake(0, 0,currentSituationBorderV.frame.size.width, 350); [currentSituationBorderV addSubview:_currentSituationChartView]; currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10); height=CGRectGetMaxY(currentSituationContent.frame); currentSituationContent.layer.cornerRadius=CornerRadius; } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){ //应付 payableContent=[UIView new]; payableContent.backgroundColor=[UIColor whiteColor]; payableContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0); [content addSubview:payableContent]; UIView *accountPayableTitleView = [[UIView alloc]init]; accountPayableTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45); UIView *accountPayableView=[UIImageView new]; accountPayableView.frame=CGRectMake(10, 10,10 , 25); [accountPayableView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; [accountPayableTitleView addSubview:accountPayableView]; UILabel *titleAccountPayable = [[UILabel alloc]init]; titleAccountPayable.frame = CGRectMake(CGRectGetMaxX(accountPayableView.frame)+10, 10, 90, 25); titleAccountPayable.text = @"应付情况"; titleAccountPayable.textColor = [UIColor blackColor]; titleAccountPayable.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [accountPayableTitleView addSubview:titleAccountPayable]; UIView *separator4=[UIView new]; separator4.frame=CGRectMake(0,accountPayableTitleView.frame.size.height-1, accountPayableTitleView.frame.size.width-20, 0.5); [separator4 setBackgroundColor:[UIColor lightGrayColor]]; [accountPayableTitleView addSubview:separator4 ]; [payableContent addSubview:accountPayableTitleView]; UIView *accountsPayableView = [[UIView alloc]init]; accountsPayableView.frame = CGRectMake(0,CGRectGetMaxY(accountPayableTitleView.frame)+topMargin,Screen_Width/2, rowHeight); [payableContent addSubview:accountsPayableView]; lblAccountsPayable = [[UILabel alloc]init]; lblAccountsPayable.frame = CGRectMake(0, 0,accountsPayableView.frame.size.width, 25); lblAccountsPayable.textAlignment=NSTextAlignmentCenter; lblAccountsPayable.text=@"0.00"; lblAccountsPayable.textColor = [UIColor blackColor]; lblAccountsPayable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [accountsPayableView addSubview:lblAccountsPayable]; UILabel *lblTitleAccountsPayable = [[UILabel alloc]init]; lblTitleAccountsPayable.frame = CGRectMake(0,CGRectGetMaxY(lblAccountsPayable.frame),Screen_Width/2, 25); lblTitleAccountsPayable.text = @"应付款金额"; lblTitleAccountsPayable.textAlignment=NSTextAlignmentCenter; lblTitleAccountsPayable.textColor = [UIColor blackColor]; lblTitleAccountsPayable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [accountsPayableView addSubview:lblTitleAccountsPayable]; UIView *middleSeparator5=[UIView new]; middleSeparator5.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(accountPayableTitleView.frame)+topMargin, 0.5, 50); middleSeparator5.backgroundColor=[UIColor lightGrayColor]; [payableContent addSubview:middleSeparator5]; UIView *advancePaymentView = [[UIView alloc]init]; advancePaymentView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(accountPayableTitleView.frame)+topMargin, Screen_Width/2,rowHeight); lblAdvancePaymentAmount = [[UILabel alloc]init]; lblAdvancePaymentAmount.frame = CGRectMake(0, 0, advancePaymentView.frame.size.width, 25); lblAdvancePaymentAmount.textAlignment=NSTextAlignmentCenter; lblAdvancePaymentAmount.text=@"0.00"; lblAdvancePaymentAmount.textColor = [UIColor blackColor]; lblAdvancePaymentAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [advancePaymentView addSubview:lblAdvancePaymentAmount]; UILabel *lblAdvancePaymentAmountTitle = [[UILabel alloc]init]; lblAdvancePaymentAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(lblAdvancePaymentAmount.frame),advancePaymentView.frame.size.width, 25); lblAdvancePaymentAmountTitle.text = @"预付款金额"; lblAdvancePaymentAmountTitle.textAlignment=NSTextAlignmentCenter; lblAdvancePaymentAmountTitle.textColor = [UIColor blackColor]; lblAdvancePaymentAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [advancePaymentView addSubview:lblAdvancePaymentAmountTitle]; [payableContent addSubview:advancePaymentView]; payableBorderV=[CustomBorderView new]; payableBorderV.frame=CGRectMake(5, CGRectGetMaxY(accountsPayableView.frame)+topMargin,Screen_Width-30, 350); [payableBorderV setBackgroundColor:[UIColor whiteColor]]; [payableBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [payableContent addSubview:payableBorderV]; _payableChartView=[[BarChartView alloc]init]; _payableChartView.frame=CGRectMake(0,0,payableBorderV.frame.size.width, 350); [payableBorderV addSubview:_payableChartView]; payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+10); height=CGRectGetMaxY(payableContent.frame); payableContent.layer.cornerRadius=CornerRadius; } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){ //库存状况 inventoryStatusContent=[UIView new]; inventoryStatusContent.frame=CGRectMake(10,CGRectGetMaxY(payableContent.frame)+10,Screen_Width,0); inventoryStatusContent.backgroundColor=[UIColor whiteColor]; [content addSubview:inventoryStatusContent]; UIView *inventoryStatusTitleView = [[UIView alloc]init]; inventoryStatusTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45); UIView * inventoryStatusView=[UIImageView new]; inventoryStatusView.frame=CGRectMake(10, 10,10 , 25); [inventoryStatusView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; UIView *separator5=[UIView new]; separator5.frame=CGRectMake(0,inventoryStatusTitleView.frame.size.height-1, inventoryStatusTitleView.frame.size.width-20, 0.5); [separator5 setBackgroundColor:[UIColor lightGrayColor]]; [inventoryStatusTitleView addSubview:separator5]; [inventoryStatusTitleView addSubview:inventoryStatusView]; UILabel *titleInventoryStatus = [[UILabel alloc]init]; titleInventoryStatus.frame = CGRectMake(CGRectGetMaxX(inventoryStatusView.frame)+10, 10, 90, 25); titleInventoryStatus.text = @"库存情况"; titleInventoryStatus.textColor = [UIColor blackColor]; titleInventoryStatus.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [inventoryStatusTitleView addSubview:titleInventoryStatus]; [inventoryStatusContent addSubview:inventoryStatusTitleView]; UIView *inventoryAmountView = [[UIView alloc]init]; inventoryAmountView.frame = CGRectMake(0,CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin, Screen_Width/2, rowHeight); lblInventoryAmount = [[UILabel alloc]init]; lblInventoryAmount.frame = CGRectMake(0, 0, inventoryAmountView.frame.size.width, 25); lblInventoryAmount.textColor = [UIColor redColor]; lblInventoryAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; lblInventoryAmount.textAlignment=NSTextAlignmentCenter; lblInventoryAmount.text=@"0.00"; [inventoryAmountView addSubview:lblInventoryAmount]; lblTitleInventoryAmount = [[UILabel alloc]init]; lblTitleInventoryAmount.frame = CGRectMake(0,CGRectGetMaxY(lblInventoryAmount.frame),inventoryAmountView.frame.size.width, 25); lblTitleInventoryAmount.text = @"库存金额"; lblTitleInventoryAmount.textColor = [UIColor redColor]; lblTitleInventoryAmount.textAlignment=NSTextAlignmentCenter; lblTitleInventoryAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [inventoryAmountView addSubview:lblTitleInventoryAmount]; UITapGestureRecognizer *inventoryAmountTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchInventoryAmount:)]; inventoryAmountView.userInteractionEnabled = YES; [inventoryAmountView addGestureRecognizer:inventoryAmountTap]; [inventoryStatusContent addSubview:inventoryAmountView]; UIView *middleSeparator6=[UIView new]; middleSeparator6.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin,0.5, 45); middleSeparator6.backgroundColor=[UIColor lightGrayColor]; [inventoryStatusContent addSubview:middleSeparator6]; UIView *inventoryQuantityView = [[UIView alloc]init]; inventoryQuantityView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin,Screen_Width/2,rowHeight); lblInventoryQuantity = [[UILabel alloc]init]; lblInventoryQuantity.frame = CGRectMake(0, 0,inventoryQuantityView.frame.size.width, 25); lblInventoryQuantity.text=@"0.00"; lblInventoryQuantity.textColor = [UIColor blackColor]; lblInventoryQuantity.textAlignment=NSTextAlignmentCenter; lblInventoryQuantity.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [inventoryQuantityView addSubview:lblInventoryQuantity]; lblInventoryQuantityTitle= [[UILabel alloc]init]; lblInventoryQuantityTitle.frame = CGRectMake(0,CGRectGetMaxY(lblInventoryQuantity.frame), inventoryQuantityView.frame.size.width, 25); lblInventoryQuantityTitle.text = @"库存量"; lblInventoryQuantityTitle.textAlignment=NSTextAlignmentCenter; lblInventoryQuantityTitle.textColor = [UIColor blackColor]; lblInventoryQuantityTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [inventoryQuantityView addSubview:lblInventoryQuantityTitle]; [inventoryStatusContent addSubview:inventoryQuantityView]; // UITapGestureRecognizer *inventoryQuantityTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchInventoryQuantity:)]; // // inventoryQuantityView.userInteractionEnabled = YES; // // [inventoryQuantityView addGestureRecognizer:inventoryQuantityTap]; [inventoryStatusContent addSubview:inventoryAmountView]; inventoryStatusBorderV=[CustomBorderView new]; inventoryStatusBorderV.frame=CGRectMake(5, CGRectGetMaxY(inventoryAmountView.frame)+topMargin,Screen_Width-30, 300); [inventoryStatusBorderV setBackgroundColor:[UIColor whiteColor]]; [inventoryStatusBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [inventoryStatusContent addSubview:inventoryStatusBorderV]; _pieView=[[PieChartView alloc]init]; _pieView.frame=CGRectMake(0,0, inventoryStatusBorderV.frame.size.width, 300); [inventoryStatusBorderV addSubview:_pieView]; inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10); inventoryStatusContent.layer.cornerRadius=CornerRadius; height=CGRectGetMaxY(inventoryStatusContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){ //采购状况 procurementSituationContent=[UIView new]; procurementSituationContent.frame=CGRectMake(10,height+10,Screen_Width,0); procurementSituationContent.backgroundColor=[UIColor whiteColor]; [content addSubview:procurementSituationContent]; UIView *procurementSituationTitleView = [[UIView alloc]init]; procurementSituationTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45); UIView * procurementSituationImgView=[UIImageView new]; procurementSituationImgView.frame=CGRectMake(10, 10,10 , 25); [procurementSituationImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; UIView *separator6=[UIView new]; separator6.frame=CGRectMake(0,procurementSituationTitleView.frame.size.height-1, procurementSituationTitleView.frame.size.width-20, 0.5); [separator6 setBackgroundColor:[UIColor lightGrayColor]]; [procurementSituationTitleView addSubview:separator6]; [procurementSituationTitleView addSubview:procurementSituationImgView]; UILabel *titleProcurementSituation = [[UILabel alloc]init]; titleProcurementSituation.frame = CGRectMake(CGRectGetMaxX(procurementSituationImgView.frame)+10, 10, 90, 25); titleProcurementSituation.text = @"采购情况"; titleProcurementSituation.textColor = [UIColor blackColor]; titleProcurementSituation.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [procurementSituationTitleView addSubview:titleProcurementSituation]; [procurementSituationContent addSubview:procurementSituationTitleView]; _btnProcurementCustomMonth = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(procurementSituationTitleView.frame)+topMargin, 70, 35)]; [_btnProcurementCustomMonth setTitle:@"自定义" forState:UIControlStateNormal]; [_btnProcurementCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnProcurementCustomMonth.tag=1004; _btnProcurementCustomMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnProcurementCustomMonth addTarget:self action:@selector(goProcurementCustomMonth:) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath21= [UIBezierPath bezierPathWithRoundedRect:_btnProcurementCustomMonth.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer22 = [CAShapeLayer layer]; maskLayer22.frame = _btnProcurementCustomMonth.bounds; maskLayer22.path = maskPath21.CGPath; _btnProcurementCustomMonth.layer.mask = maskLayer22; [procurementSituationContent addSubview:_btnProcurementCustomMonth]; procurementCustomMonthMaskLayer = [CAShapeLayer layer]; procurementCustomMonthMaskLayer.frame = _btnProcurementCustomMonth.bounds; procurementCustomMonthMaskLayer.path = maskPath21.CGPath; procurementCustomMonthMaskLayer.fillColor=[UIColor clearColor].CGColor; procurementCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; procurementCustomMonthMaskLayer.lineWidth=1; [_btnProcurementCustomMonth.layer addSublayer:procurementCustomMonthMaskLayer]; _btnProcurementCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnProcurementCustomMonth.frame),CGRectGetMaxY(procurementSituationTitleView.frame)+topMargin, 70, 35)]; [_btnProcurementCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal]; _btnProcurementCurrentMonth.tag=1005; [_btnProcurementCurrentMonth addTarget:self action:@selector(goProcurementCurrentMonth:) forControlEvents:UIControlEventTouchUpInside]; [_btnProcurementCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; _btnProcurementCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0]; UIBezierPath *maskPath22 = [UIBezierPath bezierPathWithRoundedRect:_btnProcurementCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer23 = [CAShapeLayer layer]; maskLayer23.frame = _btnProcurementCurrentMonth.bounds; maskLayer23.path = maskPath22.CGPath; _btnProcurementCurrentMonth.layer.mask = maskLayer23; [procurementSituationContent addSubview:_btnProcurementCurrentMonth]; procurementCurrentMonthMaskLayer = [CAShapeLayer layer]; procurementCurrentMonthMaskLayer.frame = _btnProcurementCurrentMonth.bounds; procurementCurrentMonthMaskLayer.path = maskPath22.CGPath; procurementCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor; procurementCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor; procurementCurrentMonthMaskLayer.lineWidth=1; [_btnProcurementCurrentMonth.layer addSublayer:procurementCurrentMonthMaskLayer]; procurementStatusPieBorderV=[CustomBorderView new]; procurementStatusPieBorderV.frame=CGRectMake(5, CGRectGetMaxY(_btnProcurementCurrentMonth.frame)+topMargin,Screen_Width-30, 200); [procurementStatusPieBorderV setBackgroundColor:[UIColor whiteColor]]; [procurementStatusPieBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [procurementSituationContent addSubview:procurementStatusPieBorderV]; procurementStatusV = [[MyView alloc]initWithFrame:CGRectMake(5,5, procurementStatusPieBorderV.frame.size.width-10,190)]; [procurementStatusPieBorderV addSubview:procurementStatusV]; UIView *percentView = [[UIView alloc]init]; percentView.frame = CGRectMake(5,CGRectGetMaxY(procurementStatusPieBorderV.frame)-30, Screen_Width-30, 25); lblProcuremmentPercent= [[UILabel alloc]init]; lblProcuremmentPercent.frame = CGRectMake(0, 0, percentView.frame.size.width, 25); lblProcuremmentPercent.textColor = [UIColor blackColor]; lblProcuremmentPercent.font = [UIFont systemFontOfSize:22]; lblProcuremmentPercent.text=@"完成率0.00%"; lblProcuremmentPercent.textAlignment=NSTextAlignmentCenter; [percentView addSubview:lblProcuremmentPercent]; [procurementSituationContent addSubview:percentView]; UIView *planAmountView = [[UIView alloc]init]; planAmountView.frame = CGRectMake(0,CGRectGetMaxY(percentView.frame)+topMargin, Screen_Width/2, rowHeight); lblPlanAmount = [[UILabel alloc]init]; lblPlanAmount.frame = CGRectMake(0, 0, planAmountView.frame.size.width, 25); lblPlanAmount.textColor = [UIColor blackColor]; lblPlanAmount.text=@"0.00"; lblPlanAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; lblPlanAmount.textAlignment=NSTextAlignmentCenter; [planAmountView addSubview:lblPlanAmount]; UILabel *lblTitlePlanAmount = [[UILabel alloc]init]; lblTitlePlanAmount.frame = CGRectMake(0,CGRectGetMaxY(lblPlanAmount.frame),planAmountView.frame.size.width, 25); lblTitlePlanAmount.text = @"任务额"; lblTitlePlanAmount.textColor = [UIColor blackColor]; lblTitlePlanAmount.textAlignment=NSTextAlignmentCenter; lblTitlePlanAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [planAmountView addSubview:lblTitlePlanAmount]; [procurementSituationContent addSubview:planAmountView]; UIView *middleSeparator7=[UIView new]; middleSeparator7.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(percentView.frame)+topMargin,0.5, 45); middleSeparator7.backgroundColor=[UIColor lightGrayColor]; [procurementSituationContent addSubview:middleSeparator7]; UIView *procurementAmountView = [[UIView alloc]init]; procurementAmountView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(percentView.frame)+topMargin,Screen_Width/2,rowHeight); lblProcurementAmount = [[UILabel alloc]init]; lblProcurementAmount.frame = CGRectMake(0, 0,procurementAmountView.frame.size.width, 25); lblProcurementAmount.text=@"0.00"; lblProcurementAmount.textColor = [UIColor blackColor]; lblProcurementAmount.textAlignment=NSTextAlignmentCenter; lblProcurementAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [procurementAmountView addSubview:lblProcurementAmount]; UILabel *lblProcurementAmountTitle= [[UILabel alloc]init]; lblProcurementAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(lblProcurementAmount.frame), procurementAmountView.frame.size.width, 25); lblProcurementAmountTitle.text = @"实际采购额"; lblProcurementAmountTitle.textAlignment=NSTextAlignmentCenter; lblProcurementAmountTitle.textColor = [UIColor blackColor]; lblProcurementAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18]; [procurementAmountView addSubview:lblProcurementAmountTitle]; [procurementSituationContent addSubview:procurementAmountView]; procurementStatusChartBorderV=[CustomBorderView new]; procurementStatusChartBorderV.frame=CGRectMake(5, CGRectGetMaxY(planAmountView.frame)+topMargin,Screen_Width-30, 350); [procurementStatusChartBorderV setBackgroundColor:[UIColor whiteColor]]; [procurementStatusChartBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [procurementSituationContent addSubview:procurementStatusChartBorderV]; _procurementStatusChartView=[[BarChartView alloc]init]; _procurementStatusChartView.frame=CGRectMake(0, 0,procurementStatusChartBorderV.frame.size.width, 350); [procurementStatusChartBorderV addSubview:_procurementStatusChartView]; procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10); procurementSituationContent.layer.cornerRadius=CornerRadius; height=CGRectGetMaxY(procurementSituationContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){ paymentFeesStatusContent=[UIView new]; paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,0); paymentFeesStatusContent.backgroundColor=[UIColor whiteColor]; [content addSubview:paymentFeesStatusContent]; UIView *paymentFeesTitleView = [[UIView alloc]init]; paymentFeesTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45); UIView *paymentFeesImgView=[UIImageView new]; paymentFeesImgView.frame=CGRectMake(10, 10,10 , 25); [paymentFeesImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]]; UIView *separator7=[UIView new]; separator7.frame=CGRectMake(0,paymentFeesTitleView.frame.size.height-1, paymentFeesTitleView.frame.size.width-20, 0.5); [separator7 setBackgroundColor:[UIColor lightGrayColor]]; [paymentFeesTitleView addSubview:separator7]; [paymentFeesTitleView addSubview:paymentFeesImgView]; UILabel *titlePaymentFees = [[UILabel alloc]init]; titlePaymentFees.frame = CGRectMake(CGRectGetMaxX(paymentFeesImgView.frame)+10, 10, 130, 25); titlePaymentFees.text = @"支出费用情况"; titlePaymentFees.textColor = [UIColor blackColor]; titlePaymentFees.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [paymentFeesTitleView addSubview:titlePaymentFees]; [paymentFeesStatusContent addSubview:paymentFeesTitleView]; _btnPaymentFeesCustomMonth = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(paymentFeesTitleView.frame)+topMargin, 70, 35)]; [_btnPaymentFeesCustomMonth setTitle:@"自定义" forState:UIControlStateNormal]; [_btnPaymentFeesCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; _btnPaymentFeesCustomMonth.tag=1005; _btnPaymentFeesCustomMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_btnPaymentFeesCustomMonth addTarget:self action:@selector(goPaymentFeesCustomMonth:) forControlEvents:UIControlEventTouchUpInside]; UIBezierPath *maskPath23= [UIBezierPath bezierPathWithRoundedRect:_btnPaymentFeesCustomMonth.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer24= [CAShapeLayer layer]; maskLayer24.frame = _btnProcurementCustomMonth.bounds; maskLayer24.path = maskPath23.CGPath; _btnPaymentFeesCustomMonth.layer.mask = maskLayer24; [paymentFeesStatusContent addSubview:_btnPaymentFeesCustomMonth]; paymentFeesCustomMonthMaskLayer = [CAShapeLayer layer]; paymentFeesCustomMonthMaskLayer.frame = _btnPaymentFeesCustomMonth.bounds; paymentFeesCustomMonthMaskLayer.path = maskPath23.CGPath; paymentFeesCustomMonthMaskLayer.fillColor=[UIColor clearColor].CGColor; paymentFeesCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor; paymentFeesCustomMonthMaskLayer.lineWidth=1; [_btnPaymentFeesCustomMonth.layer addSublayer:paymentFeesCustomMonthMaskLayer]; _btnPaymentFeesCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnPaymentFeesCustomMonth.frame),CGRectGetMaxY(paymentFeesTitleView.frame)+topMargin, 70, 35)]; [_btnPaymentFeesCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal]; _btnPaymentFeesCurrentMonth.tag=1006; [_btnPaymentFeesCurrentMonth addTarget:self action:@selector(goPaymentFeesCurrentMonth:) forControlEvents:UIControlEventTouchUpInside]; [_btnPaymentFeesCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; _btnPaymentFeesCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0]; UIBezierPath *maskPath27 = [UIBezierPath bezierPathWithRoundedRect:_btnPaymentFeesCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)]; CAShapeLayer *maskLayer28 = [CAShapeLayer layer]; maskLayer28.frame = _btnPaymentFeesCurrentMonth.bounds; maskLayer28.path = maskPath27.CGPath; _btnPaymentFeesCurrentMonth.layer.mask = maskLayer28; [paymentFeesStatusContent addSubview:_btnPaymentFeesCurrentMonth]; paymentFeesCurrentMonthMaskLayer = [CAShapeLayer layer]; paymentFeesCurrentMonthMaskLayer.frame = _btnPaymentFeesCurrentMonth.bounds; paymentFeesCurrentMonthMaskLayer.path = maskPath27.CGPath; paymentFeesCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor; paymentFeesCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor; paymentFeesCurrentMonthMaskLayer.lineWidth=1; [_btnPaymentFeesCurrentMonth.layer addSublayer:paymentFeesCurrentMonthMaskLayer]; UIView *feesAmountView= [[UIView alloc]init]; feesAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnPaymentFeesCustomMonth.frame)+topMargin, Screen_Width, 25); UILabel *lblTitleFeesAmount= [[UILabel alloc]init]; lblTitleFeesAmount.frame = CGRectMake(Screen_Width/2-110, 0, 110, 25); lblTitleFeesAmount.text = @"费用总额:"; lblTitleFeesAmount.textColor = [UIColor redColor]; lblTitleFeesAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [feesAmountView addSubview:lblTitleFeesAmount]; lblFeesTotalAmount = [[UILabel alloc]init]; lblFeesTotalAmount.frame = CGRectMake(CGRectGetMaxX(lblTitleFeesAmount.frame), 0, 150, 25); lblFeesTotalAmount.textColor = [UIColor redColor]; lblFeesTotalAmount.text=@"0.00"; lblFeesTotalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize]; [feesAmountView addSubview:lblFeesTotalAmount]; [paymentFeesStatusContent addSubview:feesAmountView]; paymentBorderV=[CustomBorderView new]; paymentBorderV.frame=CGRectMake(5, CGRectGetMaxY(feesAmountView.frame)+topMargin,Screen_Width-30, 350); [paymentBorderV setBackgroundColor:[UIColor whiteColor]]; [paymentBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]]; [paymentFeesStatusContent addSubview:paymentBorderV]; _paymentFeesChartView=[[BarChartView alloc]init]; _paymentFeesChartView.frame=CGRectMake(0,0,paymentBorderV.frame.size.width, 350); _paymentFeesChartView.tag=1001; [paymentBorderV addSubview:_paymentFeesChartView]; paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10); paymentFeesStatusContent.layer.cornerRadius=CornerRadius; height=CGRectGetMaxY(paymentFeesStatusContent.frame); } content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame)); scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100); } -(void)touchInventoryAmount:(UITapGestureRecognizer *)gesture { [self changeInventoryStatusTextColor]; lblInventoryAmount.textColor = [UIColor redColor]; lblTitleInventoryAmount.textColor = [UIColor redColor]; [self drawPieView:inventoryAmountArray pieTitleArray:inventoryTitleArray pieView:_pieView]; } -(void)touchInventoryQuantity:(UITapGestureRecognizer *)gesture { [self changeInventoryStatusTextColor]; lblInventoryQuantity.textColor = [UIColor redColor]; lblInventoryQuantityTitle.textColor = [UIColor redColor]; [self drawPieView:inventoryQuantityArray pieTitleArray:inventoryTitleArray pieView:_pieView]; } -(void)changeInventoryStatusTextColor { lblInventoryAmount.textColor = [UIColor blackColor]; lblTitleInventoryAmount.textColor = [UIColor blackColor];; lblInventoryQuantity.textColor = [UIColor blackColor]; lblInventoryQuantityTitle.textColor = [UIColor blackColor]; } /** 画饼图 */ -(void)drawPieView:(NSMutableArray*)pieArray pieTitleArray:(NSMutableArray*)pieTitleArry pieView:(PieChartView*)pieView { pieView.usePercentValuesEnabled = YES; pieView.drawSlicesUnderHoleEnabled = NO; pieView.dragDecelerationFrictionCoef = 0.5; // chartView.holeRadiusPercent = 0.58; pieView.transparentCircleRadiusPercent = 0; pieView.drawEntryLabelsEnabled=NO; // chartView.transparentCircleRadiusPercent = 0.61; pieView.chartDescription.enabled = NO; [pieView setExtraOffsetsWithLeft:5.f top:10.f right:5.f bottom:5.f]; NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail; paragraphStyle.alignment = NSTextAlignmentCenter; pieView.drawHoleEnabled = NO; pieView.rotationAngle = 0.0; pieView.rotationEnabled = YES; pieView.highlightPerTapEnabled = YES; BalloonMarker *marker = [[BalloonMarker alloc] initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0] font: [UIFont systemFontOfSize:12.0] textColor: UIColor.whiteColor insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; marker.chartView = pieView; marker.minimumSize = CGSizeMake(80.f, 40.f); pieView.marker = marker; ChartLegend *l = pieView.legend; l.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; l.verticalAlignment = ChartLegendVerticalAlignmentBottom; l.orientation = ChartLegendOrientationHorizontal; l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; l.drawInside = NO; l.xEntrySpace =1; l.yEntrySpace =3; l.yOffset =5; pieView.legend.enabled = YES; pieView.delegate = self; [pieView animateWithYAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack]; NSMutableArray *entries = [[NSMutableArray alloc] init]; for (int i = 0; i < pieArray.count; i++) { [entries addObject:[[PieChartDataEntry alloc] initWithValue:[[pieArray objectAtIndex:i] doubleValue] label:[pieTitleArry objectAtIndex:i]]]; } PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:entries label:@""]; dataSet.sliceSpace = 2.0; // add a lot of colors NSMutableArray *colors = [[NSMutableArray alloc] init]; [colors addObject:[UIColor colorWithRed:112/255.f green:168/255.f blue:76/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:40/255.f green:69/255.f blue:118/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:153/255.f green:70/255.f blue:24/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:70/255.f green:116/255.f blue:194/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:235/255.f green:125/255.f blue:60/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:163/255.f green:162/255.f blue:166/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:232/255.f green:175/255.f blue:41/255.f alpha:1.f]]; [colors addObject:[UIColor colorWithRed:88/255.f green:147/255.f blue:198/255.f alpha:1.f]]; dataSet.colors = colors; dataSet.valueLinePart1OffsetPercentage = 0.8; dataSet.valueLinePart1Length = 0.4; dataSet.valueLinePart2Length = 0.4; dataSet.yValuePosition = PieChartValuePositionOutsideSlice; PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet]; NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init]; pFormatter.numberStyle=NSNumberFormatterPercentStyle; pFormatter.maximumFractionDigits = 2; pFormatter.minimumFractionDigits=2; pFormatter.multiplier = @1.0f; pFormatter.percentSymbol = @"%"; [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]]; [data setValueTextColor:UIColor.blackColor]; pieView.data = data; [pieView highlightValues:nil]; } /** 画单个柱状图 */ -(void)drawSingleBarchart:(NSMutableArray*)barchartArray chartView:(BarChartView*)chart axisValueFormatter:(id)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue minimumValue:(double)minimumValue paymentFeesIdArray:(NSArray*)feesArray { chart.chartDescription.enabled = NO; chart.legend.enabled = NO; chart.drawGridBackgroundEnabled = NO; chart.dragEnabled = NO; [chart setScaleEnabled:NO]; chart.pinchZoomEnabled = NO; chart.extraBottomOffset=20; chart.rightAxis.enabled = NO; chart.delegate = self; chart.drawBarShadowEnabled = NO; chart.drawValueAboveBarEnabled = YES; BalloonMarker *marker = [[BalloonMarker alloc] initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0] font: [UIFont systemFontOfSize:12.0] textColor: UIColor.whiteColor insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; marker.chartView = chart; marker.minimumSize = CGSizeMake(80.f, 40.f); chart.marker = marker; chart.maxVisibleCount = 60; ChartXAxis *xAxis = chart.xAxis; xAxis.labelPosition = XAxisLabelPositionBottom; xAxis.labelFont = [UIFont systemFontOfSize:10.f]; xAxis.drawGridLinesEnabled = NO; xAxis.granularity = 1.0; // only intervals of 1 day xAxis.labelCount = count; xAxis.labelRotationAngle=20; xAxis.valueFormatter = formatter; ChartYAxis *leftAxis = chart.leftAxis; leftAxis.labelFont = [UIFont systemFontOfSize:10.f]; leftAxis.axisMaximum=maximumValue+100; leftAxis.labelPosition = YAxisLabelPositionOutsideChart; leftAxis.spaceTop = 0.15; if(minimumValue<0) { leftAxis.axisMinimum =minimumValue; } else{ leftAxis.axisMinimum = 0.0; } double start = 0; NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; NSMutableArray *colorArray = [[NSMutableArray alloc] init]; for (int i = start; i < barchartArray.count; i++) { BarChartDataEntry *dataEntry; if(feesArray!=nil&&feesArray.count>0) { dataEntry= [[BarChartDataEntry alloc] initWithX:i y:[[barchartArray objectAtIndex:i]doubleValue] icon: [UIImage imageNamed:@"icon"] idValue:[[feesArray objectAtIndex:i]intValue]]; [yVals1 addObject:dataEntry]; } else { dataEntry= [[BarChartDataEntry alloc] initWithX:i y:[[barchartArray objectAtIndex:i]doubleValue] icon: [UIImage imageNamed:@"icon"] ]; [yVals1 addObject:dataEntry]; } } BarChartDataSet *set1 = nil; UIColor *blueColor= [UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1]; [colorArray addObject:blueColor]; if (chart.data.dataSetCount > 0) { set1 = (BarChartDataSet *)chart.data.dataSets[0]; [set1 replaceEntries: yVals1]; [chart.data notifyDataChanged]; [chart notifyDataSetChanged]; } else { set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:@"资金"]; [set1 setColors:colorArray]; set1.drawIconsEnabled = NO; [set1 setDrawValuesEnabled:NO]; NSMutableArray *dataSets = [[NSMutableArray alloc] init]; [dataSets addObject:set1]; BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.0f]]; data.barWidth = 0.5f; chart.data = data; } } /** 画三个柱状图 */ -(void)drawMultipleBarchart:(NSArray*)barchartArray receivablesTitleArray:(NSMutableArray*)receivablesTitleArry barChartView:(BarChartView*) chartView axisValueFormatter:(id)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue minimumValue:(double)minimumValue { chartView.delegate = self; chartView.chartDescription.enabled = NO; chartView.extraBottomOffset=20; chartView.dragEnabled = NO; [chartView setScaleEnabled:NO]; chartView.pinchZoomEnabled = NO; chartView.drawBarShadowEnabled = NO; BalloonMarker *marker = [[BalloonMarker alloc] initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0] font: [UIFont systemFontOfSize:12.0] textColor: UIColor.whiteColor insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; marker.chartView = chartView; marker.minimumSize = CGSizeMake(80.f, 40.f); chartView.marker = marker; chartView.drawGridBackgroundEnabled = NO; ChartLegend *legend = chartView.legend; legend.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; legend.verticalAlignment = ChartLegendVerticalAlignmentBottom; legend.orientation = ChartLegendOrientationHorizontal; legend.drawInside = NO; legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]; legend.yOffset = 1; legend.xOffset = 1; legend.yEntrySpace =1; ChartXAxis *xAxis = chartView.xAxis; xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; xAxis.axisMinimum=0; xAxis.labelRotationAngle=20; xAxis.granularity = 1.0f; xAxis.labelCount=count; xAxis.drawGridLinesEnabled=NO; xAxis.centerAxisLabelsEnabled = YES; xAxis.labelPosition = XAxisLabelPositionBottom; xAxis.valueFormatter =formatter ; ChartYAxis *leftAxis = chartView.leftAxis; leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; leftAxis.valueFormatter = [[YAxisValueFormatter alloc] init]; leftAxis.drawGridLinesEnabled = YES; leftAxis.gridColor = [UIColor colorWithRed:200/255.0f green:200/255.0f blue:200/255.0f alpha:1];//网格线颜色 leftAxis.spaceTop = 0.35; leftAxis.granularityEnabled=YES; leftAxis.inverted=NO; leftAxis.gridLineWidth =1; if(minimumValue<0) { leftAxis.axisMinimum = minimumValue; } else { leftAxis.axisMinimum=0; } leftAxis.axisMaximum=maximumValue+100; leftAxis.decimals=2; // leftAxis.granularity=maximumValue/5; chartView.rightAxis.enabled = NO; float groupSpace = 0.1f; float barSpace = 0.15f; float barWidth = 0.15f; NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; NSMutableArray *yVals3 = [[NSMutableArray alloc] init]; int start =0; long end = barchartArray.count; for (int i = start; i < end; i++) { NSMutableDictionary *barchartDic=barchartArray[i]; double y1= [[barchartDic objectForKey:@"Amount"]doubleValue]; double y2=[[barchartDic objectForKey:@"CostAmount"]doubleValue]; double y3=[[barchartDic objectForKey:@"FeeAmount"]doubleValue]; [yVals1 addObject:[[BarChartDataEntry alloc] initWithX:i y:y1]]; [yVals2 addObject:[[BarChartDataEntry alloc] initWithX:i y:y2]]; [yVals3 addObject:[[BarChartDataEntry alloc] initWithX:i y:y3]]; } BarChartDataSet *set1 = nil, *set2 = nil,*set3=nil; if (chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)chartView.data.dataSets[0]; set2 = (BarChartDataSet *)chartView.data.dataSets[1]; set3 = (BarChartDataSet *)chartView.data.dataSets[2]; [set1 replaceEntries:yVals1]; [set2 replaceEntries:yVals2]; [set3 replaceEntries:yVals3]; BarChartData *data = chartView.barData; chartView.xAxis.axisMinimum = start; chartView.xAxis.axisMaximum = [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end + start; [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace]; [chartView.data notifyDataChanged]; [chartView notifyDataSetChanged]; } else { set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:receivablesTitleArry[0]]; [set1 setColor:[UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1]]; set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:receivablesTitleArry[1]]; [set2 setColor:[UIColor colorWithRed:235/255.0f green:125/255.0f blue:60/255.0f alpha:1]]; set3 = [[BarChartDataSet alloc] initWithEntries:yVals3 label:receivablesTitleArry[2]]; [set3 setColor:[UIColor lightGrayColor]]; [set1 setDrawValuesEnabled:NO]; [set2 setDrawValuesEnabled:NO]; [set3 setDrawValuesEnabled:NO]; NSMutableArray *dataSets = [[NSMutableArray alloc] init]; [dataSets addObject:set1]; [dataSets addObject:set2]; [dataSets addObject:set3]; BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; data.barWidth = barWidth; // restrict the x-axis range chartView.xAxis.axisMinimum = start; // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters chartView.xAxis.axisMaximum = start+ [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end; [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace]; chartView.data = data; } } /** 画两个柱状图 */ -(void)drawTwoBarchart:(NSMutableArray*)barchartArray receivablesTitleArray:(NSMutableArray*)receivablesTitleArry barChartView:(BarChartView*) chartView axisValueFormatter:(id)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue minimumValue:(double)minimumValue { chartView.delegate = self; chartView.extraBottomOffset=20; chartView.chartDescription.enabled = NO; chartView.dragEnabled = NO; [chartView setScaleEnabled:NO]; chartView.pinchZoomEnabled = NO; chartView.drawBarShadowEnabled = NO; chartView.drawGridBackgroundEnabled = NO; chartView.maxVisibleCount = 60; BalloonMarker *marker = [[BalloonMarker alloc] initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0] font: [UIFont systemFontOfSize:12.0] textColor: UIColor.whiteColor insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; marker.chartView = chartView; marker.minimumSize = CGSizeMake(80.f, 40.f); chartView.marker = marker; ChartLegend *legend = chartView.legend; legend.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; legend.verticalAlignment = ChartLegendVerticalAlignmentBottom; legend.orientation = ChartLegendOrientationHorizontal ; legend.drawInside = NO; legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f]; legend.yOffset = 1.0; legend.xOffset = 1.0; legend.yEntrySpace =1; ChartXAxis *xAxis = chartView.xAxis; xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; xAxis.axisMinimum = 0.0; xAxis.granularity = 1.0f; xAxis.labelCount=count; xAxis.labelRotationAngle=20; xAxis.drawGridLinesEnabled=NO; xAxis.centerAxisLabelsEnabled = YES; xAxis.labelPosition = XAxisLabelPositionBottom; xAxis.valueFormatter =formatter ; ChartYAxis *leftAxis = chartView.leftAxis; leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; leftAxis.valueFormatter = [[YAxisValueFormatter alloc] init]; leftAxis.drawGridLinesEnabled = YES; leftAxis.gridColor = [UIColor colorWithRed:200/255.0f green:200/255.0f blue:200/255.0f alpha:1];//网格线颜色 leftAxis.spaceTop = 0.35; leftAxis.granularityEnabled=YES; leftAxis.gridLineWidth =1; if(minimumValue<0) { leftAxis.axisMinimum = minimumValue; } else { leftAxis.axisMinimum=0; } leftAxis.axisMaximum=maximumValue+100; leftAxis.decimals=2; // leftAxis.granularity=maximumValue/5; chartView.rightAxis.enabled = NO; float groupSpace = 0.1f; float barSpace = 0.15f; float barWidth = 0.3f; NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; int start =0; long end = barchartArray.count; for (int i = start; i < end; i++) { NSMutableDictionary *barchartDic=barchartArray[i]; double y1=0; double y2=0; if([[barchartDic allKeys] containsObject:@"AccountReceivable"]) { y1= [[barchartDic objectForKey:@"AccountReceivable"]doubleValue]; } if([[barchartDic allKeys] containsObject:@"DepositReceived"]) { y2=[[barchartDic objectForKey:@"DepositReceived"]doubleValue]; } if([[barchartDic allKeys] containsObject:@"AccountPayable"]) { y1= [[barchartDic objectForKey:@"AccountPayable"]doubleValue]; } if([[barchartDic allKeys] containsObject:@"AdvanceMoney"]) { y2=[[barchartDic objectForKey:@"AdvanceMoney"]doubleValue]; } if([[barchartDic allKeys] containsObject:@"PlanAmount"]) { y1= [[barchartDic objectForKey:@"PlanAmount"]doubleValue]; } if([[barchartDic allKeys] containsObject:@"OrderAmount"]) { y2=[[barchartDic objectForKey:@"OrderAmount"]doubleValue]; } [yVals1 addObject:[[BarChartDataEntry alloc] initWithX:i y:y1]]; [yVals2 addObject:[[BarChartDataEntry alloc] initWithX:i y:y2]]; } BarChartDataSet *set1 = nil, *set2 = nil; if (chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)chartView.data.dataSets[0]; set2 = (BarChartDataSet *)chartView.data.dataSets[1]; [set1 replaceEntries:yVals1]; [set2 replaceEntries:yVals2]; BarChartData *data = chartView.barData; chartView.xAxis.axisMinimum = start; chartView.xAxis.axisMaximum = [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end + start; [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace]; [chartView.data notifyDataChanged]; [chartView notifyDataSetChanged]; } else { set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:receivablesTitleArry[0]]; [set1 setColor:[UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1]]; set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:receivablesTitleArry[1]]; [set2 setColor:[UIColor colorWithRed:235/255.0f green:125/255.0f blue:60/255.0f alpha:1]]; [set1 setDrawValuesEnabled:NO]; [set2 setDrawValuesEnabled:NO]; NSMutableArray *dataSets = [[NSMutableArray alloc] init]; [dataSets addObject:set1]; [dataSets addObject:set2]; BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; data.barWidth = barWidth; // restrict the x-axis range chartView.xAxis.axisMinimum = start; // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters chartView.xAxis.axisMaximum = start+ [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end; [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace]; chartView.data = data; } } -(void)clearSalesProfitData { lblNetProfitRate.text=@"0.00%"; lblSalesIncome.text=@"0.00"; lblSalesCost.text=@"0.00"; lblFeeAmount.text=@"0.00"; lblNetProfit.text=@"0.00"; lblSalesMargin.text=@"0.00"; lblGrossProfitMargin.text=@"0.00%"; } -(void)clearProcuremmentData { lblProcuremmentPercent.text=@"完成率0.00%"; lblPlanAmount.text=@"0.00"; lblProcurementAmount.text=@"0.00"; } -(void)clearPaymentFeesData { lblFeesTotalAmount.text=@"0.00"; } -(void)clearMoneytoryAssetsData { lblMonetoryCapitalAmount.text=@"0.00"; lblCashInHand.text=@"0.00"; lblBankDeposit.text=@"0.00"; lblOtherMonetoryCaiptal.text=@"0.00"; lblNetMoneyInflow.text=@"0.00"; } -(void)clearCurrentSituation { lblReceivablesAmount.text=@"0.00"; lblDepositAmount.text=@"0.00"; lblAdvancePayment.text = @"0.00"; lblReceivablesAdvanceDeposit.text=@"0.00"; } -(void)clearPayableSituation { lblAccountsPayable.text=@"0.00"; lblAdvancePaymentAmount.text=@"0.00"; } -(void)clearInventorySituation { lblInventoryAmount.text=@"0.00"; lblInventoryQuantity.text=@"0"; } /** * 异步执行 + 并发队列 * 特点:可以开启多个线程,任务交替(同时)执行。 */ - (void)asyncConcurrent { dispatch_queue_t queue = dispatch_queue_create("com.test.queue", DISPATCH_QUEUE_CONCURRENT); if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_SALES_PROFIT_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 1 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadSalesProfitData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 2 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadtAccountCashsData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 3 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadCurrentSituationData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 4 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadPayableData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 5 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadInvnetoryStatusData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 5 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadProcurementStatusData]; }); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){ dispatch_async(queue, ^{ // 追加任务 5 [NSThread sleepForTimeInterval:1]; // 模拟耗时操作 [self loadPaymentFeesData]; }); } } /** 导航按钮样式 */ -(void)loadNavStyle { self.navigationItem.title=@"统计数据分析"; //返回 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setBackgroundImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(0, 0, 15, 18); UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.leftBarButtonItem = menuButton; } /** 选择销售利润开始日期 */ - (void)btnSelectStartDate { __weak typeof(self) weakself=self; _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""]; [_dealDatePicker configureSelectionBlock:^(NSString *date){ _tempSalesProfitStartDate=date; } andCompletionBlock:^(void){ _salesProfitStartDate = _tempSalesProfitStartDate; [weakself.btnSalesProfitStartDate setTitle:weakself.salesProfitStartDate forState:UIControlStateNormal]; [self startLoading]; [self clearSalesProfitData]; [self loadSalesProfitData]; } andCancelBlock:^(void){ }]; [_dealDatePicker show]; } /** 选择销售利润结束日期 */ - (void)btnSelectEndDate { __weak typeof(self) weakself=self; _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""]; [_dealDatePicker configureSelectionBlock:^(NSString *date){ _tempSalesProfitEndDate=date; } andCompletionBlock:^(void){ weakself.salesProfitEndDate = _tempSalesProfitEndDate; [weakself.btnSalesProfitEndDate setTitle:weakself.salesProfitEndDate forState:UIControlStateNormal]; [self clearSalesProfitData]; [self startLoading]; [self loadSalesProfitData]; } andCancelBlock:^(void){ }]; [_dealDatePicker show]; } /** 选择销售利润今天日期 */ -(void)selectTodayDateData { vDate.hidden=YES; netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame)); salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350); salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10); height=CGRectGetMaxY(salesProfitContent.frame); if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){ currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame)); height=CGRectGetMaxY(currencyCapitalContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){ currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10); height=CGRectGetMaxY(currentSituationContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){ payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+30); height=CGRectGetMaxY(payableContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){ inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10); height=CGRectGetMaxY(inventoryStatusContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){ procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10); height=CGRectGetMaxY(procurementSituationContent.frame); } if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){ paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10); height=CGRectGetMaxY(paymentFeesStatusContent.frame); } content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame)); scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100); [salesIncomeYValues removeAllObjects]; [salesProfitTitleArray removeAllObjects]; [self changeButtonColor]; [self clearSalesProfitData]; _btnToday.layer.borderColor=[UIColor redColor].CGColor; [_btnToday setTitleColor:[UIColor redColor]forState:UIControlStateNormal]; _salesProfitStartDate=[DateFormat getCurrentDate]; _salesProfitEndDate=[DateFormat getCurrentDate]; [self startLoading]; [self loadSalesProfitData]; } /** 获取y轴最大值 */ -(double)getYAxisMaximumValue:(NSMutableArray*) yValueArray { double maximumValue=[[yValueArray objectAtIndex:0]doubleValue]; for(int i=1;imaximumValue) { maximumValue=yValue; } } return maximumValue; } /** 获取y轴最小值 */ -(double)getYAxisMinimumValue:(NSMutableArray*) yValueArray { double minimumValue=[[yValueArray objectAtIndex:0]doubleValue]; for(int i=1;i=3) { [self stopLoading]; } RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int status= resultModel.status; if(status==0) { NSDictionary *resultDic=(NSDictionary*)resultModel.result; NSArray *resultArray=[resultDic objectForKey:@"Table"]; if(resultArray!=nil&&resultArray.count>0) { double totalFeesAmount=0; for(int i=0;i=3) { [self stopLoading]; } RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int status= resultModel.status; if(status==0) { NSDictionary *resultDic=(NSDictionary*)resultModel.result; NSArray *resultArray=[resultDic objectForKey:@"Table"]; NSArray *resultArray1=[resultDic objectForKey:@"Table1"]; double totalPlanAmount=0; NSString *totalPlanAmountStr; if(resultArray1!=nil&&resultArray1.count>0) { NSDictionary *resultDic1=[resultArray1 objectAtIndex:0]; totalPlanAmount= [[resultDic1 objectForKey:@"PlanAmount"]doubleValue]; totalPlanAmountStr =[NSString stringWithFormat:@"%.2f",totalPlanAmount]; } if(resultArray!=nil&&resultArray.count>0) { double totalOrderAmount=0; NSMutableArray *orderAmountArray=[[NSMutableArray alloc]init]; for(int i=0;i=3) { [self stopLoading]; } if(iStatus==0) { NSDictionary *resultDic= (NSDictionary*)resultModel.result; NSArray *resultArray= [resultDic objectForKey:@"Table"]; if(resultArray!=nil&&resultArray.count>0) { double totalInventoryQuantity=0; double totalInventoryAmount=0; for(int i=0;i=3) { [self stopLoading]; } RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int iStatus = resultModel.status; if(iStatus==0) { NSDictionary *resultDic= (NSDictionary*)resultModel.result; NSMutableArray *yAxisArray=[[NSMutableArray alloc]init]; if(resultDic!=nil) { NSArray *resultArray= [resultDic objectForKey:@"Table"]; NSMutableArray *yAxisArray=[[NSMutableArray alloc]init]; if(resultArray!=nil&&resultArray.count>0) { double totalAccountPayable=0; double totalAdvanceMoney=0; for(int i=0;i=3) { [self stopLoading]; } RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int iStatus = resultModel.status; if(iStatus==0) { NSDictionary *resultDic= (NSDictionary*)resultModel.result; if(resultDic!=nil) { NSArray *resultArray= [resultDic objectForKey:@"Table"]; NSMutableArray *yAxisArray=[[NSMutableArray alloc]init]; if(resultArray!=nil&&resultArray.count>0) { double totalAccountReceivable=0; double totalBalanceAmount=0; double totalDepositReceived=0; double totalEarnest=0; for(int i=0;i=3) { [self stopLoading]; } RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; int iStatus = resultModel.status; if(iStatus==0) { NSDictionary *resultDic= (NSDictionary*)resultModel.result; NSArray *resultArray=[resultDic objectForKey:@"Table"]; double totalInComeAmount=0; double totalPayAmount=0; double totalMoneytoryAssets=0; double totalNetIncome=0; double inventoryCash=0; double bankDeposit=0; double otherMoneytoryAssets=0; if(resultArray!=nil&&resultArray.count>0) { NSMutableArray *yAxisArray=[[NSMutableArray alloc]init]; for(int i=0;i @param date <#date description#> @param dateString <#dateString description#> */ - (void)datePickerController:(ITDatePickerController *)datePickerController didSelectedDate:(NSDate *)date dateString:(NSString *)dateString { NSInteger tag = datePickerController.tag; if (datePickerController.tag == 100) { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM"] ; NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; [dateFormatter1 setDateFormat:@"yyyyMM"]; //NSDate转NSString moneytoryAssetsDate = [dateFormatter1 stringFromDate:date]; [_btnMonetoryCaitalCustom setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal]; [self clearMoneytoryAssetsData]; [self startLoading]; [self loadtAccountCashsData]; } if(datePickerController.tag == 101) { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM"] ; NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; [dateFormatter1 setDateFormat:@"yyyyMM"]; //NSDate转NSString procurementStatusDate = [dateFormatter1 stringFromDate:date]; [_btnProcurementCustomMonth setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal]; [procurementStatusYArray removeAllObjects]; [procurementStatusXTitleArray removeAllObjects]; [self clearProcuremmentData]; [self startLoading]; [self loadProcurementStatusData]; } if(datePickerController.tag == 102) { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM"] ; NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; [dateFormatter1 setDateFormat:@"yyyyMM"]; //NSDate转NSString paymentFeesDate = [dateFormatter1 stringFromDate:date]; [_btnPaymentFeesCustomMonth setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal]; [paymentFeesYArray removeAllObjects]; [paymentFeesYIdArray removeAllObjects]; [paymentFeesXArray removeAllObjects]; [self clearPaymentFeesData]; [self startLoading]; [self loadPaymentFeesData]; } } /** 货币资金数据加载失败 */ -(void)onAccountCashsDataLoadFail:(ASIDownManager *)sender { [self stopLoading]; [self showAlertViewText:@"网络异常"]; } //-(void)onFNCAccountLoadFinish:(ASIDownManager *)sender { // // [self stopLoading]; // RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; // int iStatus = resultModel.status; // if(iStatus==0) // { // fncArray=(NSArray*)resultModel.result; // if(fncArray!=nil&&fncArray.count>0) // { // NSDictionary *resultDic=[fncArray objectAtIndex:0]; // int accountIdValue=[[resultDic objectForKey:@"AccountID"]intValue]; // accountCode=[resultDic objectForKey:@"AccountCode"]; // accountId =[NSString stringWithFormat:@"%d",accountIdValue]; // [btnFncAccount setTitle:accountCode forState:UIControlStateNormal]; // // } // } // //} //-(void)goFncAccount //{ // CustomerReportTextVC *tc = [[CustomerReportTextVC alloc] init]; // tc.delegate=self; // tc.jsonArr=fncArray; // tc.showDialogViewTag=ReportFncAccount; // [self.navigationController pushViewController:tc animated:YES]; //} //-(void)onFNCAccountLoadFail:(ASIDownManager *)sender { // // [self stopLoading]; //} //- (void)customerReportTextDoneDatas:(CustomerReportTextInfoModel *)model CustomerReport:(CustomerReport)cr{ // if (model == nil) { // return; // } // // //渠道返回值 // if(cr == ReportFncAccount){ // accountId=model.idCode; // accountCode=model.name; // [btnFncAccount setTitle:model.name forState:UIControlStateNormal]; // // } // //} /** 销售利润加载完成 */ - (void)onSalesProfitLoadFinish:(ASIDownManager *)sender { // 取消进度条 count++; if(count>=3) { [self stopLoading]; } // 服务器返回数据 RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; // 服务器返回数据状态值 int iStatus = resultModel.status; // 服务器返回数据消息 NSString *message = resultModel.message; // ++count; [self stopLoading]; // 服务器返回数据状态值正确 if (iStatus == 0) { NSDictionary *result=(NSDictionary*)resultModel.result; if(result!=nil) { NSArray *resultArray=[result objectForKey:@"Table"]; if(resultArray!=nil&&resultArray.count>0) { double totalNetProfitRate=0; double totalSalesIncome=0; double totalSalesCost=0; double totalFeeAmount=0; double totalNetProfit=0; double totalMariProfit=0; double totalMariProfitRate=0; NSMutableArray *yAxisArray=[[NSMutableArray alloc]init]; for(int i=0;i */ - (void)onSalesProfitLoadFail:(ASIDownManager *)sender { [self stopLoading]; [self showAlertViewText:@"网络异常"]; } /** 柱状图选中事件 */ - (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight { if(chartView.tag==1001) { NSInteger organizationId=entry.id; if(organizationId>0) { self.hidesBottomBarWhenPushed=YES; StatisticsDataAnalysisDetailVC *detailVc = [[StatisticsDataAnalysisDetailVC alloc] init]; detailVc.organizationId=[NSString stringWithFormat:@"%ld",organizationId]; detailVc.accountMonth=paymentFeesDate; detailVc.typeId=@"0"; [self.navigationController pushViewController:detailVc animated:YES]; } else { NSMutableArray *otherArray=[[NSMutableArray alloc]init]; for(int i=0;i0) { [otherArray addObject:departmentId]; NSString *departmentIds= [otherArray componentsJoinedByString:@","]; self.hidesBottomBarWhenPushed=YES; StatisticsDataAnalysisDetailVC *detailVc = [[StatisticsDataAnalysisDetailVC alloc] init]; detailVc.organizationId=departmentIds; detailVc.accountMonth=paymentFeesDate; detailVc.typeId=@"1"; [self.navigationController pushViewController:detailVc animated:YES]; } } } } } /** 柱状图反选事件 */ - (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView { } @end