SalesSlipListCell.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. //
  2. // SalesSlipListCell.m
  3. // IBOSSmini
  4. //
  5. // Created by ssl on 2018/1/26.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SalesSlipListCell.h"
  9. #import "NSString+Tools.h"
  10. #define orderTextFont [UIFont systemFontOfSize:13]
  11. @implementation SalesSlipListCell
  12. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  13. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  14. return self;
  15. }
  16. - (void)setSalesOrder:(SalesSlipListModel *)salesOrderModel{
  17. _salesOrder=salesOrderModel;
  18. if (_salesOrder==nil) {
  19. return;
  20. }
  21. CGFloat heightLine = 1;
  22. CGFloat heightRow = 40;
  23. CGFloat lblx = 20;
  24. CGFloat lbly = 8;
  25. CGFloat lblwidth = 70;
  26. CGFloat lblheight = 25;
  27. CGFloat btnwidth = 50;
  28. CGFloat valuey = 8;
  29. CGFloat valueheight = 25;
  30. NSDictionary *orderDict = @{NSFontAttributeName:orderTextFont};
  31. UIView *vOrderNo = [UIView new];
  32. vOrderNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
  33. [self.contentView addSubview:vOrderNo];
  34. _orderNoLbl = [UILabel new];
  35. _orderNoLbl.frame=CGRectMake(lblx, valuey, Screen_Width- lblx - 45, valueheight);
  36. _orderNoLbl.textColor = [UIColor grayColor];
  37. _orderNoLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  38. [vOrderNo addSubview:_orderNoLbl];
  39. _orderNoLbl.text = _salesOrder.SalesNo;
  40. _orderStatusLbl = [UILabel new];
  41. _orderStatusLbl.frame=CGRectMake(Screen_Width-55 ,valuey, 45, valueheight);
  42. _orderStatusLbl.textAlignment = NSTextAlignmentRight;
  43. _orderStatusLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  44. [vOrderNo addSubview:_orderStatusLbl];
  45. NSString *invoiceStatusName= _salesOrder.invoiceStatusName;
  46. if([invoiceStatusName isEqualToString:@"冲正"]){
  47. _orderStatusLbl.textColor = [UIColor redColor];
  48. }
  49. else{
  50. _orderStatusLbl.textColor = [UIColor blackColor];
  51. }
  52. _orderStatusLbl.text=invoiceStatusName;
  53. //分割线
  54. _topSeparatorView= [UIView new];
  55. _topSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vOrderNo.frame), Screen_Width, heightLine);
  56. [self.contentView addSubview:_topSeparatorView];
  57. UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
  58. [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
  59. btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
  60. [_topSeparatorView addSubview:btnLine];
  61. //客户名称
  62. UIView *vCustomerName = [UIView new];
  63. vCustomerName.frame=CGRectMake(0, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width, heightRow);
  64. [self.contentView addSubview:vCustomerName];
  65. UILabel *customerNameTitleLbl=[UILabel new];
  66. customerNameTitleLbl.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  67. customerNameTitleLbl.text=@"客户名称:";
  68. customerNameTitleLbl.textColor = [UIColor blackColor];
  69. customerNameTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  70. [vCustomerName addSubview:customerNameTitleLbl];
  71. _customerNameLbl = [UILabel new];
  72. _customerNameLbl.frame=CGRectMake(CGRectGetMaxX(customerNameTitleLbl.frame), valuey, Screen_Width/2 -CGRectGetMaxX(customerNameTitleLbl.frame), valueheight);
  73. _customerNameLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  74. [vCustomerName addSubview:_customerNameLbl];
  75. _customerNameLbl.text = _salesOrder.customerName;
  76. //电话
  77. UIView *vCustomerTelephone = [UIView new];
  78. vCustomerTelephone.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width / 2, heightRow);
  79. [self.contentView addSubview: vCustomerTelephone];
  80. UILabel *customerTelephoneTitleLbl=[UILabel new];
  81. customerTelephoneTitleLbl.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  82. customerTelephoneTitleLbl.text=@"客户电话:";
  83. customerTelephoneTitleLbl.textColor = [UIColor blackColor];
  84. customerTelephoneTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  85. [vCustomerTelephone addSubview:customerTelephoneTitleLbl];
  86. _customerTelephoneLbl= [UILabel new];
  87. _customerTelephoneLbl.frame=CGRectMake(CGRectGetMaxX(customerTelephoneTitleLbl.frame), valuey, Screen_Width/2-CGRectGetMaxX(customerTelephoneTitleLbl.frame) , valueheight);
  88. _customerTelephoneLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  89. [vCustomerTelephone addSubview:_customerTelephoneLbl];
  90. _customerTelephoneLbl.text = _salesOrder.telephone;
  91. //客户编码
  92. UIView *vCustomerCode = [UIView new];
  93. vCustomerCode.frame=CGRectMake(0, CGRectGetMaxY(vCustomerName.frame), Screen_Width, heightRow);
  94. [self.contentView addSubview:vCustomerCode];
  95. UILabel *customerCodeTitleLbl=[UILabel new];
  96. customerCodeTitleLbl.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  97. customerCodeTitleLbl.text=@"客户编码:";
  98. customerCodeTitleLbl.textColor = [UIColor blackColor];
  99. customerCodeTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  100. [vCustomerCode addSubview:customerCodeTitleLbl];
  101. _customerCodeLbl = [UILabel new];
  102. _customerCodeLbl.frame=CGRectMake(CGRectGetMaxX(customerCodeTitleLbl.frame), valuey, Screen_Width/2 -CGRectGetMaxX(customerCodeTitleLbl.frame), valueheight);
  103. _customerCodeLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  104. [vCustomerCode addSubview:_customerCodeLbl];
  105. _customerCodeLbl.text = _salesOrder.customerCode;
  106. //业务员
  107. UIView *vStaffName = [UIView new];
  108. vStaffName.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vCustomerName.frame), Screen_Width / 2, heightRow);
  109. [self.contentView addSubview: vStaffName];
  110. UILabel *staffNameTitleLbl=[UILabel new];
  111. staffNameTitleLbl.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  112. staffNameTitleLbl.text=@"业 务 员:";
  113. staffNameTitleLbl.textColor = [UIColor blackColor];
  114. staffNameTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  115. [vStaffName addSubview:staffNameTitleLbl];
  116. _staffLbl= [UILabel new];
  117. _staffLbl.frame=CGRectMake(CGRectGetMaxX(staffNameTitleLbl.frame), valuey, Screen_Width/2-CGRectGetMaxX(staffNameTitleLbl.frame) , valueheight);
  118. _staffLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  119. [vStaffName addSubview:_staffLbl];
  120. _staffLbl.text = _salesOrder.staffName;
  121. //业务部门
  122. UIView *vDepartment = [UIView new];
  123. vDepartment.frame=CGRectMake(0, CGRectGetMaxY(vCustomerCode.frame), Screen_Width, heightRow);
  124. [self.contentView addSubview:vDepartment];
  125. UILabel *departmentTitleLbl=[UILabel new];
  126. departmentTitleLbl.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  127. departmentTitleLbl.text=@"业务部门:";
  128. departmentTitleLbl.textColor = [UIColor blackColor];
  129. departmentTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  130. [vDepartment addSubview:departmentTitleLbl];
  131. _departmentLbl = [UILabel new];
  132. _departmentLbl.frame=CGRectMake(CGRectGetMaxX(departmentTitleLbl.frame), valuey, Screen_Width/2 -CGRectGetMaxX(departmentTitleLbl.frame), valueheight);
  133. _departmentLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  134. [vDepartment addSubview:departmentTitleLbl];
  135. _departmentLbl.text = _salesOrder.organizationName;
  136. [vDepartment addSubview:_departmentLbl];
  137. //创建人
  138. UIView *vCreator = [UIView new];
  139. vCreator.frame=CGRectMake(0, CGRectGetMaxY(vDepartment.frame), Screen_Width, heightRow);
  140. [self.contentView addSubview:vCreator];
  141. UILabel *creatorTitleLbl=[UILabel new];
  142. creatorTitleLbl.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  143. creatorTitleLbl.text=@"创 建 人:";
  144. creatorTitleLbl.textColor = [UIColor blackColor];
  145. creatorTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  146. [vCreator addSubview:creatorTitleLbl];
  147. _creatorLbl = [UILabel new];
  148. _creatorLbl.frame=CGRectMake(CGRectGetMaxX(creatorTitleLbl.frame), valuey, Screen_Width/2 -CGRectGetMaxX(creatorTitleLbl.frame), valueheight);
  149. _creatorLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  150. [vCreator addSubview:_creatorLbl];
  151. _creatorLbl.text = _salesOrder.createUser;
  152. //账务日期
  153. UIView *vAccountDate = [UIView new];
  154. vAccountDate.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vDepartment.frame), Screen_Width / 2, heightRow);
  155. [self.contentView addSubview: vAccountDate];
  156. UILabel *accountDateTitleLbl=[UILabel new];
  157. accountDateTitleLbl.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  158. accountDateTitleLbl.text=@"账务日期:";
  159. accountDateTitleLbl.textColor = [UIColor blackColor];
  160. accountDateTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  161. [vAccountDate addSubview:accountDateTitleLbl];
  162. _accountDateLbl= [UILabel new];
  163. _accountDateLbl.frame=CGRectMake(CGRectGetMaxX(accountDateTitleLbl.frame), valuey, Screen_Width/2-CGRectGetMaxX(accountDateTitleLbl.frame) , valueheight);
  164. _accountDateLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  165. [vAccountDate addSubview:_accountDateLbl];
  166. _accountDateLbl.text = _salesOrder.accountDate;
  167. //客户地址
  168. UIView *vCustomerAddress = [UIView new];
  169. vCustomerAddress.frame=CGRectMake(0, CGRectGetMaxY(vCreator.frame), Screen_Width, heightRow);
  170. [self.contentView addSubview:vCustomerAddress];
  171. UILabel *customerAddressTitleLbl=[UILabel new];
  172. customerAddressTitleLbl.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  173. customerAddressTitleLbl.text=@"客户地址:";
  174. customerAddressTitleLbl.textColor = [UIColor blackColor];
  175. customerAddressTitleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  176. [vCustomerAddress addSubview:customerAddressTitleLbl];
  177. _customerAddressLbl = [UILabel new];
  178. _customerAddressLbl.frame=CGRectMake(CGRectGetMaxX(customerAddressTitleLbl.frame), valuey, Screen_Width -CGRectGetMaxX(customerAddressTitleLbl.frame), valueheight);
  179. _customerAddressLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  180. [vCustomerAddress addSubview:_customerAddressLbl];
  181. _customerAddressLbl.text = _salesOrder.address;
  182. //分割线
  183. _middleSeparatorView = [UIView new];
  184. _middleSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vCustomerAddress.frame), Screen_Width, heightLine);
  185. _middleSeparatorView.backgroundColor = LineBackgroundColor;
  186. [self.contentView addSubview:_middleSeparatorView];
  187. //金额
  188. UIView *vGoodsAmount = [UIView new];
  189. vGoodsAmount.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparatorView.frame), Screen_Width, heightRow);
  190. [self.contentView addSubview:vGoodsAmount];
  191. _goodsAmountLbl=[UILabel new];
  192. NSString *goodsAmount= _salesOrder.goodsAmount;
  193. goodsAmount= [NSString stringWithFormat:@"%@%@",@"货物总额:¥",goodsAmount];
  194. CGRect goodsAmountFrame = [goodsAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:orderDict];
  195. goodsAmountFrame.origin.x =Screen_Width-goodsAmountFrame.size.width-10;
  196. goodsAmountFrame.origin.y = valuey;
  197. _goodsAmountLbl.frame=goodsAmountFrame;
  198. _goodsAmountLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  199. _goodsAmountLbl.textColor = [UIColor redColor];
  200. _goodsAmountLbl.text= goodsAmount;
  201. [vGoodsAmount addSubview:_goodsAmountLbl];
  202. _earnestAmountLbl=[UILabel new];
  203. NSString *earnestAmount=_salesOrder.amountCollected;
  204. earnestAmount=[NSString stringWithFormat:@"%@%@",@"收款:¥",earnestAmount];
  205. CGRect earnestAmountFrame = [earnestAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:orderDict];
  206. earnestAmountFrame.origin.x =Screen_Width-goodsAmountFrame.size.width-earnestAmountFrame.size.width-10-5;
  207. earnestAmountFrame.origin.y = valuey;
  208. _earnestAmountLbl.frame=earnestAmountFrame;
  209. _earnestAmountLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  210. _earnestAmountLbl.textColor = [UIColor redColor];
  211. _earnestAmountLbl.text=earnestAmount;
  212. [vGoodsAmount addSubview:_earnestAmountLbl];
  213. _goodsCountLbl=[UILabel new];
  214. NSString *goodsCount=_salesOrder.goodsCount;
  215. goodsCount= [NSString stringWithFormat:@"%@%@%@",@"共",goodsCount,@"件商品"];
  216. CGRect goodsCountFrame = [goodsCount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:orderDict];
  217. goodsCountFrame.origin.x =Screen_Width-goodsAmountFrame.size.width- earnestAmountFrame.size.width-goodsCountFrame.size.width-10-10;
  218. goodsCountFrame.origin.y = valuey;
  219. _goodsCountLbl.frame=goodsCountFrame;
  220. _goodsCountLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  221. _goodsCountLbl.textColor = [UIColor redColor];
  222. _goodsCountLbl.text=goodsCount;
  223. [vGoodsAmount addSubview:_goodsCountLbl];
  224. // //客户地址
  225. UIView *vOperation = [UIView new];
  226. vOperation.frame=CGRectMake(0, CGRectGetMaxY(vGoodsAmount.frame), Screen_Width, 25);
  227. [self.contentView addSubview:vOperation];
  228. _digitalInvoiceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  229. [_digitalInvoiceBtn setTitle:@"电子单据" forState:UIControlStateNormal];
  230. [_digitalInvoiceBtn setBackgroundColor:[UIColor whiteColor]];
  231. [_digitalInvoiceBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  232. _digitalInvoiceBtn.layer.cornerRadius = 10;
  233. _digitalInvoiceBtn.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  234. [_digitalInvoiceBtn addTarget:self action:@selector(btnGoDigitalInvoice) forControlEvents:UIControlEventTouchUpInside];
  235. _digitalInvoiceBtn.layer.borderWidth = 1.0f;//设置边框颜色
  236. _digitalInvoiceBtn.frame = CGRectMake(Screen_Width-70-5 ,0 , 70, valueheight);
  237. [vOperation addSubview:_digitalInvoiceBtn];
  238. _editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  239. [_editBtn setTitle:@"编辑" forState:UIControlStateNormal];
  240. [_editBtn setBackgroundColor:[UIColor whiteColor]];
  241. _editBtn.layer.cornerRadius = 10;
  242. _editBtn.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  243. [_editBtn addTarget:self action:@selector(btnGoEdit) forControlEvents:UIControlEventTouchUpInside];
  244. _editBtn.layer.borderWidth = 1.0f;//设置边框颜色
  245. _editBtn.frame = CGRectMake(Screen_Width-btnwidth-70-5*2 ,0 , btnwidth, valueheight);
  246. [vOperation addSubview:_editBtn];
  247. _correctBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  248. [_correctBtn setTitle:@"冲正" forState:UIControlStateNormal];
  249. [_correctBtn setBackgroundColor:[UIColor whiteColor]];
  250. _correctBtn.layer.cornerRadius = 10;
  251. _correctBtn.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  252. _correctBtn.layer.borderWidth = 1.0f;//设置边框颜色
  253. _correctBtn.frame = CGRectMake(Screen_Width-2*btnwidth-70-5*3 ,0 , btnwidth, valueheight);
  254. [_correctBtn addTarget:self action:@selector(btnGoCorrect) forControlEvents:UIControlEventTouchUpInside];
  255. [vOperation addSubview:_correctBtn];
  256. _goodsDetailBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  257. [_goodsDetailBtn setTitle:@"商品详细" forState:UIControlStateNormal];
  258. [_goodsDetailBtn setBackgroundColor:[UIColor whiteColor]];
  259. _goodsDetailBtn.layer.cornerRadius = 10;
  260. _goodsDetailBtn.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  261. _goodsDetailBtn.layer.borderWidth = 1.0f;//设置边框颜色
  262. _goodsDetailBtn.layer.borderColor = [UIColor blackColor].CGColor;
  263. [_goodsDetailBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  264. _goodsDetailBtn.frame = CGRectMake(Screen_Width-2*btnwidth-70*2-5*4 ,0 , 70, valueheight);
  265. [_goodsDetailBtn addTarget:self action:@selector(btnGoDetail) forControlEvents:UIControlEventTouchUpInside];
  266. [vOperation addSubview:_goodsDetailBtn];
  267. _receivablesBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  268. [_receivablesBtn setTitle:@"收款" forState:UIControlStateNormal];
  269. [_receivablesBtn setBackgroundColor:[UIColor whiteColor]];
  270. _receivablesBtn.layer.cornerRadius = 10;
  271. _receivablesBtn.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  272. _receivablesBtn.layer.borderWidth = 1.0f;//设置边框颜色
  273. _receivablesBtn.layer.borderColor = [UIColor blackColor].CGColor;
  274. [_receivablesBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  275. _receivablesBtn.frame = CGRectMake(Screen_Width-3*btnwidth-70*2-5*5 ,0 , 50, valueheight);
  276. [_receivablesBtn addTarget:self action:@selector(btnGoReceivables) forControlEvents:UIControlEventTouchUpInside];
  277. [vOperation addSubview:_receivablesBtn];
  278. NSString *finalReceivables= _salesOrder.finalReceivables;
  279. if([finalReceivables doubleValue]==0){
  280. _receivablesBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  281. [_receivablesBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  282. [_receivablesBtn setEnabled:NO];
  283. }
  284. else{
  285. _receivablesBtn.layer.borderColor = [UIColor blackColor].CGColor;
  286. [_receivablesBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  287. [_receivablesBtn setEnabled:YES];
  288. }
  289. _bottomSeparatorView = [UIView new];
  290. _bottomSeparatorView.frame=CGRectMake(0, CGRectGetMaxY(vOperation.frame)+15, Screen_Width, 10);
  291. _bottomSeparatorView.backgroundColor = LineBackgroundColor;
  292. [self.contentView addSubview:_bottomSeparatorView];
  293. NSInteger status= _salesOrder.status;
  294. switch (status) {
  295. case 4:
  296. _editBtn.layer.borderColor = [UIColor blackColor].CGColor;
  297. [_editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  298. [_editBtn setEnabled:YES];
  299. _correctBtn.layer.borderColor = [UIColor redColor].CGColor;
  300. [_correctBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  301. [_correctBtn setEnabled:YES];
  302. break;
  303. case 5:
  304. _editBtn.layer.borderColor = [UIColor blackColor].CGColor;
  305. [_editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  306. [_editBtn setEnabled:YES];
  307. _correctBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  308. [_correctBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  309. [_correctBtn setEnabled:NO];
  310. break;
  311. case 7:
  312. _editBtn.layer.borderColor = [UIColor blackColor].CGColor;
  313. [_editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  314. [_editBtn setEnabled:YES];
  315. if(salesOrderModel.salesDetailType == 1){
  316. _correctBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  317. [_correctBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  318. [_correctBtn setEnabled:NO];
  319. }else{
  320. _correctBtn.layer.borderColor = [UIColor blackColor].CGColor;
  321. [_correctBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  322. [_correctBtn setEnabled:YES];
  323. }
  324. break;
  325. case 10:
  326. _editBtn.layer.borderColor = [UIColor blackColor].CGColor;
  327. [_editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  328. [_editBtn setEnabled:YES];
  329. _correctBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  330. [_correctBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  331. [_correctBtn setEnabled:NO];
  332. _receivablesBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  333. [_receivablesBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  334. [_receivablesBtn setEnabled:NO];
  335. break;
  336. case 11:
  337. _digitalInvoiceBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  338. [_digitalInvoiceBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  339. [_digitalInvoiceBtn setEnabled:NO];
  340. _editBtn.layer.borderColor = [UIColor blackColor].CGColor;
  341. [_editBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  342. [_editBtn setEnabled:YES];
  343. _correctBtn.layer.borderColor = [UIColor redColor].CGColor;
  344. [_correctBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  345. [_correctBtn setEnabled:YES];
  346. break;
  347. default:
  348. _editBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
  349. [_editBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  350. [_editBtn setEnabled:NO];
  351. break;
  352. }
  353. }
  354. - (void)btnGoCorrect{
  355. __weak typeof(self) weakself=self;
  356. if ([weakself.delegate respondsToSelector:@selector(goCorrect:)]){
  357. [weakself.delegate performSelector:@selector(goCorrect:) withObject:weakself];
  358. }
  359. }
  360. -(void)btnGoDigitalInvoice{
  361. __weak typeof(self) weakself=self;
  362. if ([weakself.delegate respondsToSelector:@selector(goElectronicInvoice:)]){
  363. [weakself.delegate goElectronicInvoice:_cellIndex];
  364. }
  365. }
  366. - (void)btnGoDetail{
  367. __weak typeof(self) weakself=self;
  368. if ([weakself.delegate respondsToSelector:@selector(goDetail:)]){
  369. [weakself.delegate performSelector:@selector(goDetail:) withObject:_salesOrder];
  370. }
  371. }
  372. - (void)btnGoEdit{
  373. __weak typeof(self) weakself=self;
  374. if ([weakself.delegate respondsToSelector:@selector(goEdit:)]){
  375. [weakself.delegate performSelector:@selector(goEdit:) withObject:_salesOrder];
  376. }
  377. }
  378. -(void)btnGoReceivables{
  379. __weak typeof(self) weakself=self;
  380. if ([weakself.delegate respondsToSelector:@selector(goReceivables:)]){
  381. [weakself.delegate goReceivables:_salesOrder];
  382. }
  383. }
  384. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  385. [super setSelected:selected animated:animated];
  386. }
  387. @end