| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- //
- // ProcurementApplyListDetailCell.m
- // IBOSS
- //
- // Created by guan hong hou on 2018/7/24.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "ProcurementApplyListDetailCell.h"
- @implementation ProcurementApplyListDetailCell
- -(void)setProcurementApplyListDetailCell:(ProcurementApplyListDetailModel*)detailModel{
- _procurementDetailModel=detailModel;
-
- if(_procurementDetailModel==nil){
- return;
- }
- CGFloat heightLine = 1;
- CGFloat heightRow = 31;
- CGFloat lblx = 20;
- CGFloat lbly = 0;
- CGFloat lblwidth = 70;
- CGFloat lblheight = 31;
- CGFloat valuex = 85;
- CGFloat valuey = 0;
- CGFloat valueheight = 31;
- CGFloat xpadding=20;
- NSString *orderNo= _procurementDetailModel.orderNo;
- NSString *applyNo=_procurementDetailModel.applyNo;
- if([orderNo isEqualToString:@"小计"]||[applyNo isEqualToString:@"小计"]){
- UIView *vCount = [UIView new];
- vCount.frame=CGRectMake(0,10, Screen_Width, heightRow);
- [self.contentView addSubview:vCount];
-
- UILabel *lblCountTitle = [UILabel new];
- lblCountTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCountTitle.text = @"小计";
- lblCountTitle.textColor = [UIColor redColor];
- lblCountTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCount addSubview:lblCountTitle];
- _middleSeparator = [[UIView alloc]init];
- _middleSeparator.frame=CGRectMake(0,CGRectGetMaxY(vCount.frame)+10, Screen_Width, heightLine);
- _middleSeparator.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:_middleSeparator];
-
- }
- else
- {
- UIView *vOrderNo = [UIView new];
- vOrderNo.frame=CGRectMake(0,10, Screen_Width, heightRow);
- [self.contentView addSubview:vOrderNo];
-
- UILabel *lblOrderNoTitle = [UILabel new];
- lblOrderNoTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblOrderNoTitle.text = @"订单单号:";
- lblOrderNoTitle.textColor = [UIColor blackColor];
- lblOrderNoTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOrderNo addSubview:lblOrderNoTitle];
- _lblOrderNo = [UILabel new];
- _lblOrderNo.frame=CGRectMake(valuex, valuey, Screen_Width-CGRectGetMaxX(lblOrderNoTitle.frame)-5, valueheight);
- _lblOrderNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOrderNo addSubview:_lblOrderNo];
- _lblOrderNo.text = orderNo;
-
- UIView *vCodeAndOnlyCode = [UIView new];
- vCodeAndOnlyCode.frame=CGRectMake(0, CGRectGetMaxY(vOrderNo.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vCodeAndOnlyCode];
-
- UIView *vCode = [UIView new];
- vCode.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
- [vCodeAndOnlyCode addSubview:vCode];
-
- UILabel *lblCodeTitle = [UILabel new];
- lblCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCodeTitle.text = @"商品编码:";
- lblCodeTitle.textColor = [UIColor blackColor];
- lblCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCode addSubview:lblCodeTitle];
- _lblCode = [UILabel new];
- _lblCode.frame=CGRectMake(valuex, valuey, Screen_Width/2 - valuex, valueheight);
- _lblCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCode addSubview:_lblCode];
- _lblCode.text = _procurementDetailModel.code;
-
- UIView *vOnlyCode = [UIView new];
- vOnlyCode.frame=CGRectMake(Screen_Width / 2, 0, Screen_Width / 2, heightRow);
- [vCodeAndOnlyCode addSubview:vOnlyCode];
-
- UILabel *lblOnlyCodeTitle = [UILabel new];
- lblOnlyCodeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblOnlyCodeTitle.text = @"唯一编码:";
- lblOnlyCodeTitle.textColor = [UIColor blackColor];
- lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:lblOnlyCodeTitle];
-
- _lblOnlyCode = [UILabel new];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2 - valuex , valueheight);
- _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:_lblOnlyCode];
- _lblOnlyCode.text = _procurementDetailModel.onlyCode;
-
- UIView *vSpecificationAndGrade = [UIView new];
- vSpecificationAndGrade.frame=CGRectMake(0, CGRectGetMaxY(vCodeAndOnlyCode.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vSpecificationAndGrade];
-
- UIView *vSpecification = [UIView new];
- vSpecification.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
- [vSpecificationAndGrade addSubview:vSpecification];
-
- UILabel *lblSpecificationTitle = [UILabel new];
- lblSpecificationTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblSpecificationTitle.text = @"商品规格:";
- lblSpecificationTitle.textColor = [UIColor blackColor];
- lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:lblSpecificationTitle];
- _lblSpecification = [UILabel new];
- _lblSpecification.frame=CGRectMake(valuex, valuey, Screen_Width/2 - valuex, valueheight);
- _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:_lblSpecification];
- _lblSpecification.text = _procurementDetailModel.goodsSpecification;
-
- UIView *vGrade = [UIView new];
- vGrade.frame=CGRectMake(Screen_Width / 2, 0, Screen_Width / 2, heightRow);
- [vSpecificationAndGrade addSubview:vGrade];
-
- UILabel *lblGradeTitle = [UILabel new];
- lblGradeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblGradeTitle.text = @"商品等级:";
- lblGradeTitle.textColor = [UIColor blackColor];
- lblGradeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGrade addSubview:lblGradeTitle];
-
- _lblGrade = [UILabel new];
- _lblGrade.frame=CGRectMake(CGRectGetMaxX(lblGradeTitle.frame), valuey, Screen_Width/2 - valuex , valueheight);
- _lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGrade addSubview:_lblGrade];
- _lblGrade.text = _procurementDetailModel.gradeName;
-
- UIView *vApplyDepartment = [UIView new];
- vApplyDepartment.frame=CGRectMake(0,CGRectGetMaxY(vSpecificationAndGrade.frame), Screen_Width, heightRow);
-
- [self.contentView addSubview:vApplyDepartment];
-
- UILabel *lblApplyDepartmentTitle = [UILabel new];
- lblApplyDepartmentTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblApplyDepartmentTitle.text = @"申请部门:";
- lblApplyDepartmentTitle.textColor = [UIColor blackColor];
- lblApplyDepartmentTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vApplyDepartment addSubview:lblApplyDepartmentTitle];
- _lblApplyDepartment = [UILabel new];
- _lblApplyDepartment.frame=CGRectMake(valuex, valuey, Screen_Width-CGRectGetMaxX(lblApplyDepartmentTitle.frame)-5, valueheight);
- _lblApplyDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vApplyDepartment addSubview:_lblApplyDepartment];
- _lblApplyDepartment.text = _procurementDetailModel.organizationName;
-
- _middleSeparator = [[UIView alloc]init];
- _middleSeparator.frame=CGRectMake(0,CGRectGetMaxY(vApplyDepartment.frame)+8, Screen_Width, heightLine);
- _middleSeparator.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:_middleSeparator];
- }
-
- NSDictionary *procurementDict = @{NSFontAttributeName:[UIFont systemFontOfSize:SubLabelAndTextFontOfSize]};
-
- _lblProcurementQuantity= [[UILabel alloc]init];
- _lblProcurementQuantity.font = [UIFont systemFontOfSize:SubLabelAndTextFontOfSize];
-
- _lblProcurementQuantity.textAlignment=NSTextAlignmentLeft;
- NSString *procurementQuantity= [NSString stringWithFormat:@"请购数量:%@;核准数量:%@",_procurementDetailModel.applyQuantity,_procurementDetailModel.approvedQuantity];
- _lblProcurementQuantity.text=procurementQuantity;
- CGRect procurementQuantityFrame = [procurementQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:procurementDict];
- procurementQuantityFrame.origin.x =Screen_Width-xpadding-procurementQuantityFrame.size.width;
- procurementQuantityFrame.origin.y =CGRectGetMaxY(_middleSeparator.frame)+ 10;
- _lblProcurementQuantity.frame=procurementQuantityFrame;
- [self.contentView addSubview:_lblProcurementQuantity];
-
- UIView *bottomSeparator = [[UIView alloc]init];
- bottomSeparator.frame=CGRectMake(0,CGRectGetMaxY(_lblProcurementQuantity.frame)+10, Screen_Width, 10);
- bottomSeparator.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:bottomSeparator];
- _height=CGRectGetMaxY(bottomSeparator.frame);
- }
- @end
|