fibu buchungen

This commit is contained in:
OpenXE 2023-04-01 20:42:37 +02:00
parent 689fdb0490
commit 2b573268fa
12 changed files with 341 additions and 50 deletions

View File

@ -6139,7 +6139,10 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
DATE_FORMAT(r.datum,'%d.%m.%Y') as vom, adr.kundennummer as kundennummer,
CONCAT(" . $this->app->erp->MarkerUseredit("r.name", "r.useredittimestamp") . ", if(r.internebezeichnung!='',CONCAT('<br><i style=color:#999>',r.internebezeichnung,'</i>'),'')) as kunde,
r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
FORMAT(r.soll,2{$extended_mysql55}) as soll, r.zahlungsstatus as zahlung, r.soll-r.ist as differenz, re.belegnr as rechnung, UPPER(r.status) as status,
".$this->app->erp->FormatMenge('r.soll',2)." as soll,
r.zahlungsstatus as zahlung,
".$this->app->erp->FormatMenge('r.soll-r.ist',2)." as differenz,
re.belegnr as rechnung, UPPER(r.status) as status,
".$this->IconsSQLReturnOrder()." ,r.id
FROM gutschrift r
LEFT JOIN rechnung re ON re.id=r.rechnungid

View File

@ -117360,12 +117360,12 @@
{
"name": "fibu_objekte",
"type": "VIEW",
"Create": "CREATE VIEW `fibu_objekte` AS select `rechnung`.`datum` AS `datum`,'rechnung' collate utf8mb4_general_ci AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`belegnr` AS `info` from `rechnung` where `rechnung`.`belegnr` <> '' union select `gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`belegnr` AS `belegnr` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select `verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`belegnr` AS `belegnr` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select `kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,concat(`konten`.`kurzbezeichnung`,' - ',`kontoauszuege`.`buchungstext`) AS `buchungstext` from (`kontoauszuege` left join `konten` on(`konten`.`id` = `kontoauszuege`.`konto`)) union select '' AS `Name_exp_1`,'kontorahmen' AS `'kontorahmen'`,`kontorahmen`.`id` AS `id`,`kontorahmen`.`beschriftung` AS `beschriftung` from `kontorahmen`"
"Create": "CREATE VIEW `fibu_objekte` AS select `auftrag`.`datum` AS `datum`,'auftrag' collate utf8mb4_general_ci AS `typ`,`auftrag`.`id` AS `id`,`auftrag`.`belegnr` AS `info` from `auftrag` where `auftrag`.`belegnr` <> '' union select `rechnung`.`datum` AS `datum`,'rechnung' collate utf8mb4_general_ci AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`belegnr` AS `info` from `rechnung` where `rechnung`.`belegnr` <> '' union select `gutschrift`.`datum` AS `datum`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`belegnr` AS `belegnr` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select `verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`belegnr` AS `belegnr` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select `kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,concat(`konten`.`kurzbezeichnung`,' - ',`kontoauszuege`.`buchungstext`) AS `buchungstext` from (`kontoauszuege` left join `konten` on(`konten`.`id` = `kontoauszuege`.`konto`)) union select '' AS `datum`,'kontorahmen' AS `'kontorahmen'`,`kontorahmen`.`id` AS `id`,`kontorahmen`.`beschriftung` AS `beschriftung` from `kontorahmen`"
},
{
"name": "fibu_buchungen_alle",
"type": "VIEW",
"Create": "CREATE VIEW `fibu_buchungen_alle` AS select `fb`.`buchungsart` AS `buchungsart`,`fb`.`typ` AS `typ`,`fb`.`id` AS `id`,if(`fibu_objekte`.`datum` <> '' collate utf8mb4_general_ci,`fibu_objekte`.`datum`,`fb`.`datum`) AS `datum`,`fb`.`gegen_typ` collate utf8mb4_general_ci AS `doc_typ`,`fb`.`gegen_id` AS `doc_id`,`fibu_objekte`.`info` AS `doc_belegnr`,`fb`.`soll` AS `betrag`,`fb`.`waehrung` AS `waehrung`,`fb`.`edit_module` collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci union select 'umsatz' AS `umsatz`,'gutschrift' AS `'gutschrift'`,`gutschrift`.`id` AS `id`,-`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `edit_module`,`gutschrift`.`id` AS `edit_id` from `gutschrift` where `gutschrift`.`belegnr` <> '' collate utf8mb4_general_ci union select 'abbuchung' AS `abbuchung`,'gutschrift' AS `rechnung`,`gutschrift`.`id` AS `id`,`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'rechnung' AS `gutschrift`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `edit_module`,`gutschrift`.`id` AS `edit_id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' collate utf8mb4_general_ci union select 'abbuchung' AS `abbuchung`,'rechnung' AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,-`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum`,'gutschrift' AS `edit_module`,`gutschrift`.`id` AS `edit_id` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' collate utf8mb4_general_ci union select 'aufwand' AS `aufwand`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,-`verbindlichkeit`.`betrag` AS `- ``openxe``.``verbindlichkeit``.``betrag```,`verbindlichkeit`.`waehrung` AS `waehrung`,'verbindlichkeit' AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' AS `edit_module`,`verbindlichkeit`.`id` AS `edit_id` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' collate utf8mb4_general_ci union select 'zahlung' AS `zahlung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,-`kontoauszuege`.`soll` AS `- ``openxe``.``kontoauszuege``.``soll```,`kontoauszuege`.`waehrung` AS `waehrung`,'kontoauszuege' AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' AS `edit_module`,`kontoauszuege`.`id` AS `edit_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 `- ``openxe``.``fibu_buchungen``.``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 `edit_module`,`fibu_buchungen`.`id` AS `edit_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 `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 `edit_module`,`fibu_buchungen`.`id` AS `edit_id` from `fibu_buchungen`) `fb` left join `fibu_objekte` on(`fb`.`gegen_typ` = `fibu_objekte`.`typ` and `fb`.`gegen_id` = `fibu_objekte`.`id`))"
"Create": "CREATE VIEW `fibu_buchungen_alle` AS select `fb`.`buchungsart` AS `buchungsart`,`fb`.`typ` AS `typ`,`fb`.`id` AS `id`,if(`fibu_objekte`.`datum` <> '' collate utf8mb4_general_ci,`fibu_objekte`.`datum`,`fb`.`datum`) AS `datum`,`fb`.`gegen_typ` collate utf8mb4_general_ci AS `doc_typ`,`fb`.`gegen_id` AS `doc_id`,`fibu_objekte`.`info` AS `doc_belegnr`,`fb`.`soll` AS `betrag`,`fb`.`waehrung` AS `waehrung`,`fb`.`edit_module` collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci 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` <> '' collate utf8mb4_general_ci 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` on(`fb`.`gegen_typ` = `fibu_objekte`.`typ` and `fb`.`gegen_id` = `fibu_objekte`.`id`))"
}
]
}

