verbindlichkeit added positionen with sachkonto

This commit is contained in:
OpenXE 2023-12-11 22:17:28 +01:00
parent bbf8b071c0
commit 57f0e2f627
9 changed files with 524 additions and 397 deletions

View File

@ -2853,7 +2853,20 @@ class YUI {
LEFT JOIN artikel a ON a.id=b.artikel LEFT JOIN projekt p ON b.projekt=p.id LEFT JOIN artikel a ON a.id=b.artikel LEFT JOIN projekt p ON b.projekt=p.id
WHERE b.$module='$id'"; WHERE b.$module='$id'";
} else { }
else if ($module == "verbindlichkeit") // OpenXE
{
$sql = "SELECT $sortcol, if(b.beschreibung!='',
if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(CONCAT(b.bezeichnung,' *'),1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),CONCAT(b.bezeichnung,' *')),
if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(b.bezeichnung,1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),b.bezeichnung))
as Artikel,
p.abkuerzung as projekt, a.nummer as nummer, b.nummer as nummer, DATE_FORMAT(lieferdatum,'%d.%m.%Y') as lieferdatum, trim(b.menge)+0 as menge, " . $this->FormatPreis($preiscell) . " as preis, CONCAT(k.sachkonto,' - ',k.beschriftung) AS sachkonto, b.id as id
FROM $table b
LEFT JOIN artikel a ON a.id=b.artikel LEFT JOIN projekt p ON b.projekt=p.id
LEFT JOIN kontorahmen k ON k.id = b.sachkonto
WHERE b.$module='$id'";
}
else {
$sql = null; $sql = null;
$this->app->erp->RunHook('yui_position_sql', 3, $table, $id, $sql); $this->app->erp->RunHook('yui_position_sql', 3, $table, $id, $sql);
if($sql === null){ if($sql === null){

View File

@ -104773,7 +104773,7 @@
}, },
{ {
"Field": "adresse", "Field": "adresse",
"Type": "int", "Type": "int(11)",
"Collation": null, "Collation": null,
"Null": "NO", "Null": "NO",
"Key": "", "Key": "",
@ -111280,6 +111280,17 @@
"Extra": "", "Extra": "",
"Privileges": "select,insert,update,references", "Privileges": "select,insert,update,references",
"Comment": "" "Comment": ""
},
{
"Field": "sachkonto",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "0",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
} }
], ],
"keys": [ "keys": [

View File

@ -38,6 +38,7 @@ class ObjGenVerbindlichkeit_Position
private $preis; private $preis;
private $menge; private $menge;
private $kostenstelle; private $kostenstelle;
private $sachkonto;
public $app; //application object public $app; //application object
@ -76,12 +77,13 @@ $result = $result[0];
$this->preis=$result['preis']; $this->preis=$result['preis'];
$this->menge=$result['menge']; $this->menge=$result['menge'];
$this->kostenstelle=$result['kostenstelle']; $this->kostenstelle=$result['kostenstelle'];
$this->sachkonto=$result['sachkonto'];
} }
public function Create() public function Create()
{ {
$sql = "INSERT INTO `verbindlichkeit_position` (`id`,`verbindlichkeit`,`sort`,`artikel`,`projekt`,`bestellung`,`nummer`,`bestellnummer`,`waehrung`,`einheit`,`vpe`,`bezeichnung`,`umsatzsteuer`,`status`,`beschreibung`,`lieferdatum`,`steuersatz`,`steuertext`,`preis`,`menge`,`kostenstelle`) $sql = "INSERT INTO `verbindlichkeit_position` (`id`,`verbindlichkeit`,`sort`,`artikel`,`projekt`,`bestellung`,`nummer`,`bestellnummer`,`waehrung`,`einheit`,`vpe`,`bezeichnung`,`umsatzsteuer`,`status`,`beschreibung`,`lieferdatum`,`steuersatz`,`steuertext`,`preis`,`menge`,`kostenstelle`)
VALUES(NULL,'{$this->verbindlichkeit}','{$this->sort}','{$this->artikel}','{$this->projekt}','{$this->bestellung}','{$this->nummer}','{$this->bestellnummer}','{$this->waehrung}','{$this->einheit}','{$this->vpe}','{$this->bezeichnung}','{$this->umsatzsteuer}','{$this->status}','{$this->beschreibung}','{$this->lieferdatum}','{$this->steuersatz}','{$this->steuertext}','{$this->preis}','{$this->menge}','{$this->kostenstelle}')"; VALUES(NULL,'{$this->verbindlichkeit}','{$this->sort}','{$this->artikel}','{$this->projekt}','{$this->bestellung}','{$this->nummer}','{$this->bestellnummer}','{$this->waehrung}','{$this->einheit}','{$this->vpe}','{$this->bezeichnung}','{$this->umsatzsteuer}','{$this->status}','{$this->beschreibung}','{$this->lieferdatum}','{$this->steuersatz}','{$this->steuertext}','{$this->preis}','{$this->menge}','{$this->kostenstelle}','{$this->sachkonto}')";
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);
$this->id = $this->app->DB->GetInsertID(); $this->id = $this->app->DB->GetInsertID();
@ -113,7 +115,8 @@ $result = $result[0];
`steuertext`='{$this->steuertext}', `steuertext`='{$this->steuertext}',
`preis`='{$this->preis}', `preis`='{$this->preis}',
`menge`='{$this->menge}', `menge`='{$this->menge}',
`kostenstelle`='{$this->kostenstelle}' `kostenstelle`='{$this->kostenstelle}',
`sachkonto`='{$this->sachkonto}'
WHERE (`id`='{$this->id}')"; WHERE (`id`='{$this->id}')";
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
@ -152,6 +155,7 @@ $result = $result[0];
$this->preis=''; $this->preis='';
$this->menge=''; $this->menge='';
$this->kostenstelle=''; $this->kostenstelle='';
$this->sachkonto='';
} }
public function Copy() public function Copy()
@ -234,5 +238,7 @@ $result = $result[0];
public function GetMenge() { return $this->menge; } public function GetMenge() { return $this->menge; }
public function SetKostenstelle($value) { $this->kostenstelle=$value; } public function SetKostenstelle($value) { $this->kostenstelle=$value; }
public function GetKostenstelle() { return $this->kostenstelle; } public function GetKostenstelle() { return $this->kostenstelle; }
public function SetSachkonto($value) { $this->sachkonto=$value; }
public function GetSachkonto() { return $this->sachkonto; }
} }

