AveragePriceMonitorItemTableViewCell.m 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. //
  2. // AveragePriceMonitorItemTableViewCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/9/8.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. // 功能描述:均价监控table view cell
  9. #import "AveragePriceMonitorItemTableViewCell.h"
  10. @implementation AveragePriceMonitorItemTableViewCell
  11. #pragma 私有函数
  12. /**
  13. 设置均价监控cell
  14. @param frame <#frame description#>
  15. @param invoiceType <#invoiceType description#>
  16. */
  17. -(void)setAveragePriceMonitorCell:(AveragePriceMonitorFrame*)frame invoiceType:(NSString*)invoiceType{
  18. _monitorModel=frame.averagePriceModel;
  19. NSInteger kindId= _monitorModel.kindId;
  20. UILabel *lblTitleDepartment = [UILabel new];
  21. lblTitleDepartment.frame=frame.departmentTitleF;
  22. lblTitleDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  23. [self addSubview:lblTitleDepartment];
  24. if(kindId>0){
  25. lblTitleDepartment.text = @"业务部门:";
  26. lblTitleDepartment.textColor =NavTitleColor;
  27. lblTitleDepartment.frame=frame.departmentTitleF;
  28. [self addSubview:lblTitleDepartment];
  29. NSString *departmentName= _monitorModel.departmentName;
  30. if(departmentName!=nil){
  31. _lblBusinessDepartment=[UILabel new];
  32. _lblBusinessDepartment.frame=frame.departmentF;
  33. _lblBusinessDepartment.textColor=[UIColor blackColor];
  34. _lblBusinessDepartment.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  35. _lblBusinessDepartment.text=departmentName;
  36. [self addSubview:_lblBusinessDepartment];
  37. UILabel *lblTitleKind = [UILabel new];
  38. lblTitleKind.text=@"商品种类:";
  39. lblTitleKind.frame=frame.kindTitleF;
  40. lblTitleKind.textColor=LabelGrayTextColor;
  41. lblTitleKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  42. [self addSubview:lblTitleKind];
  43. NSString *kindName=_monitorModel.kindName;
  44. if(kindName!=nil){
  45. _lblGoodsKind=[UILabel new];
  46. _lblGoodsKind.frame=frame.kindF;
  47. _lblGoodsKind.textColor=[UIColor blackColor];
  48. _lblGoodsKind.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  49. _lblGoodsKind.text=kindName;
  50. [self addSubview:_lblGoodsKind];
  51. }
  52. }
  53. }
  54. else{
  55. lblTitleDepartment.text = @"小计";
  56. lblTitleDepartment.textColor =[UIColor redColor];
  57. }
  58. UIView *topSeparator=[UIView new];
  59. topSeparator.frame=frame.topSeparatorF;
  60. topSeparator.backgroundColor=LineBackgroundColor;
  61. [self addSubview:topSeparator];
  62. UILabel *lblTitleProfit = [UILabel new];
  63. lblTitleProfit.text=@"毛 利 率:";
  64. lblTitleProfit.frame=frame.profitTitleF;
  65. lblTitleProfit.textColor=LabelGrayTextColor;
  66. lblTitleProfit.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  67. [self addSubview:lblTitleProfit];
  68. NSString *profit= _monitorModel.profit;
  69. if(profit!=nil){
  70. _lblProfit=[UILabel new];
  71. _lblProfit.frame=frame.profitF;
  72. _lblProfit.textColor=[UIColor blackColor];
  73. _lblProfit.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  74. _lblProfit.text=profit;
  75. [self addSubview:_lblProfit];
  76. }
  77. UILabel *lblTitleOrderQuantity = [UILabel new];
  78. if([invoiceType isEqualToString:@"1"]){
  79. lblTitleOrderQuantity.text=@"订单数量:";
  80. }
  81. else if([invoiceType isEqualToString:@"2"]){
  82. lblTitleOrderQuantity.text=@"销售数量:";
  83. }
  84. lblTitleOrderQuantity.frame=frame.orderQuantityTitleF;
  85. lblTitleOrderQuantity.textColor=LabelGrayTextColor;
  86. lblTitleOrderQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  87. [self addSubview:lblTitleOrderQuantity];
  88. NSString *orderQuantity= _monitorModel.orderQuantity;
  89. if(orderQuantity!=nil){
  90. _lblOrderQuantity=[UILabel new];
  91. _lblOrderQuantity.frame=frame.orderQuantityF;
  92. _lblOrderQuantity.textColor=[UIColor blackColor];
  93. _lblOrderQuantity.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  94. _lblOrderQuantity.text=orderQuantity;
  95. [self addSubview:_lblOrderQuantity];
  96. }
  97. UILabel *lblTitleOrderAmount = [UILabel new];
  98. if([invoiceType isEqualToString:@"1"]){
  99. lblTitleOrderAmount.text=@"订单总额:";
  100. }
  101. else if ([invoiceType isEqualToString:@"2"]){
  102. lblTitleOrderAmount.text=@"销售总额:";
  103. }
  104. lblTitleOrderAmount.frame=frame.orderAmountTitleF;
  105. lblTitleOrderAmount.textColor=LabelGrayTextColor;
  106. lblTitleOrderAmount.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  107. [self addSubview:lblTitleOrderAmount];
  108. NSString *orderAmount= _monitorModel.orderAmount;
  109. if(orderAmount!=nil){
  110. _lblOrderAmount=[UILabel new];
  111. _lblOrderAmount.frame=frame.orderAmountF;
  112. _lblOrderAmount.textColor=[UIColor blackColor];
  113. _lblOrderAmount.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  114. _lblOrderAmount.text=orderAmount;
  115. [self addSubview:_lblOrderAmount];
  116. }
  117. UILabel *lblTitleOrderAveragePrice = [UILabel new];
  118. if([invoiceType isEqualToString:@"1"]){
  119. lblTitleOrderAveragePrice.text=@"订单均价:";
  120. }
  121. else if ([invoiceType isEqualToString:@"2"]){
  122. lblTitleOrderAveragePrice.text=@"销售均价:";
  123. }
  124. lblTitleOrderAveragePrice.frame=frame.orderAveragePriceTitleF;
  125. lblTitleOrderAveragePrice.textColor=LabelGrayTextColor;
  126. lblTitleOrderAveragePrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  127. [self addSubview:lblTitleOrderAveragePrice];
  128. NSString *orderAveragePrice= _monitorModel.orderAveragePrice;
  129. if(orderAveragePrice!=nil){
  130. _lblOrderAveragePrice=[UILabel new];
  131. _lblOrderAveragePrice.frame=frame.orderAveragePriceF;
  132. _lblOrderAveragePrice.textColor=[UIColor blackColor];
  133. _lblOrderAveragePrice.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  134. _lblOrderAveragePrice.text=orderAveragePrice;
  135. [self addSubview:_lblOrderAveragePrice];
  136. }
  137. UILabel *lblTitleCostAmount = [UILabel new];
  138. lblTitleCostAmount.text=@"成本总额:";
  139. lblTitleCostAmount.frame=frame.costAmountTitleF;
  140. lblTitleCostAmount.textColor=LabelGrayTextColor;
  141. lblTitleCostAmount.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  142. [self addSubview:lblTitleCostAmount];
  143. NSString *costAmount= _monitorModel.costAmount;
  144. if(costAmount!=nil){
  145. _lblCostAmount=[UILabel new];
  146. _lblCostAmount.frame=frame.costAmountF;
  147. _lblCostAmount.textColor=[UIColor blackColor];
  148. _lblCostAmount.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  149. _lblCostAmount.text=costAmount;
  150. [self addSubview:_lblCostAmount];
  151. }
  152. UILabel *lblTitleCostAveragePrice = [UILabel new];
  153. lblTitleCostAveragePrice.text=@"成本均价:";
  154. lblTitleCostAveragePrice.frame=frame.costAveragePriceTitleF;
  155. lblTitleCostAveragePrice.textColor=LabelGrayTextColor;
  156. lblTitleCostAveragePrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  157. [self addSubview:lblTitleCostAveragePrice];
  158. NSString *costAveragePrice= _monitorModel.costAveragePrice;
  159. if(costAveragePrice!=nil){
  160. _lblCostAveragePrice=[UILabel new];
  161. _lblCostAveragePrice.frame=frame.costAveragePriceF;
  162. _lblCostAveragePrice.textColor=[UIColor blackColor];
  163. _lblCostAveragePrice.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
  164. _lblCostAveragePrice.text=costAveragePrice;
  165. [self addSubview:_lblCostAveragePrice];
  166. }
  167. UIView *bottomSeparator=[UIView new];
  168. bottomSeparator.frame=frame.bottomSeparatorF;
  169. bottomSeparator.backgroundColor=LineBackgroundColor;
  170. [self addSubview:bottomSeparator];
  171. }
  172. @end