Added sepa date

This commit is contained in:
Frank Schubert
2024-02-06 20:47:44 +01:00
parent e9937f2df8
commit 38ec49ddb3
10 changed files with 309 additions and 1 deletions

View File

@@ -229,6 +229,14 @@
<div class="col-lg-10 alert alert-danger hidden" id="bank-error"></div>
</div>
<?php if($me->can("Fibu")): ?>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="sepa_date">Sepa Mandatsdatum</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="sepa_date" id="sepa_date" value="<?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?>" />
</div>
</div>
<?php endif; ?>
</div>
</div>
@@ -426,6 +434,14 @@
<script type="text/javascript">
$('#sepa_date').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
var bankdata_valid = false;
$("#parent_id").select2({

View File

@@ -116,7 +116,14 @@
</tr><tr>
<th>BIC</th>
<td><?=$address->bank_account_bic?></td>
</tr><tr>
</tr>
<?php if($me->can("Fibu")): ?>
<tr>
<th>Sepa Mandatsdatum</th>
<td><?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2"><h4>FIBU</h4></td>
</tr>
<tr>

View File

@@ -243,6 +243,8 @@ class AddressController extends mfBaseController {
$data['uid'] = trim($r->uid);
if($this->me->can("Fibu")) {
$data["sepa_date"] = ($r->sepa_date) ? Layout::dateToInt($r->sepa_date) : null;
$data['fibu_account_number'] = ($r->fibu_account_number) ? trim($r->fibu_account_number) : null;
$data['fibu_supplier_number'] = ($r->fibu_supplier_number) ? trim($r->fibu_supplier_number) : null;
if($r->fibu_primary_account) {
@@ -283,6 +285,13 @@ class AddressController extends mfBaseController {
if($r->billing_type == "sepa") {
$data['billing_type'] = "sepa";
if(!$r->sepa_date) {
if($mode == "add" || ($mode == "edit" && !$address->sepa_date)) {
$data['sepa_date'] = date('U');
}
} else {
$data['sepa_date'] = $r->sepa_date;
}
} else {
$data['billing_type'] = "invoice";
}

View File

@@ -8,6 +8,7 @@ class AddressModel {
public $fibu_supplier_due;
public $fibu_supplier_skonto;
public $fibu_supplier_skonto_rate;
public $fibu_supplier_paymentblock;
public $fibu_primary_account;
public $spin;
public $company;
@@ -28,6 +29,7 @@ class AddressModel {
public $bank_account_owner;
public $bank_account_iban;
public $bank_account_bic;
public $sepa_date;
public $allow_contact;
public $allow_spin;
@@ -365,6 +367,14 @@ class AddressModel {
}
}
if(array_key_exists("billing_type", $filter)) {
$billing_type = FronkDB::singleton()->escape($filter["billing_type"]);
if($billing_type) {
$where .= " AND billing_type='$billing_type'";
}
}
/*
* Address Type
*/

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateContractqueue extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contractqueue");
$table->addColumn("approved", "integer", ["null" => false, "default" => 0]);
$table->addColumn("contract_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("order_id", "integer", ["null" => false]);
$table->addColumn("orderproduct_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("owner_id", "integer", ["null" => false]);
$table->addColumn("billingaddress_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("termination_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_name", "string", ["null" => false, "limit" => 255]);
$table->addColumn("product_info", "text", ["null" => true, "default" => null]);
$table->addColumn("matchcode", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("amount", "decimal", ["null" => false, "precision" => 9, "scale" => 6]);
$table->addColumn("sla_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_external", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
$table->addColumn("product_external_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
$table->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("price_nne", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("price_nbe", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("billing_delay", "integer", ["null" => false, "default" => 0]);
$table->addColumn("billing_period", "integer", ["null" => false, "default" => 1]);
$table->addColumn("order_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("finish_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("finish_date_by", "integer", ["null" => true, "default" => null]);
$table->addColumn("cancel_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("cancel_date_by", "integer", ["null" => true, "default" => null]);
$table->addColumn("imported_from", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("imported_data", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("note", "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") {
$table = $this->table("Contractqueue")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddressAddSepaDate extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Address");
$table->addColumn("sepa_date", "integer", ["null" => true, "default" => null, "after" => "bank_account_bic"]);
$table->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Address")->removeColumn("sepa_date")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ContractAddResellerId extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contract");
$table->addColumn("crediting_partner_id", "integer", ["null" => true, "default" => null, "after" => "orderproduct_id"]);
$table->addColumn("crediting_partner_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "crediting_partner_id"]);
$table->addColumn("reseller_id", "integer", ["null" => true, "default" => null, "after" => "crediting_partner_rate"]);
$table->addColumn("reseller_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "reseller_id"]);
$table->addIndex("orderproduct_id");
$table->update();
$table = $this->table("Contractqueue");
$table->addColumn("approved_credit", "integer", ["null" => false, "default" => 0, "after" => "approved"]);
$table->addColumn("crediting_partner_id", "integer", ["null" => true, "default" => null, "after" => "orderproduct_id"]);
$table->addColumn("crediting_partner_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "crediting_partner_id"]);
$table->addColumn("reseller_id", "integer", ["null" => true, "default" => null, "after" => "crediting_partner_rate"]);
$table->addColumn("reseller_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "reseller_id"]);
$table->addIndex("order_id");
$table->addIndex("orderproduct_id");
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contractqueue");
$table->removeIndex("orderproduct_id");
$table->removeIndex("order_id");
$table->removeColumn("reseller_rate");
$table->removeColumn("reseller_id");
$table->removeColumn("crediting_partner_rate");
$table->removeColumn("crediting_partner_id");
$table->update();
$table = $this->table("Contract");
$table->removeIndex("orderproduct_id");
$table->removeColumn("reseller_rate");
$table->removeColumn("reseller_id");
$table->removeColumn("crediting_partner_rate");
$table->removeColumn("crediting_partner_id");
$table->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ContractLinkAddTypeCredit extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ContractLink");
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange,credit"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ContractLink");
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class OrderChangeOrderdateDefaultNull extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Order");
$table->changeColumn("order_date", "integer", ["null" => true, "default" => null]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ProductOrderContractAddContractTerm extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Product");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("OrderProduct");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("Contract");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("Contractqueue");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Contractqueue")->removeColumn("contract_term")->update();
$this->table("Contract")->removeColumn("contract_term")->update();
$this->table("OrderProduct")->removeColumn("contract_term")->update();
$this->table("Product")->removeColumn("contract_term")->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}