// // AveragePriceMonitorItemTableViewCell.m // IBOSS // // Created by guan hong hou on 2017/9/8. // Copyright © 2017年 elongtian. All rights reserved. // // 功能描述:均价监控table view cell #import "AveragePriceMonitorItemTableViewCell.h" @implementation AveragePriceMonitorItemTableViewCell #pragma 私有函数 /** 设置均价监控cell @param frame <#frame description#> @param invoiceType <#invoiceType description#> */ -(void)setAveragePriceMonitorCell:(AveragePriceMonitorFrame*)frame invoiceType:(NSString*)invoiceType{ _monitorModel=frame.averagePriceModel; NSInteger kindId= _monitorModel.kindId; UILabel *lblTitleDepartment = [UILabel new]; lblTitleDepartment.frame=frame.departmentTitleF; lblTitleDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleDepartment]; if(kindId>0){ lblTitleDepartment.text = @"业务部门:"; lblTitleDepartment.textColor =NavTitleColor; lblTitleDepartment.frame=frame.departmentTitleF; [self addSubview:lblTitleDepartment]; NSString *departmentName= _monitorModel.departmentName; if(departmentName!=nil){ _lblBusinessDepartment=[UILabel new]; _lblBusinessDepartment.frame=frame.departmentF; _lblBusinessDepartment.textColor=[UIColor blackColor]; _lblBusinessDepartment.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblBusinessDepartment.text=departmentName; [self addSubview:_lblBusinessDepartment]; UILabel *lblTitleKind = [UILabel new]; lblTitleKind.text=@"商品种类:"; lblTitleKind.frame=frame.kindTitleF; lblTitleKind.textColor=LabelGrayTextColor; lblTitleKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleKind]; NSString *kindName=_monitorModel.kindName; if(kindName!=nil){ _lblGoodsKind=[UILabel new]; _lblGoodsKind.frame=frame.kindF; _lblGoodsKind.textColor=[UIColor blackColor]; _lblGoodsKind.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblGoodsKind.text=kindName; [self addSubview:_lblGoodsKind]; } } } else{ lblTitleDepartment.text = @"小计"; lblTitleDepartment.textColor =[UIColor redColor]; } UIView *topSeparator=[UIView new]; topSeparator.frame=frame.topSeparatorF; topSeparator.backgroundColor=LineBackgroundColor; [self addSubview:topSeparator]; UILabel *lblTitleProfit = [UILabel new]; lblTitleProfit.text=@"毛 利 率:"; lblTitleProfit.frame=frame.profitTitleF; lblTitleProfit.textColor=LabelGrayTextColor; lblTitleProfit.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleProfit]; NSString *profit= _monitorModel.profit; if(profit!=nil){ _lblProfit=[UILabel new]; _lblProfit.frame=frame.profitF; _lblProfit.textColor=[UIColor blackColor]; _lblProfit.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblProfit.text=profit; [self addSubview:_lblProfit]; } UILabel *lblTitleOrderQuantity = [UILabel new]; if([invoiceType isEqualToString:@"1"]){ lblTitleOrderQuantity.text=@"订单数量:"; } else if([invoiceType isEqualToString:@"2"]){ lblTitleOrderQuantity.text=@"销售数量:"; } lblTitleOrderQuantity.frame=frame.orderQuantityTitleF; lblTitleOrderQuantity.textColor=LabelGrayTextColor; lblTitleOrderQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleOrderQuantity]; NSString *orderQuantity= _monitorModel.orderQuantity; if(orderQuantity!=nil){ _lblOrderQuantity=[UILabel new]; _lblOrderQuantity.frame=frame.orderQuantityF; _lblOrderQuantity.textColor=[UIColor blackColor]; _lblOrderQuantity.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblOrderQuantity.text=orderQuantity; [self addSubview:_lblOrderQuantity]; } UILabel *lblTitleOrderAmount = [UILabel new]; if([invoiceType isEqualToString:@"1"]){ lblTitleOrderAmount.text=@"订单总额:"; } else if ([invoiceType isEqualToString:@"2"]){ lblTitleOrderAmount.text=@"销售总额:"; } lblTitleOrderAmount.frame=frame.orderAmountTitleF; lblTitleOrderAmount.textColor=LabelGrayTextColor; lblTitleOrderAmount.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleOrderAmount]; NSString *orderAmount= _monitorModel.orderAmount; if(orderAmount!=nil){ _lblOrderAmount=[UILabel new]; _lblOrderAmount.frame=frame.orderAmountF; _lblOrderAmount.textColor=[UIColor blackColor]; _lblOrderAmount.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblOrderAmount.text=orderAmount; [self addSubview:_lblOrderAmount]; } UILabel *lblTitleOrderAveragePrice = [UILabel new]; if([invoiceType isEqualToString:@"1"]){ lblTitleOrderAveragePrice.text=@"订单均价:"; } else if ([invoiceType isEqualToString:@"2"]){ lblTitleOrderAveragePrice.text=@"销售均价:"; } lblTitleOrderAveragePrice.frame=frame.orderAveragePriceTitleF; lblTitleOrderAveragePrice.textColor=LabelGrayTextColor; lblTitleOrderAveragePrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleOrderAveragePrice]; NSString *orderAveragePrice= _monitorModel.orderAveragePrice; if(orderAveragePrice!=nil){ _lblOrderAveragePrice=[UILabel new]; _lblOrderAveragePrice.frame=frame.orderAveragePriceF; _lblOrderAveragePrice.textColor=[UIColor blackColor]; _lblOrderAveragePrice.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblOrderAveragePrice.text=orderAveragePrice; [self addSubview:_lblOrderAveragePrice]; } UILabel *lblTitleCostAmount = [UILabel new]; lblTitleCostAmount.text=@"成本总额:"; lblTitleCostAmount.frame=frame.costAmountTitleF; lblTitleCostAmount.textColor=LabelGrayTextColor; lblTitleCostAmount.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleCostAmount]; NSString *costAmount= _monitorModel.costAmount; if(costAmount!=nil){ _lblCostAmount=[UILabel new]; _lblCostAmount.frame=frame.costAmountF; _lblCostAmount.textColor=[UIColor blackColor]; _lblCostAmount.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblCostAmount.text=costAmount; [self addSubview:_lblCostAmount]; } UILabel *lblTitleCostAveragePrice = [UILabel new]; lblTitleCostAveragePrice.text=@"成本均价:"; lblTitleCostAveragePrice.frame=frame.costAveragePriceTitleF; lblTitleCostAveragePrice.textColor=LabelGrayTextColor; lblTitleCostAveragePrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [self addSubview:lblTitleCostAveragePrice]; NSString *costAveragePrice= _monitorModel.costAveragePrice; if(costAveragePrice!=nil){ _lblCostAveragePrice=[UILabel new]; _lblCostAveragePrice.frame=frame.costAveragePriceF; _lblCostAveragePrice.textColor=[UIColor blackColor]; _lblCostAveragePrice.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize]; _lblCostAveragePrice.text=costAveragePrice; [self addSubview:_lblCostAveragePrice]; } UIView *bottomSeparator=[UIView new]; bottomSeparator.frame=frame.bottomSeparatorF; bottomSeparator.backgroundColor=LineBackgroundColor; [self addSubview:bottomSeparator]; } @end