// // RepairReceiptFrame.m // IBOSS // // Created by guan hong hou on 2017/7/18. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // #import "RepairReceiptFrame.h" #import "NSString+Tools.h" #import "DateFormat.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] #define kTitleFont [UIFont systemFontOfSize:14] @implementation RepairReceiptFrame #pragma 私有函数 /** 设置维修已回执frame @param repairReceiptedModel <#repairReceiptedModel description#> */ - (void)setRepairReceiptFrame:(RepairReceiptListModel *)repairReceiptedModel{ _repairReceiptModel= repairReceiptedModel; NSDictionary *repairDict = @{NSFontAttributeName:kTitleFont}; CGFloat xpadding =10; NSString *receiptNoTitle = @"回执单号:"; CGRect lblReceiptNoFrame = [receiptNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblReceiptNoFrame.origin.x=xpadding; lblReceiptNoFrame.origin.y=15; _lblReceiptNoF= lblReceiptNoFrame; NSString *receiptNo = [_repairReceiptModel receiptNo ]; if(receiptNo != nil&&receiptNo.length>0){ CGRect receiptNoFrame = [receiptNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; receiptNoFrame.origin.x =CGRectGetMaxX(_lblReceiptNoF); receiptNoFrame.origin.y =15; _receiptNoF= receiptNoFrame; } _separatorF=CGRectMake(0,CGRectGetMaxY( _lblReceiptNoF)+15, Screen_Width, 1); NSString *arrangementNoTitle = @"安排单号:"; CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblArrangementNoFrame.origin.x=xpadding; lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15; _lblArrangementNoF=lblArrangementNoFrame; NSString *arrangementNo = [_repairReceiptModel arrangementNo]; if(arrangementNo != nil&&arrangementNo.length>0){ CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; arrangementNoFrame.origin.x =CGRectGetMaxX(_lblArrangementNoF); arrangementNoFrame.origin.y =CGRectGetMaxY(_separatorF)+15; _arrangementNoF=arrangementNoFrame; } NSString *repairNoTitle = @"维修单号:"; CGRect lblRepairNoFrame = [repairNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblRepairNoFrame.origin.x=xpadding; lblRepairNoFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15; _lblRepairNoF=lblRepairNoFrame; NSString *repairNo = [_repairReceiptModel repairNo]; if(repairNo != nil&&repairNo.length>0){ CGRect repairNoFrame = [repairNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; repairNoFrame.origin.x =CGRectGetMaxX(_lblRepairNoF); repairNoFrame.origin.y =CGRectGetMaxY(_lblArrangementNoF)+15; _repairNoF=repairNoFrame; } NSString *customerNameTitle = @"客户名称:"; CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblCustomerNameFrame.origin.x=xpadding; lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblRepairNoF)+15; _lblCustomerNameF=lblCustomerNameFrame; NSString *customerName = [_repairReceiptModel customerName]; if(customerName != nil&&customerName.length>0){ CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; customerNameFrame.origin.x =CGRectGetMaxX(_lblCustomerNameF); customerNameFrame.origin.y =CGRectGetMaxY(_lblRepairNoF)+15; _customerNameF=customerNameFrame; } NSString *serviceStaffTitle = @"服务员工:"; CGRect lblServiceStaffFrame = [serviceStaffTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblServiceStaffFrame.origin.x=Screen_Width/2; lblServiceStaffFrame.origin.y=CGRectGetMaxY(_lblRepairNoF)+15; _lblServiceStaffF=lblServiceStaffFrame; NSString *serviceStaffName = [_repairReceiptModel serviceStaffName]; if(serviceStaffName != nil&&serviceStaffName.length>0){ CGRect serviceStaffNameFrame = [serviceStaffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; serviceStaffNameFrame.origin.x =CGRectGetMaxX(_lblServiceStaffF); serviceStaffNameFrame.origin.y =CGRectGetMaxY(_lblRepairNoF)+15; _serviceStaffF=serviceStaffNameFrame; } NSString *customerAddressTitle = @"客户地址:"; CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblCustomerAddressFrame.origin.x = xpadding; lblCustomerAddressFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15; _lblCustomerAddressF=lblCustomerAddressFrame; NSString *customerAddress = [_repairReceiptModel customerAddress]; if(customerAddress != nil &&customerAddress.length > 0){ CGRect customerAddressFrame=CGRectMake( CGRectGetMaxX(_lblCustomerAddressF), CGRectGetMaxY(_lblCustomerNameF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerAddressF)-5, 16.7); _customerAddressF = customerAddressFrame; } NSString *customerTelephoneTitle = @"客户电话:"; CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblCustomerTelephoneFrame.origin.x = xpadding; lblCustomerTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; _lblCustomerTelephoneF = lblCustomerTelephoneFrame; NSString *customerTelephone = [_repairReceiptModel customerTelephone]; if(customerTelephone != nil && customerTelephone.length > 0){ CGRect customerTelephoneFrame=CGRectMake( CGRectGetMaxX(_lblCustomerTelephoneF)+2, CGRectGetMaxY(_lblCustomerAddressF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerTelephoneF)-2-5, 16.7); _customerTelephoneF = customerTelephoneFrame; } NSString *receiptDateTitle = @"回执日期:"; CGRect lblReceiptDateFrame = [receiptDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblReceiptDateFrame.origin.x=xpadding; lblReceiptDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15; _lblReceiptDateF=lblReceiptDateFrame; NSString *receiptDate = [_repairReceiptModel receiptDate]; if(receiptDate != nil&&receiptDate.length>0){ receiptDate= [DateFormat dateFormatSplit:receiptDate]; CGRect receiptDateFrame = [receiptDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; receiptDateFrame.origin.x =CGRectGetMaxX(_lblReceiptDateF); receiptDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15; _receiptDateF=receiptDateFrame; } NSString *receiptStatusTitle = @"回执状态:"; CGRect lblReceiptStatusFrame = [receiptStatusTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:repairDict]; lblReceiptStatusFrame.origin.x=Screen_Width/2; lblReceiptStatusFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15; _lblReceiptStatusF=lblReceiptStatusFrame; NSString *recReceiptType = [_repairReceiptModel recReceiptType]; if(recReceiptType != nil&&recReceiptType.length>0){ if ([recReceiptType isEqualToString:@"1"]) { recReceiptType = @"完成"; } if ([recReceiptType isEqualToString:@"0"]) { recReceiptType = @"再安排"; } CGRect recReceiptTypeFrame = [recReceiptType textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:repairDict]; recReceiptTypeFrame.origin.x =CGRectGetMaxX(_lblReceiptStatusF); recReceiptTypeFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15; _receiptStatusF=recReceiptTypeFrame; } _cellHeight=CGRectGetMaxY( _lblReceiptDateF)+5; } @end