mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
angebot deckungsbeitrag
This commit is contained in:
parent
f84e7af78a
commit
63b85f213a
@ -2839,6 +2839,14 @@ class YUI {
|
||||
|
||||
|
||||
,b.waehrung, b.rabatt as rabatt,";
|
||||
|
||||
|
||||
if ($this->app->erp->RechteVorhanden('angebot','einkaufspreise')) {
|
||||
$sql .= $this->FormatPreis('einkaufspreis')." as einkaufspreis,
|
||||
CONCAT(".$this->app->erp->FormatPreis("ROUND(deckungsbeitrag*100,2)",2).",'%') AS DB,
|
||||
";
|
||||
}
|
||||
|
||||
}else{
|
||||
$sql = "SELECT $sortcol, CONCAT($hersteller_ansicht if(b.beschreibung!='',
|
||||
if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(CONCAT(b.bezeichnung,' *'),1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),CONCAT(b.bezeichnung,' *')),
|
||||
|
@ -307,21 +307,52 @@ class Angebot extends GenAngebot
|
||||
{
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
|
||||
if(!$this->app->DB->Select("SELECT deckungsbeitragcalc FROM angebot WHERE id='$id' LIMIT 1")) {
|
||||
$this->app->erp->BerechneDeckungsbeitrag($id,'angebot');
|
||||
// Deckungsbeitrag
|
||||
if (!$this->app->erp->RechteVorhanden('angebot','einkaufspreise')) {
|
||||
$this->app->Tpl->Set('DBHIDDEN','hidden');
|
||||
} else {
|
||||
$sql = "
|
||||
SELECT
|
||||
umsatz_netto_gesamt,
|
||||
artikel,
|
||||
menge,
|
||||
einkaufspreis
|
||||
FROM
|
||||
`angebot_position`
|
||||
WHERE
|
||||
`angebot` = ".$id."
|
||||
";
|
||||
|
||||
$positionen = $this->app->DB->SelectArr($sql);
|
||||
|
||||
$umsatz_gesamt = 0;
|
||||
$kosten_gesamt = 0;
|
||||
$db_gesamt = 0;
|
||||
foreach ($positionen as $position) {
|
||||
if (empty($position['einkaufspreis'])) {
|
||||
$position['einkaufspreis'] = $this->app->erp->GetEinkaufspreis($position['artikel'],$position['menge']);
|
||||
}
|
||||
$kosten = ($position['einkaufspreis']*$position['menge']);
|
||||
$db_gesamt += $position['umsatz_netto_gesamt']-$kosten;
|
||||
$kosten_gesamt += $kosten;
|
||||
$umsatz_gesamt += $position['umsatz_netto_gesamt'];
|
||||
}
|
||||
|
||||
$auftragArr = $this->app->DB->SelectArr("SELECT * FROM angebot WHERE id='$id' LIMIT 1");
|
||||
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM adresse WHERE id='{$auftragArr[0]['adresse']}' LIMIT 1");
|
||||
$projekt = $this->app->DB->Select("SELECT abkuerzung FROM projekt WHERE id='{$auftragArr[0]['projekt']}' LIMIT 1");
|
||||
$kundenname = $this->app->DB->Select("SELECT name FROM adresse WHERE id='{$auftragArr[0]['adresse']}' LIMIT 1");
|
||||
$this->app->Tpl->Set('NETTOGESAMT',$this->app->erp->number_format_variable($umsatz_gesamt,2));
|
||||
$this->app->Tpl->Set('KOSTEN',$this->app->erp->number_format_variable($kosten_gesamt,2));
|
||||
$this->app->Tpl->Set('DECKUNGSBEITRAG',$this->app->erp->number_format_variable($db_gesamt,2));
|
||||
$this->app->Tpl->Set( 'DBPROZENT',
|
||||
$umsatz_gesamt==0?
|
||||
"-":
|
||||
$this->app->erp->number_format_variable(
|
||||
round(
|
||||
$db_gesamt/$umsatz_gesamt*100,2
|
||||
)
|
||||
)."%"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->app->Tpl->Set('KUNDE',"<a href=\"index.php?module=adresse&action=edit&id=".$auftragArr[0]['adresse']."\" target=\"_blank\">".$kundennummer."</a> ".$kundenname);
|
||||
//$this->app->Tpl->Set('KUNDE',$kundennummer." ".$kundenname);
|
||||
$this->app->Tpl->Set('DECKUNGSBEITRAG',0);
|
||||
$this->app->Tpl->Set('DBPROZENT',0);
|
||||
|
||||
if($this->app->erp->RechteVorhanden('projekt','dashboard')){
|
||||
$this->app->Tpl->Set('PROJEKT', "<a href=\"index.php?module=projekt&action=dashboard&id=" . $auftragArr[0]['projekt'] . "\" target=\"_blank\">$projekt</a>");
|
||||
}
|
||||
@ -1695,6 +1726,11 @@ class Angebot extends GenAngebot
|
||||
$this->app->erp->AdresseAlsLieferadresseButton($adresse);
|
||||
}
|
||||
|
||||
|
||||
if ($schreibschutz != 1 AND $status != 'abgeschlossen') {
|
||||
$this->app->erp->BerechneDeckungsbeitrag($id,'angebot');
|
||||
}
|
||||
|
||||
if($nummer!="")
|
||||
{
|
||||
$this->app->Tpl->Set('NUMMER',$nummer);
|
||||
|
@ -45,7 +45,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="background-color:white" [DBHIDDEN]>
|
||||
<h2 class="greyh2">{|Deckungsbeitrag (netto)|}</h2>
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Umsatz EUR</td>
|
||||
<td>Kosten EUR</td>
|
||||
<td>Deckungsbeitrag EUR</td>
|
||||
<td>DB %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="greybox" width="25%">[NETTOGESAMT]</td>
|
||||
<td class="greybox" width="25%">[KOSTEN]</td>
|
||||
<td class="greybox" width="25%">[DECKUNGSBEITRAG]</td>
|
||||
<td class="greybox" width="25%">[DBPROZENT]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="background-color:white">
|
||||
<h2 class="greyh2">Protokoll</h2>
|
||||
@ -59,12 +77,6 @@
|
||||
[PDFARCHIV]
|
||||
</div>
|
||||
</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>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -310,6 +310,11 @@ class WidgetGenangebot_position
|
||||
$field = new HTMLCheckbox("erloesefestschreiben","","","1","0","0");
|
||||
$this->form->NewField($field);
|
||||
|
||||
if ($this->app->erp->RechteVorhanden('angebot','einkaufspreise')) {
|
||||
$field = new HTMLInput("einkaufspreis","text","","50","","","","","","","","0","","");
|
||||
$this->form->NewField($field);
|
||||
}
|
||||
|
||||
$field = new HTMLTextarea("bemerkung",3,40,"","","","","0");
|
||||
$this->form->NewField($field);
|
||||
|
||||
|
@ -215,36 +215,48 @@ $('#anderersteuersatz').click(function() { if (!$(this).is(':checked')) {
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td width="30%">
|
||||
<td width="30%" [STYLERECHTS]>
|
||||
<table width="100%"><tr><td align="right"><input type="submit" value="Speichern" ></td></tr></table>
|
||||
<div id="positionaccordion">
|
||||
[ANZEIGEEINKAUFLAGER]
|
||||
<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>
|
||||
[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]
|
||||
<tr>
|
||||
<td>[EINKAUFSPREIS][MSGEINKAUFSPREIS]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>{|Bemerkung|}</h3>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td>
|
||||
[BEMERKUNG][MSGBEMERKUNG]
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td> [BEMERKUNG][MSGBEMERKUNG] </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -35,6 +35,7 @@ class WidgetAngebot_position extends WidgetGenAngebot_position
|
||||
$this->app->YUI->AutoComplete("kostenstelle","kostenstelle",1);
|
||||
$this->app->YUI->AutoComplete("explodiert_parent","angebot_position",0,"&angebotposition=".$id."&angebot=".$this->app->DB->Select("SELECT angebot FROM angebot_position WHERE id = '$id' LIMIT 1"));
|
||||
$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