Added vatgroup_id to product

This commit is contained in:
Frank Schubert
2024-02-21 15:09:26 +01:00
parent d1cd15935d
commit 0c706f6a0c
4 changed files with 19 additions and 1 deletions

View File

@@ -183,6 +183,16 @@
<input type="text" name="price" id="price" class="form-control" value="<?=$this::dotToComma($product->price)?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="vatgroup_id">Umsatzsteuersatz *</label>
<div class="col-lg-10">
<select class="select2 form-control " name="vatgroup_id" id="vatgroup_id">
<?php foreach(VatgroupModel::getAll() as $vg): ?>
<option value="<?=$vg->id?>" <?=( (!$product && $vg->id == TT_VATRATE_DEFAULT) || ($product && $vg->id == $product->vatgroup_id)) ? "selected='selected'" : ""?>><?=$vg->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="price_nne">Netznutzungsentgelt (NNE)</label>
<div class="col-lg-10">

View File

@@ -150,7 +150,7 @@
<td><?=(count($product->networks)) ? array_shift($product->networks)->name . ((count($product->networks) > 1) ? ", ..." : "") : ""?></td>
<td><?=$product->productgroup->name?></td>
<td><?=$product->name?></td>
<td><?=$product->producttech->name?> (<?=$product->attributes[TT_ATTRIB_RTRTECHCODE_NAME]->value?>)</td>
<td><?=$product->producttech->name?><?=(is_array($product->attributes) && array_key_exists(TT_ATTRIB_RTRTECHCODE_NAME, $product->attributes)) ? " (".$product->attributes[TT_ATTRIB_RTRTECHCODE_NAME]->value.")" : "" ?></td>
<td><?=__($product->producttech->customer_type)?></td>
<td><?=$product->price?></td>
<td><?=(12 / $product->billing_period)?>x Jährlich</td>
@@ -158,6 +158,7 @@
<td><?=$product->ivt_id?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("Product", "edit", ["id" => $product->id])?>"><i class="far fa-edit" title="Produkt Bearbeiten"></i></a>
<!--a href="<?=self::getUrl("Product", "copy", ["id" => $product->id])?>"><i class="far fa-clone" title="Kopie erstellen"></i></a-->
<a href="<?=self::getUrl("Product", "delete", ["id" => $product->id])?>" class="text-danger" onclick="if(!confirm('Berechtigungen wirklich löschen?')) return false;" title="Produkt Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>

View File

@@ -154,6 +154,7 @@ class ProductController extends mfBaseController {
$data['price_nbe'] = ($r->price_nbe) ? Layout::commaToDot($r->price_nbe) : 0;
$data['price'] = ($r->price) ? Layout::commaToDot($r->price) : 0;
$data['price_setup'] = ($r->price_setup) ? Layout::commaToDot($r->price_setup) : 0;
$data['vatgroup_id'] = $r->vatgroup_id;
$data['billing_period'] = $r->billing_period;
$data['billing_delay'] = ($r->billing_delay) ? $r->billing_delay : 0;
$data['contract_term'] = $r->contract_term;

View File

@@ -10,6 +10,7 @@ final class CreateVatTables extends AbstractMigration
if($this->getEnvironment() == "thetool") {
$table = $this->table("Vatgroup");
$table->addColumn("name", "string", ["null" => false, "limit" => 255]);
$table->addColumn("default", "string", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
@@ -29,6 +30,10 @@ final class CreateVatTables extends AbstractMigration
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->create();
$table = $this->table("Product");
$table->addColumn("vatgroup_id", "integer", ["null" => false, "default" => 1]);
$table->save();
}
if($this->getEnvironment() == "addressdb") {
@@ -39,6 +44,7 @@ final class CreateVatTables extends AbstractMigration
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Product")->removeColumn("vatgroup_id")->save();
$this->table("Vatrate")->drop()->save();
$this->table("Vatgroup")->drop()->save();
}