View File

@ -2362,7 +2362,14 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
for($i = 0; $i < $carr; $i++) for($i = 0; $i < $carr; $i++)
$newarr[] = $arr[$i]['name']; $newarr[] = $arr[$i]['name'];
break; break;
case "sachkonto_aufwendungen":
$arr = $this->app->DB->SelectArr("SELECT CONCAT(sachkonto,' ',beschriftung) as name FROM kontorahmen
WHERE art = 1 AND (beschriftung LIKE '%$term%' OR sachkonto LIKE '%$term%' OR sachkonto LIKE '%$term2%' OR sachkonto LIKE '%$term3%' OR beschriftung LIKE '%$term2%' OR beschriftung LIKE '%$term3%') AND ausblenden!=1 $andprojekt ORDER by sachkonto");
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++)
$newarr[] = $arr[$i]['name'];
break;
case "lieferbedingungen": case "lieferbedingungen":
$arr = $this->app->DB->SelectArr("SELECT CONCAT(lieferbedingungen) as name FROM lieferbedingungen $arr = $this->app->DB->SelectArr("SELECT CONCAT(lieferbedingungen) as name FROM lieferbedingungen
WHERE (lieferbedingungen LIKE '%$term%' OR lieferbedingungen LIKE '%$term2%' OR lieferbedingungen LIKE '%$term3%') ORDER by lieferbedingungen"); WHERE (lieferbedingungen LIKE '%$term%' OR lieferbedingungen LIKE '%$term2%' OR lieferbedingungen LIKE '%$term3%') ORDER by lieferbedingungen");

View File

@ -1,13 +1,8 @@
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1"></a></li> <li><a href="#tabs-1">Details</a></li>
<li><a href="#tabs-2">Positionen</a></li>
</ul> </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"> <div id="tabs-1">
[MESSAGE] [MESSAGE]
<form action="" method="post"> <form action="" method="post">
@ -184,5 +179,8 @@
<input type="submit" name="submit" value="Speichern" style="float:right"/> <input type="submit" name="submit" value="Speichern" style="float:right"/>
</form> </form>
</div> </div>
<div id="tabs-2">
[POS]
</div>
</div> </div>

View File

