fibu_buchungen booking to kontorahmen

This commit is contained in:
OpenXE 2023-04-08 14:49:08 +02:00
parent 44af8f3b3d
commit 667b70eaf5
4 changed files with 98 additions and 224 deletions

View File

@ -39106,6 +39106,17 @@
"Privileges": "select,insert,update,references", "Privileges": "select,insert,update,references",
"Comment": "" "Comment": ""
}, },
{
"Field": "datum",
"Type": "date",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{ {
"Field": "zeit", "Field": "zeit",
"Type": "datetime", "Type": "datetime",
@ -117352,12 +117363,12 @@
{ {
"name": "fibu_objekte_view", "name": "fibu_objekte_view",
"type": "VIEW", "type": "VIEW",
"Create": "CREATE VIEW `fibu_objekte_view` AS select `fo`.`datum` AS `datum`,`fo`.`typ` AS `typ`,`fo`.`id` AS `id`,`fo`.`info` AS `info`,`fo`.`parent_typ` AS `parent_typ`,`fo`.`parent_id` AS `parent_id`,`fo`.`parent_info` AS `parent_info`,`fo`.`typ` in ('rechnung','gutschrift','verbindlichkeit','auftrag') AS `is_beleg` from (select `auftrag`.`datum` AS `datum`,'auftrag' AS `typ`,`auftrag`.`id` AS `id`,`auftrag`.`belegnr` AS `info`,'adresse' AS `parent_typ`,`auftrag`.`adresse` AS `parent_id`,`auftrag`.`name` AS `parent_info` from `auftrag` where `auftrag`.`belegnr` <> '' and `auftrag`.`status` <> 'abgeschlossen' union select `rechnung`.`datum` AS `datum`,'rechnung' AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`belegnr` AS `info`,'adresse' AS `parent_type`,`rechnung`.`adresse` AS `parent_id`,`rechnung`.`name` AS `parent_info` from `rechnung` where `rechnung`.`belegnr` <> '' and `rechnung`.`zahlungsstatus` <> 'bezahlt' union select `gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`belegnr` AS `belegnr`,'adresse' AS `parent_type`,`gutschrift`.`adresse` AS `parent_id`,`gutschrift`.`name` AS `parent_info` from `gutschrift` where `gutschrift`.`belegnr` <> '' and `gutschrift`.`zahlungsstatus` <> 'bezahlt' union select `verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnung` AS `belegnr`,'adresse' AS `parent_type`,`verbindlichkeit`.`adresse` AS `parent_id`,`adresse`.`name` AS `name` from (`verbindlichkeit` join `adresse` on(`verbindlichkeit`.`adresse` = `adresse`.`id`)) where `verbindlichkeit`.`belegnr` <> '' and `verbindlichkeit`.`status` <> 'bezahlt' union select `kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,concat(`konten`.`kurzbezeichnung`,' - ',`kontoauszuege`.`buchungstext`) AS `buchungstext`,'konten' AS `parent_type`,`kontoauszuege`.`konto` AS `parent_id`,`konten`.`bezeichnung` AS `bezeichnung` from (`kontoauszuege` left join `konten` on(`konten`.`id` = `kontoauszuege`.`konto`)) union select '' AS `datum`,'kontorahmen' AS `'kontorahmen'`,`kontorahmen`.`id` AS `id`,concat(`kontorahmen`.`sachkonto`,' - ',`kontorahmen`.`beschriftung`) AS `beschriftung`,'','','' from `kontorahmen`) `fo` where `fo`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum') or `fo`.`datum` = ''" "Create": "CREATE VIEW `fibu_objekte_view` AS select `fo`.`datum` AS `datum`,`fo`.`typ` AS `typ`,`fo`.`id` AS `id`,`fo`.`info` AS `info`,`fo`.`parent_typ` AS `parent_typ`,`fo`.`parent_id` AS `parent_id`,`fo`.`parent_info` AS `parent_info`,`fo`.`typ` in ('rechnung','gutschrift','verbindlichkeit','auftrag') AS `is_beleg` from (select `auftrag`.`datum` AS `datum`,'auftrag' AS `typ`,`auftrag`.`id` AS `id`,`auftrag`.`belegnr` AS `info`,'adresse' AS `parent_typ`,`auftrag`.`adresse` AS `parent_id`,`auftrag`.`name` AS `parent_info` from `auftrag` where `auftrag`.`belegnr` <> '' and `auftrag`.`status` <> 'abgeschlossen' union select `rechnung`.`datum` AS `datum`,'rechnung' AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`belegnr` AS `info`,'adresse' AS `parent_type`,`rechnung`.`adresse` AS `parent_id`,`rechnung`.`name` AS `parent_info` from `rechnung` where `rechnung`.`belegnr` <> '' and `rechnung`.`zahlungsstatus` <> 'bezahlt' union select `gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`belegnr` AS `belegnr`,'adresse' AS `parent_type`,`gutschrift`.`adresse` AS `parent_id`,`gutschrift`.`name` AS `parent_info` from `gutschrift` where `gutschrift`.`belegnr` <> '' and `gutschrift`.`zahlungsstatus` <> 'bezahlt' union select `verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnung` AS `belegnr`,'adresse' AS `parent_type`,`verbindlichkeit`.`adresse` AS `parent_id`,`adresse`.`name` AS `name` from (`verbindlichkeit` join `adresse` on(`verbindlichkeit`.`adresse` = `adresse`.`id`)) where `verbindlichkeit`.`belegnr` <> '' and `verbindlichkeit`.`status` <> 'bezahlt' union select `kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,concat(`konten`.`kurzbezeichnung`,' - ',`kontoauszuege`.`buchungstext`) AS `buchungstext`,'konten' AS `parent_type`,`kontoauszuege`.`konto` AS `parent_id`,`konten`.`bezeichnung` AS `bezeichnung` from (`kontoauszuege` left join `konten` on(`konten`.`id` = `kontoauszuege`.`konto`)) union select (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum') AS `datum`,'kontorahmen' AS `'kontorahmen'`,`kontorahmen`.`id` AS `id`,concat(`kontorahmen`.`sachkonto`,' - ',`kontorahmen`.`beschriftung`) AS `beschriftung`,'','','' from `kontorahmen`) `fo` where `fo`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum') or `fo`.`datum` = ''"
}, },
{ {
"name": "fibu_buchungen_alle_view", "name": "fibu_buchungen_alle_view",
"type": "VIEW", "type": "VIEW",
"Create": "CREATE VIEW `fibu_buchungen_alle_view` AS select `fb`.`buchungsart` AS `buchungsart`,`fb`.`typ` AS `typ`,`fb`.`id` AS `id`,if(`fibu_objekte_view`.`datum` <> '',`fibu_objekte_view`.`datum`,`fb`.`datum`) AS `datum`,`fb`.`gegen_typ` AS `doc_typ`,`fb`.`gegen_id` AS `doc_id`,`fibu_objekte_view`.`info` AS `doc_info`,`fb`.`soll` AS `betrag`,`fb`.`waehrung` AS `waehrung`,`fb`.`edit_module` AS `edit_module`,`fb`.`edit_id` AS `edit_id` from ((select 'umsatz' AS `buchungsart`,'rechnung' AS `typ`,`rechnung`.`id` AS `id`,-`rechnung`.`soll` AS `soll`,`rechnung`.`waehrung` AS `waehrung`,'rechnung' AS `gegen_typ`,`rechnung`.`id` AS `gegen_id`,`rechnung`.`datum` AS `datum`,'rechnung' AS `edit_module`,`rechnung`.`id` AS `edit_id` from `rechnung` where `rechnung`.`belegnr` <> '' union select 'umsatz' AS `umsatz`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`soll` AS `soll`,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `edit_module`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select 'abbuchung' AS `abbuchung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,-`gutschrift`.`soll` AS `-``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'rechnung' AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'abbuchung' AS `abbuchung`,'rechnung' AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`soll` AS `soll`,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'aufwand' AS `aufwand`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`betrag` AS `betrag`,`verbindlichkeit`.`waehrung` AS `waehrung`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select 'zahlung' AS `zahlung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`soll` AS `soll`,`kontoauszuege`.`waehrung` AS `waehrung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id` from `kontoauszuege` where `kontoauszuege`.`importfehler` is null union select 'abbuchung' AS `abbuchung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,`fibu_buchungen`.`betrag` AS `betrag`,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,`fibu_buchungen`.`zeit` AS `zeit`,'fibu_buchungen' AS `fibu_buchungen`,`fibu_buchungen`.`id` AS `id` from `fibu_buchungen` union select 'zubuchung' AS `zubuchung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,-`fibu_buchungen`.`betrag` AS `-``openxe``.``fibu_buchungen``.``betrag```,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,`fibu_buchungen`.`zeit` AS `zeit`,'fibu_buchungen' AS `fibu_buchungen`,`fibu_buchungen`.`id` AS `id` from `fibu_buchungen`) `fb` left join `fibu_objekte_view` on(`fb`.`gegen_typ` = `fibu_objekte_view`.`typ` and `fb`.`gegen_id` = `fibu_objekte_view`.`id`)) where `fb`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum') and `fibu_objekte_view`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum')" "Create": "CREATE VIEW `fibu_buchungen_alle_view` AS select `fb`.`buchungsart` AS `buchungsart`,`fb`.`typ` AS `typ`,`fb`.`id` AS `id`,if(`fibu_objekte_view`.`datum` <> '',`fibu_objekte_view`.`datum`,`fb`.`datum`) AS `datum`,`fb`.`gegen_typ` AS `doc_typ`,`fb`.`gegen_id` AS `doc_id`,`fibu_objekte_view`.`info` AS `doc_info`,`fb`.`soll` AS `betrag`,`fb`.`waehrung` AS `waehrung`,`fb`.`edit_module` AS `edit_module`,`fb`.`edit_id` AS `edit_id` from ((select 'umsatz' AS `buchungsart`,'rechnung' AS `typ`,`rechnung`.`id` AS `id`,-`rechnung`.`soll` AS `soll`,`rechnung`.`waehrung` AS `waehrung`,'rechnung' AS `gegen_typ`,`rechnung`.`id` AS `gegen_id`,`rechnung`.`datum` AS `datum`,'rechnung' AS `edit_module`,`rechnung`.`id` AS `edit_id` from `rechnung` where `rechnung`.`belegnr` <> '' union select 'umsatz' AS `umsatz`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`soll` AS `soll`,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `edit_module`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select 'abbuchung' AS `abbuchung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,-`gutschrift`.`soll` AS `-``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'rechnung' AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'abbuchung' AS `abbuchung`,'rechnung' AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`soll` AS `soll`,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'aufwand' AS `aufwand`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`betrag` AS `betrag`,`verbindlichkeit`.`waehrung` AS `waehrung`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select 'zahlung' AS `zahlung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`soll` AS `soll`,`kontoauszuege`.`waehrung` AS `waehrung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id` from `kontoauszuege` where `kontoauszuege`.`importfehler` is null union select 'abbuchung' AS `abbuchung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,`fibu_buchungen`.`betrag` AS `betrag`,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,`fibu_buchungen`.`datum` AS `datum`,'fibu_buchungen' AS `fibu_buchungen`,`fibu_buchungen`.`id` AS `id` from `fibu_buchungen` union select 'zubuchung' AS `zubuchung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,-`fibu_buchungen`.`betrag` AS `-``openxe``.``fibu_buchungen``.``betrag```,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,`fibu_buchungen`.`datum` AS `datum`,'fibu_buchungen' AS `fibu_buchungen`,`fibu_buchungen`.`id` AS `id` from `fibu_buchungen`) `fb` left join `fibu_objekte_view` on(`fb`.`gegen_typ` = `fibu_objekte_view`.`typ` and `fb`.`gegen_id` = `fibu_objekte_view`.`id`)) where `fb`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum') and `fibu_objekte_view`.`datum` >= (select `firmendaten_werte`.`wert` from `firmendaten_werte` where `firmendaten_werte`.`name` = 'fibu_buchungen_startdatum')"
} }
] ]
} }

