DispatchNoReceiptFrame.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. //
  2. // RequirementNoReceiptFrame.m
  3. // IBOSSHSH
  4. //
  5. // Created by ssl on 2018/1/12.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "DispatchNoReceiptFrame.h"
  9. #import "RequirementNoReceiptCell.h"
  10. #import "NSString+Tools.h"
  11. #import "DateFormat.h"
  12. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  13. #define kTitleFont [UIFont systemFontOfSize:14]
  14. @implementation DispatchNoReceiptFrame
  15. #pragma mark - 私有函数
  16. /**
  17. 设置未回执frame
  18. @param unReceiptListModel <#unReceiptListModel description#>
  19. */
  20. - (void)setUnReceiptListFrame:(DispatchNoReceiptModel *)unReceiptListModel{
  21. _unReceiptListModel=unReceiptListModel;
  22. NSDictionary *unReceiptDict = @{NSFontAttributeName:kTitleFont};
  23. NSDictionary *customerNameDict = @{NSFontAttributeName:[UIFont systemFontOfSize:15]};
  24. CGFloat xpadding = 10;
  25. NSString *customerNameTitle = @"客户名称:";
  26. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:customerNameDict];
  27. lblCustomerNameFrame.origin.x = xpadding;
  28. lblCustomerNameFrame.origin.y = 15;
  29. _lblCustomerNameF = lblCustomerNameFrame;
  30. NSString *customerName = [unReceiptListModel customerName];
  31. if([unReceiptListModel.receivables doubleValue]>0)
  32. {
  33. customerName=[NSString stringWithFormat:@"%@%@",customerName,@"[有费用]"];
  34. }
  35. if(customerName != nil && customerName.length > 0){
  36. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(500, MAXFLOAT) attributes:customerNameDict];
  37. customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF);
  38. customerNameFrame.origin.y = 15;
  39. _customerNameF = customerNameFrame;
  40. }
  41. _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32);
  42. _separatorF=CGRectMake(0,CGRectGetMaxY(_lblCustomerNameF)+15, Screen_Width, 1);
  43. NSString *customerAddressTitle = @"送货地址:";
  44. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:customerNameDict];
  45. lblCustomerAddressFrame.origin.x = xpadding;
  46. lblCustomerAddressFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  47. _lblCustomerAddressF = lblCustomerAddressFrame;
  48. NSString *customerAddress = [unReceiptListModel deliveryAddress];
  49. if(customerAddress!=nil&&customerAddress.length>0){
  50. CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerAddressF)-10, MAXFLOAT) attributes:customerNameDict];
  51. customerAddressFrame.origin.x = CGRectGetMaxX(_lblCustomerAddressF);
  52. customerAddressFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  53. _customerAddressF = customerAddressFrame;
  54. }
  55. NSString *telephponeTitle = @"联系电话:";
  56. CGRect lblTelephoneFrame = [telephponeTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  57. lblTelephoneFrame.origin.x = xpadding;
  58. lblTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  59. _lblCustomerTelephoneF = lblTelephoneFrame;
  60. NSString *telephone = [unReceiptListModel telephone];
  61. if(telephone != nil && telephone.length > 0){
  62. CGRect telephoneFrame = [telephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  63. telephoneFrame.origin.x = CGRectGetMaxX(_lblCustomerTelephoneF);
  64. telephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  65. _customerTelephoneF = telephoneFrame;
  66. }
  67. NSString *dispatchNoTitle = @"派工单号:";
  68. CGRect lblDispatchNoFrame = [dispatchNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  69. lblDispatchNoFrame.origin.x = xpadding;
  70. lblDispatchNoFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  71. _lblDispatchNoF = lblDispatchNoFrame;
  72. NSString *dispatchNo = [unReceiptListModel arrangementNo];
  73. if(dispatchNo != nil && dispatchNo.length > 0){
  74. CGRect dispatchNoFrame = CGRectMake(CGRectGetMaxX(_lblDispatchNoF), CGRectGetMaxY(_lblCustomerTelephoneF) + 15, SCREENWIDTH - 20 -CGRectGetMaxX(_lblDispatchNoF), 16);
  75. _dispatchNoF = dispatchNoFrame;
  76. }
  77. NSString *deliveryDateTitle = @"送货日期:";
  78. CGRect lblDeliveryDateFrame = [deliveryDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  79. lblDeliveryDateFrame.origin.x = xpadding;
  80. lblDeliveryDateFrame.origin.y = CGRectGetMaxY(_lblDispatchNoF) + 15;
  81. _lblDeliveryDateF=lblDeliveryDateFrame;
  82. NSString *deliveryDate = [unReceiptListModel deliveryDate];
  83. if(deliveryDate != nil && deliveryDate.length > 0){
  84. CGRect deliveryDateFrame = [deliveryDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  85. deliveryDateFrame.origin.x = CGRectGetMaxX(lblDeliveryDateFrame);
  86. deliveryDateFrame.origin.y = CGRectGetMaxY(_lblDispatchNoF) + 15;
  87. _deliveryDateF = deliveryDateFrame;
  88. }
  89. NSString *truckNameTitle = @"车 牌 号:";
  90. CGRect lblTruckNameFrame = [truckNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  91. lblTruckNameFrame.origin.x = Screen_Width/2;
  92. lblTruckNameFrame.origin.y = CGRectGetMaxY(_lblDispatchNoF) + 15;
  93. _lblTruckNameF = lblTruckNameFrame;
  94. // NSString *truckName = [unReceiptListModel truckName];
  95. //
  96. // CGRect truckNameFrame = [truckName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  97. // truckNameFrame.origin.x = CGRectGetMaxX(_lblTruckNameF);
  98. // truckNameFrame.origin.y = CGRectGetMaxY(_lblDispatchNoF) + 15;
  99. CGRect truckNameFrm=CGRectMake(CGRectGetMaxX(_lblTruckNameF), CGRectGetMaxY(_lblDispatchNoF) + 15, Screen_Width-CGRectGetMaxX(_lblTruckNameF), 17);
  100. _truckNameF=truckNameFrm;
  101. NSString *installDateTitle = @"安装日期:";
  102. CGRect lblInstallDateFrame = [installDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  103. lblInstallDateFrame.origin.x = xpadding;
  104. lblInstallDateFrame.origin.y = CGRectGetMaxY( _lblDeliveryDateF) + 15;
  105. _installDateTitleF=lblInstallDateFrame;
  106. NSString *installDate = [unReceiptListModel installDate];
  107. if(installDate != nil && installDate.length > 0){
  108. CGRect installDateFrame = [installDate textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:unReceiptDict];
  109. installDateFrame.origin.x = CGRectGetMaxX( _installDateTitleF);
  110. installDateFrame.origin.y = CGRectGetMaxY(_lblDeliveryDateF) + 15;
  111. _installDateF = installDateFrame;
  112. }
  113. NSString *serviceStaffNameTitle = @"服务人员:";
  114. CGRect lblServiceStaffNameFrame = [serviceStaffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  115. lblServiceStaffNameFrame.origin.x = Screen_Width/2;
  116. lblServiceStaffNameFrame.origin.y = CGRectGetMaxY(_lblDeliveryDateF) + 15;
  117. _serviceStaffTitleF = lblServiceStaffNameFrame;
  118. NSString *serviceStaffName = [unReceiptListModel serviceStaffName];
  119. if(serviceStaffName != nil && serviceStaffName.length > 0){
  120. CGRect serviceStaffNameFrame = [serviceStaffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  121. serviceStaffNameFrame.origin.x = CGRectGetMaxX(_serviceStaffTitleF);
  122. serviceStaffNameFrame.origin.y = CGRectGetMaxY(_lblDeliveryDateF) + 15;
  123. _serviceStaffF = serviceStaffNameFrame;
  124. }
  125. NSString *deliveryFlagTitle=@"送货回执标识:";
  126. CGRect lblDeliveryFlagTitleFrame = [deliveryFlagTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  127. lblDeliveryFlagTitleFrame.origin.x = xpadding;
  128. lblDeliveryFlagTitleFrame.origin.y = CGRectGetMaxY(_installDateTitleF) + 15;
  129. _deliveryFlagTitleF = lblDeliveryFlagTitleFrame;
  130. NSString *deliveryFlag = [unReceiptListModel deliveryReceiptFlag];
  131. NSString *deliveryFlagStr;
  132. if([deliveryFlag intValue]==0)
  133. {
  134. deliveryFlagStr=@"否";
  135. }
  136. else{
  137. deliveryFlagStr=@"是";
  138. }
  139. if(deliveryFlagStr != nil && deliveryFlagStr.length > 0){
  140. CGRect deliveryFlagFrame = [deliveryFlagStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  141. deliveryFlagFrame.origin.x = CGRectGetMaxX(_deliveryFlagTitleF);
  142. deliveryFlagFrame.origin.y = CGRectGetMaxY(_installDateTitleF) + 15;
  143. _deliveryFlagF = deliveryFlagFrame;
  144. }
  145. NSString *installFlagTitle=@"安装回执标识:";
  146. CGRect lblInstallFlagTitleFrame = [installFlagTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unReceiptDict];
  147. lblInstallFlagTitleFrame.origin.x = Screen_Width/2;
  148. lblInstallFlagTitleFrame.origin.y = CGRectGetMaxY(_installDateTitleF) + 15;
  149. _installFlagTitleF = lblInstallFlagTitleFrame;
  150. NSString *installFlag = [unReceiptListModel installReceiptFlag];
  151. NSString *installFlagStr;
  152. if([installFlag intValue]==0)
  153. {
  154. installFlagStr=@"否";
  155. }
  156. else{
  157. installFlagStr=@"是";
  158. }
  159. if(installFlagStr != nil && installFlagStr.length > 0){
  160. CGRect installFlagFrame = [installFlagStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unReceiptDict];
  161. installFlagFrame.origin.x = CGRectGetMaxX(_installFlagTitleF);
  162. installFlagFrame.origin.y = CGRectGetMaxY(_installDateTitleF) + 15;
  163. _installFlagF = installFlagFrame;
  164. }
  165. NSString *dispatchStatusTitle=@"派工状态:";
  166. CGRect lblDispatchStatusTitleFrame = [dispatchStatusTitle textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:unReceiptDict];
  167. lblDispatchStatusTitleFrame.origin.x = xpadding;
  168. lblDispatchStatusTitleFrame.origin.y = CGRectGetMaxY(_deliveryFlagTitleF) + 15;
  169. _dispatchStatusTitleF = lblDispatchStatusTitleFrame;
  170. _deliveryTypeF=CGRectMake(CGRectGetMaxX(_dispatchStatusTitleF),CGRectGetMaxY(_deliveryFlagTitleF) + 10,25,25);
  171. NSString *deliveryTypeTitle=@"配送";
  172. CGRect lblDeliveryTypeTitleFrame = [deliveryTypeTitle textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:unReceiptDict];
  173. lblDeliveryTypeTitleFrame.origin.x =CGRectGetMaxX(_deliveryTypeF);
  174. lblDeliveryTypeTitleFrame.origin.y = CGRectGetMaxY(_deliveryFlagTitleF) + 15;
  175. _deliveryTypeTitleF = lblDeliveryTypeTitleFrame;
  176. _installTypeF=CGRectMake(CGRectGetMaxX(_deliveryTypeTitleF),CGRectGetMaxY(_deliveryFlagTitleF) + 10,25,25);
  177. NSString *installTypeTitle=@"安装";
  178. CGRect lblInstallTypeTitleFrame = [installTypeTitle textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:unReceiptDict];
  179. lblInstallTypeTitleFrame.origin.x =CGRectGetMaxX(_installTypeF);
  180. lblInstallTypeTitleFrame.origin.y = CGRectGetMaxY(_deliveryFlagTitleF) + 15;
  181. _installTypeTitleF = lblInstallTypeTitleFrame;
  182. _deliveryInstallTypeF=CGRectMake(CGRectGetMaxX(_installTypeTitleF),CGRectGetMaxY(_deliveryFlagTitleF) + 10,25,25);
  183. NSString *deliveryInstallTypeTitle=@"送安一体";
  184. CGRect lblDeliveryInstallTypeTitleFrame = [deliveryInstallTypeTitle textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:unReceiptDict];
  185. lblDeliveryInstallTypeTitleFrame.origin.x =CGRectGetMaxX(_deliveryInstallTypeF);
  186. lblDeliveryInstallTypeTitleFrame.origin.y = CGRectGetMaxY(_deliveryFlagTitleF) + 15;
  187. _deliveryInstallTypeTitleF = lblDeliveryInstallTypeTitleFrame;
  188. _middleSeparatorF=CGRectMake(0,CGRectGetMaxY(_dispatchStatusTitleF)+10, Screen_Width, 1);
  189. CGFloat btnmargin = 100;
  190. CGFloat btnwidth = 80;
  191. _navigationBtnF= CGRectMake(Screen_Width - 2 * btnmargin ,CGRectGetMaxY(_middleSeparatorF)+10 , btnwidth, 25);
  192. _saveBtnF= CGRectMake(Screen_Width - btnmargin ,CGRectGetMaxY(_middleSeparatorF)+10 , btnwidth, 25);
  193. _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32);
  194. _cellHeight = CGRectGetMaxY(_navigationBtnF)+15;
  195. }
  196. @end