12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import UIKit
- class BondDebenturesSummaryViewController: UIViewController {
-
- @IBOutlet var couponReceivedMonthlyTF: UITextField!
- @IBOutlet var totalCouponReceivedTF: UITextField!
- @IBOutlet var bondMaturityDateTF: UITextField!
- @IBOutlet var effectiveTimeTF: UITextField!
- @IBOutlet var currentValueTF: UITextField!
- @IBOutlet var viewDetailedButton: UIButton!
- @IBOutlet var tableView: UITableView!
-
- var bondDebentureModel : BondDebenturesModel?
- var bondDebentureOutputListModel = [BondDebenturesOutputListModel]()
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
-
- setupUI()
- setupData()
- }
-
- func setupUI() {
- viewDetailedButton.isHidden = false
- tableView.isHidden = true
- }
-
- func setupData() {
- couponReceivedMonthlyTF.text = String(format: "%.2f", "\(bondDebentureModel!.couponReceived!)")
- totalCouponReceivedTF.text = String(format: "%.2f", "\(bondDebentureModel!.totalCouponReceived!)")
- let date = bondDebentureModel!.daysToMaturity
- let dateString = date?.stringBefore("T")
- bondMaturityDateTF.text = convertDateFormat(inputDate: dateString!)
- effectiveTimeTF.text = String(format: "%.2f", "\(bondDebentureModel!.effectiveTimeToMaturity!)")
- currentValueTF.text = String(format: "%.2f", "\(bondDebentureModel!.currentValue!)")
- }
-
-
-
-
- @IBAction func viewDetailedProjectionAction(_ sender: Any) {
- viewDetailedButton.isHidden = true
- tableView.isHidden = false
- }
-
- }
- extension BondDebenturesSummaryViewController : UITableViewDelegate, UITableViewDataSource {
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- bondDebentureOutputListModel.count
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: "BondDebenturesTableViewCell", for: indexPath) as? BondDebenturesTableViewCell
-
- cell?.monthLabel.text = bondDebentureOutputListModel[indexPath.row].referenceMonth
- cell?.amountDepositedLabel.text = "\(bondDebentureOutputListModel[indexPath.row].bondAmountDeposited!)"
- cell?.couponReceivedLabel.text = "\(bondDebentureOutputListModel[indexPath.row].couponReceived!)"
- cell?.totalCouponReceivedLabel.text = "\(bondDebentureOutputListModel[indexPath.row].totalCouponReceived!)"
-
- return cell!
- }
- }
|