WIP Contract/Billing 2024-07-04
This commit is contained in:
@@ -9,7 +9,7 @@ final class ContractAddVat extends AbstractMigration
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contract");
|
||||
$table->addColumn("vatrate", "decimal", ["null" => false, "default" => 0, "precision" => 6, "scale" => 2, "after" => "price_setup"]);
|
||||
$table->addColumn("vatgroup_id", "integer", ["null" => false, "after" => "price_setup"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ final class ContractAddVat extends AbstractMigration
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contract");
|
||||
$table->removeColumn("vatrate");
|
||||
$table->removeColumn("vatgroup_id");
|
||||
$table->update();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class BillingAddFibuData extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$billing = $this->table("Billing");
|
||||
$billing->addColumn("fibu_account_number", "integer", ["null" => true, "default" => null, "after" => "customer_number"]);
|
||||
$billing->addColumn("vatgroup_id", "string", ["null" => true, "default" => null, "after" => "vatrate"]);
|
||||
$billing->addColumn("vatarea", "string", ["null" => true, "default" => null, "after" => "vatgroup_id"]);
|
||||
$billing->save();
|
||||
|
||||
$invoice = $this->table("Invoice");
|
||||
$invoice->addColumn("fibu_account_number", "integer", ["null" => true, "default" => null, "after" => "customer_number"]);
|
||||
$invoice->addColumn("fibu_cost_area", "string", ["null" => true, "default" => null, "after" => "fibu_account_number"]);
|
||||
$invoice->addColumn("fibu_cost_account", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_area"]);
|
||||
$invoice->addColumn("fibu_cost_account_legacy", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account"]);
|
||||
$invoice->addColumn("fibu_taxcode", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account_legacy"]);
|
||||
$invoice->addColumn("tax_text", "string", ["null" => true, "default" => null, "length" => 255, "after" => "fibu_taxcode"]);
|
||||
$invoice->save();
|
||||
|
||||
$ip = $this->table("Invoiceposition");
|
||||
$ip->addColumn("fibu_cost_account", "integer", ["null" => true, "default" => null, "after" => "vatrate"]);
|
||||
$ip->addColumn("fibu_cost_account_legacy", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account"]);
|
||||
$ip->addColumn("fibu_taxcode", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account_legacy"]);
|
||||
$ip->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
$this->table("Invoiceposition")
|
||||
->removeColumn("fibu_taxcode")
|
||||
->removeColumn("fibu_cost_account_legacy")
|
||||
->removeColumn("fibu_cost_account")
|
||||
->update();
|
||||
|
||||
$this->table("Invoice")
|
||||
->removeColumn("fibu_invoice_text")
|
||||
->removeColumn("fibu_taxcode")
|
||||
->removeColumn("fibu_cost_account_legacy")
|
||||
->removeColumn("fibu_cost_account")
|
||||
->removeColumn("fibu_cost_area")
|
||||
->removeColumn("fibu_account_number")
|
||||
->update();
|
||||
$this->table("Billing")
|
||||
->removeColumn("vatarea")
|
||||
->removeColumn("vatgroup_id")
|
||||
->removeColumn("fibu_account_number")
|
||||
->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateBillingVoicenumber extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("BillingVoicenumber");
|
||||
$table->addColumn("invoice_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("contract_id", "integer", ["null" => false]);
|
||||
$table->addColumn("owner_id", "integer", ["null" => false]);
|
||||
$table->addColumn("billingaddress_id", "integer", ["null" => false]);
|
||||
$table->addColumn("voicenumber", "string", ["null" => false, "limit" => 64]);
|
||||
$table->addColumn("start_date", "date", ["null" => false]);
|
||||
$table->addColumn("end_date", "date", ["null" => false]);
|
||||
$table->addColumn("zone", "string", ["null" => false, "limit" => 64]);
|
||||
$table->addColumn("duration", "integer", ["null" => false]);
|
||||
$table->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
$table->addColumn("total_vat", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
|
||||
$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("BillingVoicenumber")->drop()->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user