mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-12 23:01:14 +01:00
verbindlichkeit positionen_edit, steuer & sachkonto auf position
This commit is contained in:
parent
3c4a4a8754
commit
cfbecd780b
64
www/pages/content/verbindlichkeit_position_edit.tpl
Normal file
64
www/pages/content/verbindlichkeit_position_edit.tpl
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1"></a></li>
|
||||||
|
</ul>
|
||||||
|
<!-- Example for multiple tabs
|
||||||
|
<ul hidden">
|
||||||
|
<li><a href="#tabs-1">First Tab</a></li>
|
||||||
|
<li><a href="#tabs-2">Second Tab</a></li>
|
||||||
|
</ul>
|
||||||
|
-->
|
||||||
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
|
<form action="" method="post">
|
||||||
|
[FORMHANDLEREVENT]
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-12 col-md-12 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{|Position bearbeiten|}</legend><i></i>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Menge|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="menge" id="menge" value="[MENGE]" size="20" [SAVEDISABLED]>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Preis|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="preis" id="preis" step="0.00001" value="[PREIS]" size="20" [SAVEDISABLED]>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Steuersatz %|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="steuersatz" id="steuersatz" value="[STEUERSATZ]" size="20" [SAVEDISABLED]>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Sachkonto|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="sachkonto" id="sachkonto" value="[SACHKONTO]" size="20" [SACHKONTOSAVEDISABLED]>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -29,6 +29,9 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<table width="100%" border="0" class="mkTableFormular">
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
<legend>{|Aktionen|}</legend>
|
<legend>{|Aktionen|}</legend>
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" name="bruttoeingabe" value="1" />Bruttopreise eingeben</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><button [SAVEDISABLED] name="submit" value="positionen_hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzufügen</button></td>
|
<td><button [SAVEDISABLED] name="submit" value="positionen_hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzufügen</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -52,23 +55,11 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<table width="100%" border="0" class="mkTableFormular">
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
<legend>{|Aktionen|}</legend>
|
<legend>{|Aktionen|}</legend>
|
||||||
<tr>
|
<tr [POSITIONHINZUFUEGENHIDDEN]>
|
||||||
<td><input type="checkbox" id="auswahlalle" onchange="alleauswaehlen();" /> {|alle markieren|}</td>
|
<td><input type="checkbox" id="auswahlalle" onchange="alleauswaehlen();" /> {|alle markieren|}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr [SACHKONTOHIDDEN]>
|
|
||||||
<td>Sachkonto: <input type="text" id="positionen_sachkonto" name="positionen_sachkonto" value=""></td>
|
|
||||||
</tr>
|
|
||||||
<tr [SACHKONTOHIDDEN]>
|
|
||||||
<td><button name="submit" value="positionen_sachkonto_speichern" class="ui-button-icon" style="width:100%;">Anpassen</button></td>
|
|
||||||
</tr>
|
|
||||||
<tr [POSITIONHINZUFUEGENHIDDEN]>
|
<tr [POSITIONHINZUFUEGENHIDDEN]>
|
||||||
<td>Steuersatz: <input type="text" id="positionen_steuersatz" name="positionen_steuersatz" value=""></td>
|
<td><button [SAVEDISABLED] name="submit" value="positionen_entfernen" class="ui-button-icon" style="width:100%;">Entfernen</button></td>
|
||||||
</tr>
|
|
||||||
<tr [POSITIONHINZUFUEGENHIDDEN]>
|
|
||||||
<td><button [SAVEDISABLED] name="submit" value="positionen_steuersatz_speichern" class="ui-button-icon" style="width:100%;">Anpassen</button></td>
|
|
||||||
</tr>
|
|
||||||
<tr [POSITIONHINZUFUEGENHIDDEN]>
|
|
||||||
<td><button [SAVEDISABLED] name="submit" value="positionen_steuersatz_zu_netto" class="ui-button-icon" style="width:100%;">Brutto zu Netto</button></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -21,6 +21,7 @@ class Verbindlichkeit {
|
|||||||
$this->app->ActionHandler("positionen", "verbindlichkeit_positionen");
|
$this->app->ActionHandler("positionen", "verbindlichkeit_positionen");
|
||||||
$this->app->ActionHandler("delete", "verbindlichkeit_delete");
|
$this->app->ActionHandler("delete", "verbindlichkeit_delete");
|
||||||
$this->app->ActionHandler("deletepos", "verbindlichkeit_deletepos");
|
$this->app->ActionHandler("deletepos", "verbindlichkeit_deletepos");
|
||||||
|
$this->app->ActionHandler("editpos", "verbindlichkeit_editpos");
|
||||||
$this->app->ActionHandler("dateien", "verbindlichkeit_dateien");
|
$this->app->ActionHandler("dateien", "verbindlichkeit_dateien");
|
||||||
$this->app->ActionHandler("inlinepdf", "verbindlichkeit_inlinepdf");
|
$this->app->ActionHandler("inlinepdf", "verbindlichkeit_inlinepdf");
|
||||||
$this->app->ActionHandler("positioneneditpopup", "verbindlichkeit_positioneneditpopup");
|
$this->app->ActionHandler("positioneneditpopup", "verbindlichkeit_positioneneditpopup");
|
||||||
@ -45,7 +46,7 @@ class Verbindlichkeit {
|
|||||||
switch ($name) {
|
switch ($name) {
|
||||||
case "verbindlichkeit_list":
|
case "verbindlichkeit_list":
|
||||||
$allowed['verbindlichkeit_list'] = array('list');
|
$allowed['verbindlichkeit_list'] = array('list');
|
||||||
$heading = array('','','Belegnr','Adresse', 'Lieferant', 'RE-Nr', 'RE-Datum', 'Betrag (brutto)', 'Währung', 'Ziel','Skontoziel','Skonto','Status','Monitor', 'Menü');
|
$heading = array('','','Belegnr','Adresse', 'Lieferant', 'RE-Nr', 'RE-Datum', 'Betrag (brutto)', 'Währung','Zahlstatus', 'Ziel','Skontoziel','Skonto','Status','Monitor', 'Menü');
|
||||||
$width = array('1%','1%','10%'); // Fill out manually later
|
$width = array('1%','1%','10%'); // Fill out manually later
|
||||||
|
|
||||||
// columns that are aligned right (numbers etc)
|
// columns that are aligned right (numbers etc)
|
||||||
@ -61,6 +62,7 @@ class Verbindlichkeit {
|
|||||||
'v.rechnungsdatum',
|
'v.rechnungsdatum',
|
||||||
'v.betrag',
|
'v.betrag',
|
||||||
'v.waehrung',
|
'v.waehrung',
|
||||||
|
'v.bezahlt',
|
||||||
'v.zahlbarbis',
|
'v.zahlbarbis',
|
||||||
'v.skontobis',
|
'v.skontobis',
|
||||||
'v.skonto',
|
'v.skonto',
|
||||||
@ -99,6 +101,7 @@ class Verbindlichkeit {
|
|||||||
".$app->erp->FormatDate("v.rechnungsdatum").",
|
".$app->erp->FormatDate("v.rechnungsdatum").",
|
||||||
".$app->erp->FormatMenge('v.betrag',2).",
|
".$app->erp->FormatMenge('v.betrag',2).",
|
||||||
v.waehrung,
|
v.waehrung,
|
||||||
|
if(v.bezahlt,'bezahlt','offen'),
|
||||||
".$app->erp->FormatDate("v.zahlbarbis").",
|
".$app->erp->FormatDate("v.zahlbarbis").",
|
||||||
IF(v.skonto <> 0,".$app->erp->FormatDate("v.skontobis").",''),
|
IF(v.skonto <> 0,".$app->erp->FormatDate("v.skontobis").",''),
|
||||||
IF(v.skonto <> 0,CONCAT(".$app->erp->FormatMenge('v.skonto',0).",'%'),''),
|
IF(v.skonto <> 0,CONCAT(".$app->erp->FormatMenge('v.skonto',0).",'%'),''),
|
||||||
@ -190,10 +193,10 @@ class Verbindlichkeit {
|
|||||||
$bestellnummer = $verbindlichkeit['belegnr'];
|
$bestellnummer = $verbindlichkeit['belegnr'];
|
||||||
$rechnung = $verbindlichkeit['rechnung'];
|
$rechnung = $verbindlichkeit['rechnung'];
|
||||||
|
|
||||||
$heading = array('Paket-Nr.','Paket-Pos.', 'Bestellung', 'Lieferschein', 'Rechnung', 'Artikel-Nr.','Artikel','Menge','Menge offen','Eingabe','Preis','');
|
$heading = array('Paket-Nr.','Paket-Pos.', 'Bestellung', 'Lieferschein', 'Rechnung', 'Artikel-Nr.','Artikel','Menge','Menge offen','Eingabe','Preis','Steuer','Sachkonto','');
|
||||||
$width = array( '1%', '1%', '5%', '5%', '5%', '5%', '20%', '2%', '1%', '1%', '1%', '1%');
|
$width = array( '1%', '1%', '5%', '5%', '5%', '5%', '20%', '2%', '1%', '1%', '1%', '1%', '1%', '1%');
|
||||||
|
|
||||||
$findcols = array('pa','auswahl','belegnr','lsnr','renr','artikelnummer','name_de','menge','offen_menge','offen_menge','preis','pa');
|
$findcols = array('pa','auswahl','belegnr','lsnr','renr','artikelnummer','name_de','menge','offen_menge','offen_menge','preis','umsatzsteuer','pa');
|
||||||
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
||||||
|
|
||||||
$alignright = array(8,9,11);
|
$alignright = array(8,9,11);
|
||||||
@ -215,8 +218,11 @@ class Verbindlichkeit {
|
|||||||
'<input type="text" name="artikel[]" value="',
|
'<input type="text" name="artikel[]" value="',
|
||||||
['sql' => 'art.id'],
|
['sql' => 'art.id'],
|
||||||
'"/ hidden>',
|
'"/ hidden>',
|
||||||
'<input type="text" name="umsatzsteuer[]" value="',
|
'<input type="text" name="umsatzsteuern[]" value="',
|
||||||
['sql' => 'art.umsatzsteuer'],
|
['sql' => 'art.umsatzsteuer'],
|
||||||
|
'"/ hidden>',
|
||||||
|
'<input type="text" name="kontorahmen[]" value="',
|
||||||
|
['sql' => 'if (skart.id <> 0,skart.id,skadr.id)'],
|
||||||
'"/ hidden>'
|
'"/ hidden>'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -302,7 +308,12 @@ class Verbindlichkeit {
|
|||||||
0
|
0
|
||||||
) offen_menge,
|
) offen_menge,
|
||||||
".$this->app->erp->ConcatSQL($werte).",
|
".$this->app->erp->ConcatSQL($werte).",
|
||||||
".$this->app->erp->ConcatSQL($preise)." AS preis
|
".$this->app->erp->ConcatSQL($preise)." AS preis,
|
||||||
|
art.umsatzsteuer,
|
||||||
|
if (skart.id <> 0,
|
||||||
|
CONCAT(skart.sachkonto,' ',skart.beschriftung),
|
||||||
|
CONCAT(skadr.sachkonto,' ',skadr.beschriftung)
|
||||||
|
) AS sachkonto
|
||||||
FROM
|
FROM
|
||||||
paketannahme pa
|
paketannahme pa
|
||||||
INNER JOIN paketdistribution pd ON
|
INNER JOIN paketdistribution pd ON
|
||||||
@ -326,6 +337,10 @@ class Verbindlichkeit {
|
|||||||
) vp
|
) vp
|
||||||
ON
|
ON
|
||||||
vp.paketdistribution = pd.id
|
vp.paketdistribution = pd.id
|
||||||
|
LEFT JOIN
|
||||||
|
kontorahmen skart ON skart.id = art.kontorahmen
|
||||||
|
LEFT JOIN
|
||||||
|
kontorahmen skadr ON skadr.id = adr.kontorahmen
|
||||||
WHERE pa.adresse = ".$lieferant." AND pd.vorlaeufig IS NULL".$innerwhere."
|
WHERE pa.adresse = ".$lieferant." AND pd.vorlaeufig IS NULL".$innerwhere."
|
||||||
) temp
|
) temp
|
||||||
";
|
";
|
||||||
@ -340,12 +355,12 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
$id = $app->Secure->GetGET('id');
|
$id = $app->Secure->GetGET('id');
|
||||||
$freigabe = $app->DB->Select("SELECT freigabe FROM verbindlichkeit WHERE id = '".$id."'");
|
$freigabe = $app->DB->Select("SELECT freigabe FROM verbindlichkeit WHERE id = '".$id."'");
|
||||||
|
$rechnungsfreigabe = $app->DB->Select("SELECT rechnungsfreigabe FROM verbindlichkeit WHERE id = '".$id."'");
|
||||||
|
|
||||||
// $heading = array('Paket-Nr.','Paket-Pos.', 'Bestellung', 'Artikel-Nr.','Artikel','Menge','Preis','Steuersatz','Sachkonto','Menü','');
|
$heading = array('', 'Paket-Nr.','Paket-Pos.', 'Bestellung', 'Artikel-Nr.','Artikel','Menge','Preis','Steuersatz','Sachkonto');
|
||||||
$heading = array('', 'Paket-Nr.','Paket-Pos.', 'Bestellung', 'Artikel-Nr.','Artikel','Menge','Preis','Steuersatz abw.','Sachkonto abw.');
|
|
||||||
$width = array( '1%','1%', '1%' , '2%', '2%', '16%', '1%', '1%', '1%', '3%', '1%', '1%');
|
$width = array( '1%','1%', '1%' , '2%', '2%', '16%', '1%', '1%', '1%', '3%', '1%', '1%');
|
||||||
|
|
||||||
$findcols = array('vp.id','pd.paketannahme','pd.id','b.belegnr','art.nummer','art.name_de','vp.menge','vp.preis','vp.steuersatz',"CONCAT(skv.sachkonto,' ',skv.beschriftung)",'vp.id','1');
|
$findcols = array('vp.id','pd.paketannahme','pd.id','b.belegnr','art.nummer','art.name_de','vp.menge','vp.preis','vp.steuersatz',"CONCAT(skv.sachkonto,' ',skv.beschriftung)",'vp.id');
|
||||||
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
||||||
|
|
||||||
$alignright = array(6,7,8,9);
|
$alignright = array(6,7,8,9);
|
||||||
@ -354,14 +369,11 @@ class Verbindlichkeit {
|
|||||||
$defaultorderdesc = 0;
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
if (empty($freigabe)) {
|
if (empty($freigabe)) {
|
||||||
$deletepos = array (
|
$menu="<table cellpadding=0 cellspacing=0><tr><td nowrap>"."<a href=\"index.php?module=verbindlichkeit&action=editpos&id=$id&posid=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=verbindlichkeit&action=deletepos&id=$id&posid=%value%\");>"."<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>"."</td></tr></table>";
|
||||||
'<a href="#" onclick=DeleteDialog("index.php?module=verbindlichkeit&action=deletepos&id=',
|
} if (empty($rechnungsfreigabe)) {
|
||||||
['sql' => 'vp.id'],
|
$menu="<table cellpadding=0 cellspacing=0><tr><td nowrap>"."<a href=\"index.php?module=verbindlichkeit&action=editpos&id=$id&posid=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>"."</td></tr></table>";
|
||||||
'")>',
|
}
|
||||||
'<img src=\"themes/'.$app->Conf->WFconf['defaulttheme'].'/images/delete.svg\" border=\"0\"></a>'
|
else {
|
||||||
);
|
|
||||||
$heading[] = 'Menü';
|
|
||||||
} else {
|
|
||||||
$deletepos = array('');
|
$deletepos = array('');
|
||||||
}
|
}
|
||||||
$heading[] = '';
|
$heading[] = '';
|
||||||
@ -389,7 +401,7 @@ class Verbindlichkeit {
|
|||||||
vp.preis,
|
vp.preis,
|
||||||
vp.steuersatz,
|
vp.steuersatz,
|
||||||
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
||||||
".$this->app->erp->ConcatSQL($deletepos)."
|
vp.id
|
||||||
FROM
|
FROM
|
||||||
verbindlichkeit_position vp
|
verbindlichkeit_position vp
|
||||||
INNER JOIN verbindlichkeit v ON
|
INNER JOIN verbindlichkeit v ON
|
||||||
@ -504,10 +516,11 @@ class Verbindlichkeit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function verbindlichkeit_deletepos() {
|
public function verbindlichkeit_deletepos() {
|
||||||
|
$posid = (int) $this->app->Secure->GetGET('posid');
|
||||||
$id = (int) $this->app->Secure->GetGET('id');
|
$id = (int) $this->app->Secure->GetGET('id');
|
||||||
$verbindlichkeit = $this->app->DB->Select("SELECT verbindlichkeit FROM verbindlichkeit_position WHERE id ='{$id}'");
|
$verbindlichkeit = $this->app->DB->Select("SELECT verbindlichkeit FROM verbindlichkeit_position WHERE id ='{$posid}'");
|
||||||
$this->app->DB->Delete("DELETE vp FROM verbindlichkeit_position vp INNER JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit WHERE vp.id = '{$id}' AND v.freigabe <> 1");
|
$this->app->DB->Delete("DELETE vp FROM verbindlichkeit_position vp INNER JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit WHERE vp.id = '{$posid}' AND v.freigabe <> 1");
|
||||||
header("Location: index.php?module=verbindlichkeit&action=edit&id=$verbindlichkeit#tabs-2");
|
header("Location: index.php?module=verbindlichkeit&action=edit&id=$id#tabs-2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -519,7 +532,7 @@ class Verbindlichkeit {
|
|||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
// Check if other users are editing this id
|
// Check if other users are editing this id
|
||||||
if($this->app->erp->DisableModul('artikel',$id))
|
if($this->app->erp->DisableModul('verbindlichkeit',$id))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -635,8 +648,11 @@ class Verbindlichkeit {
|
|||||||
$ids = $this->app->Secure->GetPOST('ids');
|
$ids = $this->app->Secure->GetPOST('ids');
|
||||||
$werte = $this->app->Secure->GetPOST('werte');
|
$werte = $this->app->Secure->GetPOST('werte');
|
||||||
$preise = $this->app->Secure->GetPOST('preise');
|
$preise = $this->app->Secure->GetPOST('preise');
|
||||||
$umsatzsteuern = $this->app->Secure->GetPOST('umsatzsteuer');
|
|
||||||
$artikel = $this->app->Secure->GetPOST('artikel');
|
$artikel = $this->app->Secure->GetPOST('artikel');
|
||||||
|
$umsatzsteuern = $this->app->Secure->GetPOST('umsatzsteuern');
|
||||||
|
$kontorahmen = $this->app->Secure->GetPOST('kontorahmen');
|
||||||
|
|
||||||
|
$bruttoeingabe = $this->app->Secure->GetPOST('bruttoeingabe');
|
||||||
|
|
||||||
foreach ($ids as $key => $paketdistribution) {
|
foreach ($ids as $key => $paketdistribution) {
|
||||||
$menge = $werte[$key];
|
$menge = $werte[$key];
|
||||||
@ -671,7 +687,6 @@ class Verbindlichkeit {
|
|||||||
$offen_menge = $this->app->DB->Select($sql);
|
$offen_menge = $this->app->DB->Select($sql);
|
||||||
|
|
||||||
if ($offen_menge == 0) {
|
if ($offen_menge == 0) {
|
||||||
echo("Abort ".$paketdistribution." ".gettype($offen_menge));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,32 +695,23 @@ class Verbindlichkeit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$preis = $preise[$key];
|
$preis = $preise[$key];
|
||||||
|
$einartikel = $artikel[$key];
|
||||||
$umsatzsteuer = $umsatzsteuern[$key];
|
$umsatzsteuer = $umsatzsteuern[$key];
|
||||||
$ein_artikel = $artikel[$key];
|
$einkontorahmen = $kontorahmen[$key];
|
||||||
|
|
||||||
$sql = "INSERT INTO verbindlichkeit_position (verbindlichkeit,paketdistribution, menge, preis, umsatzsteuer, artikel) VALUES ($id, $paketdistribution, $menge, $preis, '$umsatzsteuer', $ein_artikel)";
|
$steuersatz = $this->get_steuersatz($umsatzsteuer,$id);
|
||||||
|
|
||||||
|
if ($bruttoeingabe) {
|
||||||
|
$preis = $preis / (1+($steuersatz/100));
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO verbindlichkeit_position (verbindlichkeit,paketdistribution, menge, preis, steuersatz, artikel, kontorahmen) VALUES ($id, $paketdistribution, $menge, $preis, $steuersatz, $einartikel, $einkontorahmen)";
|
||||||
|
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'positionen_sachkonto_speichern':
|
case 'positionen_entfernen':
|
||||||
|
|
||||||
$rechnungsfreigabe = $this->app->DB->Select("SELECT rechnungsfreigabe FROM verbindlichkeit WHERE id =".$id);
|
|
||||||
if ($rechnungsfreigabe) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Process multi action
|
|
||||||
$ids = $this->app->Secure->GetPOST('auswahl');
|
|
||||||
if (!is_array($ids)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$sachkonto = $this->app->Secure->GetPOST('positionen_sachkonto');
|
|
||||||
$kontorahmen = $this->app->erp->ReplaceKontorahmen(true,$sachkonto,false);
|
|
||||||
$sql = "update verbindlichkeit_position SET kontorahmen = '".$kontorahmen."' WHERE id IN (".implode(',',$ids).")";
|
|
||||||
$this->app->DB->Update($sql);
|
|
||||||
break;
|
|
||||||
case 'positionen_steuersatz_speichern':
|
|
||||||
|
|
||||||
$freigabe = $this->app->DB->SelectArr("SELECT rechnungsfreigabe, freigabe FROM verbindlichkeit WHERE id =".$id)[0];
|
$freigabe = $this->app->DB->SelectArr("SELECT rechnungsfreigabe, freigabe FROM verbindlichkeit WHERE id =".$id)[0];
|
||||||
if ($freigabe['rechnungsfreigabe'] || $freigabe['freigabe']) {
|
if ($freigabe['rechnungsfreigabe'] || $freigabe['freigabe']) {
|
||||||
@ -716,12 +722,8 @@ class Verbindlichkeit {
|
|||||||
if (!is_array($ids)) {
|
if (!is_array($ids)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$steuersatz = $this->app->Secure->GetPOST('positionen_steuersatz');
|
$this->app->DB->Delete("DELETE vp FROM verbindlichkeit_position vp INNER JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit WHERE vp.id IN (".implode(',',$ids).") AND v.freigabe <> 1");
|
||||||
if (!is_numeric($steuersatz)) {
|
|
||||||
$steuersatz = 'NULL';
|
|
||||||
}
|
|
||||||
$sql = "update verbindlichkeit_position SET steuersatz = ".$steuersatz." WHERE id IN (".implode(',',$ids).")";
|
|
||||||
$this->app->DB->Update($sql);
|
|
||||||
break;
|
break;
|
||||||
case 'positionen_steuersatz_zu_netto':
|
case 'positionen_steuersatz_zu_netto':
|
||||||
|
|
||||||
@ -1016,6 +1018,98 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function verbindlichkeit_editpos() {
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
$posid = $this->app->Secure->GetGET('posid');
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('ID', $id);
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=edit&id=$id#tabs-2", "Zurück");
|
||||||
|
|
||||||
|
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||||
|
$menge = $this->app->Secure->GetPOST('menge');
|
||||||
|
$preis = $this->app->Secure->GetPOST('preis');
|
||||||
|
$steuersatz = $this->app->Secure->GetPOST('steuersatz');
|
||||||
|
|
||||||
|
$kontorahmen = $this->app->erp->ReplaceKontorahmen(true,$sachkonto,false);
|
||||||
|
if ($menge < 0) {
|
||||||
|
$menge = 0;
|
||||||
|
}
|
||||||
|
if ($preis < 0) {
|
||||||
|
$preis = 0;
|
||||||
|
}
|
||||||
|
if ($steuersatz < 0) {
|
||||||
|
$steuersatz = 0;
|
||||||
|
}
|
||||||
|
$submit = $this->app->Secure->GetPOST('submit');
|
||||||
|
|
||||||
|
$freigabe = $this->app->DB->SelectArr("SELECT rechnungsfreigabe, freigabe FROM verbindlichkeit WHERE id =".$id)[0];
|
||||||
|
if ($freigabe['rechnungsfreigabe'] && $freigabe['freigabe']) {
|
||||||
|
$this->app->Tpl->Set('SAVEDISABLED','disabled');
|
||||||
|
$this->app->Tpl->Set('SACHKONTOSAVEDISABLED','disabled');
|
||||||
|
} else if ($freigabe['freigabe']) {
|
||||||
|
$this->app->Tpl->Set('SAVEDISABLED','disabled');
|
||||||
|
if ($submit != '')
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
UPDATE verbindlichkeit_position SET
|
||||||
|
kontorahmen = '$kontorahmen'
|
||||||
|
WHERE id = ".$posid."
|
||||||
|
";
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||||
|
header("Location: index.php?module=verbindlichkeit&action=edit&id=$id&msg=$msg#tabs-2");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($submit != '')
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
UPDATE verbindlichkeit_position SET
|
||||||
|
menge = '$menge',
|
||||||
|
preis = '$preis',
|
||||||
|
steuersatz = '$steuersatz',
|
||||||
|
kontorahmen = '$kontorahmen'
|
||||||
|
WHERE id = ".$posid."
|
||||||
|
";
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||||
|
header("Location: index.php?module=verbindlichkeit&action=edit&id=$id&msg=$msg#tabs-2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load values again from database
|
||||||
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') AS `auswahl`";
|
||||||
|
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, v.steuersatz, v.preis, v.menge, v.kontorahmen, v.id FROM verbindlichkeit_position v"." WHERE id=$posid");
|
||||||
|
|
||||||
|
foreach ($result[0] as $key => $value) {
|
||||||
|
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result)) {
|
||||||
|
$verbindlichkeit_position_from_db = $result[0];
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add displayed items later
|
||||||
|
*
|
||||||
|
|
||||||
|
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||||
|
$this->app->Tpl->Add('EMAIL', $email);
|
||||||
|
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||||
|
|
||||||
|
$this->app->YUI->AutoComplete("artikel", "artikelnummer");
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->app->YUI->AutoComplete("sachkonto", "sachkonto", 1);
|
||||||
|
$this->app->Tpl->Set('SACHKONTO', $this->app->erp->ReplaceKontorahmen(false,$verbindlichkeit_position_from_db['kontorahmen'],false));
|
||||||
|
|
||||||
|
$this->app->Tpl->Parse('PAGE', "verbindlichkeit_position_edit.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all paramters from html form and save into $input
|
* Get all paramters from html form and save into $input
|
||||||
*/
|
*/
|
||||||
@ -1203,25 +1297,16 @@ class Verbindlichkeit {
|
|||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
vp.id,
|
vp.id,
|
||||||
v.belegnr,
|
v.belegnr
|
||||||
skv.id skv_id,
|
|
||||||
skart.id skart_id,
|
|
||||||
skadr.id skadr_id
|
|
||||||
FROM verbindlichkeit_position vp
|
FROM verbindlichkeit_position vp
|
||||||
INNER JOIN artikel art ON art.id = vp.artikel
|
|
||||||
LEFT JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit
|
LEFT JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit
|
||||||
LEFT JOIN adresse adr ON adr.id = v.adresse
|
|
||||||
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
|
||||||
LEFT JOIN kontorahmen skart ON skart.id = art.kontorahmen
|
|
||||||
LEFT JOIN kontorahmen skadr ON skadr.id = adr.kontorahmen
|
|
||||||
WHERE
|
WHERE
|
||||||
verbindlichkeit='$id'
|
verbindlichkeit='$id'
|
||||||
AND
|
AND vp.kontorahmen = 0
|
||||||
(
|
|
||||||
COALESCE(skv.id,0) = 0 AND COALESCE(skart.id,0) = 0 AND COALESCE(skadr.id,0) = 0
|
|
||||||
)
|
|
||||||
";
|
";
|
||||||
|
|
||||||
|
$check = $this->app->DB->SelectArr($sql);
|
||||||
|
|
||||||
if (!empty($check)) {
|
if (!empty($check)) {
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->app->YUI->Message('warning','Kontierung unvollständig');
|
$this->app->YUI->Message('warning','Kontierung unvollständig');
|
||||||
@ -1407,23 +1492,13 @@ class Verbindlichkeit {
|
|||||||
vp.menge,
|
vp.menge,
|
||||||
vp.preis,
|
vp.preis,
|
||||||
vp.steuersatz,
|
vp.steuersatz,
|
||||||
if (skv.id <> 0,
|
CONCAT(skv.sachkonto,' ',skv.beschriftung) AS sachkonto,
|
||||||
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
|
||||||
(
|
|
||||||
if (skart.id <> 0,
|
|
||||||
CONCAT(skart.sachkonto,' ',skart.beschriftung, ' (Artikel)'),
|
|
||||||
CONCAT(skadr.sachkonto,' ',skadr.beschriftung, ' (Adresse)')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
) AS sachkonto,
|
|
||||||
''
|
''
|
||||||
FROM verbindlichkeit_position vp
|
FROM verbindlichkeit_position vp
|
||||||
INNER JOIN artikel art ON art.id = vp.artikel
|
INNER JOIN artikel art ON art.id = vp.artikel
|
||||||
LEFT JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit
|
LEFT JOIN verbindlichkeit v ON v.id = vp.verbindlichkeit
|
||||||
LEFT JOIN adresse adr ON adr.id = v.adresse
|
LEFT JOIN adresse adr ON adr.id = v.adresse
|
||||||
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
||||||
LEFT JOIN kontorahmen skart ON skart.id = art.kontorahmen
|
|
||||||
LEFT JOIN kontorahmen skadr ON skadr.id = adr.kontorahmen
|
|
||||||
WHERE verbindlichkeit='$id'
|
WHERE verbindlichkeit='$id'
|
||||||
ORDER by vp.sort ASC");
|
ORDER by vp.sort ASC");
|
||||||
|
|
||||||
@ -1516,4 +1591,56 @@ class Verbindlichkeit {
|
|||||||
return($this->app->DB->Select("SELECT belegnr FROM verbindlichkeit WHERE id =".$id));
|
return($this->app->DB->Select("SELECT belegnr FROM verbindlichkeit WHERE id =".$id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Calculate steuersatz
|
||||||
|
Get from
|
||||||
|
Check address first, if foreign, then steuersatz = 0
|
||||||
|
if not foreign there are three cases: befreit = 0, ermaessigt, normal
|
||||||
|
if not befreit, get from projekt or firmendaten
|
||||||
|
*/
|
||||||
|
function get_steuersatz($umsatzsteuer, $verbindlichkeit) {
|
||||||
|
if (is_numeric($umsatzsteuer)) {
|
||||||
|
return($umsatzsteuer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($umsatzsteuer == 'befreit') {
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$adresse = $this->app->DB->Select("SELECT adresse FROM verbindlichkeit WHERE id=".$verbindlichkeit);
|
||||||
|
$umsatzsteuer_lieferant = $this->app->DB->Select("SELECT umsatzsteuer_lieferant FROM adresse WHERE id=".$adresse); /* inland, eu-lieferung, import*/
|
||||||
|
|
||||||
|
if (in_array($umsatzsteuer_lieferant,array('import','eu-lieferung'))) {
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$projekt = $this->app->DB->Select("SELECT projekt FROM verbindlichkeit WHERE id=".$verbindlichkeit);
|
||||||
|
$steuersatz_projekt = $this->app->DB->SelectRow("SELECT steuersatz_normal, steuersatz_ermaessigt FROM projekt WHERE id ='".$projekt."'");
|
||||||
|
$steuersatz_normal_projekt = $steuersatz_projekt['steuer_normal'];
|
||||||
|
$steuersatz_ermaessigt_projekt = $steuersatz_projekt['steuer_ermaessigt'];
|
||||||
|
|
||||||
|
$steuersatz_normal = $this->app->erp->Firmendaten('steuersatz_normal');
|
||||||
|
$steuersatz_ermaessigt = $this->app->erp->Firmendaten('steuersatz_ermaessigt');
|
||||||
|
|
||||||
|
switch($umsatzsteuer) {
|
||||||
|
case 'normal':
|
||||||
|
if (!empty($steuersatz_normal_projekt)) {
|
||||||
|
return($steuersatz_normal_projekt);
|
||||||
|
} else {
|
||||||
|
return($steuersatz_normal);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'ermaessigt':
|
||||||
|
if (!empty($steuersatz_ermaessigt_projekt)) {
|
||||||
|
return($steuersatz_ermaessigt_projekt);
|
||||||
|
} else {
|
||||||
|
return($steuersatz_ermaessigt);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user