View File

@ -2072,6 +2072,20 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
$newarr[] = $arr[$i]['name'];
break;
case "fibu_objekte":
$arr = $this->app->DB->SelectArr("SELECT CONCAT(".$this->app->erp->FormatUCfirst('typ').",'-',id,'-',info) as objekt FROM fibu_objekte WHERE info LIKE '%$term%' LIMIT 20");
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++)
$newarr[] = $arr[$i]['objekt'];
break;
case "fibu_belege":
$arr = $this->app->DB->SelectArr("SELECT CONCAT(".$this->app->erp->FormatUCfirst('typ').",'-',id,'-',info) as objekt FROM fibu_objekte WHERE info LIKE '%$term%' AND typ IN ('auftrag','rechnung','gutschrift','verbindlichkeit') LIMIT 20");
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++)
$newarr[] = $arr[$i]['objekt'];
break;
case "vpeartikel":
$arr = $this->app->DB->SelectArr("SELECT DISTINCT vpe FROM verkaufspreise WHERE geloescht=0 AND vpe LIKE '%$term%' ORDER by vpe");
$carr = !empty($arr)?count($arr):0;

View File

@ -1,10 +1,17 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
<li><a href="#tabs-1">Salden</a></li>
<li><a href="#tabs-2">Buchungen</a></li>
</ul>
<div id="tabs-1">
<legend>Salden m&uuml;ssen &uuml;ber Gegenbuchungen ausgeglichen werden.</legend>
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
<div id="tabs-2">
[MESSAGE]
[TAB2]
[TAB2NEXT]
</div>
</div>

