money

Sum negative values in Money column

I'm trying to sum two columns, and subtract the two sums to get a balance amount of two columns. But I'm getting the same output for both queries even though I know there are negative values. I need to exclude those negative values in the query. SELECT SUM(ReceiptAmt) - SUM(BalanceAmt) FROM Receipt SELECT SUM(ReceiptAmt) - SUM(BalanceA...

decimal vs double! - Which one should I use and when?

I keep seeing people using doubles in C#. I know I read somewhere that doubles sometimes lose precision. My question is when should a use a double and when should I use a decimal type? Which type is suitable for money computations? (ie. greater than $100 million) ...

iPhone/Android Dev for Pocket Change?

Hi folks, First the disclaimer - I've read a bunch of posts already on making money with mobile app development, and I'm not sure I feel encouraged or discouraged at this point :) I understand the very real "Gold Rush" mentality of the iPhone and Android apps... Here's my situation: I've coded professionally solo and on teams for abo...

How can I accept strings like "$1,250.00" and convert it to a decimal in C#?

How can I accept strings like "$1,250.00" and convert it to a decimal in C#? Do I just do a replace("$", "") and (",", "") or is there a different way I should handle this kind of input? ...

Using maskMoney input pluging -- still need some assistance

Ok, considering the regular expressions aren't working properly and there are no errors, I'm going to try and use the money mask. The goal is still to only allow numeric characters and a decimal. With maskMoney, that does the work for you. Also, I need to be able to successfully calculate each cell. As of right now, the masks are wo...

What's the best technique for handling US Dollar calculations in Perl?

What's the best technique for handling US Dollar calculations in Perl? Especially: the following needs to work: $balance = 10; $payment = $balance / 3; # Each payment should be 3.33. How best to round amount? $balance -= $payment * 3; # assert: $balance == .01 ...

Java - Name for money class

What should I name my class that stores costs/prices/amounts of money in CAD/USD as separate longs for dollars and cents? I has "PriceInDollars", but I don't really like that, and I always forget it. Any ideas? EDIT: Apparently I should use BigDecimal, not reinvent the wheel. I guess I'll just use that. I did learn a lot trying to make ...

how do i initialize the money gem?

I have a new gem I'm playing with, but I'm not sure where to put it so that it is initialized, but that I don't have to do it each and every time I use my method which uses it. def self.get_rate(from, to, amount) Money.default_bank.fetch_rates #<---------------- Here it is... if to == "USD" or from == "USD" rate = Mon...

How to retain the rights to sell an open-source project at a later date?

I'm in the process of starting an open-source project aimed at digitising a whole bunch of forms provided by a government department. Basically at the moment if people need to fill out the forms they need to do so on paper, and I'd like to change that so that it can be done on the computer. At present, the project has no official affil...

What class to use for money representation?

What class should I use for representation of money to avoid most rounding errors? Should I use Decimal, or a simple built-in number? Is there any existing Money class with support for currency conversion that I could use? Any pitfalls that I should avoid? ...

Is this SQL code susceptible to rounding errors?

I have discovered some strange behavior where a stored procedure is returning inaccurate results by a penny or two. Here's the code (I didn't write it): ALTER PROCEDURE [dbo].[TN_GetSimpleBalance] @custID int, @nBalance decimal (8,2) output AS declare @ArBalance as decimal (8,2) declare @custStatusCode varchar (2) declare @u...

Code Golf: Banknote calculator

This question was posted by a C beginner and it was an exercise to calculate, given a dollar value input by the user, the minimum number of bills (or banknotes, depending on your locale) needed to reach that dollar value. So, if the user entered 93, the output would be: $20 bills = 4 $10 bills = 1 $5 bills = 0 $1 bills = 3 Finally su...

php money_format

i am trying to remove the .00 at the end of the price function getMoney($mon) { setlocale(LC_MONETARY, 'en_US'); return money_format('%.2n', $mon); } Thank You, ...

Good example of Quantity or Money class.

Does someone konow a good .NET implementation of Quantity (with Unit of Measure) or Money (with Currency) classess/patterns in .NET ? ...

What to charge for card style newsletter design work?

hi friends, my client asking for Card Style Newsletter design. I have no idea how much normally designers charge for such work :/ any idea? thanks!! appreciate ... ...

C# Money numeric value to written value.

I am receiving data which I am basically recreating the image of a check for filing purposes. I have the monetary amount of the check coming in, but I need to create the written out value. i.e $2400.22 >> Two Thousand Four Hundred Dollars and Twenty Two Cents Was wondering if any one out there knows of a pre-packaged class or something...

Proof that Fowler's money allocation algorithm is correct.

Martin Fowler has a Money class that has a money allocation routine. This routine allocates money according to a given list of ratios without losing any value through rounding. It spreads any remainder value over the results. For example, $100 allocated by the "ratios" (1, 1, 1) would yield ($34, $33, $33). Here is the allocate functio...

Should I use Sharepoint Number column types to store monetary values?

In SharePoint I can create a list column of type 'Number'. I need to store monetary amounts and would like to be able to use this column type rather than having to create a new one. Are values of this type stored and manipulated by SharePoint (e.g. when summing values in a list view) to prevent loss of precision (i.e. not as some kind o...

What is the correct term for online fund transfer services?

Services like PayPal, NETeller, Click2Pay, Moneybookers? ...

Changing Open Source Software to divert donations

I have produced some open source software, released under the GPL, and intend to give users the opportunity to send me donations if they wish. It has occurred to me that since the open source license allows anyone to amend the software, someone could change the 'donate here' message displayed by the app to point to their own website/PayP...