mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-23 19:31:13 +01:00
Bestellvorschlag with parameter absatz and voraus
This commit is contained in:
parent
93e3b01a25
commit
ab65feb455
@ -26,28 +26,34 @@ class Bestellvorschlag {
|
|||||||
/* Fill out manually later */
|
/* Fill out manually later */
|
||||||
}
|
}
|
||||||
|
|
||||||
static function TableSearch(&$app, $name, $erlaubtevars) {
|
public function TableSearch(&$app, $name, $erlaubtevars) {
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case "bestellvorschlag_list":
|
case "bestellvorschlag_list":
|
||||||
$allowed['bestellvorschlag_list'] = array('list');
|
$allowed['bestellvorschlag_list'] = array('list');
|
||||||
|
|
||||||
$monate_absatz = $app->Secure->GetPOST('monate_absatz');
|
$monate_absatz = $this->app->User->GetParameter('bestellvorschlag_monate_absatz');
|
||||||
$monate_voraus = $app->Secure->GetPOST('monate_voraus');
|
if (empty($monate_absatz)) {
|
||||||
|
$monate_absatz = 0;
|
||||||
|
}
|
||||||
|
$monate_voraus = $this->app->User->GetParameter('bestellvorschlag_monate_voraus');
|
||||||
|
if (empty($monate_voraus)) {
|
||||||
|
$monate_voraus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$heading = array('', '', 'Nr.', 'Artikel','Lieferant','Mindestlager','Lager','Bestellt','Auftrag','Vorschlag','Eingabe','');
|
$heading = array('', '', 'Nr.', 'Artikel','Lieferant','Mindestlager','Lager','Bestellt','Auftrag','Absatz','Voraus','Vorschlag','Eingabe','');
|
||||||
$width = array('1%','1%','1%', '20%', '10%', '1%', '1%', '1%', '1%', '1%', '1%', '1%');
|
$width = array('1%','1%','1%', '20%', '10%', '1%', '1%', '1%', '1%', '1%', '1%', '1%', '1%', '1%');
|
||||||
|
|
||||||
// columns that are aligned right (numbers etc)
|
// columns that are aligned right (numbers etc)
|
||||||
// $alignright = array(4,5,6,7,8);
|
// $alignright = array(4,5,6,7,8);
|
||||||
|
|
||||||
$findcols = array('a.id','a.id','a.nummer','a.name_de','l.name','mindestlager','lager','bestellt','auftrag','vorschlag');
|
$findcols = array('a.id','a.id','a.nummer','a.name_de','l.name','mindestlager','lager','bestellt','auftrag','absatz','voraus','vorschlag');
|
||||||
$searchsql = array('a.name_de');
|
$searchsql = array('a.name_de');
|
||||||
|
|
||||||
$defaultorder = 1;
|
$defaultorder = 1;
|
||||||
$defaultorderdesc = 0;
|
$defaultorderdesc = 0;
|
||||||
$numbercols = array(6,7,8,9,10);
|
$numbercols = array(6,7,8,9,10,11,12);
|
||||||
// $sumcol = array(6);
|
// $sumcol = array(6);
|
||||||
$alignright = array(6,7,8,9,10);
|
$alignright = array(6,7,8,9,10,11,12);
|
||||||
|
|
||||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',a.id,'\" />') AS `auswahl`";
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',a.id,'\" />') AS `auswahl`";
|
||||||
|
|
||||||
@ -70,8 +76,7 @@ class Bestellvorschlag {
|
|||||||
a.id,
|
a.id,
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
COALESCE(SUM(menge),
|
COALESCE(SUM(menge),0)
|
||||||
0)
|
|
||||||
FROM
|
FROM
|
||||||
lager_platz_inhalt lpi
|
lager_platz_inhalt lpi
|
||||||
INNER JOIN lager_platz lp ON
|
INNER JOIN lager_platz lp ON
|
||||||
@ -81,7 +86,7 @@ class Bestellvorschlag {
|
|||||||
) AS lager,
|
) AS lager,
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
COALESCE(SUM(menge - geliefert))
|
COALESCE(SUM(menge - geliefert),0)
|
||||||
FROM
|
FROM
|
||||||
bestellung_position bp
|
bestellung_position bp
|
||||||
INNER JOIN bestellung b ON
|
INNER JOIN bestellung b ON
|
||||||
@ -95,7 +100,7 @@ class Bestellvorschlag {
|
|||||||
) AS bestellt,
|
) AS bestellt,
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
COALESCE(SUM(menge - geliefert))
|
COALESCE(SUM(menge - geliefert),0)
|
||||||
FROM
|
FROM
|
||||||
auftrag_position aufp
|
auftrag_position aufp
|
||||||
INNER JOIN auftrag auf ON
|
INNER JOIN auftrag auf ON
|
||||||
@ -109,7 +114,24 @@ class Bestellvorschlag {
|
|||||||
) AS auftrag,
|
) AS auftrag,
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
menge
|
COALESCE(SUM(menge),0)
|
||||||
|
FROM
|
||||||
|
rechnung_position rp
|
||||||
|
INNER JOIN rechnung r ON
|
||||||
|
rp.rechnung = r.id
|
||||||
|
WHERE
|
||||||
|
rp.artikel = a.id AND r.status IN(
|
||||||
|
'versendet',
|
||||||
|
'freigegeben'
|
||||||
|
) AND r.datum > LAST_DAY(CURDATE() - INTERVAL ('$monate_absatz'+1) MONTH) AND r.datum <= LAST_DAY(CURDATE() - INTERVAL 1 MONTH)
|
||||||
|
) AS absatz,
|
||||||
|
ROUND (
|
||||||
|
(
|
||||||
|
select absatz
|
||||||
|
) / '$monate_absatz' * '$monate_voraus') AS voraus,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
COALESCE(menge,0)
|
||||||
FROM
|
FROM
|
||||||
bestellvorschlag bv
|
bestellvorschlag bv
|
||||||
WHERE
|
WHERE
|
||||||
@ -127,7 +149,13 @@ SELECT
|
|||||||
SELECT
|
SELECT
|
||||||
auftrag
|
auftrag
|
||||||
),
|
),
|
||||||
0) AS vorschlag_ber_raw,
|
0)
|
||||||
|
+ COALESCE((
|
||||||
|
SELECT
|
||||||
|
voraus
|
||||||
|
),
|
||||||
|
0)
|
||||||
|
AS vorschlag_ber_raw,
|
||||||
IF(
|
IF(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -174,6 +202,24 @@ SELECT
|
|||||||
0,
|
0,
|
||||||
'de_DE'
|
'de_DE'
|
||||||
) AS auftrag_form,
|
) AS auftrag_form,
|
||||||
|
FORMAT(
|
||||||
|
COALESCE((
|
||||||
|
SELECT
|
||||||
|
absatz
|
||||||
|
),
|
||||||
|
0),
|
||||||
|
0,
|
||||||
|
'de_DE'
|
||||||
|
) AS absatz_form,
|
||||||
|
FORMAT(
|
||||||
|
COALESCE((
|
||||||
|
SELECT
|
||||||
|
voraus
|
||||||
|
),
|
||||||
|
0),
|
||||||
|
0,
|
||||||
|
'de_DE'
|
||||||
|
) AS voraus_form,
|
||||||
FORMAT(
|
FORMAT(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -195,6 +241,10 @@ FROM
|
|||||||
artikel a
|
artikel a
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
|
//echo($sql_artikel_mengen);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||||
a.id,
|
a.id,
|
||||||
$dropnbox,
|
$dropnbox,
|
||||||
@ -205,6 +255,8 @@ FROM
|
|||||||
mengen.lager_form,
|
mengen.lager_form,
|
||||||
mengen.bestellt_form,
|
mengen.bestellt_form,
|
||||||
mengen.auftrag_form,
|
mengen.auftrag_form,
|
||||||
|
mengen.absatz_form,
|
||||||
|
mengen.voraus_form,
|
||||||
mengen.vorschlag_ber_form,"
|
mengen.vorschlag_ber_form,"
|
||||||
.$input_for_menge
|
.$input_for_menge
|
||||||
."FROM
|
."FROM
|
||||||
@ -237,6 +289,19 @@ FROM
|
|||||||
$submit = $this->app->Secure->GetPOST('submit');
|
$submit = $this->app->Secure->GetPOST('submit');
|
||||||
$user = $this->app->User->GetID();
|
$user = $this->app->User->GetID();
|
||||||
|
|
||||||
|
$monate_absatz = $this->app->Secure->GetPOST('monate_absatz');
|
||||||
|
if (empty($monate_absatz)) {
|
||||||
|
$monate_absatz = 0;
|
||||||
|
}
|
||||||
|
$monate_voraus = $this->app->Secure->GetPOST('monate_voraus');
|
||||||
|
if (empty($monate_voraus)) {
|
||||||
|
$monate_voraus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For transfer to tablesearch
|
||||||
|
$this->app->User->SetParameter('bestellvorschlag_monate_absatz', $monate_absatz);
|
||||||
|
$this->app->User->SetParameter('bestellvorschlag_monate_voraus', $monate_voraus);
|
||||||
|
|
||||||
switch ($submit) {
|
switch ($submit) {
|
||||||
case 'loeschen':
|
case 'loeschen':
|
||||||
$sql = "DELETE FROM bestellvorschlag where user = $user";
|
$sql = "DELETE FROM bestellvorschlag where user = $user";
|
||||||
@ -263,6 +328,9 @@ FROM
|
|||||||
|
|
||||||
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MONATE_ABSATZ',$monate_absatz);
|
||||||
|
$this->app->Tpl->Set('MONATE_VORAUS',$monate_voraus);
|
||||||
|
|
||||||
$this->app->YUI->TableSearch('TAB1', 'bestellvorschlag_list', "show", "", "", basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB1', 'bestellvorschlag_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
$this->app->Tpl->Parse('PAGE', "bestellvorschlag_list.tpl");
|
$this->app->Tpl->Parse('PAGE', "bestellvorschlag_list.tpl");
|
||||||
}
|
}
|
||||||
|
@ -5,20 +5,18 @@
|
|||||||
<div class="row-height">
|
<div class="row-height">
|
||||||
<div class="col-xs-14 col-md-4 col-md-height">
|
<div class="col-xs-14 col-md-4 col-md-height">
|
||||||
<div class="inside inside-full-height">
|
<div class="inside inside-full-height">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<!---
|
|
||||||
<table width="100%" border="0" class="mkTableFormular">
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
<legend>{|Einstellungen|}</legend>
|
<legend>{|Einstellungen|}</legend>
|
||||||
|
|
||||||
<td>{|Absatz der letzten Monate|}:</td>
|
<td>{|Absatz berücksichtigen (Monate)|}:</td>
|
||||||
<td><input type="number" min="0" name="monate_absatz" id="monate_absatz" value="[MONATE_ABSATZ]" size="20""></td>
|
<td><input type="number" min="0" name="monate_absatz" id="monate_absatz" value="[MONATE_ABSATZ]" size="20""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{|Vorausplanen Monate|}:</td>
|
<td>{|Vorausplanen (Monate)|}:</td>
|
||||||
<td><input type="number" min="0" name="monate_voraus" id="monate_voraus" value="[MONATE_VORAUS]" size="20""></td>
|
<td><input type="number" min="0" name="monate_voraus" id="monate_voraus" value="[MONATE_VORAUS]" size="20""></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
--!>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -29,7 +27,7 @@
|
|||||||
<div class="col-xs-14 col-md-2 col-md-height">
|
<div class="col-xs-14 col-md-2 col-md-height">
|
||||||
<div class="inside inside-full-height">
|
<div class="inside inside-full-height">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<table>
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
<legend>Aktionen</legend>
|
<legend>Aktionen</legend>
|
||||||
<tr>
|
<tr>
|
||||||
<td><button name="submit" class="ui-button-icon" style="width:100%;" value="loeschen">{|Zurücksetzen|}</button></td>
|
<td><button name="submit" class="ui-button-icon" style="width:100%;" value="loeschen">{|Zurücksetzen|}</button></td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user