@ -17,9 +17,12 @@ class Verbindlichkeit {
$this->app->ActionHandler("list", "verbindlichkeit_list"); $this->app->ActionHandler("list", "verbindlichkeit_list");
$this->app->ActionHandler("create", "verbindlichkeit_edit"); // This automatically adds a "New" button $this->app->ActionHandler("create", "verbindlichkeit_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "verbindlichkeit_edit"); $this->app->ActionHandler("edit", "verbindlichkeit_edit");
$this->app->ActionHandler("positionen", "verbindlichkeit_positionen");
$this->app->ActionHandler("delete", "verbindlichkeit_delete"); $this->app->ActionHandler("delete", "verbindlichkeit_delete");
$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->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
} }
@ -138,6 +141,8 @@ class Verbindlichkeit {
function verbindlichkeit_edit() { function verbindlichkeit_edit() {
$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))
{ {
@ -330,4 +335,71 @@ 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;
}
} }

View File

@ -115,6 +115,9 @@ class WidgetGenverbindlichkeit_position
$field = new HTMLInput("projekt","text","","50","","","","","","","","0","",""); $field = new HTMLInput("projekt","text","","50","","","","","","","","0","","");
$this->form->NewField($field); $this->form->NewField($field);
$field = new HTMLInput("sachkonto","text","","50","","","","","","","","0","","");
$this->form->NewField($field);
$field = new HTMLInput("kostenstelle","text","","50","","","","","","","","0","",""); $field = new HTMLInput("kostenstelle","text","","50","","","","","","","","0","","");
$this->form->NewField($field); $this->form->NewField($field);

View File

