| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- //
- // UnReceiptListFrame.m
- // IBOSS
- //
- // Created by guan hong hou on 16/4/14.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- // 功能描述:配送未回执frame
- #import "UnReceiptListFrame.h"
- #import "UnReceiptListModel.h"
- #import "NSString+Tools.h"
- #import "DateFormat.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- #define kTitleFont [UIFont systemFontOfSize:14]
- @implementation UnReceiptListFrame
- #pragma mark - 私有函数
- /**
- 设置未回执frame
- @param unReceiptListModel <#unReceiptListModel description#>
- */
- - (void)setUnReceiptListFrame:(UnReceiptListModel *)unReceiptListModel{
- _unReceiptListModel=unReceiptListModel;
- NSDictionary *unReceiptDict = @{NSFontAttributeName:kTitleFont};
- CGFloat xpadding = 10;
- NSString *deliveryNoTitle = @"送货单号:";
- CGRect lblDeliveryNoFrame = [deliveryNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblDeliveryNoFrame.origin.x = xpadding;
- lblDeliveryNoFrame.origin.y = 15;
- _lblDeliveryNoF = lblDeliveryNoFrame;
-
- NSString *deliveryNo = [unReceiptListModel deliveryNo];
- if(deliveryNo != nil && deliveryNo.length > 0){
- CGRect deliveryNoFrame = CGRectMake(CGRectGetMaxX(_lblDeliveryNoF), 15, SCREENWIDTH - 20 -CGRectGetMaxX(_lblDeliveryNoF), 16);
- _deliveryNoF = deliveryNoFrame;
- }
-
- _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32);
- _separatorF=CGRectMake(0,CGRectGetMaxY(_lblDeliveryNoF)+15, Screen_Width, 1);
- NSString *arrangementNoTitle = @"安排单号:";
- CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblArrangementNoFrame.origin.x = xpadding;
- lblArrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
- _lblArrangementNoF = lblArrangementNoFrame;
- NSString *arrangementNo = [unReceiptListModel arrangementNo];
- if(arrangementNo != nil && arrangementNo.length>0){
- CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- arrangementNoFrame.origin.x = CGRectGetMaxX(_lblArrangementNoF);
- arrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
- _arrangementNoF= arrangementNoFrame;
- }
-
- NSString *customerNameTitle = @"客户名称:";
- CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblCustomerNameFrame.origin.x = xpadding;
- lblCustomerNameFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
- _lblCustomerNameF = lblCustomerNameFrame;
-
- NSString *customerName = [unReceiptListModel customerName];
- if(customerName != nil && customerName.length > 0){
- CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF);
- customerNameFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
- _customerNameF = customerNameFrame;
- }
-
-
- NSString *telephponeTitle = @"客户电话:";
- CGRect lblTelephoneFrame = [telephponeTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblTelephoneFrame.origin.x = xpadding;
- lblTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
- _lblCustomerTelephoneF = lblTelephoneFrame;
- NSString *telephone = [unReceiptListModel telephone];
- if(telephone != nil && telephone.length > 0){
- CGRect telephoneFrame = [telephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- telephoneFrame.origin.x = CGRectGetMaxX(_lblCustomerTelephoneF);
- telephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
- _customerTelephoneF = telephoneFrame;
- }
- NSString *deliveryDateTitle = @"送货日期:";
- CGRect lblDeliveryDateFrame = [deliveryDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblDeliveryDateFrame.origin.x = xpadding;
- lblDeliveryDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
- _lblDeliveryDateF=lblDeliveryDateFrame;
-
- NSString *deliveryDate = [unReceiptListModel deliveryDate];
- deliveryDate= [DateFormat dateFormatSplit:deliveryDate];
- if(deliveryDate != nil && deliveryDate.length > 0){
- CGRect deliveryDateFrame = [deliveryDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- deliveryDateFrame.origin.x = CGRectGetMaxX(lblDeliveryDateFrame);
- deliveryDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
- _deliveryDateF = deliveryDateFrame;
- }
- NSString *truckNameTitle = @"车牌号码:";
- CGRect lblTruckNameFrame = [truckNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblTruckNameFrame.origin.x = Screen_Width / 2;
- lblTruckNameFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
- _lblTruckNameF = lblTruckNameFrame;
- NSString *truckName = [unReceiptListModel truckName];
- if(truckName != nil && truckName.length > 0){
- CGRect truckNameFrame = [truckName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- truckNameFrame.origin.x = CGRectGetMaxX(_lblTruckNameF);
- truckNameFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
- _truckNameF = truckNameFrame;
- }
- NSString *customerAddressTitle = @"客户地址:";
- CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblCustomerAddressFrame.origin.x = xpadding;
- lblCustomerAddressFrame.origin.y = CGRectGetMaxY(lblDeliveryDateFrame) + 15;
- _lblCustomerAddressF = lblCustomerAddressFrame;
- NSString *customerAddress = [unReceiptListModel deliveryAddress];
- if(customerAddress!=nil&&customerAddress.length>0){
- CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- customerAddressFrame.origin.x = CGRectGetMaxX(_lblCustomerAddressF);
- customerAddressFrame.origin.y = CGRectGetMaxY(_lblDeliveryDateF) + 15;
- _customerAddressF = customerAddressFrame;
-
- }
-
- NSString *staffName =[unReceiptListModel staffName];
- NSString *organizationName = [unReceiptListModel organizationName];
-
- if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){
- _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5;
-
- }
- else{
- NSString *organizationNameTitle = @"业务部门:";
- CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblOrganizationNameFrame.origin.x = xpadding;
- lblOrganizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
- _lblOrganizationNameF = lblOrganizationNameFrame;
- if(organizationName!=nil&&organizationName.length>0){
- CGRect organizationNameFrame = [organizationName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- organizationNameFrame.origin.x = CGRectGetMaxX(_lblOrganizationNameF);
- organizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
- if(organizationNameFrame.size.width>Screen_Width/2-lblOrganizationNameFrame.size.width){
- organizationNameFrame.size.width=Screen_Width/2-lblOrganizationNameFrame.size.width-3;
- }
- _organizationNameF = organizationNameFrame;
- }
-
- NSString *staffNameTitle = @"业 务 员:";
- CGRect lblStaffNameFrame = [staffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
- lblStaffNameFrame.origin.x = Screen_Width/2;
- lblStaffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
- _lblStaffNameF = lblStaffNameFrame;
- if(staffName!=nil&&staffName.length>0){
- CGRect staffNameFrame = [staffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
- staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF);
- staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
- _staffNameF = staffNameFrame;
-
- }
-
- _cellHeight = CGRectGetMaxY(_lblOrganizationNameF)+5;
- }
-
-
-
-
- }
- @end
|