Paypal Subscriptions - Quantity based - Charge variable amount - paypal

On my application, I need to charge users a different amount at a set frequency.
Hourly Fee * No. of Hours = Sum to be charged
(user is expected to fill the timesheet basis which the number of hours will be calculated
and Hourly fee is fixed)
We will charge this sum every week or every month. I thought of using the Paypal's quantity based subscriptions API, but I am not able to find a way to change the number of hours for every period (since the number of hours would change in every period).
Please advise.

Related

How to display month and YTD data on same group band in Crystal Reports

I am working on a productivity report. I need it to display units for the month along with YTD units.
Example:
Month units YTD Units
Staff (group 1)
Accounting Period (group 2)
Service Category (group 2)
Detail - services with minutes that are calculated into minutes. This may or may not be hidden.
Service Category (footer) Units sum for period Total Units sum
Page Break
Accounting period.... and so on until we run out of accounting periods for that staff with services, then onto the next staff.
Units are being calculated in a formula field based off of minutes of the service. How can I accurately display the year to date units? Everything I've tried hasn't worked. Perhaps I'm doing a running total wrong but it told me I couldn't use a formula field in it (units). I hope my explanation makes sense.

Calculating the mean for fluctuating data

Suppose we want to calculate the average annual balance of a customer in the bank.
If we want to have a normal average, we will add up the customer balance in the year and then dividing by the number of days in the year.
Now consider a customer who had a high balance only in the last month of the year and for the last 11 months his account balance has been very low. But because he had a high account balance only in the last month, his annual average shows a high number.
How can we design the annual average balance indicator in a way that 11 months of low customer balance affects his annual average and in fact the annual average of the customer does not increase only because of the last month?

DAX Calculate Monthly Average

I am trying to create a measure to calculate a monthly average from a set of data that was collected every 15 minutes. I am newer to DAX and am just unsure how to intelligently filter by month without hard setting in the month ID #. The formula I am trying is:
Average Monthly Use:=AVERAGEX(VALUES('Lincoln Data'[Month]),[kWh])
Where kWh is a measure of the total usage in a column
Thanks in advance
DVDV
To get the monthly average usage, You need to sum up the total usage per user and divide by the total number of months for that user.
Without knowing what your tables look like, it's hard to give a very good formula, but your measure might look something like this:
= DIVIDE(SUMX(DataTable, [kWh]), DISTINCTCOUNT(DataTable[Year-Month]))

Criteria to classify retail customers as churn Y or N

I have retail transactions data set. some of the attributes are CUSTID, BILL_DT, ITEM_Desc, VALUE. I want to classify the custid as churn y or n. Should i use the days between last purchase date till now as a criteria to classify? Can i say anything beyond 180 days that customer has churned? What is the criteria which the big retailers like costco, walmart uses?
Thanks,
From the transaction data, you could extract history consisting of a sequence of the pair (time elapsed since last transaction, amount spent in current transaction). If you know which customers have actually churned, you could build a predictive model using the Markov Chain classifier.
https://pkghosh.wordpress.com/2015/07/06/customer-conversion-prediction-with-markov-chain-classifier/

Calculate interest on postgresql with trigger/function

I'm currently working on a simple banking application.
I have built a postgresql database, with the right tables and functions.
My problem is, that I am not sure how to calculate the interest rate on the accounts. I have a function that will tell me the balance, on a time.
If we say that we have a 1 month period, where I want to calculate the interest on the account. The balance looks like this:
February Balance
1. $1000
3. $300
10. $700
27. $500
Balance on end of month: $500
My initial thoughts are to make a for loop, looping from the 1st in the month, to the last day in month, and adding the interest earned for that particular day in a row.
The function I want to use at end of month should be something like addInterest(startDate,endDate,accountNumber), which should insert one row into the table, adding the earned rate.
Could someone bring me on the right track, or show me some good learning resources on PL/PGSQL?
Edit
I have been reading a bit on cursors. Should I use a cursor to walk through the table?
I find it a bit confusing to use cursors, anyone here with some well explained examples?
There are various ways of interest calculation in banking system.
Interest = Balance x Rate x Days / Year
Types of Balances
Periodical Aggregate Balance
Daily Aggregate Balance
Types of Rates
Fixed Rate Dynamic Rate (according to balance)
Dynamic Rate (according to term)
Dynamic Rate (according to schedule)
Types of Days/Schedules
End of Day Processing (One day)
End of Month Processing (One month)
End of Quarter Processing (Three months)
End of Half Processing (Six months)
End of Year Processing (One year)
Year Formula
A year could consist of 365 or 366 days.
Your user might want to override number of days in a year, maintain a separate year variable property in your application.
Conclusion
Interest should be calculated as a routine task. Best approach would be that would run on a schedule depending upon the frequency setup of individual accounts.
The manual has a section about loops and looping through query results. There are also examples of trigger functions written in pl/pgsql. The manual is very complete, it's the best source I know of.