@ -28,6 +28,9 @@ $('#anderersteuersatz').click(function() { if (!$(this).is(':checked')) {
[FORMHANDLEREVENT] [FORMHANDLEREVENT]
<table border="0" style="padding-right:10px;" class="mkTableFormular"> <table border="0" style="padding-right:10px;" class="mkTableFormular">
<tbody> <tbody>
<tr valign="top">
<td width="550">
<table border="0" style="padding-right:10px;" class="mkTableFormular">
<tr><td nowrap>{|Artikel-Nr|}:</td><td>[ARTIKEL][MSGARTIKEL]</td></tr> <tr><td nowrap>{|Artikel-Nr|}:</td><td>[ARTIKEL][MSGARTIKEL]</td></tr>
<tr><td nowrap>{|Beschreibung|}:</td><td>[BEZEICHNUNG][MSGBEZEICHNUNG]</td></tr> <tr><td nowrap>{|Beschreibung|}:</td><td>[BEZEICHNUNG][MSGBEZEICHNUNG]</td></tr>
<tr><td nowrap>{|Artikel-Nr|}:</td><td>[NUMMER][MSGNUMMER]</td></tr> <tr><td nowrap>{|Artikel-Nr|}:</td><td>[NUMMER][MSGNUMMER]</td></tr>
@ -36,7 +39,6 @@ $('#anderersteuersatz').click(function() { if (!$(this).is(':checked')) {
<tr><td>{|Preis|}:</td><td>[PREIS][MSGPREIS]</td></tr> <tr><td>{|Preis|}:</td><td>[PREIS][MSGPREIS]</td></tr>
<tr><td>{|W&auml;hrung|}:</td><td>[WAEHRUNG][MSGWAEHRUNG]&nbsp;[WAEHRUNGSBUTTON]</td></tr> <tr><td>{|W&auml;hrung|}:</td><td>[WAEHRUNG][MSGWAEHRUNG]&nbsp;[WAEHRUNGSBUTTON]</td></tr>
<tr><td>{|Steuersatz|}:</td><td>[UMSATZSTEUER][MSGUMSATZSTEUER]&nbsp; <tr><td>{|Steuersatz|}:</td><td>[UMSATZSTEUER][MSGUMSATZSTEUER]&nbsp;
[ANDERERSTEUERSATZ][MSGANDERERSTEUERSATZ]&nbsp;individuellen Steuersatz verwenden [ANDERERSTEUERSATZ][MSGANDERERSTEUERSATZ]&nbsp;individuellen Steuersatz verwenden
</td></tr> </td></tr>
<tr style="display:none" class="steuersatz"><td>{|Individueller Steuersatz|}:</td><td>[STEUERSATZ][MSGSTEUERSATZ]&nbsp;in Prozent</td></tr> <tr style="display:none" class="steuersatz"><td>{|Individueller Steuersatz|}:</td><td>[STEUERSATZ][MSGSTEUERSATZ]&nbsp;in Prozent</td></tr>
@ -45,11 +47,19 @@ $('#anderersteuersatz').click(function() { if (!$(this).is(':checked')) {
</td></tr> </td></tr>
<tr><td>{|Einheit|}:</td><td>[EINHEIT][MSGEINHEIT]</td></tr> <tr><td>{|Einheit|}:</td><td>[EINHEIT][MSGEINHEIT]</td></tr>
<tr><td>{|VPE|}:</td><td>[VPE][MSGVPE]</td></tr> <tr><td>{|VPE|}:</td><td>[VPE][MSGVPE]</td></tr>
<tr><td>{|Lieferdatum|}:</td><td>[LIEFERDATUM][MSGLIEFERDATUM]</td></tr>
</table>
</td>
<td width="30%" [STYLERECHTS]>
<table width="100%">
<tr><td></td><td align="right"><input type="submit" value="Speichern" ></td></tr>
<tr><td>{|Projekt|}:</td><td>[PROJEKT][MSGPROJEKT]</td></tr> <tr><td>{|Projekt|}:</td><td>[PROJEKT][MSGPROJEKT]</td></tr>
<tr><td>{|Kostenstelle|}:</td><td>[KOSTENSTELLE][MSGKOSTENSTELLE]</td></tr> <tr><td>{|Kostenstelle|}:</td><td>[KOSTENSTELLE][MSGKOSTENSTELLE]</td></tr>
<tr><td>{|Lieferdatum|}:</td><td>[LIEFERDATUM][MSGLIEFERDATUM]</td></tr> <tr><td>{|Sachkonto|}:</td><td>[SACHKONTO][MSGSACHKONTO]</td></tr>
<tr><td></td><td><input type="submit" value="Speichern" ></td></tr> </table>
</td>
</tbody></table> </tr>
</tbody>
</table>
</form> </form>
[WAEHRUNGSTABELLE] [WAEHRUNGSTABELLE]

View File

@ -24,6 +24,7 @@ class WidgetVerbindlichkeit_position extends WidgetGenVerbindlichkeit_position
$this->app->YUI->AutoComplete("projekt","projektname",1); $this->app->YUI->AutoComplete("projekt","projektname",1);
$this->app->YUI->AutoComplete("kostenstelle","kostenstelle",1); $this->app->YUI->AutoComplete("kostenstelle","kostenstelle",1);
$this->app->YUI->AutoComplete("sachkonto","sachkonto_aufwendungen",1);
$this->app->YUI->AutoComplete("artikel","artikelnummer"); $this->app->YUI->AutoComplete("artikel","artikelnummer");
//$this->app->YUI->AutoComplete(AUTO,"artikel",array('nummer','name_de','warengruppe'),"nummer"); //$this->app->YUI->AutoComplete(AUTO,"artikel",array('nummer','name_de','warengruppe'),"nummer");
@ -36,6 +37,7 @@ class WidgetVerbindlichkeit_position extends WidgetGenVerbindlichkeit_position
$this->form->ReplaceFunction("menge",$this,"ReplaceMenge"); $this->form->ReplaceFunction("menge",$this,"ReplaceMenge");
//$this->form->ReplaceFunction("geliefert",$this,"ReplaceMenge"); //$this->form->ReplaceFunction("geliefert",$this,"ReplaceMenge");
$this->form->ReplaceFunction("projekt",$this,"ReplaceProjekt"); $this->form->ReplaceFunction("projekt",$this,"ReplaceProjekt");
$this->form->ReplaceFunction("sachkonto",$this,"ReplaceSachkonto");
if($this->app->erp->Firmendaten("briefhtml")=="1") if($this->app->erp->Firmendaten("briefhtml")=="1")
{ {
@ -79,6 +81,11 @@ class WidgetVerbindlichkeit_position extends WidgetGenVerbindlichkeit_position
return $this->app->erp->ReplaceProjekt($db,$value,$fromform); return $this->app->erp->ReplaceProjekt($db,$value,$fromform);
} }
function ReplaceSachkonto($db,$value,$fromform)
{
return $this->app->erp->ReplaceKontorahmen($db,$value,$fromform);
}
function ReplaceSteuersatz($db,$value,$fromform) function ReplaceSteuersatz($db,$value,$fromform)
{ {
if($db) if($db)