andom-tec changes

This commit is contained in:
Frank Schubert
2024-12-24 12:38:29 +01:00
parent aff469924e
commit ee0037835c
24 changed files with 5518 additions and 298 deletions
+716
View File
@@ -0,0 +1,716 @@
<?php
$urlfilter = [];
if($s) {
$urlfilter['s'] = $s;
}
if($f) {
$urlfilter['f'] = $f;
}
$posturl = self::getUrl("Address", "save", $urlfilter);
?>
<?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"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
<?php if($address->id): ?>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address", "View", ['id' => $address->id])?>"><?=(is_object($address) && get_class($address) == "Address") ? $address->getCompanyOrName() : ""?> [<?=$address->customer_number?>]</a></li>
<?php endif; ?>
<li class="breadcrumb-item active"><?=($address->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<h4><?=($address->id) ? "Person/Firma bearbeiten" : "Neue Person/Firma"?></h4>
<form class="form-horizontal" method="post" name="addressForm" id="addressForm" action="<?=$posturl?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$address->id?>" />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="customer_number">Kundennummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="customer_number" id="customer_number" value="<?=$address->customer_number?>" disabled="disabled" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="company">Firmenname</label>
<div class="col-lg-10">
<textarea name="company" id="company" class="form-control" rows="2"><?=$address->company?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="firstname">Vorname</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="firstname" id="firstname" value="<?=$address->firstname?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="lastname">Nachname</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="lastname" id="lastname" value="<?=$address->lastname?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="street">Strasse</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="street" id="street" value="<?=$address->street?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="zip">PLZ / Ort</label>
<div class="col-lg-10">
<div class="row">
<div class="col-md-4">
<input type="text" class="form-control" name="zip" id="zip" placeholder="PLZ" value="<?=$address->zip?>">
</div>
<div class="col-md-8">
<input type="text" class="form-control" name="city" id="city" placeholder="Ort" value="<?=$address->city?>">
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="country">Land</label>
<div class="col-lg-10">
<select name="country_id" id="country_id" class="form-control">
<?php foreach(CountryModel::getAll() as $country): ?>
<option value="<?=$country->id?>" <?=(($address && $address->country_id == $country->id) || ((!$address || !$address->country_id) && $country->name == "Österreich")) ? "selected='selected'" : ""?>><?=$country->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="phone">Telefon</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="phone" id="phone" value="<?=$address->phone?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="mobile">Mobil</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="mobile" id="mobile" value="<?=$address->mobile?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fax">Fax</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="fax" id="fax" value="<?=$address->fax?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="email">Email</label>
<div class="col-lg-10">
<input type="email" class="form-control" name="email" id="email" value="<?=$address->email?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="birthdate">Geburtsdatum</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="birthdate" id="birthdate" value="<?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?>">
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="spin">Service PIN</label>
<div class="col-lg-10">
<input type="spin" class="form-control" name="spin" id="spin" value="<?=$address->spin?>" disabled="disabled">
</div>
</div>
</div>
</div>
<h4>Einwilligungen</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_contact" id="allow_contact" <?=($address->allow_contact) ? "checked='checked'" : ""?> /> Informationen per Post/Email/Telefon</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_spin" id="allow_spin" <?=($address->allow_spin) ? "checked='checked'" : ""?> /> Auskunft mit Service PIN</label>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="addresstypes">Rolle</label>
<div class="col-lg-10">
<select class="select2 form-control select2-multiple" name="addresstypes[]" id="addresstypes" multiple="multiple" data-placeholder="Choose ...">
<?php foreach(TT_ROLES as $role): ?>
<option value="<?=$role?>" <?=(is_array($address->types) && array_key_exists($role, $address->types)) ? "selected='selected'" : ""?>><?=__($role)?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
<h4 id="billing-data">Verrechnungsdaten</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="uid">UID</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="uid" id="uid" value="<?=$address->uid?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="billing_type">Verrechnungsart</label>
<div class="col-lg-10">
<select class="form-control" name="billing_type" id="billing_type">
<option value="invoice" <?=($address->billing_type == "invoice") ? "selected='selected'" : ""?>>Rechnung</option>
<option value="sepa" <?=($address->billing_type == "sepa") ? "selected='selected'" : ""?>>SEPA Bankeinzug</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="billing_delivery">Rechnungsversand</label>
<div class="col-lg-10">
<select class="form-control" name="billing_delivery" id="billing_delivery">
<option value="email" <?=($address->billing_delivery == "email") ? "selected='selected'" : ""?>>Email</option>
<option value="paper" <?=($address->billing_delivery == "paper" || !$address->billing_delivery) ? "selected='selected'" : ""?>>Post</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bank">Kreditinstitut</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_bank" id="bank_account_bank" value="<?=$address->bank_account_bank?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_owner">Kontoinhaber</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_owner" id="bank_account_owner" value="<?=$address->bank_account_owner?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_iban">IBAN</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_iban" id="bank_account_iban" value="<?=$address->bank_account_iban?>" />
<small id="iban_error" class="hidden">IBAN ungültig!</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bic">BIC</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_bic" id="bank_account_bic" value="<?=$address->bank_account_bic?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bic"></label>
<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>
<?php if($me->can("Fibu")): ?>
<h4>FIBU</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2">Primäres Verrechnungskonto</label>
<div class="col-lg-10">
<label><input type="checkbox" name="fibu_primary_account" id="fibu_primary_account" value="1" <?=($address->fibu_primary_account) ? "checked='checked'" : ""?> /> Ist primäres Verrechnungskonto</label>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_account_number">FIBU Verrechnungsnummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_account_number" id="fibu_account_number" value="<?=$address->fibu_account_number?>" />
</div>
</div>
<hr />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_number">FIBU Lieferantennummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_number" id="fibu_supplier_number" value="<?=$address->fibu_supplier_number?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_due">Lieferant Zahlungsziel</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_due" id="fibu_supplier_due" value="<?=$address->fibu_supplier_due?>" />
<small>Standard: <?=TT_ADDRESS_DEFAULT_SUPPLIER_DUE?> Tage</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_skonto">Lieferant Skontotage</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_skonto" id="fibu_supplier_skonto" value="<?=$address->fibu_supplier_skonto?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_skonto_rate">Lieferant Skonto %</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_skonto_rate" id="fibu_supplier_skonto_rate" value="<?=$address->fibu_supplier_skonto_rate?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2">Lieferant Zahlsperre</label>
<div class="col-lg-10">
<label><input type="checkbox" name="fibu_supplier_paymentblock" id="fibu_supplier_paymentblock" value="1" <?=($address->fibu_supplier_paymentblock) ? "checked='checked'" : ""?> /> Zahlsperre akiviert</label>
</div>
</div>
</div>
</div>
<?php endif; ?>
<h4>Zusatzdaten</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="rtrcode">RTR Betreiber ID</label>
<div class="col-lg-10">
<input class="form-control" name="attributes[rtrcode]" id="rtrcode" value="<?=$address->attributes['rtrcode']->value?>">
</div>
</div>
</div>
</div>
<h4>Verknüpfungen</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(is_array($address->links) && count($address->links) && array_key_exists($type, $address->links)): ?>
<?php foreach($address->links[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->firstname?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->lastname?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Address", "deleteLink", ["id" => $link->id])?>" onclick="if(!confirm('Verknüpfung wirklich entfernen?')) return false;" class="text-danger" title="Verknüpfung entfernen"><i class="fas fa-xmark-large"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
<?php $linknum = 1; ?>
<h5>Neue Verknüpfung</h5>
<div class="form-group row" id="link-<?=$linknum?>">
<div class="col-lg-2"></div>
<div class="col-lg-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<select class="form-control" name="links[<?=$linknum?>][type]">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<option value="<?=$type?>"><?=__($type)?></option>
<?php endforeach; ?>
</select>
</div>
<select class="form-control basicAutoComplete link-autocomplete" autocomplete="off" name="links[<?=$linknum?>][address_id]" id="links_<?=$linknum?>_address_id" data-linknum="<?=$linknum?>" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Name, Kundennummer, ID" data-noresults-text="Keine Suchergebnisse">
<option></option>
</select>
<div class="input-group-append">
<button type="button" class="btn btn-danger" onclick="clearNewLink(<?=$linknum?>)"><i class="fas fa-xmark-large mr-1"></i> Entfernen</button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><?=__($type)?> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>" target="_blank"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
<div class="col-lg-10">
<textarea id="note" class="form-control" name="note" rows="5"><?=$address->note?></textarea>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary mr-1">Speichern</button>
<button type="submit" name="return" value="index" class="btn btn-primary">Speichern und zur Übersicht</button>
<span id="error" class="hidden ml-2 alert alert-danger text-danger">Fehler: Ungültige IBAN</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#sepa_date').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('#birthdate').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
var bankdata_valid = false;
$("#parent_id").select2({
allowClear: true,
placeholder: ""
});
$("#addresstypes").select2();
$("#country_id").select2();
function validateIbanFormat(iban) {
if(!iban) {
return false;
}
iban = iban.toUpperCase().replace(/\s+/, '');
//check format
var m;
if(!iban.match(/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/)) {
return false;
}
var cc = iban.substr(0, 2);
var check = parseInt(iban.substr(2, 2));
var account = iban.substr(4);
var searchRange = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('');
//var replaceRange = [];
var checkStr = account + cc + "00";
for(var i = 0; i <= 25; i++) {
checkStr = checkStr.replace(searchRange[i], i + 10);
};
// make checksum
var checksum = parseInt(checkStr.substr(0,1));
for(pos = 1; pos < checkStr.length; pos++) {
checksum *= 10;
checksum += parseInt(checkStr.substr(pos, 1));
checksum %= 97;
}
if(98 - checksum == check) {
return true;
} else {
return false;
}
}
function validateIbanBic(iban, bic) {
if(!iban) return false;
iban = iban.toUpperCase().replace(/\s+/, '');
$.post("<?=self::getUrl("Address", "api")?>", {
do: "validateIbanBic",
iban: iban,
bic: bic
},
function(success) {
if(success.status == "OK") {
var data = success.result;
$("#bank-error").hide();
$("#bank-error").text("");
if(data.iban_correct && data.bic_correct && (!data.iban_sus || data.iban_sus === "www")) {
bankdata_valid = true;
$('#addressForm').submit();
return;
}
var bank_error = [];
if(!data.iban_correct) {
$("#bank_account_iban").addClass("invalid");
bank_error.push("Ungültige IBAN!");
}
if(data.iban_sus && data.iban_sus !== "www") {
$("#bank_account_iban").addClass("invalid");
bank_error.push("IBAN verdächtig (" + data.iban_sus + ")!");
}
if(!data.bic_correct) {
$("#bank_account_bic").addClass("invalid");
bank_error.push("Ungültige BIC!");
if(Array.isArray(data.bic)) {
bank_error.push(" Mögliche korrekte BIC: " + data.bic.join(", "));
}
}
$("#bank-error").html(bank_error.join("<br />\n"));
$("#bank-error").show();
$('html, body').animate( {scrollTop: $('#billing-data').offset().top - 230}, 200);
} else {
$("#bank-error").text("Beim Validieren der Bankdaten ist ein Fehler aufgetreten.");
}
},
"json"
);
return false;
}
function formatIBAN(input) {
let iban = input.value.replace(/\s/g, '');
let formattedIBAN = '';
for (let i = 0; i < iban.length; i++) {
if (i > 0 && i % 4 === 0) {
formattedIBAN += ' ';
}
formattedIBAN += iban[i];
}
input.value = formattedIBAN;
}
$("#bank_account_iban").on("input", function () {
formatIBAN(this);
});
formatIBAN(document.getElementById('bank_account_iban'));
$('#addressForm').submit(function(e) {
$("#error").hide();
$("#bank-error").hide();
$("#bank_account_iban").val($("#bank_account_iban").val().replaceAll(/\s/g, ''));
if($('#billing_type').val() == "sepa") {
console.log("bankdata_valid (1): " + bankdata_valid);
if(bankdata_valid) {
return true;
}
if(!validateIbanFormat($("#bank_account_iban").val())) {
$("#error").show();
console.log("nope");
}
console.log("bankdata_valid: " + bankdata_valid);
if($("#bank_account_iban").val() != "<?=$address->bank_account_iban?>" || $("#bank_account_bic").val() != "<?=$address->bank_account_bic?>") {
validateIbanBic($("#bank_account_iban").val(), $("#bank_account_bic").val());
} else {
return true;
}
e.preventDefault();
return false;
}
});
/*
* link autocomplete
*/
$('.link-autocomplete').autoComplete();
$('.link-autocomplete').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
/*
* Links autocomplete
*/
$('.link-autocomplete').on("autocomplete.select", function(evt, item) {
autocompleteSelect(evt,item);
});
function autocompleteSelect(evt, item) {
if(item && item.value === 0) {
$('.link-autocomplete').autoComplete('set', null);
return;
}
var match = evt.currentTarget.id.match(/links_(\d+)_address_id/);
var link_num = match[1];
if(!link_num) {
console.log("Couldn't find selected Address");
}
addLink(Number(link_num) + 1);
}
function addLink(linknum) {
if(!linknum) {
console.log("no linknum");
return false;
}
if($("#links_" + linknum + "_address_id").length) {
console.log("gibs scho");
return false;
}
var new_link = '<div class="form-group row" id="link-' + linknum + '"> \
<label class="col-lg-2 col-form-label" for="links_' + linknum + '_address_id"></label> \
<div class="col-lg-6"> \
<div class="input-group mb-3"> \
<div class="input-group-prepend"> \
<select class="form-control" name="links[' + linknum + '][type]"> \
<option value="techcontact">Technischer Kontakt</option> \
</select> \
</div> \
<select class="form-control basicAutoComplete link-autocomplete" autocomplete="off" name="links[' + linknum + '][address_id]" id="links_' + linknum + '_address_id" data-linknum="' + linknum + '" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Name, Kundennummer, ID" data-noresults-text="Keine Suchergebnisse"> \
<option></option> \
</select> \
<div class="input-group-append"> \
<button type="button" class="btn btn-danger" onclick="clearNewLink(' + linknum + ')"><i class="fas fa-xmark-large mr-1"></i> Entfernen</button> \
</div> \
</div> \
</div> \
</div>';
$('#link-container').append(new_link);
//$('#links_' + linknum + '_address_id').autocomplete();
$('#links_' + linknum + '_address_id').autoComplete();
$('#links_' + linknum + '_address_id').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
$('#links_' + linknum + '_address_id').on("autocomplete.select", function(evt, item) {
autocompleteSelect(evt,item);
});
}
function clearNewLink(linknum) {
if(!$("#link-" + linknum).length) {
return;
}
// only remove is not the only one
if($('#link-container').find('div.row').length > 1) {
$("#link-" + linknum).remove();
}
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
+382
View File
@@ -0,0 +1,382 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Adressen";
?>
<?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>
<?php if(is_array($filter['addresstype']) && count($filter['addresstype'])): ?>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
<li class="breadcrumb-item active">
<?php foreach($filter['addresstype'] as $type) { $types[] = __($type); } ?>
<?=implode(", ", $types)?>
</li>
<?php else: ?>
<li class="breadcrumb-item active">Personen & Firmen</li>
<?php endif; ?>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<h4 class="header-title mb-3"><i class="fad fa-filter fa-fw"></i> Filter</h4>
<form method="get" action="<?=self::getUrl("Address")?>">
<div class="row">
<?php if($me->is("Admin")): ?>
<div class="col-2">
<label class="form-label" for="filter_addresstype">Rolle</label>
<select name="filter[addresstype][]" id="filter_addresstype" class="form-control" multiple="multiple">
<option value="systemowner" <?=(array_key_exists("addresstype", $filter) && in_array("systemowner", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("systemowner")?></option>
<option value="productowner" <?=(array_key_exists("addresstype", $filter) && in_array("productowner", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("productowner")?></option>
<option value="netowner" <?=(array_key_exists("addresstype", $filter) && in_array("netowner", $filter["addresstype"])) ? "selected='selected'" : "netowner"?>><?=__("netowner")?></option>
<option value="salespartner" <?=(array_key_exists("addresstype", $filter) && in_array("salespartner", $filter["addresstype"])) ? "selected='selected'" : "salespartner"?>><?=__("salespartner")?></option>
<option value="pipeworker" <?=(array_key_exists("addresstype", $filter) && in_array("pipeworker", $filter["addresstype"])) ? "selected='selected'" : "pipeworker"?>><?=__("pipeworker")?></option>
<option value="lineworker" <?=(array_key_exists("addresstype", $filter) && in_array("lineworker", $filter["addresstype"])) ? "selected='selected'" : "lineworker"?>><?=__("lineworker")?></option>
<option value="pipeplanner" <?=(array_key_exists("addresstype", $filter) && in_array("pipeplanner", $filter["addresstype"])) ? "selected='selected'" : "pipeplanner"?>><?=__("pipeplanner")?></option>
<option value="lineplanner" <?=(array_key_exists("addresstype", $filter) && in_array("lineplanner", $filter["addresstype"])) ? "selected='selected'" : "lineplanner"?>><?=__("lineplanner")?></option>
<option value="netoperator" <?=(array_key_exists("addresstype", $filter) && in_array("netoperator", $filter["addresstype"])) ? "selected='selected'" : "netoperator"?>><?=__("netoperator")?></option>
<option value="support" <?=(array_key_exists("addresstype", $filter) && in_array("support", $filter["addresstype"])) ? "selected='selected'" : "support"?>><?=__("support")?></option>
<option value="billing" <?=(array_key_exists("addresstype", $filter) && in_array("billing", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("billing")?></option>
<option value="employee" <?=(array_key_exists("addresstype", $filter) && in_array("employee", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("employee")?></option>
<option value="customer" <?=(array_key_exists("addresstype", $filter) && in_array("customer", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("customer")?></option>
<option value="supplier" <?=(array_key_exists("addresstype", $filter) && in_array("supplier", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("supplier")?></option>
<option value="contact" <?=(array_key_exists("addresstype", $filter) && in_array("contact", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("contact")?></option>
<option value="techcontact" <?=(array_key_exists("addresstype", $filter) && in_array("techcontact", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("techcontact")?></option>
</select>
</div>
<?php endif; ?>
<div class="col-1">
<label class="form-label" for="filter_customer_number">Kundennummer</label>
<input type="text" class="form-control" name="filter[customer_number]" id="filter_customer_number" value="<?=(array_key_exists('customer_number', $filter)) ? $filter['customer_number'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_spin">Service PIN</label>
<input type="text" class="form-control" name="filter[spin]" id="filter_spin" value="<?=(array_key_exists('spin', $filter)) ? $filter['spin'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_fibu_account_number">FIBU Konto</label>
<input type="text" class="form-control" name="filter[fibu_account_number]" id="filter_fibu_account_number" value="<?=array_key_exists('fibu_account_number', $filter) ? $filter['fibu_account_number'] : ""?>" />
</div>
<div class="col-4">
<label class="form-label" for="filter_kunde">Kunde</label>
<input type="text" class="form-control" name="filter[kunde]" id="filter_kunde" value="<?=array_key_exists('kunde', $filter) ? $filter['kunde'] : ""?>" />
</div>
</div>
<div class="row mt-2">
<div class="col-2">
<label class="form-label" for="filter_street">Straße</label>
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=array_key_exists('street', $filter) ? $filter['street'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_zip">PLZ</label>
<input type="text" class="form-control" name="filter[zip]" id="filter_zip" value="<?=array_key_exists('zip', $filter) ? $filter['zip'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_city">Ort</label>
<input type="text" class="form-control" name="filter[city]" id="filter_city" value="<?=array_key_exists('city', $filter) ? $filter['city'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_country">Land</label>
<input type="text" class="form-control" name="filter[country]" id="filter_country" value="<?=array_key_exists('country', $filter) ? $filter['country'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_pfm">Fon/Fax/Mobil</label>
<input type="text" class="form-control" name="filter[pfm]" id="filter_pfm" value="<?=array_key_exists('pfm', $filter) ? $filter['pfm'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_email">Email</label>
<input type="text" class="form-control" name="filter[email]" id="filter_email" value="<?=array_key_exists('email', $filter) ? $filter['email'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_note">Notiz</label>
<input type="text" class="form-control" name="filter[note]" id="filter_note" value="<?=array_key_exists('note', $filter) ? $filter['note'] : ""?>" />
</div>
<?php if(defined("TT_ADDRESS_FILTER_DEFAULT_SYSOWNER") && TT_ADDRESS_FILTER_DEFAULT_SYSOWNER): ?>
<div class="col-1">
<label class="form-label" for="filter_type">Mandant</label>
<select class="form-control" name="filter[type]" id="filter_type">
<option value="<?=(array_key_exists('type', $filter) && $filter["type"] == "all") ? "selected='selected'" : ""?>">Alle</option>
<option value="xinon" <?=(array_key_exists('type', $filter) && $filter["type"] != "xinon") ? "" : "selected='selected'"?>>andom-tec</option>
<option value="others" <?=(array_key_exists('type', $filter) && $filter["type"] == "others") ? "selected='selected'" : ""?>>Fremd</option>
</select>
</div>
<?php endif; ?>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary"><i class="far fa-search fa-fw"></i> Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Address", "", ["resetFilter" => 1])?>"><i class="far fa-xmark fa-fw"></i> Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Personen & Firmen</h4>
</div>
<div class="float-right">
<a class="btn btn-primary" href="<?=self::getUrl("Address", "add")?>"><i class="fas fa-plus"></i> Neue Person/Firma anlegen</a>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Typ</th>
<th>Kundennummer</th>
<th>FIBU Konten</th>
<th>Firma</th>
<th>Name</th>
<th>Adresse</th>
<th>Telefon</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach($addresses as $address): ?>
<tr>
<?php if(is_array($address->types) && count($address->types)):?>
<?php
$types = array_keys($address->types);
$l7d_types = [];
foreach($types as $type):
$l7d_types[] = __($type);
endforeach;
?>
<td title="<?=implode(", ", $l7d_types)?>">
<?=$l7d_types[0]?><?=(count($types) > 1) ? ", ..." : ""?>
</td>
<?php else: ?>
<td></td>
<?php endif; ?>
<td>
<a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>">
<?=$address->customer_number?>
<?=($address->spin) ? "<br /><span class='text-pink'>".$address->spin."</span>" : ""?>
</a>
</td>
<td>
<?php if($address->fibu_account_number): ?>
<span title="Verrechnungskonto"><?=$address->fibu_account_number?></span><?=($address->fibu_primary_account) ? " <i class='fas fa-check text-success' title='Primäres Verrechnungskonto'></i>" : ""?>
<?php endif; ?>
<?php if($address->fibu_supplier_number): ?>
<br /><span title="Lieferantenkonto"><?=$address->fibu_supplier_number?></span>
<?php endif; ?>
</td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><?=nl2br($address->company)?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><?=$address->getFullName()?></a></td>
<td>
<?=$address->street?><br />
<?=$address->zip?> <?=$address->city?>
</td>
<td><?=$address->phone?></td>
<td><?=$address->email?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("User", "Index", ["filter" => ["address_id" => $address->id]])?>" title="Benutzer anzeigen"><i class="fas fa-users"></i></a>
<a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Address", "edit", ["id" => $address->id, 's' => $pagination['start']])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?=self::getUrl("Address", "delete", ["id" => $address->id, 's' => $pagination['start']])?>" onclick="if(!confirm('Person/Firma wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
</div>
</div>
</div>
</div>
<!-- CREATE TICKET MODAL START -->
<!--add a bootstrap modal here and below add a new <script> which creates a form for self::getUrl("Address", "createTicket") with post parameters
string $subject, string $description, string $customer_name, string $customer_number, string $customer_address, string $customer_phone_number, string $customer_email, string $customer_service_ping
-->
<div class="modal" id="createTicketModal" tabindex="-1" role="dialog" aria-labelledby="createTicketModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="createTicketModalLabel">Störungs-Ticket erstellen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="createTicketForm">
<div class="row">
<div class="col-6">
<label class="form-label required" for="subject">Betreff</label>
<input type="text" class="form-control" name="subject" id="subject" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="description">Beschreibung</label>
<textarea class="form-control" name="description" id="description" required="required"></textarea>
</div>
<div class="col-6">
<label class="form-label required" for="customer_name">Kundenname</label>
<input type="text" class="form-control" name="customer_name" id="customer_name" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_number">Kundennummer</label>
<input type="text" class="form-control" name="customer_number" id="customer_number" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_address">Kundenadresse</label>
<input type="text" class="form-control" name="customer_address" id="customer_address" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_phone_number">Telefon</label>
<input type="text" class="form-control" name="customer_phone_number" id="customer_phone_number" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_email">Email</label>
<input type="text" class="form-control" name="customer_email" id="customer_email" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_service_pin">Service-Pin</label>
<input type="text" class="form-control" name="customer_service_pin" id="customer_service_pin" required="required" />
</div>
</div>
<!-- add submit and close button here-->
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Ticket erstellen</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" @click="closeModal">Schließen</button>
</div>
</form>
</div>
<script>
const newTicketUrl = '<?=self::getUrl("Address", "createTicket")?>';
function openCreateTicketModal(customer_name, customer_number, customer_address, customer_phone_number, customer_email, customer_service_pin) {
$("#createTicketModal").modal("show");
$("#subject").val('');
$("#description").val('');
$("#customer_name").val(customer_name);
$("#customer_number").val(customer_number);
$("#customer_address").val(customer_address);
$("#customer_phone_number").val(customer_phone_number);
$("#customer_email").val(customer_email);
$("#customer_service_pin").val(customer_service_pin);
}
document.getElementById('createTicketForm').addEventListener('submit', submitNewTicket);
function submitNewTicket(e) {
e.preventDefault();
const data = {
subject: $("#subject").val(),
description: $("#description").val(),
customer_name: $("#customer_name").val(),
customer_number: $("#customer_number").val(),
customer_address: $("#customer_address").val(),
customer_phone_number: $("#customer_phone_number").val(),
customer_email: $("#customer_email").val(),
customer_service_pin: $("#customer_service_pin").val()
};
$.post(newTicketUrl, data, function(response) {
response = JSON.parse(response);
console.log(response);
if(response.id) {
window.open('https://project.xinon.at/projects/storungen-and-support/work_packages/' + response.id + '/activity', '_blank');
closeModal();
} else {
alert("Fehler beim Erstellen des Tickets.");
}
});
}
function closeModal() {
$("#createTicketModal").modal("hide");
// set all input fields to empty
$("#createTicketForm").trigger("reset");
}
</script>
<!-- CREATE TICKET MODAL END -->
<script type="text/javascript">
$("#filter_addresstype").select2({closeOnSelect: false});
function startBmdExport(e, type) {
e.preventDefault();
if(type == "inc") {
name = "inkrementellen";
url = "<?=self::getUrl("Address", "exportBmd")?>";
} else if(type == "full") {
name = "VOLLSTÄNDIGEN";
url = "<?=self::getUrl("Address", "exportBmd", ["type" => "full"])?>";
} else {
return false;
}
console.log(name);
if(!confirm("Wirklich " + name + " BMD-Export starten?")) {
return false;
}
$('button, input').prop('disabled', true);
$('a').removeAttr("href");
$("#bmd-export-loader").show();
window.location.href = url;
return false;
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
+350
View File
@@ -0,0 +1,350 @@
<?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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Personen & Firmen</a></li>
<li class="breadcrumb-item active"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="float-left">
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
</div>
<div class="float-right">
<a href="<?=self::getUrl("Address","invoice", ["address_id" => $address->id])?>" class="btn btn-purple mr-1"><i class="far fa-file-invoice-dollar"></i> Rechungsübersicht</a>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="card border-top-primary">
<div class="card-body">
<h3 class="text-center mb-3"><?=$address->getCompanyOrName()?><?=($address->customer_number) ? " [".$address->customer_number."]" : ""?></h3>
<table class="table table-sm table-striped view-table">
<tr>
<th>Kundennummer</th>
<td><?=$address->customer_number?></td>
</tr><tr>
<th>Firmenname</th>
<td><?=nl2br($address->company)?></td>
</tr><tr>
<th>Vorname</th>
<td><?=$address->firstname?></td>
</tr><tr>
<th>Nachname</th>
<td><?=$address->lastname?></td>
</tr><tr>
<th>Straße</th>
<td><?=$address->street?></td>
</tr><tr>
<th>PLZ / Ort</th>
<td><?=$address->zip?> <?=$address->city?></td>
</tr><tr>
<th>Land</th>
<td><?=$address->country->name?></td>
</tr><tr>
<th>Telefon</th>
<td><?=$address->phone?></td>
</tr><tr>
<th>Mobil</th>
<td><?=$address->mobile?></td>
</tr><tr>
<th>Fax</th>
<td><?=$address->fax?></td>
</tr><tr>
<th>Email</th>
<td><?=$address->email?></td>
</tr><tr>
<th>Geburtsdatum</th>
<td><?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?></td>
</tr><tr>
<th>Interne Notiz</th>
<td><?=nl2br($address->note)?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Service PIN</th>
<td><?=$address->spin?></td>
</tr><tr>
<th>Einwilligungen</th>
<td>
<p><i class="mr-1 fas <?=($address->allow_contact) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i> Informationen per Post/Email/Telefon</p>
<p><i class="mr-1 fas <?=($address->allow_spin) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i>Auskunft mit Service PIN</p>
</td>
</tr><tr>
<th>Rollen</th>
<td>
<?php if(is_array($address->types) && count($address->types)): ?>
<?php foreach(TT_ROLES as $role): ?>
<ul>
<?php if(array_key_exists($role, $address->types)): ?>
<li><?=__($role)?></li>
<?php endif; ?>
</ul>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr><tr>
<td colspan="2">
<h4>
Verrechnungsdaten
<?php if(array_key_exists("billing", $address->links_to) && is_array($address->links_to["billing"]) && count($address->links_to["billing"])): ?>
(<span class='text-danger'>Achtung: Seperate Rechnungsadresse vorhanden</span>)
<?php elseif(array_key_exists("billing", $address->linked_as) && is_array($address->linked_as["billing"]) && count($address->linked_as["billing"])): ?>
<span class='text-success'>(Ist aktive Rechnungsadresse)</span>
<?php endif; ?>
</h4>
</td>
</tr><tr>
<th>UID</th>
<td><?=$address->uid?></td>
</tr><tr>
<th>Verrechnungsart</th>
<td><?=($address->billing_type == "sepa") ? "SEPA Bankeinzug" : "Rechnung"?></td>
</tr><tr>
<th>Rechnungsversand</th>
<td><?=($address->billing_delivery == "paper" || !$address->billing_delivery) ? "Post" : "Email"?></td>
</tr><tr>
<th>Kreditinstitut</th>
<td><?=$address->bank_account_bank?></td>
</tr><tr>
<th>Kontoinhaber</th>
<td><?=$address->bank_account_owner?></td>
</tr><tr>
<th>IBAN</th>
<td><?php
$iban = $address->bank_account_iban;
$iban = preg_replace('/\s+/', '', $iban);
$iban = chunk_split($iban, 4, ' ');
$iban = trim($iban);
echo $iban;
?></td>
</tr><tr>
<th>BIC</th>
<td><?=$address->bank_account_bic?></td>
</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>
<th>Ist primäres Verrechnungskonto</th>
<td><?=($address->fibu_primary_account) ? "<i class='fas fa-check text-success' title='Primäres Verrechnungskonto'></i>" : "<i class='fas fa-xmark text-danger'></i>"?></td>
</tr><tr>
<th>Verrechnungskonto</th>
<td><?=$address->fibu_account_number?></td>
</tr><tr>
<th>Lieferantenkonto</th>
<td><?=$address->fibu_supplier_number?></td>
</tr><tr>
<th>Zahlungsziel Lieferant</th>
<td><?=$address->fibu_supplier_due?></td>
</tr><tr>
<th>Lieferant Skontotage</th>
<td><?=$address->fibu_supplier_skonto?></td>
</tr><tr>
<th>Lieferant Skonto %</th>
<td><?=$address->fibu_supplier_skonto_rate?></td>
</tr><tr>
<th>Lieferant Zahlsperre</th>
<td><?=($address->fibu_supplier_paymentblock) ? "<i class='fas fa-xmark text-danger'></i> Automatische Zahlungen gesperrt" : "Nicht gesperrt"?></td>
</tr><tr>
<td colspan="2"><h4>Zusatzdaten</h4></td>
</tr><tr>
<th>RTR Code</th>
<td><?=(is_array($address->attributes) && array_key_exists("rtrcode", $address->attributes)) ? $address->attributes['rtrcode']->value : ""?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->create)?> (<?=$address->creator->name?>)</td>
</tr><tr>
<th>Letzte Bearbeitung</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->edit)?> (<?=$address->editor->name?>)</td>
</tr>
</table>
<h4>Verknüpfungen</h4>
<?php if(is_array($address->links) && count($address->links)): ?>
<div class="card border-top-warning">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Name</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(is_array($address->links_to) && array_key_exists($type, $address->links_to)): ?>
<?php foreach($address->links_to[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->getFullName()?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><strong><?=__($type)?></strong> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-4">
<div class="card border-top-success">
<div class="card-header">
Aktive Produkte (Contracts)
</div>
<?php if(is_array($address->contracts) && count($address->contracts)): ?>
<ul class="list-group list-group-flush">
<?php foreach($address->contracts as $contract): ?>
<?php if($contract->owner_id != $address->id) continue; ?>
<li class="list-group-item <?=$contract->isCancelled() ? "canceled" : ""?>">
<?php if($contract->billingaddress_id && $contract->owner_id != $contract->billingaddress_id): ?>
<a href="<?=self::getUrl("Address", "view", ["id" => $contract->billingaddress_id])?>" class="mr-1">
<i class="far fa-fw fa-money-bill-simple-wave" title="Hat separate Rechungsadresse"></i>
</a>
<?php endif; ?>
<?php if($contract->cancel_date && $contract->cancel_date > date("U")): ?>
<i class="far fa-fw fa-eraser text-danger mr-1" title="Kündigungsdatum <?=date("d.m.Y", $contract->cancel_date)?>"></i>
<?php endif; ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>" class="<?=($contract->price < 0) ? "text-danger" : ""?>">
<?=$contract->product_name?> <?=($contract->matchcode) ? "[".$contract->matchcode."]" : ""?>
</a>
<?php if(is_array($contract->voicenumbers)): ?>
<span class="text-pink">
(<?=implode(", ", $contract->voicenumbers)?>)
</span>
<?php endif; ?>
<span class='text-secondary'>
<?=($contract->finish_date) ? "Fertigstellung: ".date('d.m.Y', $contract->finish_date) : "in Herstellung"?>
<?=($contract->cancel_date) ? "Kündigung: ".date('d.m.Y', $contract->cancel_date) : ""?>
</span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
<?php if(is_array($address->active_contracts) && count($address->active_contracts)): ?>
<div class="card border-top-success">
<div class="card-header">
Verträge
</div>
<div class="card-body">
<table class="table table-striped table-sm table-bordered table-hover">
<tr>
<th>Rolle</th>
<th>Contract ID</th>
<th>Produkt</th>
<th>Matchcode</th>
<th>Preis</th>
<th>Setup</th>
<th>Bestelldatum</th>
<th>Fertigstellung</th>
<th>Kündigung</th>
</tr>
<?php foreach($address->active_contracts as $contract): ?>
<tr>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>">
<a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>">
<?php if($contract->owner_id == $address->id): ?>
Vertragsinhaber
<?php elseif($contract->billingaddress_id == $address->id): ?>
Rechnungsempfänger
<?php endif; ?>
</a>
</td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->id?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->product_name?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->price < 0) ? "text-danger" : ""?>">€ <?=number_format($contract->price,4,",",".")?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->price_setup < 0) ? "text-danger" : ""?>">€ <?=number_format($contract->price_setup,4,",",".")?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->order_date) ? date('d.m.Y', $contract->order_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->cancel_date) ? "font-weight-bold text-danger" : ""?>"><?=($contract->cancel_date) ? date('d.m.Y', $contract->cancel_date) : ""?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
@@ -0,0 +1,10 @@
<?php
$header = "\u{FEFF}FIBU Kontonummber;Zahlungsziel Lieferant;Skontotage;Skontoprozent;Zahlsperre;Vorname;Nachname;Straße Hausnummer;PLZ;Ort;Land;Telefon;Mail;UID;SEPA;Kontoinhaber;IBAN;BIC;customer_numbers\n";
$this->setReturnValue(["header" => $header]);
foreach($addresses as $a):
?>
<?=$a["fibu_account_number"]?>;<?=$a["fibu_supplier_due"]?>;<?=$a["fibu_supplier_skonto"]?>;<?=$a["fibu_supplier_skonto_rate"]?>;<?=$a["fibu_supplier_paymentblock"]?>;<?=$this->nl2ws($a["firstname"])?>;<?=$this->nl2ws($a["lastname"])?>;<?=$this->nl2ws($a["street"])?>;<?=$this->nl2ws($a["zip"])?>;<?=$this->nl2ws($a["city"])?>;<?=$this->nl2ws($a["countrycode"])?>;<?=$this->nl2ws($a["phone"])?>;<?=$this->nl2ws($a["email"])?>;<?=$this->nl2ws($a["uid"])?>;<?=$a["billing_type"]?>;<?=$a["bank_owner"]?>;<?=$a["iban"]?>;<?=$a["bic"]?>;<?=implode(" ",$a["customer_numbers"])?>
<?php
endforeach;
+98
View File
@@ -0,0 +1,98 @@
<?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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address", "view", ["id" => $address->id])?>"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</a></li>
<li class="breadcrumb-item active">Rechnungen</li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card border-top-purple">
<div class="card-body">
<h3 class="">Rechnungen zu Kundennummer <?=$address->customer_number?></h3>
<div class="mb-3">Verrechnungskonto: <?=$address->fibu_account_number?></div>
<div class="font-weight-bold"><?=$address->getCompanyOrName()?></div>
<div><?=$address->street?></div>
<div><?=$address->zip?> <?=$address->city?></div>
<div><?=$address->country->name?></div>
<table class="table table-sm table-striped mt-2">
<tr>
<th>Typ</th>
<th>Rechnungsnummer</th>
<th>Rechnungsdatum</th>
<th>Betrag Netto</th>
<th>Betrag Brutto</th>
<th>Zahlungsart</th>
<th>Versand</th>
<th></th>
</tr>
<?php foreach($invoices as $invoice): ?>
<tr>
<td>
<ul>
<?php if($invoice->owner_id == $address->id):?>
<li>Vertragsinhaber</li>
<?php endif; ?>
<?php if($invoice->billingaddress_id == $address->id):?>
<li>Rechnungsempfänger</li>
<?php endif; ?>
</ul>
</td>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoice", ["id" => $invoice->id])?>"><i class="fas fa-download fa-fw"></i> <?=$invoice->invoice_number?></a></td>
<td><?=date("d.m.Y", $invoice->invoice_date)?></td>
<td class="<?=($invoice->total < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total, 2, ",", ".")?></td>
<td class="<?=($invoice->total_gross < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total_gross, 2, ",", ".")?></td>
<td><?=($invoices->billing_type == "sepa") ? "Einzug" : "Einzahlung" ?></td>
<td><?=($invoices->billing_delivery == "email") ? "Email (".$invoice->email.")" : "Postversand" ?></td>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoiceCsv", ["id" => $invoice->id])?>" title="CSV-Download"><i class="fas fa-file-csv fa-fw"></i></a></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>