// // OrderSalesDetailTableViewCell.m // IBOSSmini // // Created by guan hong hou on 2017/5/26. // Copyright © 2017年 elongtian. All rights reserved. // #import "OrderSalesDetailTableViewCell.h" @implementation OrderSalesDetailTableViewCell /** 初始化 @param style <#style description#> @param reuseIdentifier <#reuseIdentifier description#> @return <#return value description#> */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.layer.cornerRadius=CornerRadius; self.backgroundColor=[UIColor whiteColor]; } return self; } /** cell的初始化ui @param orderItem <#orderItem description#> */ -(void)parseOrderSalesDetailInfo:(OrderSaleListDetailModel *)orderItem{ UIView *contentView=[[UIView alloc]init]; CGFloat xpadding=5; CGFloat ypadding=10; [self addSubview:contentView]; UILabel *lblTitleDetailInvoiceNo=[[UILabel alloc]init]; lblTitleDetailInvoiceNo.frame=CGRectMake(xpadding,ypadding,80,25); lblTitleDetailInvoiceNo.text=@"单 号:"; lblTitleDetailInvoiceNo.font=orderTextFont; [contentView addSubview:lblTitleDetailInvoiceNo]; _lblDetailInvoiceNo=[[UILabel alloc]init]; _lblDetailInvoiceNo.frame=CGRectMake(CGRectGetMaxX(lblTitleDetailInvoiceNo.frame),ypadding,250, 25); _lblDetailInvoiceNo.text=orderItem.detailInvoiceNo; _lblDetailInvoiceNo.font=orderTextFont; [contentView addSubview:_lblDetailInvoiceNo]; UILabel *lblTitleInvoicesTypeName=[[UILabel alloc]init]; lblTitleInvoicesTypeName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleDetailInvoiceNo.frame)+ypadding,80,25); lblTitleInvoicesTypeName.text=@"单据类型:"; lblTitleInvoicesTypeName.font=orderTextFont; [contentView addSubview:lblTitleInvoicesTypeName]; _lblInvoicesTypeName=[[UILabel alloc]init]; _lblInvoicesTypeName.font=orderTextFont; _lblInvoicesTypeName.text=orderItem.invoiceTypeName; _lblInvoicesTypeName.frame=CGRectMake(CGRectGetMaxX(lblTitleInvoicesTypeName.frame),CGRectGetMaxY(lblTitleDetailInvoiceNo.frame)+ypadding,250, 25); _lblInvoicesTypeName.font=orderTextFont; [contentView addSubview:_lblInvoicesTypeName]; UILabel *lblTitleSalesDetailTypeName=[[UILabel alloc]init]; lblTitleSalesDetailTypeName.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleInvoicesTypeName.frame)+ypadding,80,25); lblTitleSalesDetailTypeName.text=@"明细类型:"; lblTitleSalesDetailTypeName.font=orderTextFont; [contentView addSubview:lblTitleSalesDetailTypeName]; _lblSalesDetailTypeName=[[UILabel alloc]init]; _lblSalesDetailTypeName.font=orderTextFont; _lblSalesDetailTypeName.text=orderItem.salesDetailTypeName; _lblSalesDetailTypeName.frame=CGRectMake(CGRectGetMaxX(lblTitleSalesDetailTypeName.frame),CGRectGetMaxY( lblTitleInvoicesTypeName.frame)+ypadding,250, 25); _lblSalesDetailTypeName.font=orderTextFont; [contentView addSubview:_lblSalesDetailTypeName]; UILabel *lblTitleOrderSalesTypeName=[[UILabel alloc]init]; lblTitleOrderSalesTypeName.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleSalesDetailTypeName.frame)+ypadding,80,25); lblTitleOrderSalesTypeName.text=@"业务类型:"; lblTitleOrderSalesTypeName.font=orderTextFont; [contentView addSubview:lblTitleOrderSalesTypeName]; _lblOrderSalesTypeName=[[UILabel alloc]init]; _lblOrderSalesTypeName.font=orderTextFont; _lblOrderSalesTypeName.text=orderItem.orderSalesTypeName; _lblOrderSalesTypeName.frame=CGRectMake(CGRectGetMaxX(lblTitleOrderSalesTypeName.frame),CGRectGetMaxY( lblTitleSalesDetailTypeName.frame)+ypadding,250, 25); _lblOrderSalesTypeName.font=orderTextFont; [contentView addSubview:_lblOrderSalesTypeName]; UILabel *lblTitleOnlyCode=[[UILabel alloc]init]; lblTitleOnlyCode.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleOrderSalesTypeName.frame)+ypadding,80,25); lblTitleOnlyCode.text=@"唯一编码:"; lblTitleOnlyCode.font=orderTextFont; [contentView addSubview:lblTitleOnlyCode]; _lblOnlyCode=[[UILabel alloc]init]; _lblOnlyCode.font=orderTextFont; _lblOnlyCode.text=orderItem.onlyCode; _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX( lblTitleOnlyCode.frame),CGRectGetMaxY( lblTitleOrderSalesTypeName.frame)+ypadding,250, 25); _lblOnlyCode.font=orderTextFont; [contentView addSubview:_lblOnlyCode]; UILabel *lblTitleCode=[[UILabel alloc]init]; lblTitleCode.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleOnlyCode.frame)+ypadding,80,25); lblTitleCode.text=@"商品编码:"; lblTitleCode.font=orderTextFont; [contentView addSubview:lblTitleCode]; _lblCode=[[UILabel alloc]init]; _lblCode.font=orderTextFont; _lblCode.text=orderItem.code; _lblCode.frame=CGRectMake(CGRectGetMaxX( lblTitleCode.frame),CGRectGetMaxY( lblTitleOnlyCode.frame)+ypadding,250, 25); _lblCode.font=orderTextFont; [contentView addSubview:_lblCode]; UILabel *lblTitleBrandName=[[UILabel alloc]init]; lblTitleBrandName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleCode.frame)+ypadding,80,25); lblTitleBrandName.text=@"商品品牌:"; lblTitleBrandName.font=orderTextFont; [contentView addSubview:lblTitleBrandName]; _lblBrandName=[[UILabel alloc]init]; _lblBrandName.font=orderTextFont; _lblBrandName.text=orderItem.brandName; _lblBrandName.frame=CGRectMake(CGRectGetMaxX( lblTitleBrandName.frame),CGRectGetMaxY( lblTitleCode.frame)+ypadding,250, 25); _lblBrandName.font=orderTextFont; [contentView addSubview:_lblBrandName]; UILabel *lblTitleKindName=[[UILabel alloc]init]; lblTitleKindName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleBrandName.frame)+ypadding,80,25); lblTitleKindName.text=@"商品种类:"; lblTitleKindName.font=orderTextFont; [contentView addSubview:lblTitleKindName]; _lblKindName=[[UILabel alloc]init]; _lblKindName.font=orderTextFont; _lblKindName.text=orderItem.kindName; _lblKindName.frame=CGRectMake(CGRectGetMaxX( lblTitleKindName.frame),CGRectGetMaxY( lblTitleBrandName.frame)+ypadding,250, 25); _lblBrandName.font=orderTextFont; [contentView addSubview:_lblKindName]; UILabel *lblTitleVarietyName=[[UILabel alloc]init]; lblTitleVarietyName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleKindName.frame)+ypadding,80,25); lblTitleVarietyName.text=@"商品品种:"; lblTitleVarietyName.font=orderTextFont; [contentView addSubview:lblTitleVarietyName]; _lblVarietyName=[[UILabel alloc]init]; _lblVarietyName.font=orderTextFont; _lblVarietyName.text=orderItem.varietyName; _lblVarietyName.frame=CGRectMake(CGRectGetMaxX( lblTitleVarietyName.frame),CGRectGetMaxY( lblTitleKindName.frame)+ypadding,250, 25); _lblVarietyName.font=orderTextFont; [contentView addSubview:_lblVarietyName]; UILabel *lblTitleSeriesName=[[UILabel alloc]init]; lblTitleSeriesName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVarietyName.frame)+ypadding,80,25); lblTitleSeriesName.text=@"商品系列:"; lblTitleSeriesName.font=orderTextFont; [contentView addSubview:lblTitleSeriesName]; _lblSeriesName=[[UILabel alloc]init]; _lblSeriesName.font=orderTextFont; _lblSeriesName.text=orderItem.seriesName; _lblSeriesName.frame=CGRectMake(CGRectGetMaxX( lblTitleSeriesName.frame),CGRectGetMaxY( lblTitleVarietyName.frame)+ypadding,250, 25); _lblSeriesName.font=orderTextFont; [contentView addSubview:_lblSeriesName]; UILabel *lblTitleUnitName=[[UILabel alloc]init]; lblTitleUnitName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSeriesName.frame)+ypadding,80,25); lblTitleUnitName.text=@"计量单位:"; lblTitleUnitName.font=orderTextFont; [contentView addSubview:lblTitleUnitName]; _lblUnitName=[[UILabel alloc]init]; _lblUnitName.font=orderTextFont; _lblUnitName.text=orderItem.unitName; _lblUnitName.frame=CGRectMake(CGRectGetMaxX( lblTitleUnitName.frame),CGRectGetMaxY( lblTitleSeriesName.frame)+ypadding,250, 25); _lblUnitName.font=orderTextFont; [contentView addSubview:_lblUnitName]; UILabel *lblTitleSpecification=[[UILabel alloc]init]; lblTitleSpecification.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleUnitName.frame)+ypadding,80,25); lblTitleSpecification.text=@"商品规格:"; lblTitleSpecification.font=orderTextFont; [contentView addSubview:lblTitleSpecification]; _lblSpecification=[[UILabel alloc]init]; _lblSpecification.font=orderTextFont; _lblSpecification.text=orderItem.specification; _lblSpecification.frame=CGRectMake(CGRectGetMaxX( lblTitleSpecification.frame),CGRectGetMaxY( lblTitleUnitName.frame)+ypadding,250, 25); _lblSpecification.font=orderTextFont; [contentView addSubview:_lblSpecification]; UILabel *lblTitleGradeName=[[UILabel alloc]init]; lblTitleGradeName.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSpecification.frame)+ypadding,80,25); lblTitleGradeName.text=@"商品等级:"; lblTitleGradeName.font=orderTextFont; [contentView addSubview:lblTitleGradeName]; _lblGradeName=[[UILabel alloc]init]; _lblGradeName.font=orderTextFont; _lblGradeName.text=orderItem.gradeName; _lblGradeName.frame=CGRectMake(CGRectGetMaxX( lblTitleGradeName.frame),CGRectGetMaxY( lblTitleSpecification.frame)+ypadding,250, 25); _lblGradeName.font=orderTextFont; [contentView addSubview:_lblGradeName]; UILabel *lblTitleColorNumber=[[UILabel alloc]init]; lblTitleColorNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleGradeName.frame)+ypadding,80,25); lblTitleColorNumber.text=@"色 号:"; lblTitleColorNumber.font=orderTextFont; [contentView addSubview:lblTitleColorNumber]; _lblColorNumber=[[UILabel alloc]init]; _lblColorNumber.font=orderTextFont; _lblColorNumber.text=orderItem.colorNumber; _lblColorNumber.frame=CGRectMake(CGRectGetMaxX( lblTitleColorNumber.frame),CGRectGetMaxY( lblTitleGradeName.frame)+ypadding,250, 25); _lblColorNumber.font=orderTextFont; [contentView addSubview:_lblColorNumber]; UILabel *lblTitleSalesQuantity=[[UILabel alloc]init]; lblTitleSalesQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding,80,25); lblTitleSalesQuantity.text=@"销售数量:"; lblTitleSalesQuantity.font=orderTextFont; [contentView addSubview:lblTitleSalesQuantity]; _lblSalesQuantity=[[UILabel alloc]init]; _lblSalesQuantity.font=orderTextFont; _lblSalesQuantity.text=orderItem.salesQuantity; _lblSalesQuantity.frame=CGRectMake(CGRectGetMaxX( lblTitleSalesQuantity.frame),CGRectGetMaxY( lblTitleColorNumber.frame)+ypadding,250, 25); _lblSalesQuantity.font=orderTextFont; [contentView addSubview:_lblSalesQuantity]; UILabel *lblTitleOrderQuantity=[[UILabel alloc]init]; lblTitleOrderQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesQuantity.frame)+ypadding,80,25); lblTitleOrderQuantity.text=@"订单数量:"; lblTitleOrderQuantity.font=orderTextFont; [contentView addSubview:lblTitleOrderQuantity]; _lblOrderQuantity=[[UILabel alloc]init]; _lblOrderQuantity.font=orderTextFont; _lblOrderQuantity.text=orderItem.orderQuantity; _lblOrderQuantity.frame=CGRectMake(CGRectGetMaxX( lblTitleOrderQuantity.frame),CGRectGetMaxY( lblTitleSalesQuantity.frame)+ypadding,250, 25); _lblOrderQuantity.font=orderTextFont; [contentView addSubview:_lblOrderQuantity]; UILabel *lblTitleSalesPrice=[[UILabel alloc]init]; lblTitleSalesPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleOrderQuantity.frame)+ypadding,80,25); lblTitleSalesPrice.text=@"销售价格:"; lblTitleSalesPrice.font=orderTextFont; [contentView addSubview:lblTitleSalesPrice]; _lblSalesPrice=[[UILabel alloc]init]; _lblSalesPrice.font=orderTextFont; _lblSalesPrice.text=orderItem.salesPrice; _lblSalesPrice.frame=CGRectMake(CGRectGetMaxX( lblTitleSalesPrice.frame),CGRectGetMaxY( lblTitleOrderQuantity.frame)+ypadding,250, 25); _lblSalesPrice.font=orderTextFont; [contentView addSubview:_lblSalesPrice]; UILabel *lblTitleGoodsSettlementPrice=[[UILabel alloc]init]; lblTitleGoodsSettlementPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesPrice.frame)+ypadding,80,25); lblTitleGoodsSettlementPrice.text=@"商品结算价:"; lblTitleGoodsSettlementPrice.font=orderTextFont; [contentView addSubview:lblTitleGoodsSettlementPrice]; _lblGoodsSettlementPrice=[[UILabel alloc]init]; _lblGoodsSettlementPrice.font=orderTextFont; _lblGoodsSettlementPrice.text=orderItem.goodsSettlementPrice; _lblGoodsSettlementPrice.frame=CGRectMake(CGRectGetMaxX( lblTitleGoodsSettlementPrice.frame),CGRectGetMaxY( lblTitleSalesPrice.frame)+ypadding,250, 25); _lblGoodsSettlementPrice.font=orderTextFont; [contentView addSubview:_lblGoodsSettlementPrice]; UILabel *lblTitleGoodsSettlementAmount=[[UILabel alloc]init]; lblTitleGoodsSettlementAmount.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleGoodsSettlementPrice.frame)+ypadding,80,25); lblTitleGoodsSettlementAmount.text=@"结算价金额:"; lblTitleGoodsSettlementAmount.font=orderTextFont; [contentView addSubview:lblTitleGoodsSettlementAmount]; _lblGoodsSettlementAmount=[[UILabel alloc]init]; _lblGoodsSettlementAmount.font=orderTextFont; _lblGoodsSettlementAmount.text=orderItem.goodsSettlementAmount; _lblGoodsSettlementAmount.frame=CGRectMake(CGRectGetMaxX( lblTitleGoodsSettlementAmount.frame),CGRectGetMaxY( lblTitleGoodsSettlementPrice.frame)+ypadding,250, 25); _lblGoodsSettlementAmount.font=orderTextFont; [contentView addSubview:_lblGoodsSettlementAmount]; UILabel *lblTitleAmount=[[UILabel alloc]init]; lblTitleAmount.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleGoodsSettlementAmount.frame)+ypadding,80,25); lblTitleAmount.text=@"金 额:"; lblTitleAmount.font=orderTextFont; [contentView addSubview:lblTitleAmount]; _lblAmount=[[UILabel alloc]init]; _lblAmount.font=orderTextFont; _lblAmount.text=orderItem.amount; _lblAmount.frame=CGRectMake(CGRectGetMaxX( lblTitleAmount.frame),CGRectGetMaxY( lblTitleGoodsSettlementAmount.frame)+ypadding,250, 25); _lblAmount.font=orderTextFont; [contentView addSubview:_lblAmount]; UILabel *lblTitleMarkedPrice=[[UILabel alloc]init]; lblTitleMarkedPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleAmount.frame)+ypadding,80,25); lblTitleMarkedPrice.text=@"标 价:"; lblTitleMarkedPrice.font=orderTextFont; [contentView addSubview:lblTitleMarkedPrice]; _lblMarkedPrice=[[UILabel alloc]init]; _lblMarkedPrice.font=orderTextFont; _lblMarkedPrice.text=orderItem.markedPrice; _lblMarkedPrice.frame=CGRectMake(CGRectGetMaxX( lblTitleMarkedPrice.frame),CGRectGetMaxY( lblTitleAmount.frame)+ypadding,250, 25); _lblMarkedPrice.font=orderTextFont; [contentView addSubview:_lblMarkedPrice]; UILabel *lblTitleDiscount=[[UILabel alloc]init]; lblTitleDiscount.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleMarkedPrice.frame)+ypadding,80,25); lblTitleDiscount.text=@"折 扣:"; lblTitleDiscount.font=orderTextFont; [contentView addSubview:lblTitleDiscount]; _lblDiscount=[[UILabel alloc]init]; _lblDiscount.font=orderTextFont; _lblDiscount.text=orderItem.discount; _lblDiscount.frame=CGRectMake(CGRectGetMaxX( lblTitleDiscount.frame),CGRectGetMaxY( lblTitleMarkedPrice.frame)+ypadding,250, 25); _lblDiscount.font=orderTextFont; [contentView addSubview:_lblDiscount]; // UIView *bottomSeparator=[[UIView alloc]init]; // bottomSeparator.frame=CGRectMake(xpadding, CGRectGetMaxY(lblTitleDiscount.frame), Screen_Width, 10); // bottomSeparator.backgroundColor=[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1]; // [contentView addSubview:bottomSeparator]; contentView.frame=CGRectMake(0,0, self.frame.size.width,CGRectGetMaxY(lblTitleDiscount.frame)) ; } @end