wareneingang redesign adding to packet and booking

This commit is contained in:
OpenXE 2024-01-06 18:29:59 +01:00
parent 6c1f40aab9
commit a1affd18d8
7 changed files with 379 additions and 200 deletions

View File

@ -10,8 +10,10 @@
<table width="100%" cellspacing="5">
<tr>
<td width="33%"><input type="checkbox" id="eigene" title="nur Artikel vom Lieferant anzeigen">&nbsp;<label for="eigene">{|Nur Artikel vom Lieferant anzeigen|}</label></td>
<td width="33%">{|Scannen|}: <input type="text" size="40" name="artikel" autofocus id="artikel" /></td>
<td width="33%">{|Artikel|}: <input type="text" size="40" name="artikel" autofocus id="artikel" /></td>
<td width="33%">{|Menge|}: <input type="number" size="40" name="menge" id="menge" value="1"/></td>
<td width="33%"><button name="submit" class="ui-button-icon" style="width:100%;" value="abschliessen">{|Weiter|}</button></td>
</tr>
</table>
</center>

View File

@ -22,7 +22,7 @@
</td></tr>
<tr valign="top"><td><br></td><td align="center"></td></tr>
[DISPLAY_WARENEINGANG_RMA_HOOK1]
<tr valign="top"><td><br></td><td align="center"><input type="submit" name="submit" value="Speichern" />&nbsp;<input type="button" onclick="window.location.href='index.php?module=wareneingang&action=distriinhalt&id=[ID]'" value="Abbrechen" /></td></tr>
<tr valign="top"><td><br></td><td align="center"><input type="submit" name="submit" value="Buchen" />&nbsp;<input type="button" onclick="window.location.href='index.php?module=wareneingang&action=distriinhalt&id=[ID]'" value="Abbrechen" /></td></tr>
</td></tr>
</table>

View File

