+
{|Bezeichnung|}:
|
diff --git a/www/pages/content/kontoauszuege_edit.tpl b/www/pages/content/kontoauszuege_edit.tpl
new file mode 100644
index 00000000..9a3b966f
--- /dev/null
+++ b/www/pages/content/kontoauszuege_edit.tpl
@@ -0,0 +1,151 @@
+
+
diff --git a/www/pages/content/kontoauszuege_list.tpl b/www/pages/content/kontoauszuege_list.tpl
new file mode 100644
index 00000000..dee9f3b1
--- /dev/null
+++ b/www/pages/content/kontoauszuege_list.tpl
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
diff --git a/www/pages/importvorlage.php b/www/pages/importvorlage.php
index eac2209f..0689e2ea 100644
--- a/www/pages/importvorlage.php
+++ b/www/pages/importvorlage.php
@@ -1419,7 +1419,7 @@ class Importvorlage extends GenImportvorlage {
$zeitstempel = time();
$number_of_rows = empty($tmp['cmd'])?0:count($tmp['cmd']);
- $number_of_rows = $number_of_rows + 2;
+// $number_of_rows = $number_of_rows + 2; // ?!?!
if($isCronjob) {
$this->app->DB->Update(
@@ -5079,6 +5079,85 @@ class Importvorlage extends GenImportvorlage {
}
break;
+ case 'kontoauszug':
+
+ $allowed_fields = array('konto','buchung','betrag','waehrung','buchungstext','buchungstext2','buchungstext3','buchungstext4');
+
+ $error = false;
+
+ // Create a row dataset (without checked and cmd)
+ $update_sql = "";
+ $row = array();
+ $comma = "";
+ foreach ($tmp as $key => $value) {
+ if ($key != 'cmd' && $key != 'checked') {
+ if (in_array($key,$allowed_fields)) {
+ $row[$key] = $value[$i];
+ $comma = ", ";
+ } else {
+ $msg .= "Feld nicht korrekt: ".$key.". ";
+ $error = true;
+ }
+ }
+ }
+
+ if (!$error) {
+ // Collect texts
+ $buchungstext = "";
+ $comma = "";
+ foreach ($row as $key => $value) {
+ if (str_starts_with($key,'buchungstext')) {
+ if (!empty($value)) {
+ $buchungstext .= $comma.$value;
+ $comma = ", ";
+ }
+ unset($row[$key]);
+ }
+ }
+ $row['buchungstext'] = $buchungstext;
+
+ $row['soll'] = $row['betrag'];
+ unset($row['betrag']);
+
+ // Calculate hash
+ $hash_fields = array('buchung','soll','waehrung','buchungstext');
+ $hash_text = "";
+
+ foreach($hash_fields as $hash_field) {
+ $hash_text .= $row[$hash_field];
+ }
+ $row['pruefsumme'] = md5($hash_text);
+
+ $sql = "SELECT id FROM konten WHERE kurzbezeichnung ='".$row['konto']."' LIMIT 1";
+ $kontoid = $this->app->DB->SelectArr($sql);
+
+ if (!empty($kontoid)) {
+
+ $row['konto'] = $kontoid[0]['id'];
+ $row['importdatum'] = date("Y-m-d H:i:s");
+
+ $sql = "SELECT pruefsumme FROM kontoauszuege WHERE pruefsumme='".$row['pruefsumme']."' AND konto ='".$row['konto']."'";
+ $result = $this->app->DB->SelectArr($sql);
+
+ if (!empty($result)) {
+ $msg .= "Doppelter Eintrag (nicht importiert): ".$row['buchungstext']." ";
+ } else {
+ $sql = "INSERT INTO kontoauszuege (".
+ implode(", ",array_keys($row)).
+ ") VALUES ('".
+ implode("', '",array_values($row)).
+ "')";
+
+ $msg .= $sql;
+
+ $result = $this->app->DB->Update($sql);
+ }
+ } else {
+ $msg .= "Konto nicht gefunden: ".$row['konto'].". ";
+ }
+ }
+
+ break;
}
// HERE END OF PROCESSING THE ROWS switch($ziel);
@@ -5106,20 +5185,22 @@ class Importvorlage extends GenImportvorlage {
if(empty($importMasterData) || $importMasterData['status'] === 'cancelled') {
break;
}
+ }
+ } // Loop
+ if($return) {
+ if($returnids) {
+ return $ids;
}
+ return $number_of_rows;
}
- if($return) {
- if($returnids) {
- return $ids;
- }
- return $number_of_rows;
- }
- if($ziel==='zeiterfassung' || $ziel==='wiedervorlage' || $ziel==='notizen') {
- $msg=$this->app->erp->base64_url_encode("Import durchgeführt. ");
- $this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
- }
- $msg=$this->app->erp->base64_url_encode("Import durchgeführt. ");
- $this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
+
+ if (empty($msg)) {
+ $msg=$this->app->erp->base64_url_encode("Import durchgeführt. ");
+ $this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
+ } else {
+ $msg=$this->app->erp->base64_url_encode("".$msg." ");
+ $this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
+ }
}
/**
diff --git a/www/pages/kontoauszuege.php b/www/pages/kontoauszuege.php
new file mode 100644
index 00000000..863c6dd0
--- /dev/null
+++ b/www/pages/kontoauszuege.php
@@ -0,0 +1,346 @@
+app = $app;
+ if ($intern)
+ return;
+
+ $this->app->ActionHandlerInit($this);
+ $this->app->ActionHandler("list", "kontoauszuege_list");
+ $this->app->ActionHandler("create", "kontoauszuege_edit"); // This automatically adds a "New" button
+ $this->app->ActionHandler("edit", "kontoauszuege_edit");
+ $this->app->ActionHandler("delete", "kontoauszuege_delete");
+ $this->app->DefaultActionHandler("list");
+ $this->app->ActionHandlerListen($app);
+ }
+
+ public function Install() {
+ /* Fill out manually later */
+ }
+
+ static function TableSearch(&$app, $name, $erlaubtevars) {
+ switch ($name) {
+ case "kontoauszuege_list":
+ $allowed['kontoauszuege_list'] = array('list');
+ $heading = array('','', 'Importdatum', 'Konto', 'Datum', 'Betrag', 'Waehrung', 'Buchungstext','Interne Bemerkung', 'Menü');
+ $width = array('1%','1%', '1%', '10%', '1%', '1%', '1%', '20%', '20%', '1%'); // Fill out manually later
+
+ // columns that are aligned right (numbers etc)
+ $alignright = array(6);
+
+ $findcols = array('k.id','k.id','k.konto', 'k.importdatum', 'k.buchung', 'k.soll', 'k.waehrung', 'k.buchungstext','k.internebemerkung');
+ $searchsql = array('k.konto', 'k.buchung', 'k.soll', 'k.buchungstext','k.internebemerkung');
+
+ $defaultorder = 1;
+ $defaultorderdesc = 0;
+
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+
+ $menu = "";
+
+ $sql = "SELECT SQL_CALC_FOUND_ROWS k.id,
+ $dropnbox,
+ ".$app->erp->FormatDateTimeShort('k.importdatum').",
+ (SELECT kurzbezeichnung FROM konten WHERE konten.id = k.konto),
+ ".$app->erp->FormatDate('k.buchung').",
+ IF(
+ k.importfehler,
+ CONCAT(
+ '',
+ ".$app->erp->FormatMenge('k.soll',2).",
+ ''
+ ),
+ ".$app->erp->FormatMenge('k.soll',2)."),
+ k.waehrung,
+ k.buchungstext,
+ k.internebemerkung,
+ k.id
+ FROM kontoauszuege k";
+
+ $where = "1";
+
+ // Toggle filters
+ $app->Tpl->Add('JQUERYREADY', "$('#importfehler').click( function() { fnFilterColumn1( 0 ); } );");
+
+ for ($r = 1;$r <= 4;$r++) {
+ $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 = $app->Secure->GetGET("more_data1");
+ if ($more_data1 == 1) {
+ $where .= "";
+ } else {
+ $where .= " AND k.importfehler IS NULL ";
+ }
+ // END Toggle filters
+
+ $count = "SELECT count(DISTINCT id) FROM kontoauszuege k WHERE $where";
+// $groupby = "";
+
+ break;
+ }
+
+ $erg = false;
+
+ foreach ($erlaubtevars as $k => $v) {
+ if (isset($$v)) {
+ $erg[$v] = $$v;
+ }
+ }
+ return $erg;
+ }
+
+ function kontoauszuege_list() {
+
+ // Process multi action
+ $auswahl = $this->app->Secure->GetPOST('auswahl');
+ $selectedIds = [];
+ if(!empty($auswahl)) {
+ foreach($auswahl as $selectedId) {
+ $selectedId = (int)$selectedId;
+ if($selectedId > 0) {
+ $selectedIds[] = $selectedId;
+ }
+ }
+
+ $submit = $this->app->Secure->GetPOST('ausfuehren');
+
+ if ($submit == 'Importfehler') {
+ $sql = "UPDATE kontoauszuege SET importfehler = 1 WHERE id IN (".implode(",",$selectedIds).")";
+ $this->app->DB->Update($sql);
+ }
+ }
+
+ $this->app->erp->MenuEintrag("index.php?module=kontoauszuege&action=list", "Übersicht");
+ $this->app->erp->MenuEintrag("index.php?module=kontoauszuege&action=create", "Neu anlegen");
+
+ $this->app->erp->MenuEintrag("index.php", "Zurück");
+
+ $this->app->YUI->TableSearch('TAB1', 'kontoauszuege_list', "show", "", "", basename(__FILE__), __CLASS__);
+ $this->app->Tpl->Parse('PAGE', "kontoauszuege_list.tpl");
+ }
+
+ public function kontoauszuege_delete() {
+ $id = (int) $this->app->Secure->GetGET('id');
+
+ $this->app->DB->Delete("UPDATE `kontoauszuege` SET importfehler = 1 WHERE `id` = '{$id}'");
+ $this->app->Tpl->Set('MESSAGE', "Der Eintrag wurde als Importfehler markiert. ");
+
+ $this->kontoauszuege_list();
+ }
+
+ /*
+ * Edit kontoauszuege item
+ * If id is empty, create a new one
+ */
+
+ function kontoauszuege_edit() {
+ $id = $this->app->Secure->GetGET('id');
+
+ // Check if other users are editing this id
+ if($this->app->erp->DisableModul('artikel',$id))
+ {
+ return;
+ }
+
+ $this->app->Tpl->Set('ID', $id);
+
+ $this->app->erp->MenuEintrag("index.php?module=kontoauszuege&action=edit&id=$id", "Details");
+ $this->app->erp->MenuEintrag("index.php?module=kontoauszuege&action=list", "Zurück zur Übersicht");
+ $id = $this->app->Secure->GetGET('id');
+ $input = $this->GetInput();
+ $submit = $this->app->Secure->GetPOST('submit');
+
+ if (empty($id)) {
+ // New item
+ $id = 'NULL';
+ }
+
+ if ($submit != '')
+ {
+
+ // Write to database
+
+ // Add checks here
+
+ $columns = "id, ";
+ $values = "$id, ";
+ $update = "";
+
+ $fix = "";
+
+ foreach ($input as $key => $value) {
+ $columns = $columns.$fix.$key;
+ $values = $values.$fix."'".$value."'";
+ $update = $update.$fix.$key." = '$value'";
+
+ $fix = ", ";
+ }
+
+// echo($columns." ");
+// echo($values." ");
+// echo($update." ");
+
+ $sql = "INSERT INTO kontoauszuege (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
+
+// echo($sql);
+
+ $this->app->DB->Update($sql);
+
+ if ($id == 'NULL') {
+ $msg = $this->app->erp->base64_url_encode("Das Element wurde erfolgreich angelegt. ");
+ header("Location: index.php?module=kontoauszuege&action=list&msg=$msg");
+ } else {
+ $this->app->Tpl->Set('MESSAGE', "Die Einstellungen wurden erfolgreich übernommen. ");
+ }
+ }
+
+
+ // Load values again from database
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+ $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS k.id, $dropnbox, k.konto, k.buchung, k.originalbuchung, k.vorgang, k.originalvorgang, k.soll, k.originalsoll, k.haben, k.originalhaben, k.gebuehr, k.originalgebuehr, k.waehrung, k.originalwaehrung, k.fertig, k.datev_abgeschlossen, k.buchungstext, k.gegenkonto, k.belegfeld1, k.bearbeiter, k.mailbenachrichtigung, k.pruefsumme, k.kostenstelle, k.importgroup, k.diff, k.diffangelegt, k.internebemerkung, k.importfehler, k.parent, k.sort, k.doctype, k.doctypeid, k.vorauswahltyp, k.vorauswahlparameter, k.klaerfall, k.klaergrund, k.bezugtyp, k.bezugparameter, k.vorauswahlvorschlag, k.id FROM kontoauszuege k"." WHERE id=$id");
+
+ foreach ($result[0] as $key => $value) {
+ $this->app->Tpl->Set(strtoupper($key), $value);
+ }
+
+ /*
+ * Add displayed items later
+ *
+
+ $this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
+ $this->app->Tpl->Add('EMAIL', $email);
+ $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
+ */
+
+ $sql = "SELECT kurzbezeichnung FROM konten WHERE id=".$result[0]['konto'];
+ $konto = $this->app->DB->Select($sql);
+ $this->app->Tpl->Set('KONTO', $konto);
+
+ $this->app->Tpl->Set('BUCHUNG', $this->app->erp->ReplaceDatum(false,$result[0]['buchung'],false));
+ $this->app->Tpl->Set('SOLL', $this->app->erp->ReplaceBetrag(false,$result[0]['soll'],false));
+
+ $this->app->Tpl->Parse('PAGE', "kontoauszuege_edit.tpl");
+ }
+
+ /**
+ * Get all paramters from html form and save into $input
+ */
+ public function GetInput(): array {
+ $input = array();
+ //$input['EMAIL'] = $this->app->Secure->GetPOST('email');
+
+/* $input['konto'] = $this->app->Secure->GetPOST('konto');
+ $input['buchung'] = $this->app->Secure->GetPOST('buchung');
+ $input['originalbuchung'] = $this->app->Secure->GetPOST('originalbuchung');
+ $input['vorgang'] = $this->app->Secure->GetPOST('vorgang');
+ $input['originalvorgang'] = $this->app->Secure->GetPOST('originalvorgang');
+ $input['soll'] = $this->app->Secure->GetPOST('soll');
+ $input['originalsoll'] = $this->app->Secure->GetPOST('originalsoll');
+ $input['haben'] = $this->app->Secure->GetPOST('haben');
+ $input['originalhaben'] = $this->app->Secure->GetPOST('originalhaben');
+ $input['gebuehr'] = $this->app->Secure->GetPOST('gebuehr');
+ $input['originalgebuehr'] = $this->app->Secure->GetPOST('originalgebuehr');
+ $input['waehrung'] = $this->app->Secure->GetPOST('waehrung');
+ $input['originalwaehrung'] = $this->app->Secure->GetPOST('originalwaehrung');
+ $input['fertig'] = $this->app->Secure->GetPOST('fertig');
+ $input['datev_abgeschlossen'] = $this->app->Secure->GetPOST('datev_abgeschlossen');
+ $input['buchungstext'] = $this->app->Secure->GetPOST('buchungstext');
+ $input['gegenkonto'] = $this->app->Secure->GetPOST('gegenkonto');
+ $input['belegfeld1'] = $this->app->Secure->GetPOST('belegfeld1');
+ $input['bearbeiter'] = $this->app->Secure->GetPOST('bearbeiter');
+ $input['mailbenachrichtigung'] = $this->app->Secure->GetPOST('mailbenachrichtigung');
+ $input['pruefsumme'] = $this->app->Secure->GetPOST('pruefsumme');
+ $input['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle');
+ $input['importgroup'] = $this->app->Secure->GetPOST('importgroup');
+ $input['diff'] = $this->app->Secure->GetPOST('diff');
+ $input['diffangelegt'] = $this->app->Secure->GetPOST('diffangelegt');
+*/ $input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung');
+/* $input['importfehler'] = $this->app->Secure->GetPOST('importfehler');
+ $input['parent'] = $this->app->Secure->GetPOST('parent');
+ $input['sort'] = $this->app->Secure->GetPOST('sort');
+ $input['doctype'] = $this->app->Secure->GetPOST('doctype');
+ $input['doctypeid'] = $this->app->Secure->GetPOST('doctypeid');
+ $input['vorauswahltyp'] = $this->app->Secure->GetPOST('vorauswahltyp');
+ $input['vorauswahlparameter'] = $this->app->Secure->GetPOST('vorauswahlparameter');
+ $input['klaerfall'] = $this->app->Secure->GetPOST('klaerfall');
+ $input['klaergrund'] = $this->app->Secure->GetPOST('klaergrund');
+ $input['bezugtyp'] = $this->app->Secure->GetPOST('bezugtyp');
+ $input['bezugparameter'] = $this->app->Secure->GetPOST('bezugparameter');
+ $input['vorauswahlvorschlag'] = $this->app->Secure->GetPOST('vorauswahlvorschlag');*/
+
+
+ return $input;
+ }
+
+ /*
+ * Set all fields in the page corresponding to $input
+ */
+ function SetInput($input) {
+ // $this->app->Tpl->Set('EMAIL', $input['email']);
+
+ $this->app->Tpl->Set('KONTO', $input['konto']);
+ $this->app->Tpl->Set('BUCHUNG', $input['buchung']);
+ $this->app->Tpl->Set('ORIGINALBUCHUNG', $input['originalbuchung']);
+ $this->app->Tpl->Set('VORGANG', $input['vorgang']);
+ $this->app->Tpl->Set('ORIGINALVORGANG', $input['originalvorgang']);
+ $this->app->Tpl->Set('SOLL', $input['soll']);
+ $this->app->Tpl->Set('ORIGINALSOLL', $input['originalsoll']);
+ $this->app->Tpl->Set('HABEN', $input['haben']);
+ $this->app->Tpl->Set('ORIGINALHABEN', $input['originalhaben']);
+ $this->app->Tpl->Set('GEBUEHR', $input['gebuehr']);
+ $this->app->Tpl->Set('ORIGINALGEBUEHR', $input['originalgebuehr']);
+ $this->app->Tpl->Set('WAEHRUNG', $input['waehrung']);
+ $this->app->Tpl->Set('ORIGINALWAEHRUNG', $input['originalwaehrung']);
+ $this->app->Tpl->Set('FERTIG', $input['fertig']);
+ $this->app->Tpl->Set('DATEV_ABGESCHLOSSEN', $input['datev_abgeschlossen']);
+ $this->app->Tpl->Set('BUCHUNGSTEXT', $input['buchungstext']);
+ $this->app->Tpl->Set('GEGENKONTO', $input['gegenkonto']);
+ $this->app->Tpl->Set('BELEGFELD1', $input['belegfeld1']);
+ $this->app->Tpl->Set('BEARBEITER', $input['bearbeiter']);
+ $this->app->Tpl->Set('MAILBENACHRICHTIGUNG', $input['mailbenachrichtigung']);
+ $this->app->Tpl->Set('PRUEFSUMME', $input['pruefsumme']);
+ $this->app->Tpl->Set('KOSTENSTELLE', $input['kostenstelle']);
+ $this->app->Tpl->Set('IMPORTGROUP', $input['importgroup']);
+ $this->app->Tpl->Set('DIFF', $input['diff']);
+ $this->app->Tpl->Set('DIFFANGELEGT', $input['diffangelegt']);
+ $this->app->Tpl->Set('INTERNEBEMERKUNG', $input['internebemerkung']);
+ $this->app->Tpl->Set('IMPORTFEHLER', $input['importfehler']);
+ $this->app->Tpl->Set('PARENT', $input['parent']);
+ $this->app->Tpl->Set('SORT', $input['sort']);
+ $this->app->Tpl->Set('DOCTYPE', $input['doctype']);
+ $this->app->Tpl->Set('DOCTYPEID', $input['doctypeid']);
+ $this->app->Tpl->Set('VORAUSWAHLTYP', $input['vorauswahltyp']);
+ $this->app->Tpl->Set('VORAUSWAHLPARAMETER', $input['vorauswahlparameter']);
+ $this->app->Tpl->Set('KLAERFALL', $input['klaerfall']);
+ $this->app->Tpl->Set('KLAERGRUND', $input['klaergrund']);
+ $this->app->Tpl->Set('BEZUGTYP', $input['bezugtyp']);
+ $this->app->Tpl->Set('BEZUGPARAMETER', $input['bezugparameter']);
+ $this->app->Tpl->Set('VORAUSWAHLVORSCHLAG', $input['vorauswahlvorschlag']);
+
+ }
+
+}
diff --git a/www/widgets/_gen/widget.gen.importvorlage.php b/www/widgets/_gen/widget.gen.importvorlage.php
index ead82519..ffcb8cfe 100644
--- a/www/widgets/_gen/widget.gen.importvorlage.php
+++ b/www/widgets/_gen/widget.gen.importvorlage.php
@@ -79,6 +79,7 @@ class WidgetGenimportvorlage
$field->AddOption('Wiedervorlagen (min. Angabe: datum_faellig, kundennummer,mitarbeiternummer,betreff)','wiedervorlagen');
$field->AddOption('Notizen (min. Angabe: datum,kundennummer,mitarbeiternummer,betreff)','notizen');
$field->AddOption('Kontenrahmen (min. Angabe: sachkonto,beschriftung,art)','kontorahmen');
+ $field->AddOption('Kontoauszug','kontoauszug');
$this->form->NewField($field);
$field = new HTMLInput("importerstezeilenummer","text","","15","","","","","","","","0","","");
|