This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/Company.php
2012-12-21 13:01:12 +11:00

104 lines
2.5 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for access company information.
*
* @package OSB
* @subpackage System
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Company {
public static function instance() {
return new Company;
}
public static function name() {
return Config::instance()->so->site_details('name');
}
public static function street($ln='<br/>') {
if ($b = Config::instance()->so->site_details('address2'))
return implode($ln,array(Config::instance()->so->site_details('address1'),Config::instance()->so->site_details('address2')));
else
return Config::instance()->so->site_details('address1');
}
public static function city() {
return Config::instance()->so->site_details('city');
}
public static function state() {
return Config::instance()->so->site_details('state');
}
public static function pcode() {
return Config::instance()->so->site_details('pcode');
}
public static function address($ln='<br/>') {
return implode($ln,array(static::street($ln),sprintf('%s, %s %s',static::city(),static::state(),static::pcode())));
}
public static function phone() {
return Config::instance()->so->site_details('phone');
}
public static function fax() {
return Config::instance()->so->site_details('fax');
}
public static function email() {
return Config::instance()->so->site_details('email');
}
public static function contacts() {
return 'Tel: '.static::phone();
}
public static function bsb() {
// @todo Details should be obtained from DB
return Kohana::$config->load('config')->bsb;
}
public static function account() {
// @todo Details should be obtained from DB
return Kohana::$config->load('config')->accnum;
}
public static function taxid() {
// Tax ID details are stored in invoice config
$mc = Config::instance()->so->module_config('invoice');
if (empty($mc['TAX_ID_NAME']))
return empty($mc['TAX_ID']) ? '' : $mc['TAX_ID'];
else
return sprintf('%s: %s',$mc['TAX_ID_NAME'],empty($mc['TAX_ID']) ? '' : $mc['TAX_ID']);
}
public static function render() {
echo static::name();
echo static::address();
echo static::contacts();
}
/**
* Return the HTML to render the company address
*/
public function __toString() {
try {
return static::render();
}
// Display the exception message
catch (Exception $e) {
Kohana::exception_handler($e);
return '';
}
}
}
?>