@ -1,162 +1,188 @@
<!-- gehort zu tabview -->
<div id="tabs">
<ul>
[BEFORETAB1]<li><a href="#tabs-1">[TAB1TEXT]</a></li>[AFTERTAB1]
[BEFORETAB2]<li><a href="#tabs-2">[TAB2TEXT]</a></li>[AFTERTAB2]
[BEFORETAB3]<li><a href="#tabs-3">[TAB3TEXT]</a></li>[AFTERTAB3]
</ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<input type="hidden" id="paketannahme_id" value="[ID]" />
[BEFORETAB1]
<div id="tabs-1">
[TAB1START]
[MESSAGE1]
<form action="" method="post">
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|[LEGENDE]|}</legend>
<table>
<tr><td>{|Status|}:</td><td><input type=text size="40" value="[STATUS]" disabled></td></tr>
<tr [ABGESCHLOSSENHIDDEN]><td></td><td><i>Abgeschlossen am [DATUM_ABGESCHLOSSEN] durch [BEARBEITER_ABGESCHLOSSEN]</i></td></tr>
<tr><td>{|Lieferschein-Nr.|}:</td><td><input type=text size="40" name="lsnr" value=[LSNR]></td></tr>
<tr><td>{|Rechnung-Nr.|}:</td><td><input type=text size="40" name="renr" value=[RENR]></td></tr>
<tr><td>{|Bemerkung|}:</td><td><textarea rows="5" cols="40" name="bemerkung">[BEMERKUNG]</textarea></td></tr>
[ISLIEFERANTSTART]
<tr><td>{|Ziellager|}:</td><td><input type=text size="40" name="ziellager" id="ziellager" value=[LAGER]><br><i>Wenn nicht angegeben, wird das Standardlager des Artikels bebucht.</i></td></tr>
[ISLIEFERANTENDE]
</table>
</fieldset>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
[BUTTONS]
[BEFOREFRM]
[AFTERFRM]
[DISTRIINHALTBUTTONS]
[BEFOREFRM]
[AFTERFRM]
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern" hidden="true"></button>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
[BEFOREMANUELLERFASSEN]
<tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="manuellerfassen">{|Artikel manuell erfassen|}</button>
</td></tr>
[AFTERMANUELLERFASSEN]
[ISLIEFERANTSTART]
<tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="fuellen">{|Aus Bestellungen f&uuml;llen|}</button>
</td></tr>
<tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="leeren">{|Leeren|}</button>
</td></tr>
[ISLIEFERANTENDE]
<tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</button>
</td></tr>
[ISLIEFERANTSTART]
<tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="buchen">{|Buchen|}</button>
</td></tr>
[ISLIEFERANTENDE]
<tr [ABSCHLIESSENHIDDEN]><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="abschliessen">{|Abschlie&szlig;en|}</button>
</td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
[TAB1]
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
[TAB1_SECOND]
</div>
</div>
</div>
</div>
</form>
[TAB1ENDE]
</div>
[AFTERTAB1]
[BEFORETAB2]
<div id="tabs-2">
[TAB2START]
[MESSAGE2]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
[TAB2]
<div class="center">[BUTTONS2]</div>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Aktionen|}</legend>
[BUTTONS]
</fieldset>
</div>
</div>
</div>
</div>
[TAB2ENDE]
</div>
[AFTERTAB2]
[BEFORETAB3]
<div id="tabs-3">
[TAB3START]
[MESSAGE3]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
[TAB3]
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Aktionen|}</legend>
[BUTTONS]
</fieldset>
</div>
</div>
</div>
</div>
[TAB3ENDE]
</div>
[AFTERTAB3]
</div>
<ul> [BEFORETAB1]
<li><a href="#tabs-1">[TAB1TEXT]</a></li>[AFTERTAB1] [BEFORETAB2]
<li><a href="#tabs-2">[TAB2TEXT]</a></li>[AFTERTAB2] [BEFORETAB3]
<li><a href="#tabs-3">[TAB3TEXT]</a></li>[AFTERTAB3] </ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<input type="hidden" id="paketannahme_id" value="[ID]" /> [BEFORETAB1]
<div id="tabs-1"> [TAB1START] [MESSAGE1] [MESSAGE]
<form action="" method="post">
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|[LEGENDE]|}</legend>
<table>
<tr>
<td>{|Status|}:</td>
<td>
<input type=text size="40" value="[STATUS]" disabled>
</td>
</tr>
<tr [ABGESCHLOSSENHIDDEN]>
<td></td>
<td><i>Abgeschlossen am [DATUM_ABGESCHLOSSEN] durch [BEARBEITER_ABGESCHLOSSEN]</i></td>
</tr>
<tr>
<td>{|Lieferschein-Nr.|}:</td>
<td>
<input type=text size="40" name="lsnr" value=[LSNR]>
</td>
</tr>
<tr>
<td>{|Rechnung-Nr.|}:</td>
<td>
<input type=text size="40" name="renr" value=[RENR]>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table>
<tr>
<td>{|Bemerkung|}:</td>
<td>
<textarea rows="5" cols="40" name="bemerkung">[BEMERKUNG]</textarea>
</td>
</tr>
[ISLIEFERANTSTART]
[ISLIEFERANTENDE]
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row" [HINZUFUEGENHIDDEN]>
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
[TAB1]
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset> [BUTTONS] [BEFOREFRM] [AFTERFRM] [DISTRIINHALTBUTTONS] [BEFOREFRM] [AFTERFRM]
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern" hidden="true"></button>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
<tr>
<td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</button>
</td>
</tr>
[ISLIEFERANTSTART]
<tr [HINZUFUEGENHIDDEN]>
<td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="hinzufuegen">{|Hinzuf&uuml;gen|}</button>
</td>
</tr>
[ISLIEFERANTENDE]
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height"> [TAB1_SECOND] </div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern" hidden="true"></button>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
[BEFOREMANUELLERFASSEN]
<tr [HINZUFUEGENHIDDEN]>
<td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="manuellerfassen">{|Artikel manuell buchen|}</button>
</td>
</tr>
[AFTERMANUELLERFASSEN]
<tr [BUCHENHIDDEN]>
<td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="vorlaeufige_buchen">{|Buchen|}</button>
</td>
</tr>
<tr [BUCHENHIDDEN]>
<td>
{|Ziellager|}:&nbsp;<img src="./themes/new/images/tooltip_grau.png" border="0" style="position: relative; left: 1px; top: 3px; z-index: 8;" class="wawitooltipicon" title="Wenn nicht angegeben, wird das Standardlager des Artikels bebucht.">
</td>
</tr>
<tr [BUCHENHIDDEN]>
<td>
<input type=text name="ziellager" id="ziellager" value="[LAGER]" style="width:98%;">
</td>
</tr>
<tr [ABSCHLIESSENHIDDEN]>
<td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="abschliessen">{|Abschlie&szlig;en|}</button>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</form> [TAB1ENDE]
</div> [AFTERTAB1] [BEFORETAB2]
<div id="tabs-2"> [TAB2START] [MESSAGE2]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height"> [TAB2]
<div class="center">[BUTTONS2]</div>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Aktionen|}</legend> [BUTTONS] </fieldset>
</div>
</div>
</div>
</div> [TAB2ENDE] </div> [AFTERTAB2] [BEFORETAB3]
<div id="tabs-3"> [TAB3START] [MESSAGE3]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height"> [TAB3] </div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Aktionen|}</legend> [BUTTONS] </fieldset>
</div>
</div>
</div>
</div> [TAB3ENDE] </div> [AFTERTAB3] </div>
<script type="text/javascript">
$(document).ready(function() {
$( "#tabs" ).tabs( "option", "active", [TABINDEX]);
if($('#frmWareneingangDistribution').length) {
$('#btnabschliessen').on('click',function(){
$('#frmWareneingangDistribution').append('<input type="hidden" value="1" name="abschliessen" />');
$('#frmWareneingangDistribution').find('[name="submit"]').trigger('click');
});
}
});
$(document).ready(function() {
$("#tabs").tabs("option", "active", [TABINDEX]);
if($('#frmWareneingangDistribution').length) {
$('#btnabschliessen').on('click', function() {
$('#frmWareneingangDistribution').append('<input type="hidden" value="1" name="abschliessen" />');
$('#frmWareneingangDistribution').find('[name="submit"]').trigger('click');
});
}
});
</script>

