seriennummern bugfix lieferschein check message

This commit is contained in:
OpenXE 2024-08-07 12:11:32 +02:00
parent 8f3d2a6ade
commit 934bd151ea
2 changed files with 42 additions and 26 deletions

View File

@ -2,27 +2,32 @@
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul>
<div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}
</div>
<ul class="filter-list">
<li class="filter-item">
<label for="altelieferscheine" class="switch">
<input type="checkbox" id="altelieferscheine" />
<span class="slider round">
</span>
</label>
<label for="altelieferscheine">
{|Zzgl. alte Lieferscheine|}
</label>
</li>
</ul>
</div>
</div>
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}
</div>
<ul class="filter-list">
<li class="filter-item">
<label for="altelieferscheine" class="switch">
<input type="checkbox" id="altelieferscheine" />
<span class="slider round">
</span>
</label>
<label for="altelieferscheine">
{|Zzgl. alte Lieferscheine|}
</label>
</li>
</ul>
</div>
</div>
</form>
<div class="row" [ARTIKEL_HIDDEN]>
[TAB1]
[TAB1NEXT]
</div>
</div>
</div>

View File

@ -425,6 +425,8 @@ class Seriennummern {
$groupby = "GROUP BY lp.id";
$orderby = "ORDER BY lp.sort ASC";
// echo($sql." WHERE ".$where." ".$groupby);
break;
@ -472,7 +474,7 @@ class Seriennummern {
function seriennummern_delivery_note_check_and_message($lieferschein_id) {
$check_delivery_notes = $this->seriennummern_check_delivery_notes($lieferschein_id);
$check_delivery_notes = $this->seriennummern_check_delivery_notes($lieferschein_id, group_lieferschein: true);
if (!empty($check_delivery_notes)) {
$lieferschein_minus_links = array();
$lieferschein_plus_links = array();
@ -931,12 +933,21 @@ class Seriennummern {
* Check if all delivery notes have serials
* Return array of delivery note positions and head information
*/
public function seriennummern_check_delivery_notes($lieferschein_id = null, $ignore_date = false, $only_missing = true) : array {
public function seriennummern_check_delivery_notes($lieferschein_id = null, $ignore_date = false, $only_missing = true, $group_lieferschein = false) : array {
if ($group_lieferschein) {
$sql_lp = "''";
$sql_lp_group = "";
} else {
$sql_lp = "lp.id";
$sql_lp_group = ", lp.id";
}
$sql = "
SELECT SQL_CALC_FOUND_ROWS
l.id lieferschein,
l.belegnr belegnr,
lp.id lieferschein_position,
$sql_lp lieferschein_position,
a.id artikel,
a.nummer artikel_nummer,
a.name_de,
@ -971,12 +982,12 @@ class Seriennummern {
)
AND (l.id = '".$lieferschein_id."' OR '".$lieferschein_id."' = '')
GROUP BY
l.id,
lp.id
l.id
$sql_lp_group
";
if ($only_missing) {
$sql .= " HAVING menge_lieferschein > menge_nummern";
$sql .= " HAVING menge_lieferschein <> menge_nummern";
}
$result = $this->app->DB->SelectArr($sql);