mirror of
https://github.com/RolandWH/SIPPCompare.git
synced 2025-04-20 00:11:48 +01:00
Compare commits
11 Commits
fca1b384bd
...
cc5686d3d7
Author | SHA1 | Date | |
---|---|---|---|
|
cc5686d3d7 | ||
e0f49a1c14 | |||
255fed7ce7 | |||
a99a6263a8 | |||
0338bc0bb7 | |||
93f69cc0da | |||
ead59079b3 | |||
df7baa2df2 | |||
d1cf30422c | |||
f395f155d0 | |||
32bc3add9b |
@ -35,7 +35,7 @@
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>401</width>
|
||||
<height>171</height>
|
||||
<height>176</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
@ -53,6 +53,11 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="value_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pension value</string>
|
||||
</property>
|
||||
@ -60,6 +65,11 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="value_input">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -82,6 +92,11 @@
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="mix_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Investment mix (funds 50% / shares 50%)</string>
|
||||
</property>
|
||||
@ -108,6 +123,11 @@
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="share_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annual share trades</string>
|
||||
</property>
|
||||
@ -115,6 +135,11 @@
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="fund_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annual fund trades</string>
|
||||
</property>
|
||||
@ -122,6 +147,11 @@
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="fund_trades_combo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -132,6 +162,11 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
@ -139,6 +174,11 @@
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="share_trades_combo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -151,6 +191,11 @@
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
@ -161,7 +206,17 @@
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPlatforms">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
@ -173,6 +228,11 @@
|
||||
<property name="text">
|
||||
<string>Edit Platforms</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -34,6 +34,11 @@
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="res_ok_but">
|
||||
<property name="geometry">
|
||||
@ -44,6 +49,11 @@
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
@ -57,6 +67,11 @@
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
|
@ -6,32 +6,20 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
<width>630</width>
|
||||
<height>567</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Platform Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>461</width>
|
||||
<height>243</height>
|
||||
<width>611</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -75,6 +63,11 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -92,7 +85,7 @@
|
||||
<item row="2" column="3">
|
||||
<widget class="QCheckBox" name="fund_deal_fee_check">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -101,6 +94,11 @@
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="share_deal_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -117,6 +115,11 @@
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_reduce_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing discount # of trades</string>
|
||||
</property>
|
||||
@ -127,6 +130,11 @@
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_plat_max_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share platform monthly fee cap</string>
|
||||
</property>
|
||||
@ -134,6 +142,11 @@
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="fund_deal_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -150,6 +163,11 @@
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing fee*</string>
|
||||
</property>
|
||||
@ -160,6 +178,11 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -186,6 +209,11 @@
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="fund_deal_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fund dealing fee*</string>
|
||||
</property>
|
||||
@ -195,10 +223,21 @@
|
||||
<widget class="QCheckBox" name="share_plat_max_fee_check"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="plat_name_box"/>
|
||||
<widget class="QLineEdit" name="plat_name_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_reduce_amount_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing discount amount</string>
|
||||
</property>
|
||||
@ -206,6 +245,11 @@
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_plat_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share platform fee*</string>
|
||||
</property>
|
||||
@ -213,6 +257,11 @@
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="share_plat_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -229,6 +278,11 @@
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="plat_name_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Platform name</string>
|
||||
</property>
|
||||
@ -239,6 +293,11 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -261,12 +320,17 @@
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>270</y>
|
||||
<x>482</x>
|
||||
<y>534</y>
|
||||
<width>141</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
@ -274,8 +338,8 @@
|
||||
<widget class="QLabel" name="req_field_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<x>8</x>
|
||||
<y>262</y>
|
||||
<width>191</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -287,7 +351,7 @@
|
||||
<widget class="QLabel" name="active_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>437</x>
|
||||
<x>577</x>
|
||||
<y>10</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
@ -300,6 +364,147 @@
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>309</y>
|
||||
<width>611</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="FastEditQDoubleSpinBox" name="first_tier_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="first_tier_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>on the first</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="first_tier_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>the fee is</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="FastEditQDoubleSpinBox" name="first_tier_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>£</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="add_row_but">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>532</x>
|
||||
<y>481</y>
|
||||
<width>91</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add row</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="del_row_but">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>481</y>
|
||||
<width>91</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove row</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="val_above_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>6</x>
|
||||
<y>479</y>
|
||||
<width>421</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>on the value above £ there is no charge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@ -321,7 +526,6 @@
|
||||
<tabstop>share_deal_fee_box</tabstop>
|
||||
<tabstop>share_deal_reduce_trades_box</tabstop>
|
||||
<tabstop>share_deal_reduce_amount_box</tabstop>
|
||||
<tabstop>save_but</tabstop>
|
||||
<tabstop>plat_name_check</tabstop>
|
||||
<tabstop>fund_deal_fee_check</tabstop>
|
||||
<tabstop>share_plat_fee_check</tabstop>
|
||||
@ -329,6 +533,11 @@
|
||||
<tabstop>share_deal_fee_check</tabstop>
|
||||
<tabstop>share_deal_reduce_trades_check</tabstop>
|
||||
<tabstop>share_deal_reduce_amount_check</tabstop>
|
||||
<tabstop>first_tier_box</tabstop>
|
||||
<tabstop>first_tier_fee_box</tabstop>
|
||||
<tabstop>del_row_but</tabstop>
|
||||
<tabstop>add_row_but</tabstop>
|
||||
<tabstop>save_but</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -66,7 +66,6 @@ class SIPPCompare(QMainWindow):
|
||||
def init_variables(self):
|
||||
self.optional_boxes = self.platform_win.get_optional_boxes()
|
||||
self.fund_plat_fee = self.platform_win.get_fund_plat_fee()
|
||||
self.fund_deal_fee = self.platform_win.get_fund_deal_fee()
|
||||
self.share_plat_fee = self.platform_win.get_share_plat_fee()
|
||||
self.share_deal_fee = self.platform_win.get_share_deal_fee()
|
||||
|
||||
@ -77,16 +76,21 @@ class SIPPCompare(QMainWindow):
|
||||
self.plat_name = None
|
||||
|
||||
if self.optional_boxes[1]:
|
||||
self.fund_deal_fee = self.platform_win.get_fund_deal_fee()
|
||||
else:
|
||||
self.fund_deal_fee = None
|
||||
|
||||
if self.optional_boxes[2]:
|
||||
self.share_plat_max_fee = self.platform_win.get_share_plat_max_fee()
|
||||
else:
|
||||
self.share_plat_max_fee = None
|
||||
|
||||
if self.optional_boxes[2]:
|
||||
if self.optional_boxes[3]:
|
||||
self.share_deal_reduce_trades = self.platform_win.get_share_deal_reduce_trades()
|
||||
else:
|
||||
self.share_deal_reduce_trades = None
|
||||
|
||||
if self.optional_boxes[3]:
|
||||
if self.optional_boxes[4]:
|
||||
self.share_deal_reduce_amount = self.platform_win.get_share_deal_reduce_amount()
|
||||
else:
|
||||
self.share_deal_reduce_amount = None
|
||||
@ -101,7 +105,8 @@ class SIPPCompare(QMainWindow):
|
||||
slider_val: int = self.mix_slider.value()
|
||||
funds_value = (slider_val / 100) * value_num
|
||||
fund_trades_num = int(self.fund_trades_combo.currentText())
|
||||
self.fund_deal_fees = fund_trades_num * self.fund_deal_fee
|
||||
if self.fund_deal_fee is not None:
|
||||
self.fund_deal_fees = fund_trades_num * self.fund_deal_fee
|
||||
|
||||
for i in range(1, len(self.fund_plat_fee[0])):
|
||||
band = self.fund_plat_fee[0][i]
|
||||
@ -120,15 +125,15 @@ class SIPPCompare(QMainWindow):
|
||||
if self.share_plat_max_fee is not None:
|
||||
if (self.share_plat_fee * shares_value / 12) > self.share_plat_max_fee:
|
||||
self.share_plat_fees = self.share_plat_max_fee * 12
|
||||
else:
|
||||
self.share_plat_fees = self.share_plat_fee * shares_value
|
||||
else:
|
||||
self.share_plat_fees = self.share_plat_fee * shares_value
|
||||
|
||||
share_trades_num = int(self.share_trades_combo.currentText())
|
||||
if self.share_deal_reduce_trades is not None:
|
||||
if (share_trades_num / 12) >= self.share_deal_reduce_trades:
|
||||
self.share_deal_fees = self.share_deal_reduce_amount * share_trades_num
|
||||
else:
|
||||
self.share_deal_fees = self.share_deal_fee * share_trades_num
|
||||
else:
|
||||
self.share_deal_fees = self.share_deal_fee * share_trades_num
|
||||
|
||||
self.show_output_win()
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
from PyQt6.QtCore import QRegularExpression
|
||||
from PyQt6.QtGui import QRegularExpressionValidator
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
from PyQt6.QtGui import QRegularExpressionValidator, QFont
|
||||
from PyQt6.QtWidgets import QWidget, QLabel
|
||||
from PyQt6 import uic
|
||||
|
||||
from widgets.fastedit_spinbox import FastEditQDoubleSpinBox
|
||||
import main_window
|
||||
|
||||
|
||||
@ -16,11 +17,7 @@ class PlatformEdit(QWidget):
|
||||
# Create main window object, passing this instance as param
|
||||
self.main_win = main_window.SIPPCompare(self)
|
||||
|
||||
# TODO: Make fund_plat_fee user-defined
|
||||
self.fund_plat_fee = [
|
||||
[0, 250000, 1000000, 2000000],
|
||||
[0, 0.25, 0.1, 0.05]
|
||||
]
|
||||
self.fund_plat_fee = []
|
||||
self.plat_name = ""
|
||||
self.fund_deal_fee = 0.0
|
||||
self.share_plat_fee = 0.0
|
||||
@ -28,19 +25,22 @@ class PlatformEdit(QWidget):
|
||||
self.share_deal_fee = 0.0
|
||||
self.share_deal_reduce_trades = 0.0
|
||||
self.share_deal_reduce_amount = 0.0
|
||||
self.widgets_list_list = []
|
||||
|
||||
self.fund_fee_rows = 1
|
||||
# Debugging feature: set with "--DEBUG_AUTOFILL" cmd argument
|
||||
self.autofill = autofill
|
||||
if autofill:
|
||||
self.save_but.setEnabled(True)
|
||||
|
||||
self.required_fields = [
|
||||
self.fund_deal_fee_box,
|
||||
self.share_plat_fee_box,
|
||||
self.share_deal_fee_box
|
||||
]
|
||||
|
||||
self.optional_fields = [
|
||||
self.plat_name_box,
|
||||
self.fund_deal_fee_box,
|
||||
self.share_plat_max_fee_box,
|
||||
self.share_deal_reduce_trades_box,
|
||||
self.share_deal_reduce_amount_box
|
||||
@ -48,12 +48,14 @@ class PlatformEdit(QWidget):
|
||||
|
||||
self.optional_check_boxes = [
|
||||
self.plat_name_check,
|
||||
self.fund_deal_fee_check,
|
||||
self.share_plat_max_fee_check,
|
||||
self.share_deal_reduce_trades_check,
|
||||
self.share_deal_reduce_amount_check
|
||||
]
|
||||
|
||||
self.check_boxes_ticked = [
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
False,
|
||||
@ -74,8 +76,14 @@ class PlatformEdit(QWidget):
|
||||
for check_box in self.optional_check_boxes:
|
||||
check_box.checkStateChanged.connect(self.check_valid)
|
||||
|
||||
self.first_tier_box.valueChanged.connect(self.check_valid)
|
||||
self.first_tier_fee_box.valueChanged.connect(self.check_valid)
|
||||
self.first_tier_box.valueChanged.connect(self.update_tier_labels)
|
||||
|
||||
# NOTE: Signal defined in UI file to close window when save button clicked
|
||||
self.save_but.clicked.connect(self.init_variables)
|
||||
self.add_row_but.clicked.connect(self.add_row)
|
||||
self.del_row_but.clicked.connect(self.remove_row)
|
||||
|
||||
# Set validators
|
||||
# Regex accepts any characters that match [a-Z], [0-9] or _
|
||||
@ -83,11 +91,28 @@ class PlatformEdit(QWidget):
|
||||
QRegularExpressionValidator(QRegularExpression("\\w*"))
|
||||
)
|
||||
|
||||
def create_plat_fee_struct(self):
|
||||
plat_fee_struct = [[0], [0]]
|
||||
plat_fee_struct[0].append(self.first_tier_box.value())
|
||||
plat_fee_struct[1].append(self.first_tier_fee_box.value())
|
||||
|
||||
for i in range(len(self.widgets_list_list)):
|
||||
band = self.widgets_list_list[i][1].value()
|
||||
fee = self.widgets_list_list[i][3].value()
|
||||
plat_fee_struct[0].append(band)
|
||||
plat_fee_struct[1].append(fee)
|
||||
|
||||
return plat_fee_struct
|
||||
|
||||
# Get fee structure variables from user input when "Save" clicked
|
||||
def init_variables(self):
|
||||
# If debugging, save time by hardcoding
|
||||
if self.autofill:
|
||||
self.plat_name = "AJBell"
|
||||
self.fund_plat_fee = [
|
||||
[0, 250000, 1000000, 2000000],
|
||||
[0, 0.25, 0.1, 0.05]
|
||||
]
|
||||
self.fund_deal_fee = 1.50
|
||||
self.share_plat_fee = 0.0025
|
||||
self.share_plat_max_fee = 3.50
|
||||
@ -96,6 +121,7 @@ class PlatformEdit(QWidget):
|
||||
self.share_deal_reduce_amount = 3.50
|
||||
else:
|
||||
self.plat_name = self.plat_name_box.text()
|
||||
self.fund_plat_fee = self.create_plat_fee_struct()
|
||||
self.fund_deal_fee = float(self.fund_deal_fee_box.value())
|
||||
self.share_plat_fee = float(self.share_plat_fee_box.value()) / 100
|
||||
self.share_plat_max_fee = float(self.share_plat_max_fee_box.value())
|
||||
@ -116,6 +142,7 @@ class PlatformEdit(QWidget):
|
||||
# It's also called when any field emits a textChanged() or valueChanged() signal
|
||||
def check_valid(self):
|
||||
valid = True
|
||||
tiers_valid = True
|
||||
|
||||
# Check all required fields have a non-zero value
|
||||
for field in self.required_fields:
|
||||
@ -145,11 +172,118 @@ class PlatformEdit(QWidget):
|
||||
input_box_item.setEnabled(False)
|
||||
self.check_boxes_ticked[i] = False
|
||||
|
||||
if valid:
|
||||
if self.first_tier_fee_box.value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
if self.widgets_list_list[0][1].value() <= self.first_tier_box.value():
|
||||
tiers_valid = False
|
||||
if self.widgets_list_list[0][3].value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
for i in range(len(self.widgets_list_list) - 1, 0, -1):
|
||||
if self.widgets_list_list[i][1].value() <= self.widgets_list_list[i-1][1].value():
|
||||
tiers_valid = False
|
||||
if self.widgets_list_list[i][3].value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
if tiers_valid and self.fund_fee_rows < 6:
|
||||
self.add_row_but.setEnabled(True)
|
||||
else:
|
||||
self.add_row_but.setEnabled(False)
|
||||
|
||||
if valid and tiers_valid:
|
||||
self.save_but.setEnabled(True)
|
||||
else:
|
||||
self.save_but.setEnabled(False)
|
||||
|
||||
def update_tier_labels(self):
|
||||
if self.fund_fee_rows > 1:
|
||||
prev_value = self.first_tier_box.value()
|
||||
self.widgets_list_list[0][0].setText(f"between £{int(prev_value)} and")
|
||||
|
||||
for i in range(len(self.widgets_list_list) - 1, 0, -1):
|
||||
prev_value = self.widgets_list_list[i-1][1].value()
|
||||
self.widgets_list_list[i][0].setText(f"between £{int(prev_value)} and")
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
max_band = self.widgets_list_list[self.fund_fee_rows - 2][1].value()
|
||||
else:
|
||||
max_band = self.first_tier_box.value()
|
||||
self.val_above_lab.setText(f"on the value above £{int(max_band)} there is no charge")
|
||||
|
||||
def add_row(self):
|
||||
widgets = []
|
||||
font = QFont()
|
||||
font.setPointSize(11)
|
||||
|
||||
widgets.append(QLabel(self.gridLayoutWidget_2))
|
||||
widgets[0].setFont(font)
|
||||
|
||||
widgets.append(FastEditQDoubleSpinBox(self.gridLayoutWidget_2))
|
||||
widgets[1].setPrefix("£")
|
||||
widgets[1].setMaximum(9999999)
|
||||
widgets[1].setButtonSymbols(FastEditQDoubleSpinBox.ButtonSymbols.NoButtons)
|
||||
widgets[1].setFont(font)
|
||||
widgets[1].valueChanged.connect(self.check_valid)
|
||||
widgets[1].valueChanged.connect(self.update_tier_labels)
|
||||
|
||||
widgets.append(QLabel(self.gridLayoutWidget_2))
|
||||
widgets[2].setText(f"the fee is")
|
||||
widgets[2].setFont(font)
|
||||
|
||||
widgets.append(FastEditQDoubleSpinBox(self.gridLayoutWidget_2))
|
||||
widgets[3].setSuffix("%")
|
||||
widgets[3].setMaximum(100)
|
||||
widgets[3].setButtonSymbols(FastEditQDoubleSpinBox.ButtonSymbols.NoButtons)
|
||||
widgets[3].setFont(font)
|
||||
widgets[3].valueChanged.connect(self.check_valid)
|
||||
|
||||
# TODO: why 28.5?
|
||||
self.gridLayoutWidget_2.setGeometry(11, 309, 611, int(round(28.5 * (self.fund_fee_rows + 1), 0)))
|
||||
for i in range(len(widgets)):
|
||||
self.gridLayout_2.addWidget(widgets[i], self.fund_fee_rows, i, 1, 1)
|
||||
|
||||
self.fund_fee_rows += 1
|
||||
|
||||
self.widgets_list_list.append(widgets)
|
||||
cur_label_idx = self.gridLayout_2.indexOf(widgets[0])
|
||||
cur_box_idx = self.gridLayout_2.indexOf(widgets[1])
|
||||
cur_label_pos = list(self.gridLayout_2.getItemPosition(cur_label_idx))[:2]
|
||||
cur_box_pos = list(self.gridLayout_2.getItemPosition(cur_box_idx))[:2]
|
||||
|
||||
prev_box_row = cur_box_pos[0] - 1
|
||||
prev_box_item = self.gridLayout_2.itemAtPosition(prev_box_row, cur_box_pos[1]).widget()
|
||||
cur_label_item = self.gridLayout_2.itemAtPosition(cur_label_pos[0], cur_label_pos[1]).widget()
|
||||
cur_label_item.setText(f"between £{int(prev_box_item.value())} and")
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
self.del_row_but.setEnabled(True)
|
||||
|
||||
if self.fund_fee_rows > 5:
|
||||
self.add_row_but.setEnabled(False)
|
||||
|
||||
self.check_valid()
|
||||
|
||||
# TODO: Tab order
|
||||
|
||||
def remove_row(self):
|
||||
for widget in self.widgets_list_list[self.fund_fee_rows - 2]:
|
||||
self.gridLayout_2.removeWidget(widget)
|
||||
widget.hide()
|
||||
self.widgets_list_list.pop()
|
||||
self.fund_fee_rows -= 1
|
||||
self.gridLayoutWidget_2.setGeometry(11, 309, 611, int(round(28.5 * self.fund_fee_rows, 0)))
|
||||
|
||||
if self.fund_fee_rows < 2:
|
||||
self.del_row_but.setEnabled(False)
|
||||
|
||||
if self.fund_fee_rows < 6:
|
||||
self.add_row_but.setEnabled(True)
|
||||
|
||||
self.check_valid()
|
||||
self.update_tier_labels()
|
||||
|
||||
# Getter functions (is this necessary? maybe directly reading class vars would be best...)
|
||||
def get_optional_boxes(self):
|
||||
return self.check_boxes_ticked
|
||||
|
Loading…
x
Reference in New Issue
Block a user