View File

@ -83,24 +83,27 @@ class Wareneingang {
$adresse = $this->app->DB->Select("SELECT adresse FROM paketannahme WHERE id='$id' LIMIT 1");
$subwhere = " AND (a.adresse=$adresse OR ( (e.gueltig_bis >= NOW() OR e.gueltig_bis='0000-00-00' OR e.gueltig_bis IS NULL) AND e.adresse=$adresse) )";
$addjoin = " RIGHT JOIN einkaufspreise e ON e.adresse=a.adresse ";
$addjoin = " INNER JOIN einkaufspreise e ON e.adresse=a.adresse AND e.artikel = a.id ";
$groupby = " GROUP BY a.id ";
}
$sql = "SELECT SQL_CALC_FOUND_ROWS a.id, a.nummer as nummer,
CONCAT('<span style=display:none>',a.name_de,'</span>',if(a.intern_gesperrt,CONCAT('<strike>',
if(a.variante AND a.variante_von > 0,CONCAT(name_de,' <font color=#848484>(Variante von ',ifnull((SELECT tmp.nummer FROM artikel tmp WHERE a.variante_von=tmp.id LIMIT 1),''),')</font>'),name_de)
,'</strike>'),
if(a.variante AND a.variante_von > 0,CONCAT(name_de,' <font color=#848484>(Variante von ',ifnull((SELECT tmp.nummer FROM artikel tmp WHERE a.variante_von=tmp.id LIMIT 1),''),')</font>'),name_de)
)) as name_de,
CONCAT('<span style=display:none>',a.name_de,'</span>',trim((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id))+0) as lagerbestand,
p.abkuerzung as projekt, a.id as menu
FROM artikel a
LEFT JOIN projekt p ON p.id=a.projekt " . $addjoin;
$sql = "
SELECT SQL_CALC_FOUND_ROWS
a.id,
a.nummer as nummer,
CONCAT('<span style=display:none>',a.name_de,'</span>',if(a.intern_gesperrt,CONCAT('<strike>',
if (
a.variante AND a.variante_von > 0,CONCAT(name_de,' <font color=#848484>(Variante von ',ifnull((SELECT tmp.nummer FROM artikel tmp WHERE a.variante_von=tmp.id LIMIT 1),''),')</font>'),name_de)
,'</strike>'),
if(a.variante AND a.variante_von > 0,CONCAT(name_de,' <font color=#848484>(Variante von ',ifnull((SELECT tmp.nummer FROM artikel tmp WHERE a.variante_von=tmp.id LIMIT 1),''),')</font>'),name_de)
)
) as name_de,
CONCAT('<span style=display:none>',a.name_de,'</span>',trim((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id))+0) as lagerbestand,
p.abkuerzung as projekt,
a.id as menu
FROM
artikel a
LEFT JOIN projekt p ON p.id=a.projekt " . $addjoin;
$where = "a.geloescht=0 $subwhere " . $this->app->erp->ProjektRechte();
@ -115,10 +118,19 @@ class Wareneingang {
$adresse = $this->app->DB->Select("SELECT adresse FROM paketannahme WHERE id='$id' LIMIT 1");
$wareneingangauftragzubestellung = $this->app->erp->Firmendaten('wareneingangauftragzubestellung');
$vorschlag = "
if(
bp.menge-bp.geliefert-COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),0) > 0,
bp.menge-bp.geliefert-COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),0),
0
)
";
$input_for_menge = "CONCAT(
'<input type = \"number\" min=\"0\"',
' value=\"',
COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),''),
$vorschlag,
'\"',
' name=\"menge_',
bp.id,
@ -128,7 +140,7 @@ class Wareneingang {
)";
if ($wareneingangauftragzubestellung) {
$heading = array('Lieferant-Art.-Nr.', 'Art.-Nummer', 'Bestellung', 'Beschreibung', 'Lieferdatum', 'Projekt', 'Menge', 'Geliefert', 'Offen', 'Auftrag', 'Menge', 'Eingabe', 'Aktion');
$heading = array('Lieferant-Art.-Nr.', 'Art.-Nummer', 'Bestellung', 'Beschreibung', 'Lieferdatum', 'Projekt', 'Menge', 'Geliefert', 'Offen', 'Auftrag', 'Menge', 'Eingabe', '');
$width = array('5%', '5%', '5%', '30%', '5%', '5%', '5%', '5%', '5%', '5%', '5%', '5%', '5%');
$findcols = array('bp.bestellnummer', 'art.nummer', 'b.belegnr',
"CONCAT(art.name_de,'<br>Bei Lieferant: ',bp.bezeichnunglieferant,
@ -962,14 +974,28 @@ class Wareneingang {
*/
$heading = array('Lieferant-Art.-Nr.', 'Art.-Nummer', 'Bestellung', 'Beschreibung', 'Menge', 'Bemerkung','Bearbeiter', '');
$width = array( '5%', '5%', '5%', '30%', '5%', '15%', '5%', '30%');
$heading = array('Lieferant-Art.-Nr.', 'Art.-Nummer', 'Bestellung', 'Beschreibung', 'Menge', 'Bemerkung','Bearbeiter', '','','');
$width = array( '5%', '5%', '5%', '30%', '5%', '15%', '5%', '1%','1%','1%');
$findcols = array('p.nummer', 'p.bestellbezug', 'p.name', 'p.menge', 'p.bemerkung','p.bearbeiter');
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
$alignright = array('5');
$defaultorder = 1;
$defaultorderdesc = 0;
$icon_nicht_eingelagert = "<img src=\"./themes/new/images/nicht_eingelagert.png\" title=\"nicht eingebucht\" style=\"margin-right:1px\" border=\"0\">";
$icon_eingelagert = "<img src=\"./themes/new/images/eingelagert.png\" title=\"eingebucht\" style=\"margin-right:1px\" border=\"0\">";
$icon_kein_lagerplatz = "<img src=\"./themes/new/images/lagerplatzstop.png\" title=\"kein Standardlager angegeben\" style=\"margin-right:1px\" border=\"0\">";
$icon_lagerplatz = "<img src=\"./themes/new/images/lagerplatzgo.png\" title=\"Lager ok\" style=\"margin-right:1px\" border=\"0\">";
$deletelink = array(
"<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=wareneingang&action=deletepos&id=",
['sql' => 'paketannahme'],
'&posid=',
['sql' => 'paketdistribution.id'],
"\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>&nbsp;</td></tr></table>"
);
$sql = "SELECT SQL_CALC_FOUND_ROWS
p.nummer,
@ -979,7 +1005,9 @@ class Wareneingang {
p.name,
p.menge,
p.bemerkung,
p.bearbeiter
p.bearbeiter,
p.icon,
p.menu
FROM
(
SELECT
@ -989,12 +1017,30 @@ class Wareneingang {
artikel.name_de as name,
" . $this->app->erp->FormatMenge("paketdistribution.menge") . " as menge,
paketdistribution.bemerkung,
paketdistribution.bearbeiter
FROM paketdistribution
INNER JOIN artikel ON artikel.id = paketdistribution.artikel
paketdistribution.bearbeiter,
CONCAT(
'<table><tr><td nowrap>',
if (
paketdistribution.vorlaeufig,
CONCAT(
'$icon_nicht_eingelagert',
if (
artikel.lager_platz = 0,
'$icon_kein_lagerplatz',
'$icon_lagerplatz'
)
),
'$icon_eingelagert'
),
'</td></tr></table>'
)
AS icon,
if (paketdistribution.vorlaeufig,".$this->app->erp->ConcatSQL($deletelink).",'') as menu
FROM paketdistribution
LEFT JOIN artikel ON artikel.id = paketdistribution.artikel
LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id
LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id
WHERE paketannahme = $id AND vorlaeufig IS NULL
WHERE paketannahme = $id
) AS p";
$where = "";
@ -1126,8 +1172,10 @@ class Wareneingang {
$this->app->ActionHandler("stornieren", "WareneingangStornieren");
$this->app->ActionHandler("settings", "WareneingangSettings");
$this->app->ActionHandler("deletepos", "WareneingangPositionLoeschen");
$this->app->DefaultActionHandler("list");
$this->app->erp->Headlines('Wareneinang');
$this->app->erp->Headlines('Wareneingang');
$this->app->ActionHandlerListen($app);
}
@ -1204,7 +1252,6 @@ class Wareneingang {
$this->app->Tpl->Set('ID', $id);
$this->app->Tpl->Add('KURZUEBERSCHRIFT', ' Paketannahme / Leistungserfassung');
$this->app->erp->MenuEintrag('index.php?module=wareneingang&action=paketannahme', 'Neu');
$this->app->erp->MenuEintrag('index.php?module=wareneingang&action=list', '&Uuml;bersicht');
$this->app->erp->RunMenuHook('wareneingangpaket');
$this->app->erp->MenuEintrag(
'index.php?module=wareneingang&action=settings&menu=paket',
@ -1647,9 +1694,10 @@ class Wareneingang {
}
public function WareneingangPaketDistriInhalt() {
$this->WareneingangPaketMenu();
$id = $this->app->Secure->GetGET('id');
$this->app->erp->MenuEintrag('index.php?module=wareneingang&action=distriinhalt&id='.$id, 'Details');
$this->app->Tpl->Add('KURZUEBERSCHRIFT', ' Paketannahme / Leistungserfassung');
$cmd = $this->app->Secure->GetGET('cmd');
$lsnr = $this->app->Secure->GetPOST('lsnr');
$renr = $this->app->Secure->GetPOST('renr');
@ -1855,7 +1903,7 @@ class Wareneingang {
}
break;
case 'speichern':
case 'hinzufuegen':
$menge_input = $this->app->Secure->GetPOSTArray();
$mengen = array();
@ -1865,9 +1913,9 @@ class Wareneingang {
if ((strpos($key,'menge_') === 0) && ($menge !== '')) {
$bestellposition = substr($key,'6');
if ($menge >= 0) { // Allow 0 for reset of saved value
if ($menge > 0) {
// Gather info bestellung
$bparr = $this->app->DB->SelectRow("SELECT * FROM bestellung INNER JOIN bestellung_position ON bestellung_position.bestellung = bestellung.id INNER JOIN artikel ON bestellung_position.artikel = artikel.id WHERE bestellung_position.id='$bestellposition' LIMIT 1");
$bparr = $this->app->DB->SelectRow("SELECT bp.artikel, a.nummer, b.projekt, b.belegnr, bp.vpe, bp.menge FROM bestellung b INNER JOIN bestellung_position bp ON bp.bestellung = b.id INNER JOIN artikel a ON bp.artikel = a.id WHERE bp.id='$bestellposition' LIMIT 1");
$artikel = $bparr['artikel'];
$artikel_nr = $bparr['nummer'];
$projekt = $bparr['projekt'];
@ -1876,8 +1924,8 @@ class Wareneingang {
$menge_bestellung = $bparr['menge'];
// Check existing preliminary value
$sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1 LIMIT 1";
$preliminary = $this->app->DB->Select($sql);
$sql = "SELECT id, menge FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1 LIMIT 1";
$preliminary = $this->app->DB->SelectRow($sql);
if (empty($preliminary)) {
$sql = "INSERT INTO paketdistribution(
@ -1904,20 +1952,101 @@ class Wareneingang {
'$menge',
'$vpe',
'',
'$bemerkung',
'',
'$bestellposition',
1
)";
$this->app->DB->Insert($sql);
} else {
$sql = "UPDATE paketdistribution SET menge = ".$menge." WHERE id = ".$preliminary;
$menge = $menge + $preliminary['menge'];
if ($menge > $bparr['menge']-$bparr['geliefert']) {
$menge = $bparr['menge']-$bparr['geliefert'];
}
$sql = "UPDATE paketdistribution SET menge = ".$menge." WHERE id = ".$preliminary['id'];
$this->app->DB->Insert($sql);
}
}
}
}
break;
case 'vorlaeufige_buchen':
$ziellager_from_form = $this->app->erp->ReplaceLagerPlatz(true,$this->app->Secure->GetPOST('ziellager'),true); // Parameters: Target db?, value, from form?
$sql = "SELECT * FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
$positionen = $this->app->DB->SelectArr($sql);
foreach ($positionen as $position) {
$bemerkung = "";
$menge = $position['menge'];
$bestellposition = $position['bestellung_position'];
if ($menge > 0) {
// Gather info bestellung
$bparr = $this->app->DB->SelectRow("
SELECT
*
FROM
bestellung
INNER JOIN
bestellung_position ON bestellung_position.bestellung = bestellung.id
INNER JOIN
artikel ON bestellung_position.artikel = artikel.id
WHERE
bestellung_position.id='$bestellposition'
LIMIT 1
");
$artikel = $bparr['artikel'];
$artikel_nr = $bparr['nummer'];
$projekt = $bparr['projekt'];
$bestellung_belegnr = $bparr['belegnr'];
$vpe = $bparr['vpe'];
$menge_bestellung = $bparr['menge'];
if ($bparr['lagerartikel']) {
// Get Lager_platz
if (empty($ziellager_from_form)) {
$lager = $this->app->DB->Select("SELECT lager_platz FROM artikel WHERE id='" . $artikel . "' LIMIT 1");
if (empty($lager)) {
$msg .= '<div class="error">Kein Ziellagerplatz gefunden für Artikel: '.$artikel_nr.'</div>';
continue;
}
}
else {
$lager = $ziellager_from_form;
}
// Put stock
$this->app->erp->LagerEinlagern($artikel, $menge, $lager, '', "Wareneingang Paket $id, Bestellung $bestellung_belegnr", '', $id);
$lagerplatz_name = $this->app->DB->Select("SELECT kurzbezeichnung FROM lager_platz WHERE lager_platz.id = $lager LIMIT 1");
$bemerkung = $lagerplatz_name;
}
// Increase bestellung_position geliefert_menge
$geliefert = $this->app->DB->Select("SELECT ifnull(geliefert,0) FROM bestellung_position WHERE id='$bestellposition' LIMIT 1");
$geliefert += $menge;
$sql = "UPDATE bestellung_position SET geliefert='$geliefert' WHERE id='$bestellposition' LIMIT 1";
$this->app->DB->Update($sql);
// Write paketdistribution
$sql = "UPDATE
paketdistribution
SET
bearbeiter = '". $this->app->User->GetName()."',
zeit = NOW(),
bemerkung = '".$bemerkung."',
vorlaeufig = NULL
WHERE
id = ".$position['id']."
";
$this->app->DB->Update($sql);
}
}
break;
case 'abschliessen':
$sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
$vorlaeufige = $this->app->DB->SelectArr($sql);
if (!empty($vorlaeufige)) {
break;
}
// Save header and finish
$sql = "UPDATE paketannahme SET status='abgeschlossen', datum_abgeschlossen = NOW(), bearbeiter_abgeschlossen = '".$this->app->User->GetName()."' WHERE id='$id'";
$this->app->DB->Update($sql);
@ -2006,6 +2135,15 @@ class Wareneingang {
$datum_abgeschlossen = $paketannahme['datum_abgeschlossen'];
$bearbeiter_abgeschlossen = $paketannahme['bearbeiter_abgeschlossen'];
$sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
$vorlaeufige = $this->app->DB->SelectArr($sql);
if (!empty($vorlaeufige)) {
$this->app->YUI->Message('warning','Nicht eingebuchte Positionen vorhanden');
$this->app->Tpl->Set('ABSCHLIESSENHIDDEN','hidden');
} else {
$this->app->Tpl->Set('BUCHENHIDDEN','hidden');
}
$addressRow = empty($adresse) ? null : $this->app->DB->SelectRow(
sprintf(
'SELECT `name`,`kundennummer`,`lieferantennummer`
@ -2035,8 +2173,8 @@ class Wareneingang {
} else {
$this->app->Tpl->Set('ISLIEFERANTSTART', '<!--');
$this->app->Tpl->Set('ISLIEFERANTENDE', '-->');
$this->app->Tpl->Set('TAB1START', '');
$this->app->Tpl->Set('TAB1ENDE', '');
/* $this->app->Tpl->Set('TAB1START', '');
$this->app->Tpl->Set('TAB1ENDE', '');*/
// $this->app->Tpl->Set('BEFORETAB1', '<!--');
// $this->app->Tpl->Set('AFTERTAB1', '-->');
}
@ -2058,7 +2196,7 @@ class Wareneingang {
$this->app->Tpl->Set('LEGENDE', "Paket <b>Nr.$id</b> vom $datum erfassen f&uuml;r Adresse '" . $addressRow['name'] . "':");
}
$this->app->Tpl->Add('TAB1_SECOND', "<legend>Paketinhalt / Leistungserfassung (eingebucht):</legend>");
$this->app->Tpl->Add('TAB1_SECOND', "<legend>Paketinhalt / Leistungserfassung:</legend>");
$this->app->YUI->TableSearch('TAB1_SECOND', 'paketdistribution_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->erp->RunHook('wareneingang_distriinhalt', 1, $id);
@ -2087,9 +2225,14 @@ class Wareneingang {
$this->app->Tpl->Set('STATUS',$status);
if ($status == 'abgeschlossen') {
$this->app->Tpl->Set('ABSCHLIESSENHIDDEN','hidden');
$this->app->Tpl->Set('DATUM_ABGESCHLOSSEN',$datum_abgeschlossen);
$this->app->Tpl->Set('BEARBEITER_ABGESCHLOSSEN',$bearbeiter_abgeschlossen);
$this->app->Tpl->Set('HINZUFUEGENHIDDEN','hidden');
if (!empty($bearbeiter_abgeschlossen)) {
$this->app->Tpl->Set('ABSCHLIESSENHIDDEN','hidden');
$this->app->Tpl->Set('DATUM_ABGESCHLOSSEN',$datum_abgeschlossen);
$this->app->Tpl->Set('BEARBEITER_ABGESCHLOSSEN',$bearbeiter_abgeschlossen);
} else {
$this->app->Tpl->Set('ABGESCHLOSSENHIDDEN','hidden');
}
} else {
$this->app->Tpl->Set('ABGESCHLOSSENHIDDEN','hidden');
}
@ -3310,5 +3453,13 @@ class Wareneingang {
$this->app->User->SetParameter('wareneingang_action', 'paketannahme');
$this->app->Tpl->Parse('PAGE', 'wareneingang_paketannahme.tpl');
}
function WareneingangPositionLoeschen() {
$id = $this->app->Secure->GetGET('id');
$posid = $this->app->Secure->GetGET('posid');
$sql = "DELETE FROM paketdistribution WHERE id = ".$posid." AND vorlaeufig = 1";
$this->app->DB->Delete($sql);
header('Location: index.php?module=wareneingang&wareneingang&action=distriinhalt&id='.$id);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B