Why withdrawal function returns me 0 ether. I am the owner
https://etherscan.io/address/0x7b20471396cedf00cd1f65eca27fdb3ca1643b6c#code
Related
Good afternoon!
I have a list of sellers in the following form:
Seller 1 - turnover $90
Seller 2 - turnover $110
Seller 3 - turnover $80
Seller 4 - turnover $120
...
I need to make the algorithm distributes them among supervisors so that each of them gets 2 sellers with equal turnover.
That is, the first supervisor will get the seller 1 and 2, the second - 3 and 4. What algorithm can be used here? Are there any functions that allow you to distribute sellers from a dataframe to Pandas in this way?
It's been asked a few times, but more about design. I'm trying to make a little home finance application to learn some new technologies. I've gone with a single double row double entry system design.
So, a Journal is the root transaction, which has 2 or more Transactions. An Account can be either a Third Party (I paid my mate some cash, I got paid by my company, I paid a restaurant for dinner) or a bank account (I paid money from my credit card)
So, I can Transfer between two accounts.
(I transferred $200 from my Current Account, to my Credit Card account)
I can recieve money.
(I got paid by My Company, into my Current Account.
I can pay someone.
(I paid the restaurant $20 for dinner)
So, lets use the last example. I use my Current Account to pay KFC.
I have two accounts to deal with. KFC, an my current account.
I create a Journal for this transaction.
And then for that Journal, I create two transactions.
First one, is an amount of -20, and the Account is my bank account.
Second one is an amount of +20, and the account is KFC.
I can quickly get the balance of my bank account.
SELECT SUM(Amount) FROM Journal WHERE AccountID = MyBankAccountId
Perfect.
But I have an issue.
How do I show a transaction list for my bank account?
So I want to get a 'Statement' for AccountId 1
But from this, I can't really tell to whom I paid, or was paid. It only shows the lines related to Account 1.
The data above shows the transactions against the account I care about, but .. I need to show the OTHER account details too. So I need to somehow get 'SourceAccountId' and 'DestinationAccountId'.
Is my design wrong, and I need to go to one line transactions, with a Source and Destination account id in the same row?
The issue I have with that is - I want to be able to assign budgets to my transactions. For example, I was going to add a BudgetId to the Transaction table, allowing me apportion the amounts to different budgets or categories.
(I went to the hardware store, and spend $25. Of that $25, $10 was for my "garden" budget, and $15 was for "internal home decoration" budget.
So my transaction line might have 3 rows.
1 for the credit to the hardware store account for $25.
1 for a debit to my bank account for $10, with a budget Id of my 'Garden Budget'.
1 for a debit to my bank account for $15 with a budget Id of my 'Internal home decoration' budget.
This may be an issue too, as I will then get two 'lines' on my statement for my bank account... One for $15 and one for $10. Maybe I can go one line transaction, but then ... an extra table for the budget apportioning?
That would make getting a balance for an account more tricky. I’d need to check SoutceAccountId and DestinationAccountId.
Any ideas would be great.
I've worked and built some A/R systems before, it's... interesting to say the least. Typically the way it's done is to record the amount as a positive number (regardless of payment transaction... $100 moved somewhere at the transaction level, the direction is irrelevant), so as it is other than recording +/- in it, I think your transaction table is fine. Might want to add a memo field though so you can record what it was for (ie, let's say you pay the electric bill, you can record that this transaction was for "June '19 bill").
The journal table is where the magic happens.
There's two models I've seen, both work:
ID - PKey - Integer - IDENTITY
TransactionID - FKey - Integer - Indicates the parent Transaction
Amount - Decimal - The amount of the journal entry
AccountID - FKey - integer - Indicates the Account the journal entry is for
NetEffect - Bit - Flag which indicates if the item is a Credit (True) or Debit (False)
OR...
ID - PKey - Integer - IDENTITY
TransactionID - FKey - Integer - Indicates the parent Transaction
DebitAmount - Decimal - Amount of Debit
CreditAmount - Decimal - Amount of Credit
DebitAccountID - FKey - Integer - Indicates the Debit account for the item
CreditAccountID - FKey - Integer - Indicates the Credit account for the item
Both would then use the Sum(Debits) - Sum(Debits) to get the balance.
The first one should be explanitory. The second one is closer to a double-entry form. You would use either the Credit OR the Debit fields for an entry, but not both. But it also makes your budget calculations easier.
The Transaction would record $25. The Transactions then record like this:
1 -- 1 -- 00 -- 25 -- null -- {account number for garden store}
2 -- 1 -- 10 -- 00 -- {Account for Garden Budget} -- null
3 -- 1 -- 15 -- 00 -- {Internal home Budget} -- null
To allocate something to the budget:
4 -- 2 -- 25 -- 00 -- null -- {Account for Garden Budget}
5 -- 2 -- 25 -- 00 -- null -- {Internal hom Budget}
6 -- 2 -- 00 -- 50 -- {Your checking account} -- null
That moves $50 into your two budgets, 25 for one, 25 for the other, and deducts if from your account.
Then you get paid:
7 -- 3 -- 1000 -- 00 -- null -- {Checking account number}
8 -- 3 -- 00 -- 1000 -- {Account for employer} -- null
Hopefully that all made sense.
I created 3 chart of accounts as follow with type current asset:
23600 Stock Interim Account (Received)
14600 Stock Interim Account (Delivered)
14000 Stock Valuation Account
And assigned to product category.
Set costing method as Average and inventory valuation as Perpetual.
Created a purchase order and received products
Then system created journal entries as follow.
When i create an vendor invoice from same purchase order, in product lines it automatically choose 501100 Cost of Goods Sold in Trading instead of 23600 Stock Interim Account (Received).
Did i configure anything wrong?
How can i resolve this?
I have a report to display count of transactions based on user, tariff plan type of operation and status of the transaction. What is the best possible way to do this. IS multiple groupby possible and feasible?
Sample data and output:
Date Plan Total USer Type of operation status product
2/8/2017 Entel Prepago Smart 5 01234567 Venta Success sim
2/8/2017 Super Plan 3 01234568 Venta Success pack
2/8/2017 Entel Prepago Smart 1 01234567 Venta Cancel sim
2/8/2017 Super Plan 1 01234568 Venta Cancel sim
2/8/2017 Entel Prepago 2 01234567 Reposicion Cancel sim
2/9/2017 Entel Prepago 10 01234570 Portabilidad Success pack
2/9/2017 Entel Prepago Smart 1 01234567 Venta Pending pack
2/9/2017 Super Plan 1 01234568 Portabilidad Success sim
Yes you can multiple group by.
You can try this query :
SELECT COUNT(transaction), user, tariff_plan, status FROM your_table GROUP BY user, tariff_plan, status
Try this:
select
user, plan, type_of_operation, status,
count(*) cnt
from your_table
group by
user, plan, type_of_operation, status;
We currently have an issue where some rates for users have not been entered correctly and I have been tasked to find out which entries are incorrect, but unfortunately I am bit stuck.
The requirements are as follows;
If user only has a GBP charge out rate, then do nothing
If user has Charge out rate in GBP + USD then;
GBP must = USD / 1.55 otherwise FALSE
The following is how I started it:
We have a table called TIMERATE where a users charge out rate is entered, with a new line added every time the rate changes. It is possible for the user to have a charge out rate in more than one currency.
Here is a cut of the data in the table for a single user;
tkinit tkeffdate tkrt01 tkrtcur
LAU 01/02/2014 170 GBP
LAU 01/08/2014 260 GBP
LAU 01/12/2014 130 GBP
LAU 01/08/2014 260 USD
LAU 01/12/2014 210 USD
LAU 01/02/2015 260 USD
To find out the latest rate for each currency:
SELECT
TKINIT as Timekeeper,
MAX (tkeffdate) as MaxEffectiveDate,
tkrtcur as Currency,
Cast (NULL as decimal (16,2)) as Rate
INTO
#LatestRate
FROM
TIMERATE
GROUP BY
TKINIT, tkrtcur
ORDER BY
TKINIT
Then I updated the Rate in the temp table
update
#LatestRate
Set
Rate = tkrt01
from
#LatestRate
JOIN
Timerate on TKINIT = Timekeeper
and tkrtcur = Currency
and tkeffdate = MaxEffectiveDate
So i now have the latest rate for each currency for each user, but I do not know how to manipulate the data to fit the requirements
Does anyone have any ideas? Have I gone about this the wrong way?
Rabbit's answer is the easiest way to compare if the conversion was done correctly.
Going off of your initial steps, you can run this query on the #LatestRate table to give you the results. Pls ensure the comparison in the case statement is working correctly. I have not tested this code.
SELECT
GBP.Timekeeper as Timekeeper,
GBP.MaxEffectiveDate as EffectiveDate,
GBP.Currency as GBP,
GBP.Rate as GBPRate,
USD.Currency as USD,
USD.Rate as USDRate,
case
when USD.Rate is null then 'GBP Only'
when round(USD.Rate/1.55,2)=round(GBP.Rate,2) then 'Correct Conversion'
else 'FALSE'
end as IsConversion
FROM #LatestRate GBP
INNER JOIN #LatestRate USD
ON GBP.Timekeeper=USD.Timekeeper
and GBP.MaxEffectiveDate=USD.MaxEffectiveDate
and GBP.Currency='GBP' and USD.Currency='USD'
Join the table to itself on the tkinit and date where one side has the gbp and the other side has usd. This will give you both on one row so you can check to see if the rate is correct.