mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Auftrag deckungsbeitrag implemented
This commit is contained in:
parent
2ae5e9f44a
commit
7cfb87c2c5
@ -2578,11 +2578,19 @@ class YUI {
|
||||
if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(b.bezeichnung,1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),b.bezeichnung))
|
||||
) $erweiterte_ansicht)
|
||||
as Artikel,
|
||||
p.abkuerzung as projekt,
|
||||
b.nummer as nummer,
|
||||
DATE_FORMAT(lieferdatum,'%d.%m.%Y') as lieferdatum,
|
||||
trim(b.menge)+0 as menge,
|
||||
".$this->FormatPreis($preiscell)." as preis,
|
||||
b.waehrung,
|
||||
".$this->FormatPreis('b.rabatt')." as rabatt,";
|
||||
|
||||
|
||||
|
||||
p.abkuerzung as projekt, b.nummer as nummer, DATE_FORMAT(lieferdatum,'%d.%m.%Y') as lieferdatum, trim(b.menge)+0 as menge, ".$this->FormatPreis($preiscell)." as preis,b.waehrung, ".$this->FormatPreis('b.rabatt')." as rabatt, ";
|
||||
|
||||
if ($this->app->erp->RechteVorhanden('auftrag','einkaufspreise')) {
|
||||
$sql .= $this->FormatPreis('einkaufspreis')." as einkaufspreis,
|
||||
CONCAT(ROUND(deckungsbeitrag*100),'%') AS DB,
|
||||
";
|
||||
}
|
||||
|
||||
$sql .= "b.id as id
|
||||
FROM $table b
|
||||
@ -14718,7 +14726,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift" || $module == "proformarechnung") {
|
||||
|
||||
if ($schreibschutz != 1) {
|
||||
$addrow = array('<form action="" method="post" id="myform">', '[ARTIKELSTART]<input type="text" size="30" name="artikel" id="artikel" onblur="window.setTimeout(\'selectafterblur()\',200);">[ARTIKELENDE]', '<input type="text" name="projekt" id="projekt" size="10" readonly onclick="checkhere()" >', '<input type="text" name="nummer" id="nummer" size="7">', '<input type="text" size="8" name="lieferdatum" id="lieferdatum">', '<input type="text" name="menge" id="menge" size="5" onblur="window.setTimeout(\'selectafterblurmenge()\',200); document.getElementById(\'preis\').style.background =\'none\';">', '<input type="text" name="preis" id="preis" size="10" onclick="checkhere();">', '<input type="text" name="waehrung" id="waehrung" size="10" onclick="checkhere();">' ,'<input type="text" name="rabatt" id="rabatt" size="7">');
|
||||
$addrow = array('<form action="" method="post" id="myform">', '[ARTIKELSTART]<input type="text" size="30" name="artikel" id="artikel" onblur="window.setTimeout(\'selectafterblur()\',200);">[ARTIKELENDE]', '<input type="text" name="projekt" id="projekt" size="10" readonly onclick="checkhere()" >', '<input type="text" name="nummer" id="nummer" size="7">', '<input type="text" size="8" name="lieferdatum" id="lieferdatum">', '<input type="text" name="menge" id="menge" size="5" onblur="window.setTimeout(\'selectafterblurmenge()\',200); document.getElementById(\'preis\').style.background =\'none\';">', '<input type="text" name="preis" id="preis" size="10" onclick="checkhere();">', '<input type="text" name="waehrung" id="waehrung" size="10" onclick="checkhere();">' ,'<input type="text" name="rabatt" id="rabatt" size="7">','','');
|
||||
$addrow[] = '<input type="submit" value="einfügen" name="ajaxbuchen">
|
||||
<script type="text/javascript">
|
||||
document.onkeydown = function(evt) {
|
||||
@ -14881,9 +14889,11 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
|
||||
}
|
||||
$table->headings[6] = 'Preis';
|
||||
$mengencol = 5;
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift") $table->headings[7] = 'Währung';
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift") $table->headings[8] = 'Rabatt';
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift") $rabattcol = 8;
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift") {
|
||||
$table->headings[7] = 'Währung';
|
||||
$table->headings[8] = 'Rabatt';
|
||||
$rabattcol = 8;
|
||||
}
|
||||
}
|
||||
$__arr = array($summencol, $mengencol, $rabattcol, $ecol, $dcol,$zwischensumme);
|
||||
$this->app->erp->RunHook('yui_sortlistadd_draw', 2,$table,$__arr);
|
||||
|
@ -1990,8 +1990,30 @@ class Auftrag extends GenAuftrag
|
||||
$gebuchtezeit = str_replace(".", ",", round($gebuchtezeit,2));
|
||||
}
|
||||
$summebrutto = $this->app->DB->Select("SELECT gesamtsumme FROM auftrag WHERE id='$id' LIMIT 1");
|
||||
$this->app->Tpl->Set('DECKUNGSBEITRAG',0);
|
||||
$this->app->Tpl->Set('DBPROZENT',0);
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
umsatz_netto_gesamt,
|
||||
artikel,
|
||||
menge
|
||||
FROM
|
||||
`auftrag_position`
|
||||
WHERE
|
||||
`auftrag` = ".$id."
|
||||
";
|
||||
|
||||
$positionen = $this->app->DB->SelectArr($sql);
|
||||
$umsatz_gesamt = 0;
|
||||
$db_gesamt = 0;
|
||||
foreach ($positionen as $position) {
|
||||
$ek = $this->app->erp->GetEinkaufspreis($position['artikel'],$position['menge']);
|
||||
$db = $position['umsatz_netto_gesamt']-($ek*$position['menge']);
|
||||
$db_gesamt += $db;
|
||||
$umsatz_gesamt = $position['umsatz_netto_gesamt'];
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('DECKUNGSBEITRAG',$db_gesamt);
|
||||
$this->app->Tpl->Set('DBPROZENT',$umsatz_gesamt==0?"-":(round($db_gesamt/$umsatz_gesamt*100)."%"));
|
||||
$this->app->Tpl->Set('GEBUCHTEZEIT',0);
|
||||
|
||||
if($auftragArr[0]['ust_befreit']==0){
|
||||
@ -4947,6 +4969,9 @@ class Auftrag extends GenAuftrag
|
||||
$this->app->erp->LieferadresseButton($adresse);
|
||||
$this->app->erp->AnsprechpartnerAlsLieferadresseButton($adresse);
|
||||
$this->app->erp->AdresseAlsLieferadresseButton($adresse);
|
||||
|
||||
$this->app->erp->BerechneDeckungsbeitrag($id,'auftrag');
|
||||
|
||||
}
|
||||
|
||||
if($nummer!='') {
|
||||
|
@ -118,12 +118,13 @@
|
||||
</div>
|
||||
<div style="background-color:white">
|
||||
<h2 class="greyh2">{|Deckungsbeitrag|}</h2>
|
||||
<div style="padding:10px">
|
||||
|
||||
<div class="info">{|Dieses Modul ist erst ab Version Professional verfügbar|}</div>
|
||||
|
||||
|
||||
</div>
|
||||
<table width="100%">
|
||||
<tbody><tr><td>Deckungsbeitrag (netto) in EUR</td><td>DB (netto) in %</td></tr>
|
||||
<tr>
|
||||
<td class="greybox" width="50%">[DECKUNGSBEITRAG]</td>
|
||||
<td class="greybox" width="50%">[DBPROZENT]</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</div>
|
||||
[INTERNEBEMERKUNGEDIT]
|
||||
|
||||
|
@ -288,7 +288,6 @@ class WidgetGenauftrag_position
|
||||
$field = new HTMLInput("mlmdirektpraemie","text","","50","","","","","","","","0","","");
|
||||
$this->form->NewField($field);
|
||||
|
||||
|
||||
$field = new HTMLInput("kostenstelle","text","","15","","","","","","","","0","","");
|
||||
$this->form->NewField($field);
|
||||
|
||||
@ -298,6 +297,11 @@ class WidgetGenauftrag_position
|
||||
$field = new HTMLCheckbox("erloesefestschreiben","","","1","0","0");
|
||||
$this->form->NewField($field);
|
||||
|
||||
if ($this->app->erp->RechteVorhanden('auftrag','einkaufspreise')) {
|
||||
$field = new HTMLInput("einkaufspreis","text","","50","","","","","","","","0","","");
|
||||
$this->form->NewField($field);
|
||||
}
|
||||
|
||||
$field = new HTMLTextarea("bemerkung",3,40,"","","","","0");
|
||||
$this->form->NewField($field);
|
||||
|
||||
|
@ -222,34 +222,47 @@ $( document ).ready(function() {
|
||||
</table>
|
||||
</td>
|
||||
<td width="30%" [STYLERECHTS]>
|
||||
<table width="100%"><tr><td align="right"><input type="submit" value="Speichern" ></td></tr></table>
|
||||
<div id="positionaccordion">
|
||||
[ANZEIGEEINKAUFLAGER]
|
||||
|
||||
<h3>{|Steuer|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody>
|
||||
[VORSTEUER]
|
||||
<tr><td>{|Kostenstelle|}:</td><td>[KOSTENSTELLE][MSGKOSTENSTELLE]</td></tr>
|
||||
<tr><td>{|Erlöse|}:</td><td>[ERLOESE][MSGERLOESE]</td></tr>
|
||||
<tr><td>{|festschreiben|}:</td><td>[ERLOESEFESTSCHREIBEN][MSGERLOESEFESTSCHREIBEN]</td></tr>
|
||||
[NACHSTEUER]
|
||||
</tbody>
|
||||
</table>
|
||||
<table width="100%"><tr><td align="right"><input type="submit" value="Speichern" ></td></tr></table>
|
||||
<div id="positionaccordion"> [ANZEIGEEINKAUFLAGER]
|
||||
<h3>{|Steuer|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody> [VORSTEUER]
|
||||
<tr>
|
||||
<td>{|Kostenstelle|}:</td>
|
||||
<td>[KOSTENSTELLE][MSGKOSTENSTELLE]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Erlöse|}:</td>
|
||||
<td>[ERLOESE][MSGERLOESE]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|festschreiben|}:</td>
|
||||
<td>[ERLOESEFESTSCHREIBEN][MSGERLOESEFESTSCHREIBEN]</td>
|
||||
</tr> [NACHSTEUER] </tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h3>{|Einkaufspreis für Deckungsbeitrag|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>[EINKAUFSPREIS][MSGEINKAUFSPREIS]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h3>{|Bemerkung|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> [BEMERKUNG][MSGBEMERKUNG] </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>{|Bemerkung|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td>
|
||||
[BEMERKUNG][MSGBEMERKUNG]
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -43,6 +43,7 @@ class WidgetAuftrag_position extends WidgetGenAuftrag_position
|
||||
$this->app->YUI->DatePicker("lieferdatum");
|
||||
$this->form->ReplaceFunction("lieferdatum",$this,"ReplaceDatum");
|
||||
$this->form->ReplaceFunction("preis",$this,"ReplaceMengeBetrag");
|
||||
$this->form->ReplaceFunction("einkaufspreis",$this,"ReplaceMengeBetrag");
|
||||
$this->form->ReplaceFunction("steuersatz",$this,"ReplaceSteuersatz");
|
||||
$this->form->ReplaceFunction("menge",$this,"ReplaceMenge");
|
||||
$this->form->ReplaceFunction("grundrabatt",$this,"ReplaceDecimal");
|
||||
|
Loading…
Reference in New Issue
Block a user