SalesInStorageListCell.m 13 KB

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