SalesOutStorageListCell.m 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. //
  2. // SalesOutStorageListCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/10.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SalesOutStorageListCell.h"
  9. @implementation SalesOutStorageListCell
  10. #pragma mark 公共函数
  11. /**
  12. 加载cell
  13. @param style <#style description#>
  14. @param reuseIdentifier <#reuseIdentifier description#>
  15. @return <#return value description#>
  16. */
  17. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. return self;
  20. }
  21. #pragma mark 私有函数
  22. /**
  23. 初始化cell UI和数据
  24. @param salesOutStorageModel <#salesOutStorageModel description#>
  25. */
  26. - (void)setSalesOutStorageModel:(SalesOutStorageListModel *)salesOutStorageModel{
  27. _outStorageModel=salesOutStorageModel;
  28. if(_outStorageModel==nil){
  29. return;
  30. }
  31. CGFloat heightLine = 1;
  32. CGFloat heightRow = 40;
  33. CGFloat lblx = 20;
  34. CGFloat lbly = 8;
  35. CGFloat lblwidth = 70;
  36. CGFloat lblheight = 25;
  37. CGFloat btnwidth = 50;
  38. CGFloat valuey = 8;
  39. CGFloat valueheight = 25;
  40. UIView *vOutStorageNo = [UIView new];
  41. vOutStorageNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
  42. [self.contentView addSubview:vOutStorageNo];
  43. _lblOutStorageNo = [UILabel new];
  44. _lblOutStorageNo.frame=CGRectMake(lblx, valuey, Screen_Width- lblx - 100, valueheight);
  45. _lblOutStorageNo.textColor = LabelGrayTextColor;
  46. _lblOutStorageNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  47. [vOutStorageNo addSubview:_lblOutStorageNo];
  48. _lblOutStorageNo.text = _outStorageModel.outStorageNo;
  49. _lblOutStorageStatus = [UILabel new];
  50. _lblOutStorageStatus.frame=CGRectMake(Screen_Width-108 ,valuey,100, valueheight);
  51. _lblOutStorageStatus.textAlignment = NSTextAlignmentRight;
  52. _lblOutStorageStatus.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  53. [vOutStorageNo addSubview:_lblOutStorageStatus];
  54. _lblOutStorageStatus.textColor = [UIColor blackColor];
  55. _lblOutStorageStatus.text=_outStorageModel.outStorageTypeName;
  56. //分割线
  57. _topSeparatorView= [UIView new];
  58. _topSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vOutStorageNo.frame), Screen_Width, heightLine);
  59. [self.contentView addSubview:_topSeparatorView];
  60. UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
  61. [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
  62. btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
  63. [_topSeparatorView addSubview:btnLine];
  64. //客户名称
  65. UIView *vCustomerName = [UIView new];
  66. vCustomerName.frame=CGRectMake(0, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width/2, heightRow);
  67. [self.contentView addSubview:vCustomerName];
  68. UILabel *lblCustomerNameTitle=[UILabel new];
  69. lblCustomerNameTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  70. lblCustomerNameTitle.text=@"客户名称:";
  71. lblCustomerNameTitle.textColor = [UIColor blackColor];
  72. lblCustomerNameTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  73. [vCustomerName addSubview:lblCustomerNameTitle];
  74. _lblCustomerName = [UILabel new];
  75. _lblCustomerName.frame=CGRectMake(CGRectGetMaxX(lblCustomerNameTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblCustomerNameTitle.frame), valueheight);
  76. _lblCustomerName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  77. [vCustomerName addSubview:_lblCustomerName];
  78. _lblCustomerName.text = _outStorageModel.customerName;
  79. //电话
  80. UIView *vCustomerTelephone = [UIView new];
  81. vCustomerTelephone.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width / 2, heightRow);
  82. [self.contentView addSubview: vCustomerTelephone];
  83. UILabel *lblCustomerTelephoneTitle=[UILabel new];
  84. lblCustomerTelephoneTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  85. lblCustomerTelephoneTitle.text=@"客户电话:";
  86. lblCustomerTelephoneTitle.textColor = [UIColor blackColor];
  87. lblCustomerTelephoneTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  88. [vCustomerTelephone addSubview:lblCustomerTelephoneTitle];
  89. _lblCustomerTelephone= [UILabel new];
  90. _lblCustomerTelephone.frame=CGRectMake(CGRectGetMaxX(lblCustomerTelephoneTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  91. _lblCustomerTelephone.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  92. [vCustomerTelephone addSubview:_lblCustomerTelephone];
  93. _lblCustomerTelephone.text = _outStorageModel.contactTelephone;
  94. //客户编码
  95. UIView *vCustomerCode = [UIView new];
  96. vCustomerCode.frame=CGRectMake(0, CGRectGetMaxY(vCustomerName.frame), Screen_Width, heightRow);
  97. [self.contentView addSubview:vCustomerCode];
  98. UILabel *lblCustomerCodeTitle=[UILabel new];
  99. lblCustomerCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  100. lblCustomerCodeTitle.text=@"客户编码:";
  101. lblCustomerCodeTitle.textColor = [UIColor blackColor];
  102. lblCustomerCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  103. [vCustomerCode addSubview:lblCustomerCodeTitle];
  104. _lblCustomerCode = [UILabel new];
  105. _lblCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblCustomerCodeTitle.frame), valuey, Screen_Width-CGRectGetMaxX(lblCustomerCodeTitle.frame)-10, valueheight);
  106. _lblCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  107. [vCustomerCode addSubview:_lblCustomerCode];
  108. _lblCustomerCode.text = _outStorageModel.customerCode;
  109. //业务部门
  110. UIView *vDepartment = [UIView new];
  111. vDepartment.frame=CGRectMake(0, CGRectGetMaxY(vCustomerCode.frame), Screen_Width/2, heightRow);
  112. [self.contentView addSubview:vDepartment];
  113. UILabel *lblDepartmentTitle=[UILabel new];
  114. lblDepartmentTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  115. lblDepartmentTitle.text=@"业务部门:";
  116. lblDepartmentTitle.textColor = [UIColor blackColor];
  117. lblDepartmentTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  118. [vDepartment addSubview:lblDepartmentTitle];
  119. _lblBusinessDepartment= [UILabel new];
  120. _lblBusinessDepartment.frame=CGRectMake(CGRectGetMaxX(lblDepartmentTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblDepartmentTitle.frame), valueheight);
  121. _lblBusinessDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  122. [vDepartment addSubview:_lblBusinessDepartment];
  123. _lblBusinessDepartment.text =_outStorageModel.businessDepartmentName;
  124. [vDepartment addSubview:_lblBusinessDepartment];
  125. //业务员
  126. UIView *vStaffName = [UIView new];
  127. vStaffName.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vCustomerCode.frame), Screen_Width / 2, heightRow);
  128. [self.contentView addSubview: vStaffName];
  129. UILabel *lblStaffNameTitle=[UILabel new];
  130. lblStaffNameTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  131. lblStaffNameTitle.text=@"业 务 员:";
  132. lblStaffNameTitle.textColor = [UIColor blackColor];
  133. lblStaffNameTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  134. [vStaffName addSubview:lblStaffNameTitle];
  135. _lblStaff= [UILabel new];
  136. _lblStaff.frame=CGRectMake(CGRectGetMaxX(lblStaffNameTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  137. _lblStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  138. [vStaffName addSubview:_lblStaff];
  139. _lblStaff.text = _outStorageModel.staffName;
  140. //创建人
  141. UIView *vCreator = [UIView new];
  142. vCreator.frame=CGRectMake(0, CGRectGetMaxY(vDepartment.frame), Screen_Width/2, heightRow);
  143. [self.contentView addSubview:vCreator];
  144. UILabel *lblCreatorTitle=[UILabel new];
  145. lblCreatorTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  146. lblCreatorTitle.text=@"创 建 人:";
  147. lblCreatorTitle.textColor = [UIColor blackColor];
  148. lblCreatorTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  149. [vCreator addSubview:lblCreatorTitle];
  150. _lblCreater = [UILabel new];
  151. _lblCreater.frame=CGRectMake(CGRectGetMaxX(lblCreatorTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblCreatorTitle.frame), valueheight);
  152. _lblCreater.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  153. [vCreator addSubview:_lblCreater];
  154. _lblCreater.text = _outStorageModel.creater;
  155. //账务日期
  156. UIView *vAccountDate = [UIView new];
  157. vAccountDate.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vDepartment.frame), Screen_Width / 2, heightRow);
  158. [self.contentView addSubview: vAccountDate];
  159. UILabel *lblAccountDateTitle=[UILabel new];
  160. lblAccountDateTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  161. lblAccountDateTitle.text=@"账务日期:";
  162. lblAccountDateTitle.textColor = [UIColor blackColor];
  163. lblAccountDateTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  164. [vAccountDate addSubview:lblAccountDateTitle];
  165. _lblAccountDate= [UILabel new];
  166. _lblAccountDate.frame=CGRectMake(CGRectGetMaxX(lblAccountDateTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  167. _lblAccountDate.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  168. [vAccountDate addSubview:_lblAccountDate];
  169. _lblAccountDate.text =_outStorageModel.accountDate;
  170. //客户地址
  171. UIView *vCustomerAddress = [UIView new];
  172. vCustomerAddress.frame=CGRectMake(0, CGRectGetMaxY(vCreator.frame), Screen_Width, heightRow);
  173. [self.contentView addSubview:vCustomerAddress];
  174. UILabel *lblCustomerAddressTitle=[UILabel new];
  175. lblCustomerAddressTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  176. lblCustomerAddressTitle.text=@"客户地址:";
  177. lblCustomerAddressTitle.textColor = [UIColor blackColor];
  178. lblCustomerAddressTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  179. [vCustomerAddress addSubview:lblCustomerAddressTitle];
  180. _lblCustomerAddress = [UILabel new];
  181. _lblCustomerAddress.frame=CGRectMake(CGRectGetMaxX(lblCustomerAddressTitle.frame), valuey, Screen_Width -CGRectGetMaxX(lblCustomerAddressTitle.frame), valueheight);
  182. _lblCustomerAddress.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  183. [vCustomerAddress addSubview:_lblCustomerAddress];
  184. _lblCustomerAddress.text =_outStorageModel.customerAddress;
  185. //分割线
  186. _middleSeparatorView = [UIView new];
  187. _middleSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vCustomerAddress.frame), Screen_Width, heightLine);
  188. _middleSeparatorView.backgroundColor = LineBackgroundColor;
  189. [self.contentView addSubview:_middleSeparatorView];
  190. //客户地址
  191. UIView *vGoodsQuantity = [UIView new];
  192. vGoodsQuantity.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparatorView.frame), Screen_Width, heightRow);
  193. [self.contentView addSubview:vGoodsQuantity];
  194. _btnCorrect = [UIButton buttonWithType:UIButtonTypeCustom];
  195. [_btnCorrect setTitle:@"冲正" forState:UIControlStateNormal];
  196. [_btnCorrect setBackgroundColor:[UIColor whiteColor]];
  197. _btnCorrect.layer.cornerRadius = 10;
  198. [_btnCorrect setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  199. _btnCorrect.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  200. _btnCorrect.layer.borderWidth = 0.5f;//设置边框颜色
  201. _btnCorrect.layer.borderColor = [UIColor redColor].CGColor;
  202. _btnCorrect.frame = CGRectMake(Screen_Width-btnwidth-8 ,lbly+8 , btnwidth, valueheight);
  203. [_btnCorrect addTarget:self action:@selector(btnGoCorrect) forControlEvents:UIControlEventTouchUpInside];
  204. [vGoodsQuantity addSubview:_btnCorrect];
  205. _btnGoodsDetail=[UIButton buttonWithType:UIButtonTypeCustom];
  206. [_btnGoodsDetail setTitle:@"商品详细" forState:UIControlStateNormal];
  207. [_btnGoodsDetail setBackgroundColor:[UIColor whiteColor]];
  208. _btnGoodsDetail.layer.cornerRadius = 10;
  209. _btnGoodsDetail.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  210. _btnGoodsDetail.layer.borderWidth = 0.5f;//设置边框颜色
  211. _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
  212. [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  213. _btnGoodsDetail.frame = CGRectMake(Screen_Width-btnwidth-70-8*2 ,lbly+8 , 70, valueheight);
  214. [_btnGoodsDetail addTarget:self action:@selector(btnGoDetail) forControlEvents:UIControlEventTouchUpInside];
  215. [vGoodsQuantity addSubview:_btnGoodsDetail];
  216. NSInteger status=_outStorageModel.invoiceStatusId;
  217. switch (status) {
  218. case 3:
  219. _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
  220. [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  221. [_btnGoodsDetail setEnabled:YES];
  222. _btnCorrect.layer.borderColor = [UIColor redColor].CGColor;
  223. [_btnCorrect setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  224. [_btnCorrect setEnabled:YES];
  225. break;
  226. case 10:
  227. _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
  228. [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  229. [_btnGoodsDetail setEnabled:YES];
  230. _btnCorrect.layer.borderColor = [UIColor lightGrayColor].CGColor;
  231. [_btnCorrect setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  232. [_btnCorrect setEnabled:NO];
  233. break;
  234. }
  235. _bottomSeparatorView = [UIView new];
  236. _bottomSeparatorView.frame=CGRectMake(0, CGRectGetMaxY(vGoodsQuantity.frame)+15, Screen_Width, 10);
  237. _bottomSeparatorView.backgroundColor = LineBackgroundColor;
  238. [self.contentView addSubview:_bottomSeparatorView];
  239. }
  240. /**
  241. 去冲正
  242. */
  243. -(void)btnGoCorrect{
  244. __weak typeof(self) weakself=self;
  245. if ([weakself.salesOutStorageDelegate respondsToSelector:@selector(goCorrect:)]){
  246. [weakself.salesOutStorageDelegate goCorrect:_outStorageModel];
  247. }
  248. }
  249. /**
  250. 跳转到销售出库明细
  251. */
  252. -(void)btnGoDetail{
  253. __weak typeof(self) weakself=self;
  254. if ([weakself.salesOutStorageDelegate respondsToSelector:@selector(goDetail:)]){
  255. [weakself.salesOutStorageDelegate goDetail:_outStorageModel];
  256. }
  257. }
  258. @end