View File

@ -0,0 +1,34 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"><!--[TABTEXT]--></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-10 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Offene Einzelsalden|}</legend>
[TAB1]
</fieldset>
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
<tr><td><input type="submit" class="btnBlue" name="ausfuehren" value="{|BUCHEN|}" /></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</form>
</div>
</div>

View File

@ -11,7 +11,8 @@
<table>
<legend>Stapelverarbeitung</legend>
<tr>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td><td><input type="submit" class="btnBlue" name="ausfuehren" value="{|Importfehler|}" /></td>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td>
<td><input type="submit" class="btnBlue" name="ausfuehren" value="{|Importfehler|}" /></td>
</tr>
</table>
</fieldset>

View File

@ -19,6 +19,7 @@ class Fibu_buchungen {
$this->app->ActionHandler("edit", "fibu_buchungen_edit");
$this->app->ActionHandler("delete", "fibu_buchungen_delete");
$this->app->ActionHandler("assoc", "fibu_buchungen_assoc");
$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
@ -30,32 +31,7 @@ class Fibu_buchungen {
}
function TableSearch(&$app, $name, $erlaubtevars) {
switch ($name) {
case "fibu_buchungen_list_tabelle":
$allowed['fibu_buchungen_list'] = array('list');
$heading = array('','','Von_typ', 'Von_id', 'Nach_typ', 'Nach_id', 'Betrag', 'Waehrung', 'Benutzer', 'Zeit', 'Internebemerkung', 'Men&uuml;');
$width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('f.id','f.id','f.von_typ', 'f.von_id', 'f.nach_typ', 'f.nach_id', 'f.betrag', 'f.waehrung', 'f.benutzer', 'f.zeit', 'f.internebemerkung');
$searchsql = array('f.von_typ', 'f.von_id', 'f.nach_typ', 'f.nach_id', 'f.betrag', 'f.waehrung', 'f.benutzer', 'f.zeit', 'f.internebemerkung');
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',f.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=fibu_buchungen&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=fibu_buchungen&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS f.id, $dropnbox, f.von_typ, f.von_id, f.nach_typ, f.nach_id, f.betrag, f.waehrung, f.benutzer, f.zeit, f.internebemerkung, f.id FROM fibu_buchungen f";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM fibu_buchungen WHERE $where";
// $groupby = "";
break;
switch ($name) {
case "fibu_buchungen_list":
$allowed['fibu_buchungen_list'] = array('list');
@ -101,6 +77,69 @@ class Fibu_buchungen {
// $groupby = "";
break;
case "fibu_buchungen_salden":
$allowed['fibu_buchungen_salden'] = array('list');
$heading = array( '', 'Typ','Anzahl', 'Saldo', 'Men&uuml;');
$width = array( '1%', '96%', '1%', '1%', '1%');
$findcols = array('','','typ','anzahl','saldo');
$searchsql = array();
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',f.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=fibu_buchungen&action=zuordnen&typ=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
$linkstart = '<table cellpadding=0 cellspacing=0><tr><td nowrap><a href="index.php?module=fibu_buchungen&action=edit&';
$linkend = '"><img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/forward.svg" border=0></a></td></tr></table>';
$id = $app->Secure->GetGET('id');
$saldolink = array (
'<a href=\"index.php?module=fibu_buchungen&action=zuordnen&typ=',
['sql' => 'typ'],
'">',
['sql' => $this->app->erp->FormatMenge('SUM(COALESCE(saldonum,0))',2)],
'</a>'
);
$sql = "SELECT
'',
'',
".$this->app->erp->FormatUCfirst('typ')." AS typ,
count(id) anzahl,
".$this->app->erp->ConcatSQL($saldolink)." AS saldo,
typ
FROM
(
SELECT
fb.typ,
fb.id,
fo.info,
SUM(betrag) AS saldonum
FROM
`fibu_buchungen_alle` fb
INNER JOIN fibu_objekte fo ON
fb.typ = fo.typ AND fb.id = fo.id
WHERE
fb.typ <> 'kontorahmen'
GROUP BY
fb.typ,
fb.id
) salden
";
$where = "saldonum <> 0";
// $count = "SELECT count(DISTINCT id) FROM fibu_buchungen_alle WHERE $where";
$groupby = "GROUP BY typ";
$orderby = "ORDER BY typ";
// echo($sql." WHERE ".$where." ".$groupby);
break;
case "fibu_buchungen_wahl":
$allowed['fibu_buchungen_wahl'] = array('list');
$heading = array('', '', 'Datum', 'Typ', 'Beleg', 'Von','Nach', 'Men&uuml;');
@ -154,9 +193,7 @@ class Fibu_buchungen {
function fibu_buchungen_list() {
$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");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
// $this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=create", "Neu anlegen");
// For transfer to tablesearch
$doc_typ = $this->app->Secure->GetGET('doc_typ');
@ -165,7 +202,9 @@ class Fibu_buchungen {
$this->app->User->SetParameter('fibu_buchungen_doc_typ', $doc_typ);
$this->app->User->SetParameter('fibu_buchungen_doc_id', $doc_id);
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_salden', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->YUI->TableSearch('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_list.tpl");
}
@ -369,4 +408,149 @@ class Fibu_buchungen {
}
function fibu_buchungen_zuordnen() {
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "&Uuml;bersicht");
$submit = $this->app->Secure->GetPOST('ausfuehren');
$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++;
}
}
}
$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.typ,
salden.id,
salden.info,
salden.saldo,
salden.objektlink,
salden.saldonum,
salden.waehrung
FROM
(
SELECT
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 <> 'kontorahmen' AND (fb.typ = '".$typ."' OR '".$typ."' = '')
GROUP BY
fb.typ,
fb.id,
fb.waehrung
) salden
WHERE
salden.saldonum <> 0
LIMIT 100
";
// echo($sql);
$items = $this->app->DB->SelectArr($sql);
//print_r($items);
$et = new EasyTable($this->app);
$et->headings = array('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_belegnr'];
}
$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(
ucfirst($item['typ']),
$item['objektlink'],
$item['saldo'],
'<input type="number" step="0.01" size="10" name="fibu_betrag[]" value="'.$item['saldo'].'" 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

@ -1392,7 +1392,7 @@ class Gutschrift extends GenGutschrift
if (!empty($saldo)) {
if ($saldo['waehrung'] == $openid['waehrung']) {
$sql = "UPDATE gutschrift SET ist = '".$saldo['betrag']."'+soll WHERE id=".$openid['id'];
$sql = "UPDATE gutschrift SET ist = soll-'".$saldo['betrag']."' WHERE id=".$openid['id'];
$result = $this->app->DB->Update($sql);
}
}

View File

@ -15,7 +15,7 @@ class Kontoauszuege {
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "kontoauszuege_konto_list");
$this->app->ActionHandler("listentries", "kontoauszuege_list");
$this->app->ActionHandler("listentries", "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");
@ -51,8 +51,7 @@ class Kontoauszuege {
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=kontoauszuege&action=listentries&kid=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
$saldolink = array (
'<a href=\"index.php?module=kontoauszuege&action=listentries&onlysaldo=1&kid=',
['sql' => 'k.id'],
'<a href=\"index.php?module=fibu_buchungen&action=zuordnen&typ=kontoauszuege',
'">',
['sql' => $this->app->erp->FormatMenge('SUM(COALESCE(fb.betrag,0))',2)],
'</a>'
@ -198,6 +197,48 @@ class Kontoauszuege {
// $count = "SELECT count(DISTINCT id) FROM kontoauszuege k WHERE $where";
// $groupby = "";
// echo($sql." WHERE ".$where." ".$groupby);
break;
case "kontoauszuege_salden":
$allowed['kontoauszuege_list'] = array('list');
$kontoid = $this->app->User->getParameter('kontoauszuege_konto_id');
$onlysaldo = $this->app->User->getParameter('kontoauszuege_only_saldo');
$heading = array('','', 'Buchungstext', 'Betrag', 'Waehrung', 'Betrag zuordnen', 'Beleg', 'ID','Beleg-Nr.','', 'Men&uuml;');
$width = array('1%','1%', '20%', '1%', '1%', '1%', '1%', '1%','1%', '1%','1%');
// columns that are aligned right (numbers etc)
$alignright = array(6);
$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');
$searchsql = array('q.konto', 'q.buchung', 'q.soll', 'q.buchungstext','q.internebemerkung');
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',q.id,'\"',if(b.doc_belegnr IS NOT NULL,'checked',''),' />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=kontoauszuege&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=kontoauszuege&action=delete&kid=".$kontoid."&onlysaldo=".$onlysaldo."&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "SELECT
".$this->app->erp->FormatUCfirst('typ')."
SUM(betrag)
FROM `fibu_buchungen_alle`
";
$where = "1";
if ($onlysaldo) {
$where .= " AND q.saldonum != 0";
}
// $count = "SELECT count(DISTINCT id) FROM kontoauszuege k WHERE $where";
$groupby = "GROUP BY typ";
// echo($sql." WHERE ".$where." ".$groupby);
break;
@ -262,14 +303,21 @@ class Kontoauszuege {
$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', "<div class=\"error\">Der Eintrag wurde als Importfehler markiert.</div>");
$sql = "SELECT id FROM fibu_buchungen_alle WHERE CONCAT(doc_typ,doc_id) <> CONCAT('kontoauszuege','".$id."') AND typ = 'kontoauszuege' AND id = ".$id;
$result = $this->app->DB->SelectArr($sql);
if (!empty($result)) {
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Es existieren Buchungen, Eintrag wurde nicht als Importfehler markiert!</div>");
} else {
$this->app->DB->Delete("UPDATE `kontoauszuege` SET importfehler = 1 WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"warning\">Der Eintrag wurde als Importfehler markiert.</div>");
}
$this->kontoauszuege_list();
}

View File

@ -277,7 +277,7 @@ class Rechnung extends GenRechnung
*/
public function removeManualPayed($invoiceId)
{
if(empty($invoiceId) || !$this->app->DB->Select(sprintf('SELECT id FROM rechnung WHERE id = %d', $invoiceId))) {
/* if(empty($invoiceId) || !$this->app->DB->Select(sprintf('SELECT id FROM rechnung WHERE id = %d', $invoiceId))) {
return false;
}
$this->app->erp->RechnungProtokoll($invoiceId,'Rechnung manuell als bezahlt entfernt');
@ -288,7 +288,7 @@ class Rechnung extends GenRechnung
WHERE id='$invoiceId'"
);
return true;
return true;*/
}
public function RechnungManuellBezahltEntfernen()
@ -2078,9 +2078,9 @@ class Rechnung extends GenRechnung
}
}
else {
$this->app->DB->Update("UPDATE rechnung SET ist = null");
$this->app->DB->Update("UPDATE rechnung SET ist = null WHERE id=".$openid['id']);
}
}
}
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('rechnung', 'edit'))
{
@ -2102,10 +2102,10 @@ class Rechnung extends GenRechnung
switch($aktion)
{
case 'bezahlt':
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='bezahlt', bezahlt_am = now(), ist=soll,mahnwesenfestsetzen='1',mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt markiert am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='bezahlt', bezahlt_am = now(), mahnwesenfestsetzen='1',mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt markiert am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
break;
case 'offen':
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen',bezahlt_am = NULL, ist='0',mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt entfernt am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen',bezahlt_am = NULL, mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt entfernt am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
break;
case 'mail':
$auswahl = $this->app->DB->SelectFirstCols(

View File

@ -94,7 +94,7 @@
</tr>
<tr>
<td>
{|OFFEN|}:
{|FEHLT|}:
</td>
<td id="istdb">
[ISTDB]

View File

@ -125,7 +125,7 @@
</tr>
<tr>
<td>
{|OFFEN|}:
{|FEHLT|}:
</td>
<td id="istdb">
[ISTDB]