// // InstallReceiptedListFrame.m // IBOSS // // Created by guan hong hou on 2017/7/13. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // 功能描述:安装已回执frame #import "InstallReceiptedListFrame.h" #import "DateFormat.h" #import "NSString+Tools.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] #define kTitleFont [UIFont systemFontOfSize:14] @implementation InstallReceiptedListFrame #pragma mark - 私有函数 /** 设置安装已回执frame @param installationInfoModel <#installationInfoModel description#> */ - (void)setInstallationListFrame:(InstallReceiptListModel *)installationInfoModel{ _installationReceiptListModel = installationInfoModel; NSDictionary *installationDict = @{NSFontAttributeName:kTitleFont}; CGFloat xpadding = 10; NSString *receiptNoTitle = @"回执单号:"; CGRect lblReceiptNoFrame = [receiptNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblReceiptNoFrame.origin.x = xpadding; lblReceiptNoFrame.origin.y = 15; _lblReceiptNoF = lblReceiptNoFrame; NSString *receiptNoStr = [_installationReceiptListModel receiptNo]; if(receiptNoStr != nil && receiptNoStr.length > 0){ CGRect receiptNoFrame = [receiptNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict]; receiptNoFrame.origin.y = 15; receiptNoFrame.origin.x = CGRectGetMaxX(_lblReceiptNoF); _receiptNoF = receiptNoFrame; } _btnCancelReceiptF=CGRectMake(Screen_Width-70, 15,60,17); _separatorF = CGRectMake(0,CGRectGetMaxY(_lblReceiptNoF) + 15, Screen_Width, 1); NSString *arrangementNoTitle = @"安排单号:"; CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblArrangementNoFrame.origin.x = xpadding; lblArrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF)+15; _lblArrangementNoF = lblArrangementNoFrame; NSString *arrangementNoStr = [_installationReceiptListModel arrangementNo]; if(arrangementNoStr != nil&&arrangementNoStr.length > 0){ CGRect arrangementNoFrame = [arrangementNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict]; arrangementNoFrame.origin.x = CGRectGetMaxX(_lblArrangementNoF) ; arrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15; _arrangementNoF = arrangementNoFrame; } NSString *installationNoTitle = @"安装单号:"; CGRect lblInstallationNoFrame = [installationNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblInstallationNoFrame.origin.x = xpadding; lblInstallationNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) +15; _lblInstallationNoF = lblInstallationNoFrame; NSString *installationNoStr = [_installationReceiptListModel installationNo]; if(installationNoStr != nil && installationNoStr.length > 0){ CGRect installationNoFrame = [installationNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict]; installationNoFrame.origin.x = CGRectGetMaxX(_lblInstallationNoF); installationNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15; _installationNoF = installationNoFrame; } NSString *customerNameTitle = @"客户名称:"; CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblCustomerNameFrame.origin.x = xpadding; lblCustomerNameFrame.origin.y = CGRectGetMaxY(_lblInstallationNoF) + 15; _lblCustomerNameF=lblCustomerNameFrame; NSString *customerName = [_installationReceiptListModel customerName]; if(customerName != nil &&customerName.length > 0){ CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF) - 5, MAXFLOAT) attributes:installationDict]; customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF); customerNameFrame.origin.y = CGRectGetMaxY( _lblInstallationNoF) + 15; _customerNameF = customerNameFrame; } NSString *customerAddressTitle = @"客户地址:"; CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblCustomerAddressFrame.origin.x = xpadding; lblCustomerAddressFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15; _lblCustomerAddressF=lblCustomerAddressFrame; NSString *customerAddress = [_installationReceiptListModel 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:installationDict]; lblCustomerTelephoneFrame.origin.x = xpadding; lblCustomerTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; _lblCustomerTelephoneF = lblCustomerTelephoneFrame; NSString *customerTelephone = [_installationReceiptListModel 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:installationDict]; lblReceiptDateFrame.origin.x = xpadding; lblReceiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15; _lblReceiptDateF = lblReceiptDateFrame; NSString *receiptDate = [_installationReceiptListModel receiptDate]; receiptDate = [DateFormat dateFormatSplit:receiptDate]; if(receiptDate != nil && receiptDate.length > 0){ CGRect receiptDateFrame = [receiptDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict]; receiptDateFrame.origin.x = CGRectGetMaxX(_lblReceiptDateF) ; receiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15; _receiptDateF = receiptDateFrame; } NSString *receiptStatusTitle = @"回执状态:"; CGRect lblReceiptStatusFrame = [receiptStatusTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict]; lblReceiptStatusFrame.origin.x=Screen_Width /2; lblReceiptStatusFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15; _lblReceiptStatusF= lblReceiptStatusFrame; NSString *receiptType = [_installationReceiptListModel receiptType]; if ([receiptType isEqualToString:@"1"]) { receiptType = @"完成"; } if ([receiptType isEqualToString:@"3"]) { receiptType = @"推迟安装"; } if(receiptType != nil&&receiptType.length>0){ CGRect receiptStatusFrame = [receiptType textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblReceiptStatusF)-5, MAXFLOAT) attributes:installationDict]; receiptStatusFrame.origin.x =CGRectGetMaxX(_lblReceiptStatusF); receiptStatusFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15; _receiptStatusF= receiptStatusFrame; } _cellHeight=CGRectGetMaxY(_lblReceiptDateF)+5; } @end