128 lines
2.6 KiB
PHP
128 lines
2.6 KiB
PHP
<?php
|
|
/*
|
|
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
|
* @package Carteasy
|
|
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
|
* @license proprietary
|
|
* @author Thomas Bartelt
|
|
* Carteasy is a web shop system
|
|
*/
|
|
|
|
include_once './core/main.class.php';
|
|
|
|
class Tax extends Main {
|
|
|
|
protected $base_object;
|
|
protected $db;
|
|
|
|
public $list_table_config = array (
|
|
'title' => 'Steuern',
|
|
'db_table' => 'tax',
|
|
'list_fields' => array(
|
|
array(
|
|
'db_field' => 'name',
|
|
'name' => 'Bezeichnung',
|
|
'sortable' => 1
|
|
),
|
|
array(
|
|
'db_field' => 'steuersatz',
|
|
'name' => 'Steuersatz',
|
|
'sortable' => 1
|
|
),
|
|
array(
|
|
'db_field' => 'standard',
|
|
'name' => 'Standard',
|
|
'rewrite_function' => 'standard',
|
|
'sortable' => 1
|
|
)
|
|
),
|
|
'search_fields' => array('name'),
|
|
'db_id_field' => 'id',
|
|
'db_selectable_field' => 'name',
|
|
'edit_link' => 'index.php?admin_modul=admin_object_edit&object=Tax&object_id=',
|
|
'toolbar' => array(
|
|
'delete' => '0',
|
|
'new' => 'index.php?admin_modul=admin_object_edit&object=Tax',
|
|
'copy' => 0,
|
|
'select_all' => 1,
|
|
'edit' => 0,
|
|
'actions' => 0,
|
|
'filter' => 0,
|
|
'search' => 1
|
|
),
|
|
'edit_title' => 'Steuern',
|
|
'edit_fields' => array (
|
|
array(
|
|
'name' => 'Allgemein',
|
|
'type' => 'form_title'
|
|
),
|
|
array(
|
|
'db_field' => 'name',
|
|
'name' => 'Bezeichnung',
|
|
'type' => 'text'
|
|
),
|
|
array(
|
|
'db_field' => 'steuersatz',
|
|
'name' => 'Steuersatz',
|
|
'type' => 'text'
|
|
)/*,
|
|
array(
|
|
'db_field' => 'standard',
|
|
'name' => 'Standard',
|
|
'type' => 'int',
|
|
'values' => 'standard'
|
|
)*/
|
|
),
|
|
'edit_mandatory_fields' => array('name', 'steuersatz'),
|
|
'edit_toolbar' => array(
|
|
'close' => 'index.php?admin_modul=admin_object_list&object=Tax',
|
|
'copy' => 0,
|
|
'undo' => 0,
|
|
'redo' => 0,
|
|
'save' => 1,
|
|
'send' => 0,
|
|
'delete' => 0
|
|
),
|
|
);
|
|
|
|
function __construct($base_object) {
|
|
$this->base_object = $base_object;
|
|
$this->db = Registry::get('base')->db;
|
|
}
|
|
|
|
public function standard() {
|
|
return array (
|
|
'0' => 'nein',
|
|
'1' => 'ja'
|
|
);
|
|
}
|
|
|
|
public function get_all() {
|
|
$sql = "SELECT * FROM tax";
|
|
$result = $this->db->query($sql);
|
|
$data = array();
|
|
while ($obj = $result->fetch_object()) {
|
|
$data[$obj->id] = $obj;
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
public static function get_taxrate($id) {
|
|
$db = Registry::get('base')->db;
|
|
|
|
$sql = "SELECT steuersatz FROM tax WHERE id = $id";
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$return = $result->fetch_object();
|
|
|
|
return number_format($return->steuersatz, 2, '.', '');
|
|
//return $return->steuersatz;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} |