View File

@ -10,7 +10,7 @@
<div class="col-xs-12 col-md-12 col-md-height"> <div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset> <fieldset>
<legend>{|Offene Einzelsalden|}</legend> <legend>{|Einzelsalden|}</legend>
<div class="filter-box filter-usersave"> <div class="filter-box filter-usersave">
<div class="filter-block filter-inline"> <div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}</div> <div class="filter-title">{|Filter|}</div>
@ -41,11 +41,26 @@
<legend>Stapelverarbeitung</legend> <legend>Stapelverarbeitung</legend>
<tr> <tr>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td> <td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td>
</tr>
<tr>
<form action="" method="post">
<td>
<button name="submit" value="neuberechnen" class="ui-button-icon" style="width:100%;">
{|Buchungen neu berechnen|}
</button>
</td>
</form>
</tr>
<tr>
<td>
<input type="text" form="buchungenform" id="sachkonto" name="sachkonto" value="">
</td>
</tr>
<tr>
<td>
<button name="submit" form="buchungenform" value="BUCHEN" class="ui-button-icon" style="width:100%;">{|Markierte BUCHEN|}</button>
</td>
</tr> </tr>
<form action="" method="post">
<td><button name="submit" value="neuberechnen" class="ui-button-icon" style="width:100%;">{|Buchungen neu berechnen|}</button></td></tr>
</form>
<td><button name="submit" form = "buchungenform" value="BUCHEN" class="ui-button-icon" style="width:100%;">{|Markierte BUCHEN|}</button></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>

