mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 06:00:28 +01:00
lieferantengutschrift positionen
This commit is contained in:
parent
8dc86fdddf
commit
ca4e320085
@ -111307,6 +111307,17 @@
|
|||||||
"Extra": "",
|
"Extra": "",
|
||||||
"Privileges": "select,insert,update,references",
|
"Privileges": "select,insert,update,references",
|
||||||
"Comment": ""
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "ust_befreit",
|
||||||
|
"Type": "int(1)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": "0",
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keys": [
|
"keys": [
|
||||||
@ -111553,6 +111564,17 @@
|
|||||||
"Privileges": "select,insert,update,references",
|
"Privileges": "select,insert,update,references",
|
||||||
"Comment": ""
|
"Comment": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Field": "verbindlichkeit_position",
|
||||||
|
"Type": "int(11)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": "0",
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Field": "kontorahmen",
|
"Field": "kontorahmen",
|
||||||
"Type": "int(11)",
|
"Type": "int(11)",
|
||||||
@ -111563,7 +111585,7 @@
|
|||||||
"Extra": "",
|
"Extra": "",
|
||||||
"Privileges": "select,insert,update,references",
|
"Privileges": "select,insert,update,references",
|
||||||
"Comment": ""
|
"Comment": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keys": [
|
"keys": [
|
||||||
{
|
{
|
||||||
|
@ -13248,6 +13248,11 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
|||||||
return $this->ReplaceANABRELSGSBE("rechnung",$db,$value,$fromform);
|
return $this->ReplaceANABRELSGSBE("rechnung",$db,$value,$fromform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ReplaceVerbindlichkeit($db,$value,$fromform)
|
||||||
|
{
|
||||||
|
return $this->ReplaceANABRELSGSBE("verbindlichkeit",$db,$value,$fromform);
|
||||||
|
}
|
||||||
|
|
||||||
function ReplaceRetoure($db,$value,$fromform)
|
function ReplaceRetoure($db,$value,$fromform)
|
||||||
{
|
{
|
||||||
return $this->ReplaceANABRELSGSBE('retoure',$db,$value,$fromform);
|
return $this->ReplaceANABRELSGSBE('retoure',$db,$value,$fromform);
|
||||||
|
@ -3832,10 +3832,13 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
|||||||
$term = str_replace(',','',$term);
|
$term = str_replace(',','',$term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$adresse = (int)$this->app->Secure->GetGET('adresse');
|
||||||
|
if (!empty($adresse)) {
|
||||||
|
$subwhere .= " AND a.id = ".$adresse;
|
||||||
|
}
|
||||||
|
|
||||||
$sql =
|
$sql =
|
||||||
"SELECT CONCAT(v.id,
|
"SELECT CONCAT(v.belegnr,
|
||||||
IF(IFNULL(v.belegnr, '') <> '' AND v.belegnr!=v.id,
|
|
||||||
CONCAT(' Nr. ',v.belegnr),''),
|
|
||||||
' Betrag: ',".$this->app->erp->FormatPreis('v.betrag',2).",
|
' Betrag: ',".$this->app->erp->FormatPreis('v.betrag',2).",
|
||||||
if(v.skonto <> 0,CONCAT(' mit Skonto ',v.skonto,'% ',
|
if(v.skonto <> 0,CONCAT(' mit Skonto ',v.skonto,'% ',
|
||||||
".$this->app->erp->FormatPreis("v.betrag-((v.betrag/100.0)*v.skonto)",2)."),''),' ',
|
".$this->app->erp->FormatPreis("v.betrag-((v.betrag/100.0)*v.skonto)",2)."),''),' ',
|
||||||
@ -3848,7 +3851,7 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
|||||||
a.name,' (Lieferant ',a.lieferantennummer,if(a.lieferantennummer_buchhaltung!='' AND a.lieferantennummer <> a.lieferantennummer_buchhaltung,CONCAT(' ',a.lieferantennummer_buchhaltung),''),') RE ',v.rechnung,' Rechnungsdatum ',DATE_FORMAT(v.rechnungsdatum,'%d.%m.%Y')) as bezeichnung
|
a.name,' (Lieferant ',a.lieferantennummer,if(a.lieferantennummer_buchhaltung!='' AND a.lieferantennummer <> a.lieferantennummer_buchhaltung,CONCAT(' ',a.lieferantennummer_buchhaltung),''),') RE ',v.rechnung,' Rechnungsdatum ',DATE_FORMAT(v.rechnungsdatum,'%d.%m.%Y')) as bezeichnung
|
||||||
FROM verbindlichkeit AS v
|
FROM verbindlichkeit AS v
|
||||||
LEFT JOIN adresse AS a ON a.id=v.adresse
|
LEFT JOIN adresse AS a ON a.id=v.adresse
|
||||||
WHERE ($subwhere) AND bezahlt!=1 AND status!='storniert'
|
WHERE ($subwhere) AND bezahlt!=1 AND status!='storniert' AND belegnr <> ''
|
||||||
ORDER by v.id DESC"; //AND v.status!='bezahlt' // heute wieder raus
|
ORDER by v.id DESC"; //AND v.status!='bezahlt' // heute wieder raus
|
||||||
|
|
||||||
$arr = $this->app->DB->SelectArr($sql);
|
$arr = $this->app->DB->SelectArr($sql);
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
{|Adresse|}:
|
{|Adresse|}:
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20" [SAVEDISABLED] required>
|
<input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20" [ADRESSESAVEDISABLED] required>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
64
www/pages/content/lieferantengutschrift_position_edit.tpl
Normal file
64
www/pages/content/lieferantengutschrift_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>
|
||||||
|
|
@ -81,7 +81,7 @@
|
|||||||
function allewareneingaengeauswaehlen()
|
function allewareneingaengeauswaehlen()
|
||||||
{
|
{
|
||||||
var wert = $('#auswahlallewareneingaenge').prop('checked');
|
var wert = $('#auswahlallewareneingaenge').prop('checked');
|
||||||
$('#lieferantengutschrift_paketdistribution_list').find(':checkbox').prop('checked',wert);
|
$('#verbindlichkeit_positionen').find(':checkbox').prop('checked',wert);
|
||||||
}
|
}
|
||||||
function alleauswaehlen()
|
function alleauswaehlen()
|
||||||
{
|
{
|
||||||
|
@ -211,10 +211,10 @@ class lieferantengutschrift {
|
|||||||
$freigabe = $app->DB->Select("SELECT freigabe FROM lieferantengutschrift WHERE id = '".$id."'");
|
$freigabe = $app->DB->Select("SELECT freigabe FROM lieferantengutschrift WHERE id = '".$id."'");
|
||||||
$rechnungsfreigabe = $app->DB->Select("SELECT rechnungsfreigabe FROM lieferantengutschrift WHERE id = '".$id."'");
|
$rechnungsfreigabe = $app->DB->Select("SELECT rechnungsfreigabe FROM lieferantengutschrift WHERE id = '".$id."'");
|
||||||
|
|
||||||
$heading = array('', 'Artikel-Nr.','Artikel','Bemerkung','Menge','Preis','Steuersatz','Sachkonto');
|
$heading = array('' ,'Verbindlichkeit', 'Artikel-Nr.','Artikel','Menge','Preis','Steuersatz','Sachkonto');
|
||||||
$width = array( '1%', '20%', '20%', '1%', '1%', '3%', '1%', '1%');
|
$width = array( '1%','1%', '20%', '20%', '1%', '1%', '3%', '1%', '1%');
|
||||||
|
|
||||||
$findcols = array('vp.id','art.nummer','art.name_de','vp.menge','vp.preis','vp.steuersatz',"CONCAT(skv.sachkonto,' ',skv.beschriftung)",'vp.id');
|
$findcols = array('lgp.id','v.belegnr','art.nummer','art.name_de','lgp.menge','lgp.preis','lgp.steuersatz',"CONCAT(skv.sachkonto,' ',skv.beschriftung)",'lgp.id');
|
||||||
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
$searchsql = array('p.nummer', 'p.name', 'p.bemerkung');
|
||||||
|
|
||||||
$alignright = array(8,9,10);
|
$alignright = array(8,9,10);
|
||||||
@ -232,31 +232,139 @@ class lieferantengutschrift {
|
|||||||
}
|
}
|
||||||
$heading[] = '';
|
$heading[] = '';
|
||||||
|
|
||||||
|
$box = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',lgp.id,'\" />') AS `auswahl`";
|
||||||
|
|
||||||
|
$verbindlichkeitlink = array (
|
||||||
|
'<a href="index.php?module=verbindlichkeit&action=edit&id=',
|
||||||
|
['sql' => 'v.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'v.belegnr'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$artikellink = array (
|
||||||
|
'<a href="index.php?module=artikel&action=edit&id=',
|
||||||
|
['sql' => 'art.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'art.nummer'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS
|
||||||
|
lgp.id,
|
||||||
|
$box,
|
||||||
|
".$this->app->erp->ConcatSQL($verbindlichkeitlink).",
|
||||||
|
".$this->app->erp->ConcatSQL($artikellink).",
|
||||||
|
art.name_de,
|
||||||
|
lgp.menge,
|
||||||
|
lgp.preis,
|
||||||
|
lgp.steuersatz,
|
||||||
|
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
||||||
|
lgp.id
|
||||||
|
FROM
|
||||||
|
lieferantengutschrift_position lgp
|
||||||
|
INNER JOIN lieferantengutschrift lg ON
|
||||||
|
lg.id = lgp.lieferantengutschrift
|
||||||
|
LEFT JOIN verbindlichkeit_position vp ON
|
||||||
|
vp.id = lgp.verbindlichkeit_position
|
||||||
|
LEFT JOIN verbindlichkeit v ON
|
||||||
|
vp.verbindlichkeit = v.id
|
||||||
|
INNER JOIN artikel art ON
|
||||||
|
art.id = lgp.artikel
|
||||||
|
INNER JOIN adresse adr ON
|
||||||
|
adr.id = lg.adresse
|
||||||
|
LEFT JOIN kontorahmen skv ON skv.id = lgp.kontorahmen
|
||||||
|
";
|
||||||
|
|
||||||
|
$where = "lgp.lieferantengutschrift = ".$id;
|
||||||
|
|
||||||
|
$count = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'verbindlichkeit_positionen':
|
||||||
|
|
||||||
|
$allowed['verbindlichkeit_positionen'] = array('list');
|
||||||
|
|
||||||
|
$id = $app->Secure->GetGET('id');
|
||||||
|
|
||||||
|
//$verbindlichkeit = $app->DB->Select("SELECT verbindlichkeit FROM lieferantengutschrift WHERE id = '".$id."'");
|
||||||
|
|
||||||
|
$heading = array('', 'Verbindlichkeit', 'Artikel-Nr.','Artikel','Menge','Preis','Steuersatz','Sachkonto', '');
|
||||||
|
$width = array( '1%','2%', '2%', '20%', '1%', '1%', '3%', '1%', '1%');
|
||||||
|
|
||||||
|
$findcols = array('vp.id','v.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');
|
||||||
|
|
||||||
|
$alignright = array(8,9,10);
|
||||||
|
|
||||||
|
$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=\"checkbox\" name=\"ids[]\" value=\"',
|
||||||
|
['sql' => 'pd.id'],
|
||||||
|
'"/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$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.00001" value="',
|
||||||
|
['sql' => $this->app->erp->FormatMenge("COALESCE(bp.preis,0)",5)],
|
||||||
|
'" min="0"',
|
||||||
|
'"/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$artikellink = array (
|
||||||
|
'<a href="index.php?module=artikel&action=edit&id=',
|
||||||
|
['sql' => 'art.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'art.nummer'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
$box = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',vp.id,'\" />') AS `auswahl`";
|
$box = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',vp.id,'\" />') AS `auswahl`";
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT SQL_CALC_FOUND_ROWS
|
SELECT SQL_CALC_FOUND_ROWS
|
||||||
vp.id,
|
vp.id,
|
||||||
$box,
|
".$this->app->erp->ConcatSQL($auswahl).",
|
||||||
art.nummer,
|
v.belegnr,
|
||||||
|
".$this->app->erp->ConcatSQL($artikellink).",
|
||||||
art.name_de,
|
art.name_de,
|
||||||
vp.menge,
|
".$this->app->erp->ConcatSQL($werte).",
|
||||||
vp.preis,
|
vp.preis,
|
||||||
vp.steuersatz,
|
vp.steuersatz,
|
||||||
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
CONCAT(skv.sachkonto,' ',skv.beschriftung),
|
||||||
vp.id
|
vp.id
|
||||||
FROM
|
FROM
|
||||||
lieferantengutschrift_position vp
|
verbindlichkeit_position vp
|
||||||
INNER JOIN lieferantengutschrift v ON
|
INNER JOIN verbindlichkeit v ON
|
||||||
v.id = vp.lieferantengutschrift
|
v.id = vp.verbindlichkeit
|
||||||
|
INNER JOIN paketdistribution pd ON
|
||||||
|
pd.id = vp.paketdistribution
|
||||||
INNER JOIN artikel art ON
|
INNER JOIN artikel art ON
|
||||||
art.id = vp.artikel
|
art.id = pd.artikel
|
||||||
INNER JOIN adresse adr ON
|
INNER JOIN adresse adr ON
|
||||||
adr.id = v.adresse
|
adr.id = v.adresse
|
||||||
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
||||||
";
|
";
|
||||||
|
|
||||||
$where = "vp.lieferantengutschrift = ".$id;
|
$where = "v.adresse = (SELECT adresse FROM lieferantengutschrift WHERE id = ".$id.") AND v.status = 'freigegeben'";
|
||||||
|
|
||||||
$count = "";
|
$count = "";
|
||||||
|
|
||||||
@ -474,7 +582,8 @@ class lieferantengutschrift {
|
|||||||
// Write to database
|
// Write to database
|
||||||
// Add checks here
|
// Add checks here
|
||||||
|
|
||||||
$freigabe = $this->app->DB->SelectArr("SELECT rechnungsfreigabe, freigabe FROM lieferantengutschrift WHERE id =".$id)[0];
|
$freigabe = $this->app->DB->SelectArr("SELECT rechnungsfreigabe, freigabe, adresse, belegnr FROM lieferantengutschrift WHERE id =".$id)[0];
|
||||||
|
|
||||||
if ($freigabe['rechnungsfreigabe'] || $freigabe['freigabe']) {
|
if ($freigabe['rechnungsfreigabe'] || $freigabe['freigabe']) {
|
||||||
$internebemerkung = $input['internebemerkung'];
|
$internebemerkung = $input['internebemerkung'];
|
||||||
$projekt = $input['projekt'];
|
$projekt = $input['projekt'];
|
||||||
@ -484,7 +593,13 @@ class lieferantengutschrift {
|
|||||||
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$projekt,true);
|
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$projekt,true);
|
||||||
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$kostenstelle."'");
|
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$kostenstelle."'");
|
||||||
} else {
|
} else {
|
||||||
$input['adresse'] = $this->app->erp->ReplaceLieferantennummer(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
|
|
||||||
|
if ($freigabe['belegnr']) {
|
||||||
|
unset($input['adresse']);
|
||||||
|
} 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['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['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['skontobis'] = $this->app->erp->ReplaceDatum(true,$input['skontobis'],true); // Parameters: Target db?, value, from form?
|
||||||
@ -513,9 +628,7 @@ class lieferantengutschrift {
|
|||||||
$input['skontobis'] = date('Y-m-d',strtotime($input['rechnungsdatum']." + ".$adressdaten['zahlungszieltageskontolieferant']." days"));
|
$input['skontobis'] = date('Y-m-d',strtotime($input['rechnungsdatum']." + ".$adressdaten['zahlungszieltageskontolieferant']." days"));
|
||||||
$input['skonto'] = $adressdaten['zahlungszielskontolieferant'];
|
$input['skonto'] = $adressdaten['zahlungszielskontolieferant'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = "id, ";
|
$columns = "id, ";
|
||||||
@ -564,7 +677,7 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
$bruttoeingabe = $this->app->Secure->GetPOST('bruttoeingabe');
|
$bruttoeingabe = $this->app->Secure->GetPOST('bruttoeingabe');
|
||||||
|
|
||||||
foreach ($ids as $key => $paketdistribution) {
|
foreach ($ids as $key => $verbindlichkeit_position) {
|
||||||
$menge = $werte[$key];
|
$menge = $werte[$key];
|
||||||
|
|
||||||
if ($menge <= 0) {
|
if ($menge <= 0) {
|
||||||
@ -575,24 +688,24 @@ class lieferantengutschrift {
|
|||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
IF(
|
IF(
|
||||||
pd.menge > COALESCE(vp.menge,0),
|
vp.menge > COALESCE(lgp.menge,0),
|
||||||
pd.menge - COALESCE(vp.menge,0),
|
vp.menge - COALESCE(lgp.menge,0),
|
||||||
0
|
0
|
||||||
) offen_menge
|
) offen_menge
|
||||||
FROM
|
FROM
|
||||||
paketdistribution pd
|
verbindlichkeit_position vp
|
||||||
LEFT JOIN(
|
LEFT JOIN(
|
||||||
SELECT
|
SELECT
|
||||||
paketdistribution,
|
verbindlichkeit_position,
|
||||||
SUM(menge) AS menge
|
SUM(menge) AS menge
|
||||||
FROM
|
FROM
|
||||||
lieferantengutschrift_position vp
|
lieferantengutschrift_position lgp
|
||||||
GROUP BY
|
GROUP BY
|
||||||
paketdistribution
|
verbindlichkeit_position
|
||||||
) vp
|
) lgp
|
||||||
ON
|
ON
|
||||||
vp.paketdistribution = pd.id
|
vp.id = lgp.verbindlichkeit_position
|
||||||
WHERE pd.id = ".$paketdistribution."
|
WHERE vp.id = ".$verbindlichkeit_position."
|
||||||
";
|
";
|
||||||
$offen_menge = $this->app->DB->Select($sql);
|
$offen_menge = $this->app->DB->Select($sql);
|
||||||
|
|
||||||
@ -604,31 +717,32 @@ class lieferantengutschrift {
|
|||||||
$menge = $offen_menge;
|
$menge = $offen_menge;
|
||||||
}
|
}
|
||||||
|
|
||||||
$preis = $preise[$key];
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
a.id,
|
a.id,
|
||||||
a.umsatzsteuer,
|
a.umsatzsteuer,
|
||||||
a.steuersatz,
|
a.steuersatz,
|
||||||
COALESCE(if (skart.id <> 0,skart.id,skadr.id),0) AS kontorahmen
|
COALESCE(if (skart.id <> 0,skart.id,skadr.id),0) AS kontorahmen,
|
||||||
|
vp.preis
|
||||||
FROM
|
FROM
|
||||||
paketdistribution pd
|
verbindlichkeit_position vp
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
paketannahme pa ON pa.id = pd.paketannahme
|
verbindlichkeit v ON v.id = vp.verbindlichkeit
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
artikel a ON a.id = pd.artikel
|
artikel a ON a.id = vp.artikel
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
adresse adr ON pa.adresse = adr.id
|
adresse adr ON v.adresse = adr.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
kontorahmen skart ON skart.id = a.kontorahmen
|
kontorahmen skart ON skart.id = a.kontorahmen
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
kontorahmen skadr ON skadr.id = adr.kontorahmen
|
kontorahmen skadr ON skadr.id = adr.kontorahmen
|
||||||
WHERE pd.id =".$paketdistribution;
|
WHERE vp.id =".$verbindlichkeit_position;
|
||||||
|
|
||||||
$artikel = $this->app->DB->SelectRow($sql);
|
$artikel = $this->app->DB->SelectRow($sql);
|
||||||
|
|
||||||
$einartikel = $artikel['id'];
|
$einartikel = $artikel['id'];
|
||||||
$umsatzsteuer = $artikel['umsatzsteuer'];
|
$umsatzsteuer = $artikel['umsatzsteuer'];
|
||||||
$kontorahmen = $artikel['kontorahmen'];
|
$kontorahmen = $artikel['kontorahmen'];
|
||||||
|
$preis = $artikel['preis'];
|
||||||
|
|
||||||
if(empty($umsatzsteuer) && is_numeric($artikel['steuersatz'])) {
|
if(empty($umsatzsteuer) && is_numeric($artikel['steuersatz'])) {
|
||||||
$steuersatz = $artikel['steuersatz'];
|
$steuersatz = $artikel['steuersatz'];
|
||||||
@ -639,9 +753,8 @@ class lieferantengutschrift {
|
|||||||
if ($bruttoeingabe) {
|
if ($bruttoeingabe) {
|
||||||
$preis = $preis / (1+($steuersatz/100));
|
$preis = $preis / (1+($steuersatz/100));
|
||||||
}
|
}
|
||||||
$sql = "INSERT INTO lieferantengutschrift_position (lieferantengutschrift,paketdistribution, menge, preis, steuersatz, artikel, kontorahmen) VALUES ($id, $paketdistribution, $menge, $preis, $steuersatz, $einartikel, $kontorahmen)";
|
$sql = "INSERT INTO lieferantengutschrift_position (lieferantengutschrift,verbindlichkeit_position, menge, preis, steuersatz, artikel, kontorahmen) VALUES ($id, $verbindlichkeit_position, $menge, $preis, $steuersatz, $einartikel, $kontorahmen)";
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'positionen_entfernen':
|
case 'positionen_entfernen':
|
||||||
@ -734,7 +847,8 @@ class lieferantengutschrift {
|
|||||||
v.beschreibung,
|
v.beschreibung,
|
||||||
v.sachkonto,
|
v.sachkonto,
|
||||||
v.internebemerkung,
|
v.internebemerkung,
|
||||||
a.lieferantennummer,
|
v.verbindlichkeit,
|
||||||
|
a.lieferantennummer,
|
||||||
a.name AS adresse_name FROM lieferantengutschrift v LEFT JOIN adresse a ON a.id = v.adresse"." WHERE v.id=$id");
|
a.name AS adresse_name FROM lieferantengutschrift v LEFT JOIN adresse a ON a.id = v.adresse"." WHERE v.id=$id");
|
||||||
|
|
||||||
foreach ($result[0] as $key => $value) {
|
foreach ($result[0] as $key => $value) {
|
||||||
@ -802,6 +916,13 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
$this->app->Tpl->Set('FREIGABEEINKAUFHIDDEN','hidden'); // prevent manual setting
|
$this->app->Tpl->Set('FREIGABEEINKAUFHIDDEN','hidden'); // prevent manual setting
|
||||||
|
|
||||||
|
if (!empty($lieferantengutschrift_from_db['belegnr'])) {
|
||||||
|
$this->app->Tpl->Set('ADRESSESAVEDISABLED','disabled');
|
||||||
|
} else {
|
||||||
|
$this->app->YUI->AutoComplete("adresse", "lieferant");
|
||||||
|
$this->app->YUI->AutoComplete("verbindlichkeit", "verbindlichkeit",false,"&adresse=".$lieferantengutschrift_from_db['adresse']);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($lieferantengutschrift_from_db['adresse']) || $lieferantengutschrift_from_db['status'] == 'angelegt') {
|
if (empty($lieferantengutschrift_from_db['adresse']) || $lieferantengutschrift_from_db['status'] == 'angelegt') {
|
||||||
$this->app->Tpl->Set('FREIGABEBUCHHALTUNGHIDDEN','hidden');
|
$this->app->Tpl->Set('FREIGABEBUCHHALTUNGHIDDEN','hidden');
|
||||||
$this->app->Tpl->Set('FREIGABEBEZAHLTHIDDEN','hidden');
|
$this->app->Tpl->Set('FREIGABEBEZAHLTHIDDEN','hidden');
|
||||||
@ -859,7 +980,8 @@ class lieferantengutschrift {
|
|||||||
$icons = $this->app->DB->SelectArr($sql);
|
$icons = $this->app->DB->SelectArr($sql);
|
||||||
$this->app->Tpl->Add('STATUSICONS', $icons[0]['icons']);
|
$this->app->Tpl->Add('STATUSICONS', $icons[0]['icons']);
|
||||||
|
|
||||||
$this->app->YUI->AutoComplete("adresse", "lieferant");
|
$this->app->Tpl->Set('VERBINDLICHKEIT',$this->app->erp->ReplaceVerbindlichkeit(false,$lieferantengutschrift_from_db['verbindlichkeit'],false));
|
||||||
|
|
||||||
$this->app->YUI->AutoComplete("projekt", "projektname", 1);
|
$this->app->YUI->AutoComplete("projekt", "projektname", 1);
|
||||||
$this->app->Tpl->Set('PROJEKT',$this->app->erp->ReplaceProjekt(false,$lieferantengutschrift_from_db['projekt'],false));
|
$this->app->Tpl->Set('PROJEKT',$this->app->erp->ReplaceProjekt(false,$lieferantengutschrift_from_db['projekt'],false));
|
||||||
$this->app->YUI->AutoComplete("kostenstelle", "kostenstelle", 1);
|
$this->app->YUI->AutoComplete("kostenstelle", "kostenstelle", 1);
|
||||||
@ -887,8 +1009,14 @@ class lieferantengutschrift {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($lieferantengutschrift_from_db['freigabe'])) {
|
if (empty($lieferantengutschrift_from_db['freigabe'])) {
|
||||||
$this->app->YUI->TableSearch('PAKETDISTRIBUTION', 'artikel_manuell', "show", "", "", basename(__FILE__), __CLASS__);
|
|
||||||
}
|
if (empty($lieferantengutschrift_from_db['verbindlichkeit'])) {
|
||||||
|
$this->app->YUI->TableSearch('PAKETDISTRIBUTION', 'artikel_manuell', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->app->YUI->TableSearch('PAKETDISTRIBUTION', 'verbindlichkeit_positionen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -- POSITIONEN
|
// -- POSITIONEN
|
||||||
$this->app->YUI->AutoComplete("positionen_sachkonto", "sachkonto", 1);
|
$this->app->YUI->AutoComplete("positionen_sachkonto", "sachkonto", 1);
|
||||||
@ -1114,37 +1242,16 @@ class lieferantengutschrift {
|
|||||||
} else {
|
} else {
|
||||||
return('lieferantengutschrift nicht freigebeben '.$this->lieferantengutschrift_get_belegnr($id));
|
return('lieferantengutschrift nicht freigebeben '.$this->lieferantengutschrift_get_belegnr($id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE lieferantengutschrift SET freigabe = 1 WHERE id=".$id;
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
|
||||||
// Check wareneingang status
|
if (!$text) {
|
||||||
$sql = "SELECT
|
$text = "lieferantengutschrift freigegeben (Einkauf)";
|
||||||
pa.id
|
|
||||||
FROM lieferantengutschrift_position vp
|
|
||||||
INNER JOIN paketdistribution pd ON pd.id = vp.paketdistribution
|
|
||||||
INNER JOIN paketannahme pa ON pa.id = pd.paketannahme
|
|
||||||
WHERE
|
|
||||||
lieferantengutschrift='$id'
|
|
||||||
AND
|
|
||||||
pa.status = 'abgeschlossen'
|
|
||||||
";
|
|
||||||
|
|
||||||
$check = $this->app->DB->SelectArr($sql);
|
|
||||||
|
|
||||||
if (empty($check)) {
|
|
||||||
if ($gotoedit) {
|
|
||||||
$this->app->YUI->Message('warning','Waren-/Leistungsprüfung (Einkauf) nicht abgeschlossen');
|
|
||||||
} else {
|
|
||||||
return('Waren-/Leistungsprüfung (Einkauf) nicht abgeschlossen '.$this->lieferantengutschrift_get_belegnr($id));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$sql = "UPDATE lieferantengutschrift SET freigabe = 1 WHERE id=".$id;
|
|
||||||
$this->app->DB->Update($sql);
|
|
||||||
|
|
||||||
if (!$text) {
|
|
||||||
$text = "lieferantengutschrift freigegeben (Einkauf)";
|
|
||||||
}
|
|
||||||
$this->app->erp->BelegProtokoll("lieferantengutschrift",$id,$text);
|
|
||||||
}
|
}
|
||||||
|
$this->app->erp->BelegProtokoll("lieferantengutschrift",$id,$text);
|
||||||
|
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->lieferantengutschrift_edit();
|
$this->lieferantengutschrift_edit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user