Merge branch 'fronkdev' into 'master'

PreorderBilling WIP & Api changed

See merge request fronk/thetool!1127
This commit is contained in:
Frank Schubert
2025-03-20 15:03:17 +00:00
32 changed files with 2847 additions and 181 deletions

View File

@@ -512,6 +512,14 @@ $pagination_entity_name = "Vorbestellungen";
<script type="text/javascript">
$(document).ready(function() {
$(".datepicker").datepicker({
//orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$("#filter_type").select2({closeOnSelect: false});
$("#filter_status").select2({closeOnSelect: false});
$("#filter_partner_id").select2({closeOnSelect: false});
@@ -1195,6 +1203,62 @@ $pagination_entity_name = "Vorbestellungen";
'json');
}
function toggleActivationdateControl(pid) {
// set select to current status id
//$("#preorder-detail-activationdate-" + pid + "-input select").val($("#preorder-detail-activationdate-" + pid + "-text").data("activationdate"));
// toggle controls
$("#preorder-detail-activationdate-" + pid + "-text").toggle();
$("#preorder-detail-activationdate-" + pid + "-input").toggle();
return false;
}
function savePreorderActivationdateControl(pid) {
if(!Number.isInteger(pid) || pid < 1) {
return false;
}
var value = $("#preorder-detail-activationdate-" + pid + "-input input").val();
//console.log("add opacity-5 to ")
$("#preorder-" + pid + "-body").addClass("opacity-5");
$("#preorder-" + pid + "-body .loader-big").show();
// reset loading overlay if request times out
setTimeout(() => {
$("#preorder-" + pid + "-body").removeClass("opacity-5");
$("#preorder-" + pid + "-body .loader-big").hide();
}, 5000);
$.post("<?=self::getUrl("Preorder","Api")?>",
{
'do': "saveActivationdate",
id: pid,
activation_date: value
},
function(success) {
if(success.status == "OK") {
console.log(success);
var new_activationdate = success.result.activation_date;
var pid = success.result.preorder_id;
//console.log(updates);
$("#preorder-detail-activationdate-" + pid + "-textpart").text(new_activationdate);
$("#preorder-detail-activationdate-" + pid + "-input").val(new_activationdate);
$("#preorder-detail-activationdate-" + pid + "-text").addClass("text-success");
setTimeout(() => { $("#preorder-detail-activationdate-" + pid + "-text").removeClass("text-success") }, 1500);
toggleActivationdateControl(pid);
}
$("#preorder-" + pid + "-body").removeClass("opacity-5");
$("#preorder-" + pid + "-body .loader-big").hide();
},
'json');
}
function createWorkorder(pid) {
if(!Number.isInteger(pid) || pid < 1) {
return false;

View File

@@ -85,6 +85,20 @@
</div>
</td>
</tr><tr>
<th>Aktivierungsdatum (Status 500):</th>
<td>
<?php if($preorder->getStatuschangeTo(500)): ?>
<span id="preorder-detail-activationdate-<?=$preorder->id?>-text" data-activationdate="<?=($preorder->getStatuschangeTo(500)) ? (new DateTime("@".$preorder->getStatuschangeTo(500)))->format("d.m.Y") : ""?>"><span id="preorder-detail-activationdate-<?=$preorder->id?>-textpart"><?=($preorder->getStatuschangeTo(500)) ? (new DateTime("@".$preorder->getStatuschangeTo(500)))->format("d.m.Y") : ""?></span> <a href="#" onclick="return toggleActivationdateControl(<?=$preorder->id?>)"><i class="fas fa-fw fa-edit"></i></a></span>
<div class="input-group" id="preorder-detail-activationdate-<?=$preorder->id?>-input" style="display:none">
<input type="text" class="form-control datepicker" value="<?=($preorder->getStatuschangeTo(500)) ? (new DateTime("@".$preorder->getStatuschangeTo(500)))->format("d.m.Y") : ""?>" />
<div class="input-group-append">
<button type="button" class="btn btn-primary" title="Speichern" onclick="savePreorderActivationdateControl(<?=$preorder->id?>)"><i class="fas fa-check"></i></button>
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleActivationdateControl(<?=$preorder->id?>)"><i class="fas fa-times"></i></button>
</div>
</div>
<?php endif; ?>
</td>
</tr><tr>
<th>Erstellt:</th>
<td class="text-monospace"><?=date("d.m.Y H:i",$preorder->create)?> (<?=$preorder->creator->name?>)</td>
</tr><tr>
@@ -585,7 +599,7 @@
<?php foreach($preorder->history as $history): ?>
<?php if($history->key != "status_id") continue; ?>
<tr>
<td><?=date("d.m.Y H:i:s", $history->create)?></td>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $history->changed)?></td>
<td><?=$history->creator->name?></td>
<td><?=$history->old->code?> - <?=$history->old->name?></td>
<td><?=$history->new->code?> - <?=$history->new->name?></td>
@@ -604,7 +618,7 @@
</tr>
<?php foreach($preorder->history as $history): ?>
<tr>
<td><?=date("d.m.Y H:i:s", $history->create)?></td>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $history->create)?></td>
<td><?=$history->creator->name?></td>
<td><?=$history->getKey()?></td>
<td><?=$history->getText("old")?></td>

View File

@@ -0,0 +1,199 @@
<?php
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Billingrecords";
?>
<?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("Preordercampaign")?>">Vorbestellkampagnen</a></li>
<li class="breadcrumb-item active">Rechnungsdatensätze</li>
</ol>
</div>
<h4 class="page-title">Rechnungsdatensä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">
<h4 class="header-title mb-3">Filter</h4>
<form method="get" action="<?=self::getUrl("PreorderBilling")?>">
<div class="row">
<div class="col-2">
<label class="form-label" for="filter_netzgebiet_id">Kampagne</label>
<select class="form-control" name="filter[preordercampaign_id]" id="filter_preordercampaign_id">
<option></option>
<?php foreach($my_campaigns as $campaign): ?>
<option value="<?=$campaign->id?>" <?=(is_array($filter) && $filter["preordercampaign_id"] == $campaign->id) ? "selected='selected'" : ""?>><?=$campaign->name?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_oaid">OAID</label>
<input type="text" class="form-control" name="filter[oaid]" id="filter_oaid" value="<?=(array_key_exists("oaid", $filter)) ? $filter['oaid'] : ""?>"/>
</div>
<div class="col-2">
<label class="form-label" for="filter_owner_id">Netzbetreiber</label>
<select class="form-control" name="filter[owner_id]" id="filter_owner_id">
<option></option>
<?php foreach($netoperators as $netop): ?>
<option value="<?=$netop->id?>" <?=(is_array($filter) && $filter["owner_id"] == $netop->id) ? "selected='selected'" : ""?>><?=$netop->getCompanyOrName()?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_fibu_account_number">Fibu Kontonummer</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-2">
<label class="form-label" for="filter_product">Produkt</label>
<select class="form-control" name="filter[product_id]" id="filter_product_id">
<option></option>
<?php foreach(PreorderProduct::getWithTypes() as $product): ?>
<option value="<?=$product->id?>" <?=(is_array($filter) && $filter["product_id"] == $product->id) ? "selected='selected'" : ""?>><?=$product->name?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_start_date_from">Periode von</label>
<input type="text" class="form-control" name="filter[start_date_from]" id="filter_start_date_from" value="<?=(array_key_exists("start_date_from", $filter)) ? $filter['start_date_from'] : ""?>"/>
</div>
<div class="col-1">
<label class="form-label" for="filter_start_date_to">Periode bis</label>
<input type="text" class="form-control" name="filter[start_date_to]" id="filter_start_date_to" value="<?=(array_key_exists("start_date_to", $filter)) ? $filter['start_date_to'] : ""?>"/>
</div>
<div class="col-2">
<label class="form-label" for="filter_status">Status</label>
<select class="form-control" name="filter[status]" id="filter_status">
<option value="open" <?=(array_key_exists("status", $filter) && $filter['status'] == "open") ? "selected='selected'" : ""?>>Nur offene</option>
<option value="billed" <?=(array_key_exists("status", $filter) && $filter['status'] == "billed" ) ? "selected='selected'" : ""?>>Nur verrechnete</option>
</select>
</div>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("PreorderBilling")?>?resetFilter=1">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">Verrechnungsdatensätze</h4>
<!--button type="submit" class="btn btn-primary"><i class="fas fa-fw fa-check"></i> Markierte Elemente als Contract übernehmen</button-->
</div>
<div class="float-right">
<a class="btn btn-outline-primary mb-2" href="<?=self::getUrl("PreorderBilling", "importPreorders")?>">
<i class="fas fa-fw fa-file-import"></i> Rechnungsdatensätze erstellen
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-sm table-striped table-hover">
<tr>
<th>Netzgebiet</th>
<th>OAID</th>
<th>Bestelldatum</th>
<th>Periode</th>
<th>Vertragsinhaber</th>
<th>Fibu Account</th>
<th>Produkt</th>
<th>Anzahl</th>
<th>Preis</th>
<th>Preis Setup</th>
<th>Zustellung</th>
<th></th>
</tr>
<?php foreach($billings as $billing): ?>
<tr>
<td><?=$billing->preorder->adb_hausnummer->netzgebiet->name?></td>
<td><a href="<?=self::getUrl("Preorder", "Index", ["filter" => ["oaid" => $billing->oaid]])?>" target="_blank"><?=$billing->oaid?></a></td>
<td><?=$billing->order_date?></td>
<td><?=$billing->start_date?> -<br /><?=$billing->end_date?></td>
<td>
<?=($billing->company) ? $billing->company."<br />" : ""?>
<?=($billing->firstname || $billing->lastname) ? $billing->firstname." ".$billing->lastname."<br />" : ""?>
<?=$billing->street?><br />
<?=$billing->zip?> <?=$billing->city?><br />
<?=$billing->name?>
</td>
<td><?=$billing->fibu_account_number?></td>
<td>
<?=$billing->product_name?>
</td>
<td><?=($billing->amount / (int)$billing->amount > 1) ? number_format($billing->amount,3,",",".") : (int)$billing->amount?></td>
<td class="<?=($billing->price < 0) ? "text-danger" : ""?>">€ <?=number_format($billing->price,4,",",".")?></td>
<td class="<?=($billing->price_setup < 0) ? "text-danger" : ""?>">€ <?=number_format($billing->price_setup,4,",",".")?></td>
<td><?=($billing->billing_delivery == "email") ? "Email" : "Papier"?></td>
<td></td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#filter_start_date_from").datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$("#filter_start_date_to").datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -137,7 +137,12 @@
});
function toggleCollapseIndicator(elem) {
var selector = "#" + $(elem).attr("id");
if(typeof elem === 'object') {
var selector = "#" + $(elem).attr("id");
} else {
var selector = elem;
}
var itype = $(elem).data("collapse-indicator");
//console.log("selector: " + selector);
@@ -183,6 +188,7 @@
if(typeof match[2] !== 'undefined') {
let prod_id = match[2];
$("#price-detail-" + netop + "-" + prod_id).collapse('toggle');
toggleCollapseIndicator("#price-detail-" + netop + "-" + prod_id + "-collapse");
}
}

View File

@@ -154,6 +154,15 @@
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>FIBU Artikelnummer</label>
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][article_number]" value="<?=$product->getDefaultArticlenumber()?>" />
</div>
</div>
</div>
<div class="form-group">
<label>Preis Internet</label>
<div class="input-group mb-3">

View File

@@ -121,6 +121,15 @@
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>FIBU Artikelnummer</label>
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][article_number]" value="<?=$product->getDefaultArticlenumber()?>" />
</div>
</div>
</div>
<div class="form-group">
<label>Preis</label>
<div class="input-group mb-3">