blueshoes php application framework and cms            core_util
[ class tree: core_util ] [ index: core_util ] [ all elements ]

Class: Bs_Finance

Source Location: /core/util/Bs_Finance.class.php

Class Overview

Bs_Object
   |
   --Bs_Finance

This static class provides some useful finance functions.


Author(s):

Version:

  • 4.3.$Revision: 1.2 $ $Date: 2003/10/29 17:48:43 $

Copyright:

  • blueshoes.org

Methods


Inherited Variables

Inherited Methods

Class: Bs_Object

Bs_Object::Bs_Object()
Bs_Object::getErrors()
Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack.
Bs_Object::getLastError()
Basic error handling: Get last error string from the global Bs_Error-error stack.
Bs_Object::getLastErrors()
Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors().
Bs_Object::persist()
Persists this object by serializing it and saving it to a file with unique name.
Bs_Object::setError()
Basic error handling: Push an error string on the global Bs_Error-error stack.
Bs_Object::toHtml()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::toString()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::unpersist()
Fetches an object that was persisted with persist()

Class Details

[line 18]
This static class provides some useful finance functions.

no dependencies here yet.




Tags:

version:  4.3.$Revision: 1.2 $ $Date: 2003/10/29 17:48:43 $
copyright:  blueshoes.org
author:  Andrej Arn <at blueshoes dot org>


[ Top ]


Class Methods


constructor Bs_Finance [line 21]

Bs_Finance Bs_Finance( )



[ Top ]

method ccVal [line 149]

bool ccVal( string $Num, [string $Name = 'n/a'])

ccVal - Credit Card Validation function.

This function accepts a credit card number and, optionally, a code for a credit card name. If a Name code is specified, the number is checked against card-specific criteria, then validated with the Luhn Mod 10 formula. Otherwise it is only checked against the formula. Valid name codes are:

mcd - Master Card vis - Visa amx - American Express dsc - Discover dnc - Diners Club jcb - JCB

Copyright (c) 1999 Holotech Enterprises. All rights reserved. You may freely modify and use this function for your own purposes. You may freely distribute it, without modification and with this notice and entire header intact.

A description of the criteria used in this function can be found at http://www.beachnet.com/~hstiles/cardtype.html. If you have any questions or comments, please direct them to ccval@holotech.net

maybe also check http://www.icverify.com/ --andrej

there is also detailed description at http://www.webmasterbase.com/article/728




Parameters:

string   $Num   the card number
string   $Name   the short form of the cart type (n/a, mcd, vis, amx, dsc, dsc, dnc, jcb) default is 'n/a'.

[ Top ]

method toPercent [line 87]

string toPercent( [string $number = 0], [char $separateChar = '.'], [string $percentSign = '%'])

returns a percent value, eg 650 -> 6.50%



Tags:

todo:  this function is not tested enough/has some new code. don't use it in a production environment. test it before!


Parameters:

string   $number   the number to be converted into a 'price'
char   $separateChar   the character that is used to separate full % from fractions. default is '.'
string   $percentSign   the % string that is attached to the new number. eg "5.35" -> "5.35%". default is '%'.

[ Top ]

method toPrice [line 35]

string toPrice( [string $price = 0], [char $centsSeparateChar = '.'], [char $thousandsSeparateChar = "'"])

returns a number formatted as a price, eg 45115 -> 451.15



Tags:

todo:  this function is not tested enough/has some new code. don't use it in a production environment. test it before!
todo:  make use of the param char $thousandsSeparateChar


Parameters:

string   $price   the number to be converted into a 'price'
char   $centsSeparateChar   the character that is used to separate dollars from cents, franken from rappen, ... (franctions). default is a dot '.'
char   $thousandsSeparateChar   the character that is used to separate 1000-groups like 346'341'934.25 default is "'". note: this option doesn't get uses yet.

[ Top ]


Documentation generated on Mon, 29 Dec 2003 21:09:11 +0100 by phpDocumentor 1.2.3