mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 04:27:14 +01:00
Wareneingang save preliminary
This commit is contained in:
parent
60e21956ad
commit
1dba7e9d7e
@ -64785,6 +64785,17 @@
|
|||||||
"Extra": "",
|
"Extra": "",
|
||||||
"Privileges": "select,insert,update,references",
|
"Privileges": "select,insert,update,references",
|
||||||
"Comment": ""
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "vorlaeufig",
|
||||||
|
"Type": "int(1)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "YES",
|
||||||
|
"Key": "",
|
||||||
|
"Default": "",
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keys": [
|
"keys": [
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
<input type="hidden" id="paketannahme_id" value="[ID]" />
|
<input type="hidden" id="paketannahme_id" value="[ID]" />
|
||||||
[BEFORETAB1]
|
[BEFORETAB1]
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
|
|
||||||
[TAB1START]
|
[TAB1START]
|
||||||
|
|
||||||
[MESSAGE1]
|
[MESSAGE1]
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -25,9 +23,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr><td>{|Lieferschein-Nr.|}:</td><td><input type=text size="40" name="lsnr" value=[LSNR]></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>{|Rechnung-Nr.|}:</td><td><input type=text size="40" name="renr" value=[RENR]></td></tr>
|
||||||
<tr><td>{|Ziellager|}:</td><td><input type=text size="40" name="ziellager" id="ziellager" value=[LAGER]></td></tr>
|
|
||||||
<tr><td>{|Bemerkung|}:</td><td><textarea rows="5" cols="40" name="bemerkung">[BEMERKUNG]</textarea></td></tr>
|
<tr><td>{|Bemerkung|}:</td><td><textarea rows="5" cols="40" name="bemerkung">[BEMERKUNG]</textarea></td></tr>
|
||||||
<tr><td><input type="submit" name="speichern" class="btnGreenNew" value="Speichern"></td>
|
[ISLIEFERANTSTART]
|
||||||
|
<tr><td>{|Ziellager|}:</td><td><input type=text size="40" name="ziellager" id="ziellager" value=[LAGER]></td></tr>
|
||||||
|
[ISLIEFERANTENDE]
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
@ -35,23 +34,41 @@
|
|||||||
<div class="col-xs-12 col-md-2 col-md-height">
|
<div class="col-xs-12 col-md-2 col-md-height">
|
||||||
<div class="inside inside-full-height">
|
<div class="inside inside-full-height">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{|Aktionen|}</legend>
|
|
||||||
[BUTTONS]
|
[BUTTONS]
|
||||||
[BEFOREFRM]
|
[BEFOREFRM]
|
||||||
[AFTERFRM]
|
[AFTERFRM]
|
||||||
[DISTRIINHALTBUTTONS]
|
[DISTRIINHALTBUTTONS]
|
||||||
[ISLIEFERANTSTART]
|
|
||||||
<!-- <button name="submit" class="ui-button-icon" style="width:100%;" value="fuellen">{|Aus Bestellungen füllen|}</button>
|
|
||||||
<button name="submit" class="ui-button-icon" style="width:100%;" value="leeren">{|Leeren|}</button> -->
|
|
||||||
[ISLIEFERANTENDE]
|
|
||||||
[BEFOREMANUELLERFASSEN]
|
|
||||||
<button name="submit" class="ui-button-icon" style="width:100%;" value="manuellerfassen">{|Artikel manuell erfassen|}</button>
|
|
||||||
[AFTERMANUELLERFASSEN]
|
|
||||||
[BEFOREFRM]
|
[BEFOREFRM]
|
||||||
[AFTERFRM]
|
[AFTERFRM]
|
||||||
<!--<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</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ü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>
|
<button name="submit" class="ui-button-icon" style="width:100%;" value="buchen">{|Buchen|}</button>
|
||||||
|
</td></tr>
|
||||||
|
[ISLIEFERANTENDE]
|
||||||
|
<tr><td>
|
||||||
<button name="submit" class="ui-button-icon" style="width:100%;" value="abschliessen">{|Abschließen|}</button>
|
<button name="submit" class="ui-button-icon" style="width:100%;" value="abschliessen">{|Abschließen|}</button>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,9 +78,7 @@
|
|||||||
<div class="row-height">
|
<div class="row-height">
|
||||||
<div class="col-xs-12 col-md-10 col-md-height">
|
<div class="col-xs-12 col-md-10 col-md-height">
|
||||||
<div class="inside-white inside-full-height">
|
<div class="inside-white inside-full-height">
|
||||||
<form action="" method="post">
|
|
||||||
[TAB1]
|
[TAB1]
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,6 +117,9 @@ class Wareneingang {
|
|||||||
|
|
||||||
$input_for_menge = "CONCAT(
|
$input_for_menge = "CONCAT(
|
||||||
'<input type = \"number\" min=\"0\"',
|
'<input type = \"number\" min=\"0\"',
|
||||||
|
' value=\"',
|
||||||
|
COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),''),
|
||||||
|
'\"',
|
||||||
' name=\"menge_',
|
' name=\"menge_',
|
||||||
bp.id,
|
bp.id,
|
||||||
'\" value=\"',
|
'\" value=\"',
|
||||||
@ -213,7 +216,7 @@ class Wareneingang {
|
|||||||
INNER JOIN bestellung b ON bp.bestellung=b.id
|
INNER JOIN bestellung b ON bp.bestellung=b.id
|
||||||
$rdJoin
|
$rdJoin
|
||||||
INNER JOIN artikel art ON art.id=bp.artikel $lagerartikel
|
INNER JOIN artikel art ON art.id=bp.artikel $lagerartikel
|
||||||
LEFT JOIN projekt p ON b.projekt=p.id ";
|
LEFT JOIN projekt p ON b.projekt=p.id";
|
||||||
if ($wareneingangauftragzubestellung) {
|
if ($wareneingangauftragzubestellung) {
|
||||||
$sql = "SELECT SQL_CALC_FOUND_ROWS bp.id, bp.bestellnummer, art.nummer, b.belegnr as `Bestellung`,
|
$sql = "SELECT SQL_CALC_FOUND_ROWS bp.id, bp.bestellnummer, art.nummer, b.belegnr as `Bestellung`,
|
||||||
$colBeschreibung as beschreibung,
|
$colBeschreibung as beschreibung,
|
||||||
@ -964,46 +967,20 @@ class Wareneingang {
|
|||||||
$defaultorder = 1;
|
$defaultorder = 1;
|
||||||
$defaultorderdesc = 0;
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
/* $sql = "SELECT p.nummer,p.lieferantnummer, p.nummer, p.bestellbezug, p.name, p.menge, p.bemerkung from
|
|
||||||
(SELECT bestellung.belegnr as bestellbezug, bestellung_position.bestellnummer as lieferantnummer ,artikel.nummer as nummer, artikel.name_de as name, ".$this->app->erp->FormatMenge("sum(paketdistribution.menge)")." as menge, paketdistribution.bemerkung
|
|
||||||
FROM paketdistribution
|
|
||||||
INNER 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 GROUP BY bestellung_position, paketdistribution.artikel) as p"; */
|
|
||||||
|
|
||||||
$sql = "SELECT SQL_CALC_FOUND_ROWS p.nummer,p.lieferantnummer, p.nummer, p.bestellbezug, p.name, p.menge, p.bemerkung from
|
$sql = "SELECT SQL_CALC_FOUND_ROWS p.nummer,p.lieferantnummer, p.nummer, p.bestellbezug, p.name, p.menge, p.bemerkung from
|
||||||
(SELECT bestellung.belegnr as bestellbezug, bestellung_position.bestellnummer as lieferantnummer ,artikel.nummer as nummer, artikel.name_de as name, " . $this->app->erp->FormatMenge("paketdistribution.menge") . " as menge, paketdistribution.bemerkung
|
(SELECT bestellung.belegnr as bestellbezug, bestellung_position.bestellnummer as lieferantnummer ,artikel.nummer as nummer, artikel.name_de as name, " . $this->app->erp->FormatMenge("paketdistribution.menge") . " as menge, paketdistribution.bemerkung
|
||||||
FROM paketdistribution
|
FROM paketdistribution
|
||||||
INNER JOIN artikel ON artikel.id = paketdistribution.artikel
|
INNER JOIN artikel ON artikel.id = paketdistribution.artikel
|
||||||
LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id
|
LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id
|
||||||
LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id
|
LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id
|
||||||
where paketannahme = $id) as p";
|
where paketannahme = $id AND vorlaeufig IS NULL) as p";
|
||||||
|
|
||||||
$where = "";
|
$where = "";
|
||||||
$count = "SELECT count(DISTINCT id) FROM paketdistribution p WHERE paketannahme = $id";
|
$count = "SELECT count(DISTINCT id) FROM paketdistribution p WHERE paketannahme = $id AND vorlaeufig IS NULL";
|
||||||
// $groupby = "";
|
// $groupby = "";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "paketannahme_list":
|
case "paketannahme_list":
|
||||||
/* $allowed['paketdistribution_list'] = array('list');
|
|
||||||
$heading = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position', 'Menü');
|
|
||||||
$width = array('10%'); // Fill out manually later
|
|
||||||
|
|
||||||
$findcols = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position');
|
|
||||||
$searchsql = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position');
|
|
||||||
|
|
||||||
$defaultorder = 1;
|
|
||||||
$defaultorderdesc = 0;
|
|
||||||
|
|
||||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=paketdistribution&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=paketdistribution&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
|
||||||
|
|
||||||
$sql = "SELECT id, bearbeiter, zeit, paketannahme, adresse, artikel, menge, vpe, etiketten, bemerkung, bestellung_position, logdatei, retoure_position, id FROM paketdistribution";
|
|
||||||
|
|
||||||
$where = "1";
|
|
||||||
$count = "SELECT count(DISTINCT id) FROM paketdistribution WHERE $where";
|
|
||||||
// $groupby = "";
|
|
||||||
*/
|
|
||||||
$allowed['paketannahme_list'] = array('list');
|
$allowed['paketannahme_list'] = array('list');
|
||||||
$heading = array('', 'Paket-Nr.', 'Datum', 'Status', 'Name', 'Kunde', 'Lieferant', 'Bestellung', 'LS-Nr.', 'RE-Nr.', 'Bearbeiter', 'Bemerkung', 'Menü');
|
$heading = array('', 'Paket-Nr.', 'Datum', 'Status', 'Name', 'Kunde', 'Lieferant', 'Bestellung', 'LS-Nr.', 'RE-Nr.', 'Bearbeiter', 'Bemerkung', 'Menü');
|
||||||
$width = array('1%', '5%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%'); // Fill out manually later
|
$width = array('1%', '5%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%'); // Fill out manually later
|
||||||
@ -1793,12 +1770,77 @@ class Wareneingang {
|
|||||||
'$bestellposition'
|
'$bestellposition'
|
||||||
)";
|
)";
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
|
|
||||||
|
// Remove existing preliminary value
|
||||||
|
$sql = "DELETE FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1";
|
||||||
|
$this->app->DB->Delete($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'speichern':
|
case 'speichern':
|
||||||
|
$menge_input = $this->app->Secure->GetPOSTArray();
|
||||||
|
$mengen = array();
|
||||||
|
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($menge_input as $key => $menge) {
|
||||||
|
if ((strpos($key,'menge_') === 0) && ($menge !== '')) {
|
||||||
|
$bestellposition = substr($key,'6');
|
||||||
|
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'];
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
if (empty($preliminary)) {
|
||||||
|
$sql = "INSERT INTO paketdistribution(
|
||||||
|
id,
|
||||||
|
bearbeiter,
|
||||||
|
zeit,
|
||||||
|
paketannahme,
|
||||||
|
adresse,
|
||||||
|
artikel,
|
||||||
|
menge,
|
||||||
|
vpe,
|
||||||
|
etiketten,
|
||||||
|
bemerkung,
|
||||||
|
bestellung_position,
|
||||||
|
vorlaeufig
|
||||||
|
)
|
||||||
|
VALUES(
|
||||||
|
'',
|
||||||
|
'" . $this->app->User->GetName() . "',
|
||||||
|
NOW(),
|
||||||
|
'$id',
|
||||||
|
'',
|
||||||
|
'$artikel',
|
||||||
|
'$menge',
|
||||||
|
'$vpe',
|
||||||
|
'',
|
||||||
|
'$bemerkung',
|
||||||
|
'$bestellposition',
|
||||||
|
1
|
||||||
|
)";
|
||||||
|
$this->app->DB->Insert($sql);
|
||||||
|
} else {
|
||||||
|
$sql = "UPDATE paketdistribution SET menge = ".$menge." WHERE id = ".$preliminary;
|
||||||
|
$this->app->DB->Insert($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'abschliessen':
|
case 'abschliessen':
|
||||||
break;
|
break;
|
||||||
@ -1899,11 +1941,11 @@ class Wareneingang {
|
|||||||
|
|
||||||
if ($isSupplier) {
|
if ($isSupplier) {
|
||||||
//$this->app->Tpl->Set('TAB1TEXT','<li><a href="#tabs-1">Bestellungen</a></li>');
|
//$this->app->Tpl->Set('TAB1TEXT','<li><a href="#tabs-1">Bestellungen</a></li>');
|
||||||
$this->app->Tpl->Set('TAB1TEXT', 'Bestellungen');
|
//$this->app->Tpl->Set('TAB1TEXT', 'Bestellungen');
|
||||||
//$this->app->Tpl->Set('TAB1START','<div id=\"tabs-1\">');
|
//$this->app->Tpl->Set('TAB1START','<div id=\"tabs-1\">');
|
||||||
//$this->app->Tpl->Set('TAB1ENDE','</div>');
|
//$this->app->Tpl->Set('TAB1ENDE','</div>');
|
||||||
|
|
||||||
$this->app->Tpl->Add('TAB1', "<br><h1>Offene Artikel aus Bestellungen bei $name:</h1><br>");
|
$this->app->Tpl->Add('TAB1', "<h1>Offene Artikel aus Bestellungen bei $name:</h1>");
|
||||||
$this->app->YUI->TableSearch('TAB1', 'wareneingang_lieferant', 'show', '', '', basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB1', 'wareneingang_lieferant', 'show', '', '', basename(__FILE__), __CLASS__);
|
||||||
} else {
|
} else {
|
||||||
$this->app->Tpl->Set('ISLIEFERANTSTART', '<!--');
|
$this->app->Tpl->Set('ISLIEFERANTSTART', '<!--');
|
||||||
@ -1931,7 +1973,7 @@ class Wareneingang {
|
|||||||
$this->app->Tpl->Set('LEGENDE', "Paket <b>Nr.$id</b> vom $datum erfassen für Adresse '" . $addressRow['name'] . "':");
|
$this->app->Tpl->Set('LEGENDE', "Paket <b>Nr.$id</b> vom $datum erfassen für Adresse '" . $addressRow['name'] . "':");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Add('TAB1_SECOND', "<br><h1>Paketinhalt (eingebucht):</h1><br>");
|
$this->app->Tpl->Add('TAB1_SECOND', "<h1>Paketinhalt (eingebucht):</h1>");
|
||||||
$this->app->YUI->TableSearch('TAB1_SECOND', 'paketdistribution_list', "show", "", "", basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB1_SECOND', 'paketdistribution_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
|
||||||
$this->app->erp->RunHook('wareneingang_distriinhalt', 1, $id);
|
$this->app->erp->RunHook('wareneingang_distriinhalt', 1, $id);
|
||||||
@ -2011,7 +2053,7 @@ class Wareneingang {
|
|||||||
INNER JOIN artikel ON artikel.id = paketdistribution.artikel
|
INNER JOIN artikel ON artikel.id = paketdistribution.artikel
|
||||||
LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id
|
LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id
|
||||||
LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id
|
LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id
|
||||||
where paketannahme = $id) as p");
|
where paketannahme = $id AND vorlaeufig IS NULL) as p");
|
||||||
|
|
||||||
$this->app->Tpl->Set('MD5', md5(microtime(true)));
|
$this->app->Tpl->Set('MD5', md5(microtime(true)));
|
||||||
$this->app->Tpl->Set('ID', $id);
|
$this->app->Tpl->Set('ID', $id);
|
||||||
|
Loading…
Reference in New Issue
Block a user