suma yang
Scris: Joi Noi 21, 2024 7:12 pm
Salutare,cum as putea face cand scriu 1kk in yang sa mearga sa pun? ca nu merge doar daca scriu de mana 1.000.000
Multumesc anticipat
Multumesc anticipat
Cod: Selectaţi tot
# Search
{
"name" : "money_value",
"type" : "editline",
"x" : 3,
"y" : 2,
"width" : 60,
"height" : 18,
"input_limit" : 6,
"only_number" : 1,
"text" : "1",
},
# Replace with
{
"name" : "money_value",
"type" : "editline",
"x" : 3,
"y" : 2,
"width" : 60,
"height" : 18,
"input_limit" : 6,
"only_number" : 0,
"text" : "1",
},
Cod: Selectaţi tot
# Add
USE_KMB_MONEY_FORMAT = True
if USE_KMB_MONEY_FORMAT:
def __ConvertMoneyText(self, text, powers = dict(k = 10**3, m = 10**6, b = 10**9)):
"""
Format string value in thousands, millions or billions.
'1k' = 1.000
'100kk' = 100.000.000
'100m' = 100.000.000
'1b' = 1.000.000.000
'1kmb' = 1.000 (can't use multiple suffixes types)
:param text: string
:return: int
:date: 10.01.2020
:author: Vegas
"""
match = re.search(r'(\d+)({:s}+)?'.format('+|'.join(powers.keys())), text, re.I)
if match:
moneyValue, suffixName = match.groups()
moneyValue = int(moneyValue)
if not suffixName:
return moneyValue
return moneyValue * (powers[suffixName[0]] ** len(suffixName))
return 0
Cod: Selectaţi tot
# Add import
import constInfo
''' 2. ENABLE_CHEQUE_SYSTEM '''
# Search @ def OnAccept
money_text = self.pickValueEditLine.GetText()
# Add below
if constInfo.USE_KMB_MONEY_FORMAT:
if money_text:
moneyValue = min(constInfo.__ConvertMoneyText(text), self.maxValue)
if moneyValue:
if self.eventAccept:
self.eventAccept(moneyValue)
''' 3. '''
# Search @ def OnAccept
text = self.pickValueEditLine.GetText()
# Add below
if constInfo.USE_KMB_MONEY_FORMAT:
if text:
moneyValue = min(constInfo.__ConvertMoneyText(text), self.maxValue)
if moneyValue:
if self.eventAccept:
self.eventAccept(moneyValue)
if __USE_DYNAMIC_MODULE__: