mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 04:27:14 +01:00
Compare commits
7 Commits
92f016d06b
...
e9c61ebfc7
Author | SHA1 | Date | |
---|---|---|---|
|
e9c61ebfc7 | ||
|
e79f2839e2 | ||
|
7aab51a390 | ||
|
3dfba163df | ||
|
4a4b1f8320 | ||
|
03f0f7217b | ||
|
c6a4cf0d23 |
@ -117352,7 +117352,7 @@
|
|||||||
{
|
{
|
||||||
"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` from (select `auftrag`.`datum` AS `datum`,'auftrag' AS `typ`,`auftrag`.`id` AS `id`,`auftrag`.`belegnr` AS `info` from `auftrag` where `auftrag`.`belegnr` <> '' union select `rechnung`.`datum` AS `datum`,'rechnung' 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`.`rechnung` 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`) `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`.`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` from `auftrag` where `auftrag`.`belegnr` <> '' union select `rechnung`.`datum` AS `datum`,'rechnung' 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`.`rechnung` 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`,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",
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
[TAB1NEXT]
|
[TAB1NEXT]
|
||||||
</div>
|
</div>
|
||||||
<div id="tabs-2">
|
<div id="tabs-2">
|
||||||
<form action="" enctype="multipart/form-data" method="POST">
|
<form action="#tabs-2" enctype="multipart/form-data" method="POST">
|
||||||
[MESSAGE]
|
[MESSAGE]
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row-height">
|
<div class="row-height">
|
||||||
|
@ -4,32 +4,63 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
[MESSAGE]
|
[MESSAGE]
|
||||||
<form action="" method="post">
|
[FORMHANDLEREVENT]
|
||||||
[FORMHANDLEREVENT]
|
<div class="row">
|
||||||
<div class="row">
|
<div class="row-height">
|
||||||
<div class="row-height">
|
<div class="col-xs-12 col-md-12 col-md-height">
|
||||||
<div class="col-xs-12 col-md-10 col-md-height">
|
<div class="inside inside-full-height">
|
||||||
<div class="inside inside-full-height">
|
<fieldset>
|
||||||
<fieldset>
|
<legend>{|Offene Einzelsalden|}</legend>
|
||||||
<legend>{|Offene Einzelsalden|}</legend>
|
<div class="filter-box filter-usersave">
|
||||||
|
<div class="filter-block filter-inline">
|
||||||
|
<div class="filter-title">{|Filter|}</div>
|
||||||
|
<ul class="filter-list">
|
||||||
|
<li class="filter-item">
|
||||||
|
<label for="vorschlagfilter" class="switch">
|
||||||
|
<input type="checkbox" id="vorschlagfilter">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="vorschlagfilter">{|Vorschläge|}</label>
|
||||||
|
</li>
|
||||||
|
<li class="filter-item">
|
||||||
|
<label for="checkedfilter" class="switch">
|
||||||
|
<input type="checkbox" id="checkedfilter">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="checkedfilter">{|Betrag korrekt|}</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form action="" method="post" id="buchungenform">
|
||||||
[TAB1]
|
[TAB1]
|
||||||
</fieldset>
|
</form>
|
||||||
</div>
|
</fieldset>
|
||||||
</div>
|
<fieldset>
|
||||||
<div class="col-xs-12 col-md-2 col-md-height">
|
<table>
|
||||||
<div class="inside inside-full-height">
|
<legend>Stapelverarbeitung</legend>
|
||||||
<fieldset>
|
<tr>
|
||||||
<table width="100%" border="0" class="mkTableFormular">
|
<td><input type="checkbox" value="1" id="autoalle" /> alle markieren </td>
|
||||||
<legend>{|Aktionen|}</legend>
|
</tr>
|
||||||
|
<form action="" method="post">
|
||||||
<td><button name="submit" value="neuberechnen" class="ui-button-icon" style="width:100%;">{|Buchungen neu berechnen|}</button></td></tr>
|
<td><button name="submit" value="neuberechnen" class="ui-button-icon" style="width:100%;">{|Buchungen neu berechnen|}</button></td></tr>
|
||||||
<td><button name="submit" value="BUCHEN" class="ui-button-icon" style="width:100%;">{|BUCHEN|}</button></td></tr>
|
</form>
|
||||||
</table>
|
<td><button name="submit" form = "buchungenform" value="BUCHEN" class="ui-button-icon" style="width:100%;">{|Markierte BUCHEN|}</button></td></tr>
|
||||||
</fieldset>
|
</table>
|
||||||
</div>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$('#autoalle').on('change',function(){
|
||||||
|
var wert = $(this).prop('checked');
|
||||||
|
$('#fibu_buchungen_zuordnen').find('input[type="checkbox"]').prop('checked',wert);
|
||||||
|
$('#fibu_buchungen_zuordnen').find('input[type="checkbox"]').first().trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@ -19,7 +19,8 @@ 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->DefaultActionHandler("list");
|
$this->app->DefaultActionHandler("list");
|
||||||
$this->app->ActionHandlerListen($app);
|
$this->app->ActionHandlerListen($app);
|
||||||
|
|
||||||
@ -178,6 +179,227 @@ 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";
|
||||||
// $groupby = "";
|
// $groupby = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'fibu_buchungen_zuordnen':
|
||||||
|
|
||||||
|
$allowed['fibu_buchungen_zuordnung'] = array('list');
|
||||||
|
$heading = array('','','Datum', 'Info', 'Betrag', 'Währung', 'Buchungsbetrag','Vorschlag', 'Menü');
|
||||||
|
$width = array( );
|
||||||
|
|
||||||
|
$findcols = array('','auswahl','datum','objektlink','saldo','waehrung','buchwert_input','vorschlag');
|
||||||
|
$searchsql = array();
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
|
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=fibu_buchungen&action=einzelzuordnen&doc=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.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>';
|
||||||
|
|
||||||
|
$typ = $this->app->User->GetParameter('fibu_buchungen_doc_typ');
|
||||||
|
|
||||||
|
$objektlink = array (
|
||||||
|
'<a href=\"index.php?action=edit&module=',
|
||||||
|
['sql' => 'fb.typ'],
|
||||||
|
'&id=',
|
||||||
|
['sql' => 'fb.id'],
|
||||||
|
'">',
|
||||||
|
['sql' => 'fo.info'],
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$check_sql = "(fo.info <> '' AND salden.saldonum = -SUM(fbd.betrag))";
|
||||||
|
|
||||||
|
$auswahl = array (
|
||||||
|
'<input type=\"text\" name=\"ids[]\" value=\"',
|
||||||
|
['sql' => 'salden.typ'],
|
||||||
|
'_',
|
||||||
|
['sql' => 'salden.id'],
|
||||||
|
'" hidden/>',
|
||||||
|
'<input type=\"checkbox\" name=\"auswahl[]\" value="',
|
||||||
|
['sql' => 'salden.typ'],
|
||||||
|
'_',
|
||||||
|
['sql' => 'salden.id'],
|
||||||
|
'"',
|
||||||
|
['sql' => "if(".$check_sql.",'checked','')"],
|
||||||
|
' />'
|
||||||
|
);
|
||||||
|
|
||||||
|
$vorschlaege = array (
|
||||||
|
'<a href=\"index.php?action=edit&module=',
|
||||||
|
['sql' => 'COALESCE(fo.typ,\'\')'],
|
||||||
|
'&id=',
|
||||||
|
['sql' => 'COALESCE(fo.id,\'\')'],
|
||||||
|
'\">',
|
||||||
|
['sql' => $this->app->erp->FormatUCfirst('COALESCE(fo.typ,\'\')')],
|
||||||
|
' ',
|
||||||
|
['sql' => 'COALESCE(fo.info,\'\')'],
|
||||||
|
' ',
|
||||||
|
['sql' => "if (SUM(fbd.betrag) IS NULL,'',CONCAT('(Saldo ',".$this->app->erp->FormatMenge('SUM(fbd.betrag)',2).",')'))"],
|
||||||
|
'</a> ',
|
||||||
|
'<input type="text" name="vorschlaege[]" value="',
|
||||||
|
['sql' => 'COALESCE(fo.typ,\'\')'],
|
||||||
|
'_',
|
||||||
|
['sql' => 'COALESCE(fo.id,\'\')'],
|
||||||
|
'" hidden/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$werte = array (
|
||||||
|
'<input type="number" step="0.01" name="werte[]" value="',
|
||||||
|
['sql' => 'salden.saldonum'],
|
||||||
|
'" min="',
|
||||||
|
['sql' => 'if(salden.saldonum < 0,salden.saldonum,0)'],
|
||||||
|
'" max="',
|
||||||
|
['sql' => 'if(salden.saldonum < 0,0,salden.saldonum)'],
|
||||||
|
'"/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$waehrungen = array (
|
||||||
|
['sql' => 'salden.waehrung'],
|
||||||
|
'<input type="text" name="waehrungen[]" value="',
|
||||||
|
['sql' => 'salden.waehrung'],
|
||||||
|
'" hidden/>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$doc = array (
|
||||||
|
['sql' => 'salden.typ'],
|
||||||
|
'_',
|
||||||
|
['sql' => 'salden.id'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
'' AS dummy,
|
||||||
|
'' AS dummy2,
|
||||||
|
auswahl,
|
||||||
|
datum,
|
||||||
|
objektlink,
|
||||||
|
saldo,
|
||||||
|
waehrung,
|
||||||
|
wert,
|
||||||
|
vorschlag,
|
||||||
|
doc,
|
||||||
|
doc_id,
|
||||||
|
doc_saldo,
|
||||||
|
checked
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
'' AS dummy,
|
||||||
|
".$this->app->erp->ConcatSQL($auswahl)." AS auswahl,
|
||||||
|
salden.datum,
|
||||||
|
salden.typ,
|
||||||
|
salden.id,
|
||||||
|
salden.info,
|
||||||
|
salden.saldo,
|
||||||
|
salden.objektlink,
|
||||||
|
salden.saldonum,
|
||||||
|
".$this->app->erp->ConcatSQL($vorschlaege)." AS vorschlag,
|
||||||
|
".$this->app->erp->ConcatSQL($werte)." AS wert,
|
||||||
|
".$this->app->erp->ConcatSQL($waehrungen)." AS waehrung,
|
||||||
|
fo.typ AS doc_typ,
|
||||||
|
fo.id AS doc_id,
|
||||||
|
fo.info AS doc_info,
|
||||||
|
SUM(fbd.betrag) as doc_saldo,
|
||||||
|
if(".$check_sql.",'1','0') AS checked,
|
||||||
|
".$this->app->erp->ConcatSQL($doc)." AS doc
|
||||||
|
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(
|
||||||
|
SELECT
|
||||||
|
fo.typ,
|
||||||
|
fo.id,
|
||||||
|
fo.info
|
||||||
|
FROM
|
||||||
|
fibu_objekte fo
|
||||||
|
WHERE fo.is_beleg = 1
|
||||||
|
GROUP BY
|
||||||
|
fo.typ,
|
||||||
|
fo.id,
|
||||||
|
fo.info
|
||||||
|
) AS fo
|
||||||
|
ON
|
||||||
|
salden.info LIKE CONCAT('%', fo.info, '%') AND salden.typ <> fo.typ AND fo.info <> ''
|
||||||
|
LEFT JOIN
|
||||||
|
fibu_buchungen_alle fbd
|
||||||
|
ON
|
||||||
|
fbd.typ = fo.typ AND fbd.id = fo.id
|
||||||
|
WHERE
|
||||||
|
salden.saldonum <> 0
|
||||||
|
GROUP BY
|
||||||
|
salden.typ,
|
||||||
|
salden.id
|
||||||
|
) AS erg
|
||||||
|
";
|
||||||
|
|
||||||
|
$where = "1";
|
||||||
|
|
||||||
|
// Toggle filters
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#vorschlagfilter').click( function() { fnFilterColumn1( 0 ); } );");
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#checkedfilter').click( function() { fnFilterColumn2( 0 ); } );");
|
||||||
|
|
||||||
|
for ($r = 1;$r <= 4;$r++) {
|
||||||
|
$this->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 = $this->app->Secure->GetGET("more_data1");
|
||||||
|
if ($more_data1 == 1) {
|
||||||
|
$where .= " AND doc_id IS NOT NULL";
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
$more_data2 = $this->app->Secure->GetGET("more_data2");
|
||||||
|
if ($more_data2 == 1) {
|
||||||
|
$where .= " AND checked = 1";
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
// END Toggle filters
|
||||||
|
|
||||||
|
|
||||||
|
// $count = "SELECT count(DISTINCT id) FROM fibu_buchungen_alle WHERE $where";
|
||||||
|
$groupby = "GROUP BY typ, id";
|
||||||
|
|
||||||
|
//echo($sql." WHERE ".$where." ".$groupby);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +436,7 @@ class Fibu_buchungen {
|
|||||||
$submit = $this->app->Secure->GetPOST('submit');
|
$submit = $this->app->Secure->GetPOST('submit');
|
||||||
if ($submit == 'neuberechnen') {
|
if ($submit == 'neuberechnen') {
|
||||||
$this->fibu_rebuild_tables();
|
$this->fibu_rebuild_tables();
|
||||||
|
$msg = "<div class=\"info\">Buchungen wurden neu berechnet.</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// For transfer to tablesearch
|
// For transfer to tablesearch
|
||||||
@ -226,6 +449,10 @@ class Fibu_buchungen {
|
|||||||
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_salden', "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->YUI->TableSearch('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
|
||||||
|
if (!empty($msg)) {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||||
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_list.tpl");
|
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_list.tpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +460,7 @@ class Fibu_buchungen {
|
|||||||
$id = (int) $this->app->Secure->GetGET('id');
|
$id = (int) $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
// $this->app->DB->Delete("DELETE FROM `fibu_buchungen` WHERE `id` = '{$id}'");
|
// $this->app->DB->Delete("DELETE FROM `fibu_buchungen` WHERE `id` = '{$id}'");
|
||||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gelöscht.</div>");
|
// $this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gelöscht.</div>");
|
||||||
|
|
||||||
$this->fibu_buchungen_list();
|
$this->fibu_buchungen_list();
|
||||||
}
|
}
|
||||||
@ -429,6 +656,72 @@ class Fibu_buchungen {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fibu_buchungen_zuordnen_tablesearch() {
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Übersicht");
|
||||||
|
// $this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=create", "Neu anlegen");
|
||||||
|
|
||||||
|
$submit = $this->app->Secure->GetPOST('submit');
|
||||||
|
if ($submit == 'neuberechnen') {
|
||||||
|
$this->fibu_rebuild_tables();
|
||||||
|
|
||||||
|
$msg = "<div class=\"info\">Buchungen wurden neu berechnet.</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($submit == 'BUCHEN') {
|
||||||
|
|
||||||
|
// Process multi action
|
||||||
|
$ids = $this->app->Secure->GetPOST('ids');
|
||||||
|
$werte = $this->app->Secure->GetPOST('werte');
|
||||||
|
$waehrungen = $this->app->Secure->GetPOST('waehrungen');
|
||||||
|
$auswahl = $this->app->Secure->GetPOST('auswahl');
|
||||||
|
$vorschlaege = $this->app->Secure->GetPOST('vorschlaege');
|
||||||
|
|
||||||
|
if (!empty($auswahl)) {
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
|
||||||
|
$key_ids = array_search($id,$ids);
|
||||||
|
$key_auswahl = array_search($id,$auswahl);
|
||||||
|
|
||||||
|
if ($key_auswahl !== false && $vorschlaege[$key_ids] != '_') {
|
||||||
|
$von = explode('_',$id);
|
||||||
|
$von_typ = strtolower($von[0]);
|
||||||
|
$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];
|
||||||
|
$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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fibu_rebuild_tables();
|
||||||
|
|
||||||
|
// For transfer to tablesearch
|
||||||
|
$doc_typ = $this->app->Secure->GetGET('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('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
|
||||||
|
if (!empty($msg)) {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
function fibu_buchungen_zuordnen() {
|
function fibu_buchungen_zuordnen() {
|
||||||
|
|
||||||
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Übersicht");
|
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Übersicht");
|
||||||
@ -518,7 +811,9 @@ class Fibu_buchungen {
|
|||||||
fb.waehrung
|
fb.waehrung
|
||||||
) salden
|
) salden
|
||||||
LEFT JOIN fibu_objekte fo ON
|
LEFT JOIN fibu_objekte fo ON
|
||||||
salden.info LIKE CONCAT('%', fo.info, '%') AND salden.typ <> fo.typ AND fo.info <> ''
|
salden.info LIKE CONCAT('%', fo.info, '%')
|
||||||
|
AND
|
||||||
|
salden.typ <> fo.typ AND fo.info <> ''
|
||||||
WHERE
|
WHERE
|
||||||
salden.saldonum <> 0
|
salden.saldonum <> 0
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
@ -1399,23 +1399,6 @@ class Gutschrift extends GenGutschrift
|
|||||||
|
|
||||||
$this->app->DB->Update("UPDATE gutschrift SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
|
$this->app->DB->Update("UPDATE gutschrift SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
|
||||||
|
|
||||||
// First refresh all open items
|
|
||||||
$openids = $this->app->DB->SelectArr("SELECT id, waehrung from gutschrift WHERE zahlungsstatus != 'bezahlt'");
|
|
||||||
|
|
||||||
foreach ($openids as $openid) {
|
|
||||||
$saldo = $this->app->erp->GetSaldoDokument($openid['id'],'gutschrift');
|
|
||||||
|
|
||||||
if (!empty($saldo)) {
|
|
||||||
if ($saldo['waehrung'] == $openid['waehrung']) {
|
|
||||||
$sql = "UPDATE gutschrift SET ist = soll-'".$saldo['betrag']."' WHERE id=".$openid['id'];
|
|
||||||
$result = $this->app->DB->Update($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->app->DB->Update("UPDATE gutschrift SET ist = null WHERE id=".$openid['id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('gutschrift', 'edit')) {
|
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('gutschrift', 'edit')) {
|
||||||
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
||||||
$aktion = $this->app->Secure->GetPOST('sel_aktion');
|
$aktion = $this->app->Secure->GetPOST('sel_aktion');
|
||||||
@ -1659,6 +1642,28 @@ class Gutschrift extends GenGutschrift
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refresh all open items
|
||||||
|
$openids = $this->app->DB->SelectArr("SELECT id, waehrung from gutschrift WHERE zahlungsstatus != 'bezahlt'");
|
||||||
|
|
||||||
|
foreach ($openids as $openid) {
|
||||||
|
$saldo = $this->app->erp->GetSaldoDokument($openid['id'],'gutschrift');
|
||||||
|
|
||||||
|
if (!empty($saldo)) {
|
||||||
|
if ($saldo['waehrung'] == $openid['waehrung']) {
|
||||||
|
$sql = "UPDATE
|
||||||
|
gutschrift
|
||||||
|
SET
|
||||||
|
ist = ".$saldo['betrag']."+soll,
|
||||||
|
zahlungsstatus = IF(".$saldo['betrag']." = 0,'bezahlt','offen')
|
||||||
|
WHERE id=".$openid['id'];
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->app->DB->Update("UPDATE gutschrift SET ist = null WHERE id=".$openid['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$backurl = $this->app->Secure->GetGET('backurl');
|
$backurl = $this->app->Secure->GetGET('backurl');
|
||||||
$backurl = $this->app->erp->base64_url_decode($backurl);
|
$backurl = $this->app->erp->base64_url_decode($backurl);
|
||||||
|
|
||||||
|
@ -1030,7 +1030,7 @@ class Importvorlage extends GenImportvorlage {
|
|||||||
|
|
||||||
if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $stueckliste_csv)) {
|
if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $stueckliste_csv)) {
|
||||||
//$importfilename = $_FILES['userfile']['name'];
|
//$importfilename = $_FILES['userfile']['name'];
|
||||||
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Die Datei konnte nicht geöffnet werden. Eventuell ist die Datei zu groß oder die Schreibrechte stimmen nicht!</div> ");
|
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Die Datei '".$stueckliste_csv."' konnte nicht geöffnet werden. Eventuell ist die Datei zu groß oder die Schreibrechte stimmen nicht!</div> ");
|
||||||
$this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
|
$this->app->Location->execute("index.php?module=importvorlage&action=import&id=$id&msg=$msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5145,7 +5145,7 @@ class Importvorlage extends GenImportvorlage {
|
|||||||
$row['konto'] = $kontoid[0]['id'];
|
$row['konto'] = $kontoid[0]['id'];
|
||||||
$row['importdatum'] = date("Y-m-d H:i:s");
|
$row['importdatum'] = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
$sql = "SELECT pruefsumme FROM kontoauszuege WHERE pruefsumme='".$row['pruefsumme']."' AND konto ='".$row['konto']."'";
|
$sql = "SELECT pruefsumme FROM kontoauszuege WHERE pruefsumme='".$row['pruefsumme']."' AND konto ='".$row['konto']."' AND importfehler IS NULL";
|
||||||
$result = $this->app->DB->SelectArr($sql);
|
$result = $this->app->DB->SelectArr($sql);
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
|
@ -265,6 +265,20 @@ class Kontoauszuege {
|
|||||||
$this->app->Tpl->Parse('PAGE', "kontoauszuege_konto_list.tpl");
|
$this->app->Tpl->Parse('PAGE', "kontoauszuege_konto_list.tpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function kontoauszuege_mark_as_error(int $id) : ?string {
|
||||||
|
$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)) {
|
||||||
|
return("Es existieren Buchungen, Eintrag wurde nicht als Importfehler markiert!");
|
||||||
|
} else {
|
||||||
|
$this->app->DB->Delete("UPDATE `kontoauszuege` SET importfehler = 1 WHERE `id` = '{$id}'");
|
||||||
|
return("Der Eintrag wurde als Importfehler markiert.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function kontoauszuege_list() {
|
function kontoauszuege_list() {
|
||||||
|
|
||||||
@ -282,8 +296,21 @@ class Kontoauszuege {
|
|||||||
$submit = $this->app->Secure->GetPOST('ausfuehren');
|
$submit = $this->app->Secure->GetPOST('ausfuehren');
|
||||||
|
|
||||||
if ($submit == 'Importfehler') {
|
if ($submit == 'Importfehler') {
|
||||||
$sql = "UPDATE kontoauszuege SET importfehler = 1 WHERE id IN (".implode(",",$selectedIds).")";
|
|
||||||
$this->app->DB->Update($sql);
|
$message = "";
|
||||||
|
|
||||||
|
foreach ($selectedIds as $selectedId) {
|
||||||
|
$result = $this->kontoauszuege_mark_as_error($selectedId);
|
||||||
|
if ($result) {
|
||||||
|
$message = $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($message) {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">".$message."</div>");
|
||||||
|
} else {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"warning\">Einträge wurden als Importfehler markiert.</div>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,15 +336,14 @@ class Kontoauszuege {
|
|||||||
public function kontoauszuege_delete() {
|
public function kontoauszuege_delete() {
|
||||||
$id = (int) $this->app->Secure->GetGET('id');
|
$id = (int) $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
$sql = "SELECT id FROM fibu_buchungen_alle WHERE CONCAT(doc_typ,doc_id) <> CONCAT('kontoauszuege','".$id."') AND typ = 'kontoauszuege' AND id = ".$id;
|
$result = $this->kontoauszuege_mark_as_error($id);
|
||||||
$result = $this->app->DB->SelectArr($sql);
|
|
||||||
|
|
||||||
if (!empty($result)) {
|
if ($result) {
|
||||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Es existieren Buchungen, Eintrag wurde nicht als Importfehler markiert!</div>");
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">".$result."</div>");
|
||||||
} else {
|
} 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->app->Tpl->Set('MESSAGE', "<div class=\"warning\">Der Eintrag wurde als Importfehler markiert.</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->kontoauszuege_list();
|
$this->kontoauszuege_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2065,23 +2065,6 @@ class Rechnung extends GenRechnung
|
|||||||
|
|
||||||
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
|
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
|
||||||
|
|
||||||
// First refresh all open items
|
|
||||||
$openids = $this->app->DB->SelectArr("SELECT id, waehrung from rechnung WHERE zahlungsstatus = 'offen'");
|
|
||||||
|
|
||||||
foreach ($openids as $openid) {
|
|
||||||
$saldo = $this->app->erp->GetSaldoDokument($openid['id'],'rechnung');
|
|
||||||
|
|
||||||
if (!empty($saldo)) {
|
|
||||||
if ($saldo['waehrung'] == $openid['waehrung']) {
|
|
||||||
$sql = "UPDATE rechnung SET ist = ".$saldo['betrag']."+soll WHERE id=".$openid['id'];
|
|
||||||
$this->app->DB->Update($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$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'))
|
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('rechnung', 'edit'))
|
||||||
{
|
{
|
||||||
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
||||||
@ -2262,6 +2245,28 @@ class Rechnung extends GenRechnung
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refresh all open items
|
||||||
|
$openids = $this->app->DB->SelectArr("SELECT id, waehrung from rechnung WHERE zahlungsstatus = 'offen'");
|
||||||
|
|
||||||
|
foreach ($openids as $openid) {
|
||||||
|
$saldo = $this->app->erp->GetSaldoDokument($openid['id'],'rechnung');
|
||||||
|
|
||||||
|
if (!empty($saldo)) {
|
||||||
|
if ($saldo['waehrung'] == $openid['waehrung']) {
|
||||||
|
$sql = "UPDATE
|
||||||
|
rechnung
|
||||||
|
SET
|
||||||
|
ist = ".$saldo['betrag']."+soll,
|
||||||
|
zahlungsstatus = IF(".$saldo['betrag']." = 0,'bezahlt','offen')
|
||||||
|
WHERE id=".$openid['id'];
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->app->DB->Update("UPDATE rechnung SET ist = null WHERE id=".$openid['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Set('UEBERSCHRIFT','Rechnungen');
|
$this->app->Tpl->Set('UEBERSCHRIFT','Rechnungen');
|
||||||
|
|
||||||
$backurl = $this->app->Secure->GetGET('backurl');
|
$backurl = $this->app->Secure->GetGET('backurl');
|
||||||
|
Loading…
Reference in New Issue
Block a user