Added Vatgroup & Vatrate
This commit is contained in:
132
Layout/default/Vatgroup/Index.php
Normal file
132
Layout/default/Vatgroup/Index.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
$pagination_baseurl = $this->getUrl($Mod,"Index");
|
||||
$pagination_baseurl_params = ["filter" => $filter];
|
||||
$pagination_entity_name = "Steuersätze";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item active">Steuersätze</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Steuersätze</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3 bg-light">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="header-title">Steuersätze</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php foreach($vatgroups as $vatgroup): ?>
|
||||
<h4>Steuersatzgruppe <span class="text-pink"><?=$vatgroup->name?></span></h4>
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<form method="post" action="<?=self::getUrl("Vatgroup", "save")?>">
|
||||
<input type="hidden" name="id" value="<?=$vatgroup->id?>" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-2 font-weight-medium">
|
||||
Zielland
|
||||
</div>
|
||||
<div class="col-2 font-weight-medium">
|
||||
Erlöskonto
|
||||
</div>
|
||||
<div class="col-2 font-weight-medium">
|
||||
Steuersatz %
|
||||
</div>
|
||||
<div class="col-4 font-weight-medium">
|
||||
Rechnungstext
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php foreach(TT_VATRATE_AREAS as $area_key => $area_name): ?>
|
||||
<div class="row mb-2">
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control" value="<?=$area_name?>" disabled="disabled" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control" name="rates[<?=$area_key?>][account]" value="<?=$vatgroup->rates[$area_key]->account?>" placeholder="Erlöskonto" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control" name="rates[<?=$area_key?>][rate]" value="<?=str_replace(".",",", round($vatgroup->rates[$area_key]->rate, 2))?>" placeholder="Steuersatz %" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<textarea class="form-control" name="rates[<?=$area_key?>][invoice_text]" placeholder="Optionaler Rechnungstext" ><?=htmlentities($vatgroup->rates[$area_key]->invoice_text)?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<input type="submit" class="btn btn-primary mt-2" value="Speichern" />
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<h4>Neue Steuersatzgruppe</h4>
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<form method="post" action="<?=self::getUrl("Vatgroup", "addGroup")?>">
|
||||
<input type="text" class="form-control" name="group_name" placeholder="Name" />
|
||||
<input type="submit" class="btn btn-primary mt-2" value="Anlegen" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggleBlock(id) {
|
||||
$('#block-detail-' + id).toggle();
|
||||
if($('#block-detail-' + id).is(":hidden")) {
|
||||
$('#block-' + id).removeClass("table-info");
|
||||
$('#block-' + id).removeClass("text-info");
|
||||
} else {
|
||||
$('#block-' + id).addClass("text-info");
|
||||
$('#block-' + id).addClass("table-info");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var block;
|
||||
var hash = window.location.hash.substr(1);
|
||||
var match = hash.match(/block=(\d+)/);
|
||||
if(match && match[1]) {
|
||||
block = match[1]
|
||||
toggleBlock(block);
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -74,6 +74,7 @@
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("OpenAccessId")?>"><i class="fad fa-fw fa-link-simple text-info"></i> Open Access IDs</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Vatgroup")?>"><i class="fas fa-fw fa-circle-dollar-to-slot text-info"></i> Steuersätze</a></li>
|
||||
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -86,36 +86,6 @@ class CountryModel {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function searchActive($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Country.* FROM Country
|
||||
WHERE $where
|
||||
ORDER BY Country.isocode";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($count)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new Country($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
37
application/Vatgroup/Vatgroup.php
Normal file
37
application/Vatgroup/Vatgroup.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class Vatgroup extends mfBaseModel {
|
||||
private $rates;
|
||||
|
||||
private function loadRates() {
|
||||
foreach(VatrateModel::search(["vatgroup_id" => $this->id]) as $rate) {
|
||||
$this->rates[$rate->area] = $rate;
|
||||
}
|
||||
return $this->rates;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "rates") {
|
||||
return $this->loadRates();
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
103
application/Vatgroup/VatgroupController.php
Normal file
103
application/Vatgroup/VatgroupController.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
class VatgroupController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function indexAction() {
|
||||
$vatgroups = VatgroupModel::getAll();
|
||||
$this->layout()->set("vatgroups", $vatgroups);
|
||||
}
|
||||
|
||||
protected function addGroupAction() {
|
||||
$name = $this->request->group_name;
|
||||
if(!$name) {
|
||||
$this->layout()->setFlash("Bitte einen Namen angeben!", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
if(VatgroupModel::getFirst(["name" => $name])) {
|
||||
$this->layout()->setFlash("Eine Steuersatzgruppe mit diesem Namen ist bereits vorhanden!", "warning");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
$group = VatgroupModel::create([
|
||||
"name" => $name
|
||||
]);
|
||||
|
||||
if(!$group->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Anlegen der Steuersatzgruppe!", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Steuersatzgruppe erfolgreic erstellt!", "success");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Ungültige Steuersatzgruppe", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
$group = new Vatgroup($id);
|
||||
if(!$group->id) {
|
||||
$this->layout()->setFlash("Ungültige Steuersatzgruppe", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
foreach($this->request->rates as $area => $rate) {
|
||||
if(!$rate['account'] && !$rate['rate']) continue;
|
||||
|
||||
if(!$area || !array_key_exists($area, TT_VATRATE_AREAS)) {
|
||||
$this->layout()->setFlash("Ungültiges Zielland", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data["vatgroup_id"] = $group->id;
|
||||
$data["area"] = $area;
|
||||
$data["account"] = trim($rate["account"]);
|
||||
$data["rate"] = str_replace(",",".", trim($rate["rate"]));
|
||||
$data["invoice_text"] = (trim($rate["invoice_text"])) ? trim($rate["invoice_text"]) : null;
|
||||
|
||||
if(!$data["account"] || !is_numeric($data["account"])) {
|
||||
$this->layout()->setFlash("Ungültige Erlöskontonummer", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
if(!is_numeric($data["rate"])) {
|
||||
$this->layout()->setFlash("Ungültiger Steuersatz", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
|
||||
$vatrate = VatrateModel::getFirst(["vatgroup_id" => $group->id, "area" => $area]);
|
||||
if($vatrate) {
|
||||
$vatrate->update($data);
|
||||
} else {
|
||||
$vatrate = VatrateModel::create($data);
|
||||
}
|
||||
|
||||
if(!$vatrate->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern eines Steuersatzes", "error");
|
||||
$this->redirect("Vatgroup");
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Steuersätze erfolgreich gespeichert", "success");
|
||||
$this->redirect("Vatgroup");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
133
application/Vatgroup/VatgroupModel.php
Normal file
133
application/Vatgroup/VatgroupModel.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
class VatgroupModel {
|
||||
public $name;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Vatgroup();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Vatgroup", "*", "1 = 1 ORDER BY name");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Vatgroup($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Vatgroup.* FROM Vatgroup
|
||||
WHERE $where
|
||||
LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Vatgroup($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUT(*) as cnt FROM Vatgroup
|
||||
WHERE $where
|
||||
";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Vatgroup.* FROM Vatgroup
|
||||
WHERE $where
|
||||
ORDER BY Vatgroup.name";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($count)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new Vatgroup($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(array_key_exists("name", $filter)) {
|
||||
$name = $db->escape($filter['name']);
|
||||
if($name) {
|
||||
$where .= " AND Vatgroup.`name` = '$name'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
5
application/Vatrate/Vatrate.php
Normal file
5
application/Vatrate/Vatrate.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Vatrate extends mfBaseModel {
|
||||
|
||||
}
|
||||
8
application/Vatrate/VatrateController.php
Normal file
8
application/Vatrate/VatrateController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
145
application/Vatrate/VatrateModel.php
Normal file
145
application/Vatrate/VatrateModel.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
class VatrateModel {
|
||||
public $vatgroup_id;
|
||||
public $area;
|
||||
public $account;
|
||||
public $rate;
|
||||
public $invoice_text;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Vatrate();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Vatrate", "*", "1 = 1 ORDER BY area");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Vatrate($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Vatrate.* FROM Vatrate
|
||||
WHERE $where
|
||||
LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Vatrate($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUT(*) as cnt FROM Vatrate
|
||||
WHERE $where
|
||||
";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Vatrate.* FROM Vatrate
|
||||
WHERE $where
|
||||
ORDER BY Vatrate.area";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($count)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new Vatrate($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(array_key_exists("vatgroup_id", $filter)) {
|
||||
$vatgroup_id = $filter['vatgroup_id'];
|
||||
if(is_numeric($vatgroup_id)) {
|
||||
$where .= " AND Vatrate.`vatgroup_id` = $vatgroup_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("area", $filter)) {
|
||||
$area = $db->escape($filter['area']);
|
||||
if($area) {
|
||||
$where .= " AND Vatrate.`area` = '$area'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
49
db/migrations/20240220192901_create_vat_tables.php
Normal file
49
db/migrations/20240220192901_create_vat_tables.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateVatTables extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Vatgroup");
|
||||
$table->addColumn("name", "string", ["null" => false, "limit" => 255]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
|
||||
|
||||
$table = $this->table("Vatrate");
|
||||
$table->addColumn("vatgroup_id", "integer", ["null" => false]);
|
||||
$table->addColumn("area", "enum", ["null" => false, "values" => "domestic,eu,other"]);
|
||||
$table->addColumn("account", "integer", ["null" => false]);
|
||||
$table->addColumn("rate", "decimal", ["null" => false, "precision" => 6, "scale" => 2]);
|
||||
$table->addColumn("invoice_text", "text", ["null" => true, "default" => null]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->create();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Vatrate")->drop()->save();
|
||||
$this->table("Vatgroup")->drop()->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user