View File

@ -19,8 +19,7 @@ class Fibu_buchungen {
$this->app->ActionHandler("edit", "fibu_buchungen_edit"); $this->app->ActionHandler("edit", "fibu_buchungen_edit");
$this->app->ActionHandler("delete", "fibu_buchungen_delete"); $this->app->ActionHandler("delete", "fibu_buchungen_delete");
$this->app->ActionHandler("assoc", "fibu_buchungen_assoc"); $this->app->ActionHandler("assoc", "fibu_buchungen_assoc");
//$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen"); $this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen");
$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen_tablesearch");
$this->app->ActionHandler("einzelzuordnen", "fibu_buchungen_einzelzuordnen"); $this->app->ActionHandler("einzelzuordnen", "fibu_buchungen_einzelzuordnen");
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
@ -47,7 +46,7 @@ class Fibu_buchungen {
$alignright = array(7); $alignright = array(7);
$sumcol= array(7); $sumcol= array(7);
$findcols = array('f.id','f.id','f.buchungsart', 'f.typ', 'f.datum', 'f.doc_info', 'f.betrag', 'f.waehrung'); $findcols = array('f.id','f.id','f.buchungsart', 'f.typ', 'f.datum', 'f.doc_info', 'f.betrag', 'f.waehrung','f.id');
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_info'); $searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_info');
$defaultorder = 1; $defaultorder = 1;
@ -57,7 +56,7 @@ class Fibu_buchungen {
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?action=edit&module=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>"; $menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?action=edit&module=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
if (!empty($doc_typ) && !empty($doc_id)) { if (!empty($doc_typ) && !empty($doc_id)) {
$where = "`doc_typ` = '$doc_typ' AND `doc_id` = $doc_id"; $where = "`doc_typ` = '$doc_typ' AND `doc_id` = $doc_id";
} else{ } else{
$where = "1"; $where = "1";
@ -81,11 +80,11 @@ class Fibu_buchungen {
break; break;
case "fibu_buchungen_salden": case "fibu_buchungen_salden":
$allowed['fibu_buchungen_salden'] = array('list'); $allowed['fibu_buchungen_salden'] = array('list');
$heading = array( '', 'Typ','Anzahl', 'Saldo', 'Men&uuml;'); $heading = array( 'Typ','Anzahl', 'Saldo', 'Men&uuml;');
$width = array( '1%', '96%', '1%', '1%', '1%'); $width = array( '83%', '1%', '1%', '1%');
$findcols = array('','','typ','anzahl','saldo'); $findcols = array('typ','','saldonum');
$searchsql = array(); $searchsql = array('typ','saldonum');
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
@ -108,10 +107,9 @@ class Fibu_buchungen {
); );
$sql = "SELECT $sql = "SELECT
'',
'', '',
".$this->app->erp->FormatUCfirst('typ')." AS typ, ".$this->app->erp->FormatUCfirst('typ')." AS typ,
count(id) anzahl, count(id) AS anzahl,
".$this->app->erp->ConcatSQL($saldolink)." AS saldo, ".$this->app->erp->ConcatSQL($saldolink)." AS saldo,
typ typ
FROM FROM
@ -187,8 +185,8 @@ class Fibu_buchungen {
$heading = array('','','Datum','Typ', 'Info', 'Betrag', 'W&auml;hrung', 'Buchungsbetrag','Vorschlag', 'Men&uuml;'); $heading = array('','','Datum','Typ', 'Info', 'Betrag', 'W&auml;hrung', 'Buchungsbetrag','Vorschlag', 'Men&uuml;');
$width = array( ); $width = array( );
$findcols = array('','auswahl','datum','typ','objektlink','saldo','waehrung','buchwert_input','vorschlag'); $findcols = array('id','auswahl','datum','typ','objektlink','saldo','waehrung','saldo','vorschlag','doc');
$searchsql = array(); $searchsql = array('objektlink','vorschlag');
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
@ -416,7 +414,7 @@ class Fibu_buchungen {
$heading = array('','Datum','Typ', 'Info', '&Uuml;bergeordnet', 'Saldo','W&auml;hrung','Buchungsbetrag', 'Men&uuml;'); $heading = array('','Datum','Typ', 'Info', '&Uuml;bergeordnet', 'Saldo','W&auml;hrung','Buchungsbetrag', 'Men&uuml;');
$width = array( ); $width = array( );
$findcols = array('auswahl','fo.datum','fo.typ','fo.info','fo.parent_info'); $findcols = array('fo.id','fo.datum','fo.typ','fo.info','fo.parent_info','fba.betrag','waehrung','fba.betrag','fo.id');
$searchsql = array('fo.typ','fo.info','fo.parent_info'); $searchsql = array('fo.typ','fo.info','fo.parent_info');
$defaultorder = 1; $defaultorder = 1;
@ -429,7 +427,6 @@ class Fibu_buchungen {
$doc_typ = $this->app->User->GetParameter('fibu_buchungen_doc_typ'); $doc_typ = $this->app->User->GetParameter('fibu_buchungen_doc_typ');
$doc_id = $this->app->User->GetParameter('fibu_buchungen_doc_id'); $doc_id = $this->app->User->GetParameter('fibu_buchungen_doc_id');
$greater_0 = $this->app->User->GetParameter('fibu_buchungen_greater_0');
$auswahl = array ( $auswahl = array (
'<input type=\"text\" name=\"ids[]\" value=\"', '<input type=\"text\" name=\"ids[]\" value=\"',
@ -497,13 +494,6 @@ class Fibu_buchungen {
// $count = "SELECT count(DISTINCT id) FROM fibu_buchungen_alle WHERE $where"; // $count = "SELECT count(DISTINCT id) FROM fibu_buchungen_alle WHERE $where";
if ($greater_0) {
$having = "saldonum < 0";
}
else {
$having = "saldonum > 0";
}
$groupby = "GROUP BY fo.id, fo.typ"; $groupby = "GROUP BY fo.id, fo.typ";
//echo($sql." WHERE ".$where." ".$groupby); //echo($sql." WHERE ".$where." ".$groupby);
@ -766,9 +756,7 @@ class Fibu_buchungen {
} }
function fibu_buchungen_zuordnen_tablesearch() { function fibu_buchungen_zuordnen() {
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "&Uuml;bersicht");
// $this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=create", "Neu anlegen");
$submit = $this->app->Secure->GetPOST('submit'); $submit = $this->app->Secure->GetPOST('submit');
if ($submit == 'neuberechnen') { if ($submit == 'neuberechnen') {
@ -785,34 +773,53 @@ class Fibu_buchungen {
$waehrungen = $this->app->Secure->GetPOST('waehrungen'); $waehrungen = $this->app->Secure->GetPOST('waehrungen');
$auswahl = $this->app->Secure->GetPOST('auswahl'); $auswahl = $this->app->Secure->GetPOST('auswahl');
$vorschlaege = $this->app->Secure->GetPOST('vorschlaege'); $vorschlaege = $this->app->Secure->GetPOST('vorschlaege');
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
$sachkontoid = null;
if (!empty($sachkonto)) {
$sachkonto_kennung = explode(' ',$sachkonto)[0];
$sachkontoid = $this->app->DB->SelectArr("SELECT id from kontorahmen WHERE sachkonto = '".$sachkonto_kennung."'")[0]['id'];
}
if (!empty($auswahl)) { if (!empty($auswahl)) {
foreach ($ids as $id) { foreach ($ids as $id) {
$key_ids = array_search($id,$ids); $key_ids = array_search($id,$ids);
$key_auswahl = array_search($id,$auswahl); $key_auswahl = array_search($id,$auswahl);
if ($key_auswahl !== false && $vorschlaege[$key_ids] != '_') { if ($key_auswahl !== false) {
$von = explode('_',$id); $von = explode('_',$id);
$von_typ = strtolower($von[0]); $von_typ = strtolower($von[0]);
$von_id = (int) $von[1]; $von_id = (int) $von[1];
$doc = $vorschlaege[$key_ids];
$doc = explode('_',$doc);
$doc_typ = strtolower($doc[0]);
$doc_id = (int) $doc[1];
$betrag = $werte[$key_ids]; $betrag = $werte[$key_ids];
$waehrung = $waehrungen[$key_ids]; $waehrung = $waehrungen[$key_ids];
$sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$von_typ."','".$von_id."','".$doc_typ."', '".$doc_id."', '".-$betrag."', '".$waehrung."', '".$this->app->User->GetID()."','". $input['zeit'] = date("Y-m-d H:i")."', '')";
$this->app->DB->Insert($sql);
} $doc_id = null;
}
} if ($sachkontoid) {
} $doc_typ = 'kontorahmen';
$doc_id = $sachkontoid;
} else if ($vorschlaege[$key_ids] != '_') {
$doc = $vorschlaege[$key_ids];
$doc = explode('_',$doc);
$doc_typ = strtolower($doc[0]);
$doc_id = (int) $doc[1];
}
$datum = $this->app->DB->SelectArr("SELECT datum FROM fibu_buchungen_alle WHERE typ='".$von_typ."' AND id = '".$von_id."'")[0]['datum']; // Get relevant date of source doc
if ($doc_id) {
$sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `datum`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$von_typ."','".$von_id."','".$doc_typ."', '".$doc_id."', '".$datum."', '".-$betrag."', '".$waehrung."', '".$this->app->User->GetID()."','".$input['zeit'] = date("Y-m-d H:i")."', '')";
$this->app->DB->Insert($sql);
// echo($sql."\n");
}
} // auswahl
} // foreach
} // auswahl
} // submit
$this->fibu_rebuild_tables(); $this->fibu_rebuild_tables();
@ -821,7 +828,6 @@ class Fibu_buchungen {
$this->app->User->SetParameter('fibu_buchungen_doc_typ', $doc_typ); $this->app->User->SetParameter('fibu_buchungen_doc_typ', $doc_typ);
// $this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_salden', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_zuordnen', "show", "", "", basename(__FILE__), __CLASS__); $this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_zuordnen', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->YUI->TableSearch('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__); $this->app->YUI->TableSearch('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__);
@ -829,12 +835,15 @@ class Fibu_buchungen {
$this->app->Tpl->Set('MESSAGE', $msg); $this->app->Tpl->Set('MESSAGE', $msg);
} }
$this->app->YUI->AutoComplete('sachkonto', 'sachkonto');
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=zuordnen&typ=".$doc_typ, "Einzelsalden");
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl"); $this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl");
} }
function fibu_buchungen_einzelzuordnen() { function fibu_buchungen_einzelzuordnen() {
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "&Uuml;bersicht");
// $this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=create", "Neu anlegen");
$submit = $this->app->Secure->GetPOST('submit'); $submit = $this->app->Secure->GetPOST('submit');
if ($submit == 'neuberechnen') { if ($submit == 'neuberechnen') {
@ -851,6 +860,8 @@ class Fibu_buchungen {
$this->app->User->SetParameter('fibu_buchungen_doc_typ', $von_typ); $this->app->User->SetParameter('fibu_buchungen_doc_typ', $von_typ);
$this->app->User->SetParameter('fibu_buchungen_doc_id', $von_id); $this->app->User->SetParameter('fibu_buchungen_doc_id', $von_id);
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=zuordnen&typ=".$von_typ, "Zur&uuml;ck");
$sql = "SELECT doc_typ, doc_id, doc_info, waehrung, sum(betrag) as saldonum,".$this->app->erp->FormatMenge("sum(betrag)",2)." as saldo FROM fibu_buchungen_alle WHERE typ = '".$von_typ."' AND id = '".$von_id."'"; $sql = "SELECT doc_typ, doc_id, doc_info, waehrung, sum(betrag) as saldonum,".$this->app->erp->FormatMenge("sum(betrag)",2)." as saldo FROM fibu_buchungen_alle WHERE typ = '".$von_typ."' AND id = '".$von_id."'";
$von_row = $this->app->DB->SelectArr($sql)[0]; $von_row = $this->app->DB->SelectArr($sql)[0];
$von_info = $von_row['doc_info']; $von_info = $von_row['doc_info'];
@ -858,8 +869,6 @@ class Fibu_buchungen {
$von_saldo = $von_row['saldo']; $von_saldo = $von_row['saldo'];
$von_waehrung = $von_row['waehrung']; $von_waehrung = $von_row['waehrung'];
$this->app->User->SetParameter('fibu_buchungen_greater_0', $von_saldonum > 0);
if ($submit == 'BUCHEN') { if ($submit == 'BUCHEN') {
// Process multi action // Process multi action
$count_success = 0; $count_success = 0;
@ -932,163 +941,4 @@ class Fibu_buchungen {
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_einzelzuordnen.tpl"); $this->app->Tpl->Parse('PAGE', "fibu_buchungen_einzelzuordnen.tpl");
} }
function fibu_buchungen_zuordnen() {
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "&Uuml;bersicht");
$submit = $this->app->Secure->GetPOST('submit');
$count_success = 0;
if ($submit == 'BUCHEN') {
// Process multi action
$von_typen = $this->app->Secure->GetPOST('fibu_typ');
$von_ids = $this->app->Secure->GetPOST('fibu_id');
$betraege = $this->app->Secure->GetPOST('fibu_betrag');
$waehrungen = $this->app->Secure->GetPOST('fibu_waehrung');
$objekte = $this->app->Secure->GetPOST('fibu_objekt');
if(!empty($von_ids)) {
$count = -1;
foreach ($von_ids as $von_id) {
$count++;
if ($von_id > 0) {
$von_typ = $von_typen[$count];
$objekt = $objekte[$count];
$objekt = explode('-',$objekt);
$doc_typ = strtolower($objekt[0]);
$doc_id = (int) $objekt[1];
$betrag = $betraege[$count];
$betrag = (float) $this->app->erp->ReplaceBetrag(true,$betrag);
$waehrung = $waehrungen[$count];
if (empty($von_typ) || empty($doc_typ) || empty($doc_id) || empty($betrag) || empty($waehrung)) {
continue;
}
$sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$von_typ."','".$von_id."','".$doc_typ."', '".$doc_id."', '".-$betrag."', '".$waehrung."', '".$this->app->User->GetID()."','". $input['zeit'] = date("Y-m-d H:i")."', '')";
$this->app->DB->Insert($sql);
$count_success++;
}
}
$this->fibu_rebuild_tables();
}
$msg .= "<div class=\"info\">".$count_success." Buchung".(($count_success===1)?'':'en')." durchgef&uuml;hrt.</div>";
}
$typ = $this->app->Secure->GetGET('typ');
$objektlink = array (
'<a href=\"index.php?action=edit&module=',
['sql' => 'fb.typ'],
'&id=',
['sql' => 'fb.id'],
'">',
['sql' => 'fo.info'],
'</a>'
);
$sql = "SELECT
salden.datum,
salden.typ,
salden.id,
salden.info,
salden.saldo,
salden.objektlink,
salden.saldonum,
salden.waehrung,
fo.typ as doc_typ,
fo.id as doc_id,
fo.info as doc_info
FROM
(
SELECT
".$this->app->erp->FormatDate("fb.datum")." as datum,
fb.typ,
fb.id,
fo.info,
".$this->app->erp->ConcatSQL($objektlink)." AS objektlink,
".$this->app->erp->FormatMenge('SUM(COALESCE(fb.betrag,0))',2)."AS saldo,
SUM(betrag) AS saldonum,
fb.waehrung
FROM
`fibu_buchungen_alle` fb
INNER JOIN fibu_objekte fo ON
fb.typ = fo.typ AND fb.id = fo.id
WHERE (fb.typ = '".$typ."' OR '".$typ."' = '')
GROUP BY
fb.typ,
fb.id,
fb.waehrung
) salden
LEFT JOIN fibu_objekte fo ON
salden.info LIKE CONCAT('%', fo.info, '%')
AND
salden.typ <> fo.typ AND fo.info <> ''
WHERE
salden.saldonum <> 0
GROUP BY
salden.typ,salden.id
LIMIT 100
";
// echo($sql);
$items = $this->app->DB->SelectArr($sql);
//print_r($items);
$et = new EasyTable($this->app);
$et->headings = array('Datum','Typ','Info','Betrag','Buchbetrag','Zuordnung');
foreach ($items as $item) {
$checked = empty($item['doc_typ'])?'':'checked';
if (empty($item['doc_id'])) {
$object_identifier = '';
} else {
$object_identifier = ucfirst($item['doc_typ'])."-".$item['doc_id']."-".$item['doc_info'];
}
$input_id = 'fibu_object_select_'.$item['id'];
$object_select = '<input
type="text"
size="40"
id="'.$input_id.'"
name="fibu_objekt[]"
value="'
.$object_identifier.'"/>';
if ($item['saldonum'] < 0) {
$min = $item['saldo'];
$max = '0';
} else {
$max = $item['saldo'];
$min = '0';
}
$row = array(
$item['datum'],
ucfirst($item['typ']),
$item['objektlink'],
$item['saldo'],
'<input type="number" step="0.01" size="10" name="fibu_betrag[]" value="'.$item['saldonum'].'" min="'.$min.'" max="'.$max.'"></input>'.$item['waehrung'],
$object_select,
'<input type="text" name="fibu_typ[]" value="'.$item['typ'].'" hidden/>',
'<input type="text" name="fibu_id[]" value="'.$item['id'].'" hidden/>',
'<input type="text" name="fibu_waehrung[]" value="'.$item['waehrung'].'" hidden/>'
);
$et->AddRow($row);
$this->app->YUI->Autocomplete($input_id,'fibu_objekte');
}
$et->DisplayNew('TAB1',"Gegenbuchung","noAction");
$this->app->Tpl->Set('MESSAGE', $msg);
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl");
}
} }

View File

@ -32,13 +32,13 @@ class Kontoauszuege {
case "kontoauszuege_konto_list": case "kontoauszuege_konto_list":
$allowed['konten_list'] = array('list'); $allowed['konten_list'] = array('list');
$heading = array('Bezeichnung', 'Kurzbezeichnung', 'Typ', 'Kontostand', 'Saldo','Men&uuml;'); $heading = array('Bezeichnung', 'Kurzbezeichnung', 'Typ', 'Kontostand','Letzter Import', 'Men&uuml;');
// $width = array('1%','1%','10%'); // Fill out manually later // $width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8); // $alignright = array(4,5,6,7,8); sdds
$findcols = array('k.bezeichnung', 'k.kurzbezeichnung', 'k.type', 'k.kontostand','saldo', 'k.id'); $findcols = array('k.bezeichnung', 'k.kurzbezeichnung', 'k.type', 'k.kontostand','ka.datum', 'k.id');
$searchsql = array('k.bezeichnung', 'k.kurzbezeichnung', 'k.datevkonto', 'k.blz', 'k.konto', 'k.swift', 'k.iban', 'k.inhaber', 'k.firma','p.abkuerzung'); $searchsql = array('k.bezeichnung', 'k.kurzbezeichnung', 'k.datevkonto', 'k.blz', 'k.konto', 'k.swift', 'k.iban', 'k.inhaber', 'k.firma','p.abkuerzung');
$defaultorder = 1; $defaultorder = 1;
@ -62,15 +62,13 @@ class Kontoauszuege {
k.bezeichnung, k.bezeichnung,
k.kurzbezeichnung, k.kurzbezeichnung,
".$this->app->erp->FormatUCfirst('k.type').", ".$this->app->erp->FormatUCfirst('k.type').",
".$this->app->erp->FormatMenge('SUM(COALESCE(ka.soll,0))',2)." AS kontostand, ".$this->app->erp->FormatMenge('SUM(COALESCE(ka.soll,0))+k.saldo_betrag',2)." AS kontostand,
".$this->app->erp->ConcatSQL($saldolink)." AS saldo, ".$this->app->erp->FormatDatetime("MIN(ka.importdatum)")." AS datum,
k.id k.id
FROM FROM
konten k konten k
LEFT JOIN kontoauszuege ka ON LEFT JOIN kontoauszuege ka ON
k.id = ka.konto k.id = ka.konto";
LEFT JOIN fibu_buchungen_alle fb ON
fb.id = ka.id AND fb.typ = 'kontoauszuege'";
$where = " k.aktiv = 1 AND ka.importfehler IS NULL "; $where = " k.aktiv = 1 AND ka.importfehler IS NULL ";
@ -122,8 +120,8 @@ class Kontoauszuege {
$sumcol = array(10); $sumcol = array(10);
$findcols = array('q.id','q.id','q.konto', 'q.importdatum', 'q.buchung', 'q.soll', 'q.waehrung', 'q.buchungstext','q.internebemerkung','q.saldo'); $findcols = array('q.id','q.id','q.kurzbezeichnung', 'q.importdatum', 'q.buchung', 'q.soll', 'q.waehrung', 'q.buchungstext','q.internebemerkung','q.saldo');
$searchsql = array('q.konto', 'q.buchung', 'q.soll', 'q.buchungstext','q.internebemerkung'); $searchsql = array('q.kurzbezeichnung', 'q.buchung', 'q.soll', 'q.buchungstext','q.internebemerkung');
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
@ -165,9 +163,9 @@ class Kontoauszuege {
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT
k.id, k.id,
$dropnbox, $dropnbox,
".$app->erp->FormatDateTimeShort('k.importdatum').", ".$app->erp->FormatDateTimeShort('k.importdatum')." AS importdatum,
(SELECT kurzbezeichnung FROM konten WHERE konten.id = k.konto), (SELECT kurzbezeichnung FROM konten WHERE konten.id = k.konto) as kurzbezeichnung,
".$app->erp->FormatDate('k.buchung').", ".$app->erp->FormatDate('k.buchung')." as buchung,
IF( IF(
k.importfehler, k.importfehler,
CONCAT( CONCAT(