NewDispatchRequirementInvoiceInfoController.m 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. //
  2. // NewDispatchRequirementInvoiceInfoController.m
  3. // IBOSS-HJ
  4. //
  5. // Created by 关宏厚 on 2021/1/28.
  6. // Copyright © 2021 elongtian. All rights reserved.
  7. //
  8. #import "NewDispatchRequirementInvoiceInfoController.h"
  9. @interface NewDispatchRequirementInvoiceInfoController ()
  10. {
  11. UIScrollView *scroll;
  12. UIView *contentView;
  13. }
  14. @end
  15. @implementation NewDispatchRequirementInvoiceInfoController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self initUI];
  19. }
  20. -(void)initUI
  21. {
  22. scroll = [UIScrollView new];
  23. scroll.delegate = self;
  24. scroll.frame=self.view.bounds;
  25. scroll.tag=1000;
  26. [self.view addSubview:scroll];
  27. if(Screen_Height2 <= 480){
  28. scroll.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height + 80);
  29. }
  30. int topMargin=10;
  31. int leftMargin=20;
  32. int titleWidth=70;
  33. int titleHeight=25;
  34. contentView = [[UIView alloc]init];
  35. contentView.frame=CGRectZero;
  36. contentView.backgroundColor = [UIColor whiteColor];
  37. UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
  38. //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。
  39. tapGestureRecognizer.cancelsTouchesInView = NO;
  40. // //将触摸事件添加到当前view
  41. [scroll addGestureRecognizer:tapGestureRecognizer];
  42. [scroll addSubview:contentView];
  43. UILabel *lblTitleDeliveryDate = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,topMargin,titleWidth, 25)];
  44. lblTitleDeliveryDate.font = kTextFont;
  45. lblTitleDeliveryDate.text = @"送货日期:";
  46. [contentView addSubview: lblTitleDeliveryDate];
  47. _lblDeliveryDate=[UILabel new];
  48. _lblDeliveryDate.font=kTextFont;
  49. _lblDeliveryDate.frame=CGRectMake(CGRectGetMaxX(lblTitleDeliveryDate.frame), topMargin,Screen_Width-CGRectGetMaxX(lblTitleDeliveryDate.frame),25);
  50. [contentView addSubview: _lblDeliveryDate];
  51. UILabel *lblTitleReceivables = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleDeliveryDate.frame)+topMargin,titleWidth, 25)];
  52. lblTitleReceivables.font = kTextFont;
  53. lblTitleReceivables.text = @"应收金额:";
  54. [contentView addSubview: lblTitleReceivables];
  55. _lblReceivables=[UILabel new];
  56. _lblReceivables.font=kTextFont;
  57. _lblReceivables.frame=CGRectMake(CGRectGetMaxX(lblTitleReceivables.frame), CGRectGetMaxY(lblTitleDeliveryDate.frame)+topMargin,Screen_Width-CGRectGetMaxX(lblTitleReceivables.frame),25);
  58. [contentView addSubview: _lblReceivables];
  59. UILabel *lblTitleRemainingReceivables = [[UILabel alloc] initWithFrame:CGRectMake(leftMargin,CGRectGetMaxY(lblTitleReceivables.frame)+topMargin,titleWidth, 25)];
  60. lblTitleRemainingReceivables.font = kTextFont;
  61. lblTitleRemainingReceivables.text = @"剩余应收:";
  62. [contentView addSubview: lblTitleRemainingReceivables];
  63. _lblRemainingReceivables=[UILabel new];
  64. _lblRemainingReceivables.font=kTextFont;
  65. _lblRemainingReceivables.frame=CGRectMake(CGRectGetMaxX(lblTitleRemainingReceivables.frame), CGRectGetMaxY(lblTitleReceivables.frame)+topMargin,Screen_Width-CGRectGetMaxX(lblTitleRemainingReceivables.frame),25);
  66. [contentView addSubview: _lblRemainingReceivables];
  67. UILabel *lblTitleReceivablesType = [UILabel new];
  68. lblTitleReceivablesType.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin,titleWidth, 25);
  69. lblTitleReceivablesType.text = @"收款方式:";
  70. lblTitleReceivablesType.font = kTextFont;
  71. [contentView addSubview:lblTitleReceivablesType];
  72. _btnReceivablesType = [UIButton buttonWithType:UIButtonTypeCustom];
  73. _btnReceivablesType.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  74. _btnReceivablesType.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
  75. _btnReceivablesType.frame = CGRectMake(CGRectGetMaxX(lblTitleReceivablesType.frame),CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTitleReceivablesType.frame) - 30, 25);
  76. _btnReceivablesType.titleLabel.font = kTextFont;
  77. [_btnReceivablesType setTitle:@"请选择收款方式" forState:UIControlStateNormal];
  78. [_btnReceivablesType setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateNormal];
  79. [_btnReceivablesType addTarget:self action:@selector(showReceivablesType) forControlEvents:UIControlEventTouchUpInside];
  80. [contentView addSubview:_btnReceivablesType];
  81. UIButton *btnArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  82. btnArrow.frame = CGRectMake(Screen_Width - 17,CGRectGetMaxY(lblTitleRemainingReceivables.frame)+topMargin,7,12);
  83. [ btnArrow setImage:[UIImage imageNamed:@"rightarrow"] forState:UIControlStateNormal];
  84. [contentView addSubview:btnArrow];
  85. UILabel *lblTxtReceiptAmount = [UILabel new];
  86. lblTxtReceiptAmount.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin,titleWidth, 25);
  87. lblTxtReceiptAmount.text = @"回执金额:";
  88. lblTxtReceiptAmount.font = kTextFont;
  89. [contentView addSubview:lblTxtReceiptAmount];
  90. _txtReceiptAmount = [UITextField new];
  91. _txtReceiptAmount.frame = CGRectMake(CGRectGetMaxX(lblTxtReceiptAmount.frame),CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTxtReceiptAmount.frame) - 30, 25);
  92. _txtReceiptAmount.font = kTextFont;
  93. _txtReceiptAmount.enabled=NO;
  94. _txtReceiptAmount.placeholder = @"请输入回执金额";
  95. _txtReceiptAmount.delegate = self;
  96. _txtReceiptAmount.keyboardType = UIKeyboardTypeDecimalPad;
  97. [contentView addSubview:_txtReceiptAmount];
  98. UILabel *lblTxtunit = [UILabel new];
  99. lblTxtunit.frame = CGRectMake(Screen_Width - 40, CGRectGetMaxY(lblTitleReceivablesType.frame)+topMargin, 30, 25);
  100. lblTxtunit.text = @"元";
  101. lblTxtunit.font = kTextFont;
  102. lblTxtunit.textAlignment = NSTextAlignmentRight;
  103. [contentView addSubview:lblTxtunit];
  104. UILabel *lblTitleRemarks = [UILabel new];
  105. lblTitleRemarks.frame = CGRectMake(leftMargin,CGRectGetMaxY(lblTxtReceiptAmount.frame)+topMargin,titleWidth, 25);
  106. lblTitleRemarks.text = @"备注信息:";
  107. lblTitleRemarks.font = kTextFont;
  108. [contentView addSubview:lblTitleRemarks];
  109. _txtRemarks= [UITextField new];
  110. _txtRemarks.frame = CGRectMake(CGRectGetMaxX(lblTitleRemarks.frame),CGRectGetMaxY(lblTxtReceiptAmount.frame)+topMargin, Screen_Width -CGRectGetMaxX(lblTitleRemarks.frame) - 30, 25);
  111. _txtRemarks.font = kTextFont;
  112. _txtRemarks.placeholder = @"请输入备注";
  113. _txtRemarks.delegate = self;
  114. [contentView addSubview:_txtRemarks];
  115. contentView.frame=CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(_txtRemarks.frame));
  116. scroll.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(contentView.frame)+rectStatusHeight+rectNavHeight+120);
  117. }
  118. /**
  119. 收款方式
  120. */
  121. - (void)showReceivablesType{
  122. [self.view endEditing:YES];
  123. PaymentMethodVC *pay = [[PaymentMethodVC alloc] init];
  124. pay.paymentMethodDelegate = self;
  125. pay.receivableList=_receivableArray;
  126. [self.cNav pushViewController:pay animated:YES];
  127. self.hidesBottomBarWhenPushed = NO;
  128. }
  129. -(void)callbackPaymentMethod:(NSMutableArray *) arry
  130. {
  131. _receivableArray=arry;
  132. _paymentMethodFilterArray=[[NSMutableArray alloc]init];
  133. NSMutableArray *receivableMethodNameArray=[[NSMutableArray alloc]init];
  134. double sum=0;
  135. for(int i=0;i<arry.count;i++)
  136. {
  137. PayTypeModel *payTypeModel= [arry objectAtIndex:i];
  138. NSString *receivableSum= payTypeModel.receivableSum;
  139. if(receivableSum!=nil&&![receivableSum isEqualToString:@""])
  140. {
  141. double feeItemSumValue=[receivableSum doubleValue];
  142. if(feeItemSumValue>0)
  143. {
  144. sum+=feeItemSumValue;
  145. [_paymentMethodFilterArray addObject:payTypeModel];
  146. [receivableMethodNameArray addObject:payTypeModel.settlementTypeName];
  147. }
  148. }
  149. }
  150. NSString *settlementTypeStr=[receivableMethodNameArray componentsJoinedByString:@","];
  151. [_btnReceivablesType setTitle:settlementTypeStr forState:UIControlStateNormal];
  152. _receivableSum=[NSString stringWithFormat:@"%.2f",sum];
  153. [_txtReceiptAmount setText:_receivableSum];
  154. }
  155. /**
  156. 收款方式回调函数
  157. @param model <#model description#>
  158. */
  159. //- (void)setPayTypeModel:(PayTypeModel *)model{
  160. // [ _btnReceivablesType setTitle:model.settlementTypeName forState:UIControlStateNormal];
  161. // _settlementTypeName = model.settlementTypeName;
  162. // _settlementType = model.settlementType;
  163. // _receivableSum = model.receivableSum;
  164. // _earnestFee = model.earnestFee;
  165. // _remarks = model.remarks;
  166. //}
  167. /**
  168. 键盘隐藏函数
  169. @param tap <#tap description#>
  170. */
  171. - (void)keyboardHide:(UITapGestureRecognizer*)tap{
  172. [self.view endEditing:YES];
  173. }
  174. @end