mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
verbindlichkeit positionen basic implementation (cosmetics tbd)
This commit is contained in:
parent
fe273bb832
commit
0806785d91
@ -111403,7 +111403,7 @@
|
|||||||
"Comment": ""
|
"Comment": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Field": "sachkonto",
|
"Field": "kontorahmen",
|
||||||
"Type": "int(11)",
|
"Type": "int(11)",
|
||||||
"Collation": null,
|
"Collation": null,
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
|
@ -2489,7 +2489,7 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
|||||||
$adresse = $this->app->DB->Select("SELECT id FROM adresse WHERE lieferantennummer = '".$lieferant[0]."' AND lieferantennummer <> '' LIMIT 1");
|
$adresse = $this->app->DB->Select("SELECT id FROM adresse WHERE lieferantennummer = '".$lieferant[0]."' AND lieferantennummer <> '' LIMIT 1");
|
||||||
}
|
}
|
||||||
$beleg = str_replace('lieferanten','',$filtername);
|
$beleg = str_replace('lieferanten','',$filtername);
|
||||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(id,' ',if(belegnr <> '',belegnr,'ENTWURF'),' ',lieferantennummer,' ',name) as name FROM $beleg WHERE (belegnr LIKE '%$term%' OR name LIKE '%$term%' OR lieferantennummer LIKE '$%term%') AND (status = 'angelegt' OR status = 'freigegeben')
|
$arr = $this->app->DB->SelectArr("SELECT CONCAT(id,' ',if(belegnr <> '',belegnr,'ENTWURF'),' ',lieferantennummer,' ',name) as name FROM $beleg WHERE (belegnr <> '') AND (belegnr LIKE '%$term%' OR name LIKE '%$term%' OR lieferantennummer LIKE '$%term%') AND (status = 'angelegt' OR status = 'freigegeben')
|
||||||
".($adresse?" AND adresse = '$adresse' ":'')." ".$this->app->erp->ProjektRechte('projekt')."
|
".($adresse?" AND adresse = '$adresse' ":'')." ".$this->app->erp->ProjektRechte('projekt')."
|
||||||
ORDER by belegnr LIMIT 20" );
|
ORDER by belegnr LIMIT 20" );
|
||||||
$carr = !empty($arr)?count($arr):0;
|
$carr = !empty($arr)?count($arr):0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#tabs-1">Details</a></li>
|
<li><a href="#tabs-1">Details</a></li>
|
||||||
<!-- <li><a href="#tabs-2">Positionen</a></li> -->
|
<li><a href="#tabs-2">Positionen</a></li>
|
||||||
<li><a href="#tabs-3">Protokoll</a></li>
|
<li><a href="#tabs-3">Protokoll</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
@ -21,7 +21,7 @@
|
|||||||
[STATUSICONS]
|
[STATUSICONS]
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset style="float: right;">
|
<fieldset style="float: right;">
|
||||||
<input type="submit" name="submit" value="Speichern"/>
|
<button [AKTION_SPEICHERN_DISABLED] name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<select name="waehrung" [SAVEDISABLED]>[WAEHRUNGSELECT]</select>
|
<select name="waehrung" [SAVEDISABLED]>[WAEHRUNGSELECT]</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr hidden>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{|Betrag Positionen brutto|}:
|
{|Betrag Positionen brutto|}:
|
||||||
</td>
|
</td>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
<input type="number" step="0.01" name="betragbruttopos" id="betragbruttopos" value="[BETRAGBRUTTOPOS]" size="20" disabled>
|
<input type="number" step="0.01" name="betragbruttopos" id="betragbruttopos" value="[BETRAGBRUTTOPOS]" size="20" disabled>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr hidden>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{|Betrag Positionen netto|}:
|
{|Betrag Positionen netto|}:
|
||||||
</td>
|
</td>
|
||||||
@ -122,6 +122,14 @@
|
|||||||
<input type="text" name="skontobis" id="skontobis" value="[SKONTOBIS]" size="20" [SAVEDISABLED]>
|
<input type="text" name="skontobis" id="skontobis" value="[SKONTOBIS]" size="20" [SAVEDISABLED]>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Bestellung|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="bestellung" id="bestellung" value="[BESTELLUNG]" size="20" [SAVEDISABLED]>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{|Waren-/Leistungsprüfung (Einkauf)|}:
|
{|Waren-/Leistungsprüfung (Einkauf)|}:
|
||||||
@ -129,7 +137,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="wareneingang" value="1" [WARENEINGANGCHECKED] size="20" disabled>
|
<input type="checkbox" id="wareneingang" value="1" [WARENEINGANGCHECKED] size="20" disabled>
|
||||||
<a href="index.php?module=verbindlichkeit&action=freigabeeinkauf&id=[ID]" title="freigeben" [FREIGABEEINKAUFHIDDEN]><img src="themes/new/images/forward.svg" border="0" class="textfeld_icon"></a>
|
<a href="index.php?module=verbindlichkeit&action=freigabeeinkauf&id=[ID]" title="freigeben" [FREIGABEEINKAUFHIDDEN]><img src="themes/new/images/forward.svg" border="0" class="textfeld_icon"></a>
|
||||||
<a href="index.php?module=verbindlichkeit&action=ruecksetzeneinkauf&id=[ID]" title="rücksetzen" [RUECKSETZENEINKAUFHIDDEN]><img src="themes/new/images/delete.svg" border="0" class="textfeld_icon"></a>
|
<a href="index.php?module=verbindlichkeit&action=ruecksetzeneinkauf&id=[ID]" title="rücksetzen" [RUECKSETZENEINKAUFHIDDEN]><img src="themes/new/images/delete.svg" border="0" class="textfeld_icon"></a>
|
||||||
|
<i [EINKAUFINFOHIDDEN]>Wird automatisch gesetzt wenn Positionen vollständig</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -196,11 +205,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
<div id="tabs-2">
|
<div id="tabs-2">
|
||||||
[POS]
|
[POSITIONENTAB]
|
||||||
</div>
|
</div>
|
||||||
-->
|
|
||||||
<div id="tabs-3">
|
<div id="tabs-3">
|
||||||
[MINIDETAIL]
|
[MINIDETAIL]
|
||||||
</div>
|
</div>
|
||||||
|
83
www/pages/content/verbindlichkeit_positionen.tpl
Normal file
83
www/pages/content/verbindlichkeit_positionen.tpl
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
[POSITIONENMESSAGE]
|
||||||
|
<form method="post" action="#tabs-2">
|
||||||
|
<div class="row" [POSITIONHINZUFUEGENHIDDEN]>
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-14 col-md-12 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend style="float:left">Offene Artikel aus Wareneingängen:</legend>
|
||||||
|
<div class="filter-box filter-usersave" style="float:right;">
|
||||||
|
<div class="filter-block filter-inline">
|
||||||
|
<div class="filter-title">{|Filter|}</div>
|
||||||
|
<ul class="filter-list">
|
||||||
|
<li class="filter-item">
|
||||||
|
<label for="passende" class="switch">
|
||||||
|
<input type="checkbox" id="passende">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="passende">{|Nur passende (Bestellung/Rechnungsnummer)|}</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[PAKETDISTRIBUTION]
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-14 col-md-2 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<legend>{|Aktionen|}</legend>
|
||||||
|
<tr>
|
||||||
|
<td><button [AKTION_SPEICHERN_DISABLED] name="submit" value="positionen_hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzufügen</button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<form method="post" action="#tabs-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-14 col-md-12 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
[POSITIONEN]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-14 col-md-2 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<legend>{|Aktionen|}</legend>
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" id="auswahlalle" onchange="alleauswaehlen();" /> {|alle markieren|}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Sachkonto: <input type="text" id="positionen_sachkonto" name="positionen_sachkonto" value=""></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><button name="submit" value="positionen_sachkonto_speichern" class="ui-button-icon" style="width:100%;">Anpassen</button></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Steuersatz: <input type="text" id="positionen_steuersatz" name="positionen_steuersatz" value=""></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><button name="submit" value="positionen_steuersatz_speichern" class="ui-button-icon" style="width:100%;">Anpassen</button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<script>
|
||||||
|
function alleauswaehlen()
|
||||||
|
{
|
||||||
|
var wert = $('#auswahlalle').prop('checked');
|
||||||
|
$('#verbindlichkeit_positionen').find(':checkbox').prop('checked',wert);
|
||||||
|
}
|
||||||
|
</script>
|
@ -20,6 +20,7 @@ class Verbindlichkeit {
|
|||||||
$this->app->ActionHandler("edit", "verbindlichkeit_edit");
|
$this->app->ActionHandler("edit", "verbindlichkeit_edit");
|
||||||
$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("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");
|
||||||
@ -175,6 +176,232 @@ class Verbindlichkeit {
|
|||||||
$moreinfo = true; // Allow drop down details
|
$moreinfo = true; // Allow drop down details
|
||||||
$menucol = 1; // For moredata
|
$menucol = 1; // For moredata
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'verbindlichkeit_paketdistribution_list':
|
||||||
|
$allowed['verbindlichkeit_paketdistribution_list'] = array('list');
|
||||||
|
|
||||||
|
$id = $app->Secure->GetGET('id');
|
||||||
|
if (empty($id)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$verbindlichkeit = $app->DB->SelectArr("SELECT v.adresse, v.rechnung, b.belegnr FROM verbindlichkeit v LEFT JOIN bestellung b ON b.id = v.bestellung WHERE v.id = ".$id)[0];
|
||||||
|
|
||||||
|
$lieferant = $verbindlichkeit['adresse'];
|
||||||
|
$bestellnummer = $verbindlichkeit['belegnr'];
|
||||||
|
$rechnung = $verbindlichkeit['rechnung'];
|
||||||
|
|
||||||
|
$heading = array('Paket-Nr.','Paket-Pos.', 'Bestellung', 'Lieferschein', 'Rechnung', 'Artikel-Nr.','Artikel','Menge','Menge offen','Eingabe','Preis','');
|
||||||
|
$width = array( '1%', '1%', '5%', '5%', '5%', '5%', '20%', '2%', '1%', '1%', '1%', '1%');
|
||||||
|
|
||||||
|
$findcols = array('id','belegnr');
|
||||||
|
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
||||||
|
|
||||||
|
$alignright = array(8,9,11);
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
|
$offen_menge = "TRIM(IF(
|
||||||
|
pd.menge > COALESCE(vp.menge,0),
|
||||||
|
pd.menge - COALESCE(vp.menge,0),
|
||||||
|
0
|
||||||
|
))+0";
|
||||||
|
|
||||||
|
$auswahl = array (
|
||||||
|
'<input type=\"text\" name=\"ids[]\" value=\"',
|
||||||
|
['sql' => 'pd.id'],
|
||||||
|
'" hidden/>',
|
||||||
|
['sql' => 'pd.id'],
|
||||||
|
'<input type="text" name="artikel[]" value="',
|
||||||
|
['sql' => 'art.id'],
|
||||||
|
'"/ hidden>',
|
||||||
|
'<input type="text" name="umsatzsteuer[]" value="',
|
||||||
|
['sql' => 'art.umsatzsteuer'],
|
||||||
|
'"/ hidden>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$werte = array (
|
||||||
|
'<input type="number" name="werte[]" value="',
|
||||||
|
['sql' => $offen_menge],
|
||||||
|
'" min="0"',
|
||||||
|
'" max="',
|
||||||
|
['sql' => $offen_menge],
|
||||||
|
'"/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$preise = array (
|
||||||
|
'<input type="number" name="preise[]" step="0.01" value="',
|
||||||
|
['sql' => $this->app->erp->FormatMenge("COALESCE(bp.preis,0)",2)],
|
||||||
|
'" min="0"',
|
||||||
|
'"/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$artikellink = array (
|
||||||
|
'<a href="index.php?module=artikel&action=edit&id=',
|
||||||
|
['sql' => 'art.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'art.nummer'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$paketlink = array (
|
||||||
|
'<a href="index.php?module=wareneingang&action=distriinhalt&id=',
|
||||||
|
['sql' => 'pa.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'pa.id'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$where = "offen_menge > 0";
|
||||||
|
|
||||||
|
// Toggle filters
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#passende').click( function() { fnFilterColumn1( 0 ); } );");
|
||||||
|
|
||||||
|
for ($r = 1;$r <= 1;$r++) {
|
||||||
|
$this->app->Tpl->Add('JAVASCRIPT', '
|
||||||
|
function fnFilterColumn' . $r . ' ( i )
|
||||||
|
{
|
||||||
|
if(oMoreData' . $r . $name . '==1)
|
||||||
|
oMoreData' . $r . $name . ' = 0;
|
||||||
|
else
|
||||||
|
oMoreData' . $r . $name . ' = 1;
|
||||||
|
|
||||||
|
$(\'#' . $name . '\').dataTable().fnFilter(
|
||||||
|
\'\',
|
||||||
|
i,
|
||||||
|
0,0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
');
|
||||||
|
}
|
||||||
|
|
||||||
|
$more_data1 = $this->app->Secure->GetGET("more_data1");
|
||||||
|
if ($more_data1 == 1) {
|
||||||
|
$innerwhere .= " AND (b.belegnr LIKE '%".$bestellnummer."%' OR pa.renr LIKE '%".$rechnung."%')";
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
// END Toggle filters
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM (
|
||||||
|
SELECT
|
||||||
|
pa.id pa,
|
||||||
|
".$this->app->erp->ConcatSQL($paketlink).",
|
||||||
|
".$this->app->erp->ConcatSQL($auswahl)." AS auswahl,
|
||||||
|
if(b.belegnr LIKE '%".$bestellnummer."%',CONCAT('<b>',b.belegnr,'</b>'),b.belegnr) AS belegnr,
|
||||||
|
pa.lsnr,
|
||||||
|
if(pa.renr LIKE '%".$rechnung."%',CONCAT('<b>',pa.renr,'</b>'),pa.renr) AS renr,
|
||||||
|
".$this->app->erp->ConcatSQL($artikellink).",
|
||||||
|
art.name_de,
|
||||||
|
pd.menge,
|
||||||
|
IF(
|
||||||
|
pd.menge > COALESCE(vp.menge,0),
|
||||||
|
pd.menge - COALESCE(vp.menge,0),
|
||||||
|
0
|
||||||
|
) offen_menge,
|
||||||
|
".$this->app->erp->ConcatSQL($werte).",
|
||||||
|
".$this->app->erp->ConcatSQL($preise)."
|
||||||
|
FROM
|
||||||
|
paketannahme pa
|
||||||
|
INNER JOIN paketdistribution pd ON
|
||||||
|
pd.paketannahme = pa.id
|
||||||
|
INNER JOIN artikel art ON
|
||||||
|
art.id = pd.artikel
|
||||||
|
LEFT JOIN adresse adr ON
|
||||||
|
adr.id = pa.adresse
|
||||||
|
LEFT JOIN bestellung_position bp ON
|
||||||
|
bp.id = pd.bestellung_position
|
||||||
|
LEFT JOIN bestellung b ON
|
||||||
|
b.id = bp.bestellung
|
||||||
|
LEFT JOIN(
|
||||||
|
SELECT
|
||||||
|
paketdistribution,
|
||||||
|
SUM(menge) AS menge
|
||||||
|
FROM
|
||||||
|
verbindlichkeit_position vp
|
||||||
|
GROUP BY
|
||||||
|
paketdistribution
|
||||||
|
) vp
|
||||||
|
ON
|
||||||
|
vp.paketdistribution = pd.id
|
||||||
|
WHERE pa.adresse = ".$lieferant." AND pd.vorlaeufig IS NULL".$innerwhere."
|
||||||
|
) temp
|
||||||
|
";
|
||||||
|
|
||||||
|
$count = "";
|
||||||
|
// $groupby = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'verbindlichkeit_positionen':
|
||||||
|
|
||||||
|
$allowed['verbindlichkeit_positionen'] = array('list');
|
||||||
|
|
||||||
|
$id = $app->Secure->GetGET('id');
|
||||||
|
$freigabe = $app->DB->Select("SELECT freigabe 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 abw.','Sachkonto abw.');
|
||||||
|
$width = array( '1%','1%', '1%' , '2%', '2%', '16%', '1%', '1%', '1%', '3%', '1%', '1%');
|
||||||
|
|
||||||
|
$findcols = array('id','id');
|
||||||
|
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
||||||
|
|
||||||
|
$alignright = array(6,7,8,9);
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
|
if (empty($freigabe)) {
|
||||||
|
$deletepos = array (
|
||||||
|
'<a href="#" onclick=DeleteDialog("index.php?module=verbindlichkeit&action=deletepos&id=',
|
||||||
|
['sql' => 'vp.id'],
|
||||||
|
'")>',
|
||||||
|
'<img src=\"themes/'.$app->Conf->WFconf['defaulttheme'].'/images/delete.svg\" border=\"0\"></a>'
|
||||||
|
);
|
||||||
|
$heading[] = 'Menü';
|
||||||
|
} else {
|
||||||
|
$deletepos = array('');
|
||||||
|
}
|
||||||
|
$heading[] = '';
|
||||||
|
|
||||||
|
$box = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',vp.id,'\" />') AS `auswahl`";
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS
|
||||||
|
vp.id,
|
||||||
|
$box,
|
||||||
|
pd.paketannahme,
|
||||||
|
pd.id paket_position,
|
||||||
|
b.belegnr,
|
||||||
|
art.nummer,
|
||||||
|
art.name_de,
|
||||||
|
vp.menge,
|
||||||
|
vp.preis,
|
||||||
|
vp.steuersatz,
|
||||||
|
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
||||||
|
".$this->app->erp->ConcatSQL($deletepos)."
|
||||||
|
FROM
|
||||||
|
verbindlichkeit_position vp
|
||||||
|
INNER JOIN verbindlichkeit v ON
|
||||||
|
v.id = vp.verbindlichkeit
|
||||||
|
INNER JOIN paketdistribution pd ON
|
||||||
|
pd.id = vp.paketdistribution
|
||||||
|
INNER JOIN artikel art ON
|
||||||
|
art.id = pd.artikel
|
||||||
|
INNER JOIN adresse adr ON
|
||||||
|
adr.id = v.adresse
|
||||||
|
LEFT JOIN bestellung_position bp ON pd.bestellung_position = bp.id
|
||||||
|
LEFT JOIN bestellung b ON b.id = bp.bestellung
|
||||||
|
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
||||||
|
";
|
||||||
|
|
||||||
|
$where = "vp.verbindlichkeit = ".$id;
|
||||||
|
|
||||||
|
$count = "";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,16 +490,21 @@ class Verbindlichkeit {
|
|||||||
$this->verbindlichkeit_list();
|
$this->verbindlichkeit_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function verbindlichkeit_deletepos() {
|
||||||
|
$id = (int) $this->app->Secure->GetGET('id');
|
||||||
|
$verbindlichkeit = $this->app->DB->Select("SELECT verbindlichkeit FROM verbindlichkeit_position WHERE id ='{$id}'");
|
||||||
|
$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");
|
||||||
|
header("Location: index.php?module=verbindlichkeit&action=edit&id=$verbindlichkeit#tabs-2");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Edit verbindlichkeit item
|
* Edit verbindlichkeit item
|
||||||
* If id is empty, create a new one
|
* If id is empty, create a new one
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function verbindlichkeit_edit() {
|
function verbindlichkeit_edit($einkauf_automatik_aus = false) {
|
||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
$this->app->YUI->AARLGPositionen(true); // create iframe with positionen action
|
|
||||||
|
|
||||||
// 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('artikel',$id))
|
||||||
{
|
{
|
||||||
@ -292,65 +524,145 @@ class Verbindlichkeit {
|
|||||||
$input['status'] = 'angelegt';
|
$input['status'] = 'angelegt';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($submit != '')
|
switch($submit)
|
||||||
{
|
{
|
||||||
|
case 'speichern':
|
||||||
|
// Write to database
|
||||||
|
// Add checks here
|
||||||
|
$schreibschutz = $this->app->DB->Select("SELECT schreibschutz FROM verbindlichkeit WHERE id =".$id);
|
||||||
|
|
||||||
// Write to database
|
if ($schreibschutz) {
|
||||||
// Add checks here
|
$internebemerkung = $input['internebemerkung'];
|
||||||
$schreibschutz = $this->app->DB->Select("SELECT schreibschutz FROM verbindlichkeit WHERE id =".$id);
|
$projekt = $input['projekt'];
|
||||||
|
$kostenstelle = $input['kostenstelle'];
|
||||||
|
unset($input);
|
||||||
|
$input['internebemerkung'] = $internebemerkung;
|
||||||
|
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$projekt,true);
|
||||||
|
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$kostenstelle."'");
|
||||||
|
} else {
|
||||||
|
$input['adresse'] = $this->app->erp->ReplaceLieferantennummer(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
|
||||||
|
$input['rechnungsdatum'] = $this->app->erp->ReplaceDatum(true,$input['rechnungsdatum'],true); // Parameters: Target db?, value, from form?
|
||||||
|
$input['eingangsdatum'] = $this->app->erp->ReplaceDatum(true,$input['eingangsdatum'],true); // Parameters: Target db?, value, from form?
|
||||||
|
$input['skontobis'] = $this->app->erp->ReplaceDatum(true,$input['skontobis'],true); // Parameters: Target db?, value, from form?
|
||||||
|
$input['zahlbarbis'] = $this->app->erp->ReplaceDatum(true,$input['zahlbarbis'],true); // Parameters: Target db?, value, from form?
|
||||||
|
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true);
|
||||||
|
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$input['kostenstelle']."'");
|
||||||
|
$input['projekt'] = $this->app->erp->ReplaceBestellung(true,$input['bestellung'],true);
|
||||||
|
if(empty($input['projekt']) && !empty($input['adresse'])) {
|
||||||
|
$input['projekt'] = $this->app->erp->GetCreateProjekt($input['adresse']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($schreibschutz) {
|
if (!empty($input['adresse'])) {
|
||||||
$internebemerkung = $input['internebemerkung'];
|
$steuertyp = $this->app->DB->Select("SELECT ust_befreit FROM adresse WHERE id = ".$input['adresse']);
|
||||||
$projekt = $input['projekt'];
|
|
||||||
$kostenstelle = $input['kostenstelle'];
|
if ($steuertyp > 0) {
|
||||||
unset($input);
|
$input['steuersatz_normal'] = '0';
|
||||||
$input['internebemerkung'] = $internebemerkung;
|
$input['steuersatz_ermaessigt'] = '0';
|
||||||
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$projekt,true);
|
} else {
|
||||||
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$kostenstelle."'");
|
$input['steuersatz_normal'] = $this->app->erp->Firmendaten("steuersatz_normal");
|
||||||
} else {
|
$input['steuersatz_ermaessigt'] = $this->app->erp->Firmendaten("steuersatz_ermaessigt");
|
||||||
$input['adresse'] = $this->app->erp->ReplaceLieferantennummer(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
|
}
|
||||||
$input['rechnungsdatum'] = $this->app->erp->ReplaceDatum(true,$input['rechnungsdatum'],true); // Parameters: Target db?, value, from form?
|
}
|
||||||
$input['eingangsdatum'] = $this->app->erp->ReplaceDatum(true,$input['eingangsdatum'],true); // Parameters: Target db?, value, from form?
|
|
||||||
$input['skontobis'] = $this->app->erp->ReplaceDatum(true,$input['skontobis'],true); // Parameters: Target db?, value, from form?
|
}
|
||||||
$input['zahlbarbis'] = $this->app->erp->ReplaceDatum(true,$input['zahlbarbis'],true); // Parameters: Target db?, value, from form?
|
|
||||||
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true);
|
$columns = "id, ";
|
||||||
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$input['kostenstelle']."'");
|
$values = "$id, ";
|
||||||
if(empty($input['projekt']) && !empty($input['adresse'])) {
|
$update = "";
|
||||||
$input['projekt'] = $this->app->erp->GetCreateProjekt($input['adresse']);
|
|
||||||
|
$fix = "";
|
||||||
|
|
||||||
|
foreach ($input as $key => $value) {
|
||||||
|
$columns = $columns.$fix.$key;
|
||||||
|
$values = $values.$fix."'".$value."'";
|
||||||
|
$update = $update.$fix.$key." = '$value'";
|
||||||
|
|
||||||
|
$fix = ", ";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$columns = "id, ";
|
// echo($columns."<br>");
|
||||||
$values = "$id, ";
|
// echo($values."<br>");
|
||||||
$update = "";
|
// echo($update."<br>");
|
||||||
|
|
||||||
$fix = "";
|
|
||||||
|
|
||||||
foreach ($input as $key => $value) {
|
$sql = "INSERT INTO verbindlichkeit (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||||
$columns = $columns.$fix.$key;
|
|
||||||
$values = $values.$fix."'".$value."'";
|
|
||||||
$update = $update.$fix.$key." = '$value'";
|
|
||||||
|
|
||||||
$fix = ", ";
|
// echo($sql);
|
||||||
}
|
|
||||||
|
|
||||||
// echo($columns."<br>");
|
$this->app->DB->Update($sql);
|
||||||
// echo($values."<br>");
|
|
||||||
// echo($update."<br>");
|
|
||||||
|
|
||||||
$sql = "INSERT INTO verbindlichkeit (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
if ($id == 'NULL') {
|
||||||
|
$id = $this->app->DB->GetInsertID();
|
||||||
|
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||||
|
header("Location: index.php?module=verbindlichkeit&action=edit&id=$id&msg=$msg");
|
||||||
|
} else {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'positionen_hinzufuegen':
|
||||||
|
|
||||||
// echo($sql);
|
$freigabeeinkauf = $this->app->DB->Select("SELECT freigabe FROM verbindlichkeit WHERE id =".$id);
|
||||||
|
if ($freigabeeinkauf) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$this->app->DB->Update($sql);
|
// Process multi action
|
||||||
|
$ids = $this->app->Secure->GetPOST('ids');
|
||||||
|
$werte = $this->app->Secure->GetPOST('werte');
|
||||||
|
$preise = $this->app->Secure->GetPOST('preise');
|
||||||
|
$umsatzsteuern = $this->app->Secure->GetPOST('umsatzsteuer');
|
||||||
|
$artikel = $this->app->Secure->GetPOST('artikel');
|
||||||
|
|
||||||
if ($id == 'NULL') {
|
foreach ($ids as $key => $paketdistribution) {
|
||||||
$id = $this->app->DB->GetInsertID();
|
$menge = $werte[$key];
|
||||||
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
|
||||||
header("Location: index.php?module=verbindlichkeit&action=edit&id=$id&msg=$msg");
|
if ($menge <= 0) {
|
||||||
} else {
|
continue;
|
||||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
}
|
||||||
}
|
|
||||||
|
$preis = $preise[$key];
|
||||||
|
$umsatzsteuer = $umsatzsteuern[$key];
|
||||||
|
$ein_artikel = $artikel[$key];
|
||||||
|
|
||||||
|
$sql = "INSERT INTO verbindlichkeit_position (verbindlichkeit,paketdistribution, menge, preis, umsatzsteuer, artikel) VALUES ($id, $paketdistribution, $menge, $preis, '$umsatzsteuer', $ein_artikel)";
|
||||||
|
|
||||||
|
$this->app->DB->Insert($sql);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'positionen_sachkonto_speichern':
|
||||||
|
|
||||||
|
$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':
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
$steuersatz = $this->app->Secure->GetPOST('positionen_steuersatz');
|
||||||
|
if (!is_numeric($steuersatz)) {
|
||||||
|
$steuersatz = 'NULL';
|
||||||
|
}
|
||||||
|
$sql = "update verbindlichkeit_position SET steuersatz = ".$steuersatz." WHERE id IN (".implode(',',$ids).")";
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -469,15 +781,27 @@ class Verbindlichkeit {
|
|||||||
$position['steuersatz_berechnet'] = $tmpsteuersatz;
|
$position['steuersatz_berechnet'] = $tmpsteuersatz;
|
||||||
$position['steuertext_berechnet'] = $tmpsteuertext;
|
$position['steuertext_berechnet'] = $tmpsteuertext;
|
||||||
$position['steuererloes_berechnet'] = $erloes;
|
$position['steuererloes_berechnet'] = $erloes;
|
||||||
|
|
||||||
$betrag_netto += ($position['menge']*$position['preis']);
|
$betrag_netto += ($position['menge']*$position['preis']);
|
||||||
$betrag_brutto += ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100));
|
$betrag_brutto += ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Set('BETRAGNETTO', $betrag_netto);
|
$this->app->Tpl->Set('BETRAGNETTO', $betrag_netto);
|
||||||
$this->app->Tpl->Set('BETRAGBRUTTOPOS', round($betrag_brutto,2));
|
$this->app->Tpl->Set('BETRAGBRUTTOPOS', round($betrag_brutto,2));
|
||||||
|
|
||||||
|
if ($verbindlichkeit_from_db['betrag'] == round($betrag_brutto,2)) {
|
||||||
|
if (!$verbindlichkeit_from_db['freigabe'] && !$einkauf_automatik_aus) {
|
||||||
|
$this->app->DB->Update("UPDATE verbindlichkeit SET freigabe = 1 WHERE id = ".$id);
|
||||||
|
$verbindlichkeit_from_db['freigabe'] = 1;
|
||||||
|
$this->app->erp->BelegProtokoll("verbindlichkeit",$id,"Verbindlichkeit automatisch freigegeben (Einkauf)");
|
||||||
|
$this->app->YUI->Message('success',"Verbindlichkeit automatisch freigegeben (Einkauf)");
|
||||||
|
}
|
||||||
|
$this->app->Tpl->Set('POSITIONENMESSAGE', '<div class="success">Positionen vollständig</div>');
|
||||||
|
} else {
|
||||||
|
$this->app->Tpl->Set('POSITIONENMESSAGE', '<div class="warning">Positionen nicht vollständig. Bruttobetrag '.$verbindlichkeit_from_db['betrag'].', Summe Positionen (brutto) '.round($betrag_brutto,2).', Summe Positionen (netto) '.round($betrag_netto,2).'</div>');
|
||||||
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Set('BETRAGDISABLED', 'disabled');
|
$this->app->Tpl->Set('BETRAGDISABLED', 'disabled');
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -493,9 +817,9 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($verbindlichkeit_from_db['schreibschutz']) {
|
if ($verbindlichkeit_from_db['rechnungsfreigabe']) {
|
||||||
$this->app->Tpl->Set('SAVEDISABLED','disabled');
|
$this->app->Tpl->Set('SAVEDISABLED','disabled');
|
||||||
$this->app->Tpl->Set('MESSAGE',"<div class=\"warning\">Diese Verbindlichkeit ist schreibgeschützt und darf daher nicht mehr bearbeitet werden! <input type=\"button\" value=\"Schreibschutz entfernen\" onclick=\"if(!confirm('Soll der Schreibschutz für diese Verbindlichkeit wirklich entfernt werden?')) return false;else window.location.href='index.php?module=verbindlichkeit&action=schreibschutz&id=$id';\"></div>");
|
$this->app->Tpl->Set('MESSAGE',"<div class=\"warning\">Diese Verbindlichkeit ist schreibgeschützt und darf daher nicht mehr bearbeitet werden! <input type=\"button\" value=\"Schreibschutz entfernen\" onclick=\"if(!confirm('Soll der Schreibschutz für diese Verbindlichkeit wirklich entfernt werden?')) return false;else window.location.href='index.php?module=verbindlichkeit&action=ruecksetzenbuchhaltung&id=$id';\"></div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($verbindlichkeit_from_db['adresse'] || $verbindlichkeit_from_db['status'] == 'angelegt')) {
|
if (empty($verbindlichkeit_from_db['adresse'] || $verbindlichkeit_from_db['status'] == 'angelegt')) {
|
||||||
@ -506,9 +830,12 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
if ($verbindlichkeit_from_db['freigabe']) {
|
if ($verbindlichkeit_from_db['freigabe']) {
|
||||||
$this->app->Tpl->Set('FREIGABEEINKAUFHIDDEN','hidden');
|
$this->app->Tpl->Set('FREIGABEEINKAUFHIDDEN','hidden');
|
||||||
|
$this->app->Tpl->Set('EINKAUFINFOHIDDEN','hidden');
|
||||||
|
$this->app->Tpl->Set('POSITIONHINZUFUEGENHIDDEN','hidden');
|
||||||
} else {
|
} else {
|
||||||
$this->app->Tpl->Set('RUECKSETZENEINKAUFHIDDEN','hidden');
|
$this->app->Tpl->Set('RUECKSETZENEINKAUFHIDDEN','hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verbindlichkeit_from_db['rechnungsfreigabe']) {
|
if ($verbindlichkeit_from_db['rechnungsfreigabe']) {
|
||||||
$this->app->Tpl->Set('FREIGABEBUCHHALTUNGHIDDEN','hidden');
|
$this->app->Tpl->Set('FREIGABEBUCHHALTUNGHIDDEN','hidden');
|
||||||
} else {
|
} else {
|
||||||
@ -550,6 +877,9 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
$this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceLieferantennummer(false,$verbindlichkeit_from_db['adresse'],false)); // Convert ID to form display
|
$this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceLieferantennummer(false,$verbindlichkeit_from_db['adresse'],false)); // Convert ID to form display
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('BESTELLUNG',$this->app->erp->ReplaceBestellung(false,$verbindlichkeit_from_db['bestellung'],false));
|
||||||
|
$this->app->YUI->AutoComplete("bestellung", "lieferantenbestellung",0,"&adresse=".$verbindlichkeit_from_db['adresse']);
|
||||||
|
|
||||||
$this->app->YUI->CkEditor("internebemerkung");
|
$this->app->YUI->CkEditor("internebemerkung");
|
||||||
|
|
||||||
$anzahldateien = $this->app->erp->AnzahlDateien("verbindlichkeit",$id);
|
$anzahldateien = $this->app->erp->AnzahlDateien("verbindlichkeit",$id);
|
||||||
@ -561,6 +891,16 @@ class Verbindlichkeit {
|
|||||||
$this->app->Tpl->Set('INLINEPDF', 'Keine Dateien vorhanden.');
|
$this->app->Tpl->Set('INLINEPDF', 'Keine Dateien vorhanden.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($verbindlichkeit_from_db['freigabe'])) {
|
||||||
|
$this->app->YUI->TableSearch('PAKETDISTRIBUTION', 'verbindlichkeit_paketdistribution_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -- POSITIONEN
|
||||||
|
$this->app->YUI->AutoComplete("positionen_sachkonto", "sachkonto", 1);
|
||||||
|
$this->app->YUI->TableSearch('POSITIONEN', 'verbindlichkeit_positionen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->Tpl->Parse('POSITIONENTAB', "verbindlichkeit_positionen.tpl");
|
||||||
|
// -- POSITIONEN
|
||||||
|
|
||||||
$this->verbindlichkeit_minidetail('MINIDETAIL',false);
|
$this->verbindlichkeit_minidetail('MINIDETAIL',false);
|
||||||
$this->app->Tpl->Parse('PAGE', "verbindlichkeit_edit.tpl");
|
$this->app->Tpl->Parse('PAGE', "verbindlichkeit_edit.tpl");
|
||||||
|
|
||||||
@ -583,6 +923,7 @@ class Verbindlichkeit {
|
|||||||
$input['zahlungsweise'] = $this->app->Secure->GetPOST('zahlungsweise');
|
$input['zahlungsweise'] = $this->app->Secure->GetPOST('zahlungsweise');
|
||||||
$input['eingangsdatum'] = $this->app->Secure->GetPOST('eingangsdatum');
|
$input['eingangsdatum'] = $this->app->Secure->GetPOST('eingangsdatum');
|
||||||
$input['rechnungsdatum'] = $this->app->Secure->GetPOST('rechnungsdatum');
|
$input['rechnungsdatum'] = $this->app->Secure->GetPOST('rechnungsdatum');
|
||||||
|
$input['bestellung'] = $this->app->Secure->GetPOST('bestellung');
|
||||||
$input['freigabe'] = $this->app->Secure->GetPOST('freigabe')?'1':'0';
|
$input['freigabe'] = $this->app->Secure->GetPOST('freigabe')?'1':'0';
|
||||||
$input['rechnungsfreigabe'] = $this->app->Secure->GetPOST('rechnungsfreigabe')?'1':'0';
|
$input['rechnungsfreigabe'] = $this->app->Secure->GetPOST('rechnungsfreigabe')?'1':'0';
|
||||||
$input['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle');
|
$input['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle');
|
||||||
@ -614,7 +955,7 @@ class Verbindlichkeit {
|
|||||||
}
|
}
|
||||||
$this->app->Tpl->Set('KURZUEBERSCHRIFT2',"$name Verbindlichkeit $belegnr");
|
$this->app->Tpl->Set('KURZUEBERSCHRIFT2',"$name Verbindlichkeit $belegnr");
|
||||||
|
|
||||||
if ($invoiceArr['status'] === 'angelegt' || $invoiceArr['schreibschutz'] != 1) {
|
if ($invoiceArr['status'] === 'angelegt' || empty($invoiceArr['status'])) {
|
||||||
$this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=freigabe&id=$id",'Freigabe');
|
$this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=freigabe&id=$id",'Freigabe');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,73 +1007,7 @@ class Verbindlichkeit {
|
|||||||
}
|
}
|
||||||
$this->app->ExitXentral();
|
$this->app->ExitXentral();
|
||||||
}
|
}
|
||||||
|
|
||||||
function verbindlichkeit_positionen() {
|
|
||||||
$this->app->YUI->AARLGPositionen(false); // Render positionen editable into iframe
|
|
||||||
}
|
|
||||||
|
|
||||||
function verbindlichkeit_positioneneditpopup() {
|
|
||||||
$cmd = $this->app->Secure->GetGET('cmd');
|
|
||||||
if($cmd === 'getopenaccordions')
|
|
||||||
{
|
|
||||||
$accordions = $this->app->Secure->GetPOST('accordions');
|
|
||||||
$accordions = explode('*|*',$accordions);
|
|
||||||
foreach($accordions as $k => $v)
|
|
||||||
{
|
|
||||||
if(empty($v))
|
|
||||||
{
|
|
||||||
unset($accordions[$k]);
|
|
||||||
}else{
|
|
||||||
$accordions[$k] = 'verbindlichkeit_accordion'.$v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ret = [];
|
|
||||||
if(!empty($accordions))
|
|
||||||
{
|
|
||||||
$accordions = $this->app->User->GetParameter($accordions);
|
|
||||||
if(!empty($accordions))
|
|
||||||
{
|
|
||||||
foreach($accordions as $v)
|
|
||||||
{
|
|
||||||
if(!empty($v['value']))
|
|
||||||
{
|
|
||||||
$ret['accordions'][] = str_replace('verbindlichkeit_accordion','',$v['name']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo json_encode($ret);
|
|
||||||
$this->app->ExitXentral();
|
|
||||||
}
|
|
||||||
if($cmd === 'setaccordion')
|
|
||||||
{
|
|
||||||
$name = $this->app->Secure->GetPOST('name');
|
|
||||||
$active = $this->app->Secure->GetPOST('active');
|
|
||||||
$this->app->User->SetParameter('verbindlichkeit_accordion'.$name, $active);
|
|
||||||
echo json_encode(array('success'=>1));
|
|
||||||
$this->app->ExitXentral();
|
|
||||||
}
|
|
||||||
$id = $this->app->Secure->GetGET('id');
|
|
||||||
$fmodul = $this->app->Secure->GetGET('fmodul');
|
|
||||||
$artikel= $this->app->DB->Select("SELECT artikel FROM verbindlichkeit_position WHERE id='$id' LIMIT 1");
|
|
||||||
|
|
||||||
// nach page inhalt des dialogs ausgeben
|
|
||||||
$filename = 'widgets/widget.auftag_position_custom.php';
|
|
||||||
if(is_file($filename))
|
|
||||||
{
|
|
||||||
include_once $filename;
|
|
||||||
$widget = new WidgetVerbindlichkeit_positionCustom($this->app,'PAGE');
|
|
||||||
} else {
|
|
||||||
$widget = new WidgetVerbindlichkeit_position($this->app,'PAGE');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sid= $this->app->DB->Select("SELECT verbindlichkeit FROM verbindlichkeit_position WHERE id='$id' LIMIT 1");
|
|
||||||
$widget->form->SpecialActionAfterExecute('close_refresh',
|
|
||||||
"index.php?module=verbindlichkeit&action=positionen&id=$sid&fmodul=$fmodul");
|
|
||||||
$widget->Edit();
|
|
||||||
$this->app->BuildNavigation=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function verbindlichkeit_freigabe()
|
function verbindlichkeit_freigabe()
|
||||||
{
|
{
|
||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
@ -748,7 +1023,7 @@ class Verbindlichkeit {
|
|||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
$gotoedit = true;
|
$gotoedit = true;
|
||||||
}
|
}
|
||||||
$sql = "UPDATE verbindlichkeit SET freigabe = 1 WHERE id=".$id;
|
$sql = "UPDATE verbindlichkeit SET freigabe = 1, schreibschutz = 1 WHERE id=".$id;
|
||||||
$this->app->DB->Update($sql);
|
$this->app->DB->Update($sql);
|
||||||
$this->app->erp->BelegProtokoll("verbindlichkeit",$id,"Verbindlichkeit freigegeben (Einkauf)");
|
$this->app->erp->BelegProtokoll("verbindlichkeit",$id,"Verbindlichkeit freigegeben (Einkauf)");
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
@ -790,11 +1065,11 @@ class Verbindlichkeit {
|
|||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
$gotoedit = true;
|
$gotoedit = true;
|
||||||
}
|
}
|
||||||
$sql = "UPDATE verbindlichkeit SET freigabe = 0 WHERE id=".$id;
|
$sql = "UPDATE verbindlichkeit SET freigabe = 0, schreibschutz = 0 WHERE id=".$id;
|
||||||
$this->app->DB->Update($sql);
|
$this->app->DB->Update($sql);
|
||||||
$this->app->erp->BelegProtokoll("verbindlichkeit",$id,"Verbindlichkeit rückgesetzt (Einkauf)");
|
$this->app->erp->BelegProtokoll("verbindlichkeit",$id,"Verbindlichkeit rückgesetzt (Einkauf)");
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->verbindlichkeit_edit();
|
$this->verbindlichkeit_edit(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +1140,6 @@ class Verbindlichkeit {
|
|||||||
v.skontofestsetzen,
|
v.skontofestsetzen,
|
||||||
v.freigabe,
|
v.freigabe,
|
||||||
v.freigabemitarbeiter,
|
v.freigabemitarbeiter,
|
||||||
v.bestellung,
|
|
||||||
p.abkuerzung AS projekt,
|
p.abkuerzung AS projekt,
|
||||||
v.teilprojekt,
|
v.teilprojekt,
|
||||||
v.auftrag,
|
v.auftrag,
|
||||||
@ -914,6 +1188,86 @@ class Verbindlichkeit {
|
|||||||
$verbindlichkeit_from_db = $result[0];
|
$verbindlichkeit_from_db = $result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$positionen = $this->app->DB->SelectArr("SELECT vp.id,
|
||||||
|
vp.sort,
|
||||||
|
art.name_de,
|
||||||
|
art.nummer,
|
||||||
|
vp.menge,
|
||||||
|
vp.preis,
|
||||||
|
vp.steuersatz,
|
||||||
|
if (skv.sachkonto <> 0,
|
||||||
|
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
||||||
|
(
|
||||||
|
if (skart.sachkonto <> 0,
|
||||||
|
CONCAT(skart.sachkonto,' ',skart.beschriftung, ' (Artikel)'),
|
||||||
|
CONCAT(skadr.sachkonto,' ',skadr.beschriftung, ' (Adresse)')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) AS sachkonto,
|
||||||
|
''
|
||||||
|
FROM verbindlichkeit_position vp
|
||||||
|
INNER JOIN artikel art ON art.id = vp.artikel
|
||||||
|
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 verbindlichkeit='$id'
|
||||||
|
ORDER by vp.sort ASC");
|
||||||
|
|
||||||
|
$tmp = new EasyTable($this->app);
|
||||||
|
$tmp->headings = array('Pos.','Artikel-Nr.','Artikel','Menge','Preis','Steuersatz','WIRDUNTENGEFÜLLTWARUMAUCHIMMER');
|
||||||
|
$betrag_netto = 0;
|
||||||
|
$betrag_brutto = 0;
|
||||||
|
$steuer_normal = 0;
|
||||||
|
$steuer_ermaessigt = 0;
|
||||||
|
foreach ($positionen as $position) {
|
||||||
|
|
||||||
|
$tmpsteuersatz = null;
|
||||||
|
$tmpsteuertext = null;
|
||||||
|
$erloes = null;
|
||||||
|
|
||||||
|
$this->app->erp->GetSteuerPosition("verbindlichkeit",$position['id'],$tmpsteuersatz,$tmpsteuertext,$erloes);
|
||||||
|
|
||||||
|
$position['steuersatz_berechnet'] = $tmpsteuersatz;
|
||||||
|
$position['steuertext_berechnet'] = $tmpsteuertext;
|
||||||
|
$position['steuererloes_berechnet'] = $erloes;
|
||||||
|
|
||||||
|
$betrag_netto += ($position['menge']*$position['preis']);
|
||||||
|
$betrag_brutto += ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100));
|
||||||
|
|
||||||
|
$row = array(
|
||||||
|
$position['sort'],
|
||||||
|
$position['nummer'],
|
||||||
|
$position['name_de'],
|
||||||
|
$position['menge'],
|
||||||
|
$position['preis'],
|
||||||
|
$position['steuersatz_berechnet'],
|
||||||
|
$position['sachkonto']
|
||||||
|
);
|
||||||
|
$tmp->AddRow($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = array(
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'<b>Betrag Positionen netto</b>',
|
||||||
|
'<b>Betrag Positionen brutto</b>'
|
||||||
|
);
|
||||||
|
$tmp->AddRow($row);
|
||||||
|
$row = array(
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
round($betrag_netto,2),
|
||||||
|
round($betrag_brutto,2)
|
||||||
|
);
|
||||||
|
$tmp->AddRow($row);
|
||||||
|
$tmp->DisplayNew('ARTIKEL',"Sachkonto","noAction");
|
||||||
|
|
||||||
$tmp = new EasyTable($this->app);
|
$tmp = new EasyTable($this->app);
|
||||||
$tmp->Query("SELECT zeit,bearbeiter,grund FROM verbindlichkeit_protokoll WHERE verbindlichkeit='$id' ORDER by zeit DESC",0,"");
|
$tmp->Query("SELECT zeit,bearbeiter,grund FROM verbindlichkeit_protokoll WHERE verbindlichkeit='$id' ORDER by zeit DESC",0,"");
|
||||||
$tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction");
|
$tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction");
|
||||||
|
Loading…
Reference in New Issue
Block a user