mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
fibu_buchungen einzelzuordnung
This commit is contained in:
parent
828af9ab50
commit
82fc367405
@ -117352,12 +117352,12 @@
|
||||
{
|
||||
"name": "fibu_objekte_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`.`adresse` AS `adresse`,`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`,`auftrag`.`adresse` AS `adresse` 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`,`rechnung`.`adresse` AS `adresse` 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`,`gutschrift`.`adresse` AS `adresse` 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`,`verbindlichkeit`.`adresse` AS `adresse` from `verbindlichkeit` 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`,'' 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 '' 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",
|
||||
"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_belegnr`,`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`.`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')"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -35920,7 +35920,7 @@ function Firmendaten($field,$projekt="")
|
||||
|
||||
/*
|
||||
* Calculate the payments of a document (rechnung, gutschrift, auftrag, verbindlichkeit)
|
||||
* Results array of payments (datum, doc_type, doc_id, doc_belegnr, betrag, waehrung)
|
||||
* Results array of payments (datum, doc_type, doc_id, doc_inof, betrag, waehrung)
|
||||
* Gutschrift -> Rechnungid, Rechnung -> Auftragid
|
||||
*/
|
||||
|
||||
@ -35949,7 +35949,7 @@ function Firmendaten($field,$projekt="")
|
||||
".$this->app->erp->FormatDate('datum')." as datum,
|
||||
doc_typ,
|
||||
doc_id,
|
||||
doc_belegnr,
|
||||
doc_info,
|
||||
".$this->app->erp->FormatMenge('betrag',2)." as betrag,
|
||||
waehrung
|
||||
FROM
|
||||
|
54
www/pages/content/fibu_buchungen_einzelzuordnen.tpl
Normal file
54
www/pages/content/fibu_buchungen_einzelzuordnen.tpl
Normal file
@ -0,0 +1,54 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"><!--[TABTEXT]--></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>
|
||||
{|Buchung|}
|
||||
</legend>
|
||||
<legend>
|
||||
Saldo: <u>[DOC_SALDO]</u><br>
|
||||
"[DOC_ZUORDNUNG]"
|
||||
</legend>
|
||||
<form action="" method="post" id="buchungenform">
|
||||
[TAB1]
|
||||
</form>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<table>
|
||||
<legend>Stapelverarbeitung</legend>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="1" id="autoalle" /> Alle markieren </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="1" name="override" form="buchungenform" /> Mit Abweichung buchen </td>
|
||||
</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>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$('#autoalle').on('change',function(){
|
||||
var wert = $(this).prop('checked');
|
||||
$('#fibu_buchungen_einzelzuordnen').find('input[type="checkbox"]').prop('checked',wert);
|
||||
$('#fibu_buchungen_einzelzuordnen').find('input[type="checkbox"]').first().trigger('change');
|
||||
});
|
||||
|
||||
</script>
|
@ -21,6 +21,7 @@ class Fibu_buchungen {
|
||||
$this->app->ActionHandler("assoc", "fibu_buchungen_assoc");
|
||||
//$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen");
|
||||
$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen_tablesearch");
|
||||
$this->app->ActionHandler("einzelzuordnen", "fibu_buchungen_einzelzuordnen");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
|
||||
@ -46,8 +47,8 @@ class Fibu_buchungen {
|
||||
$alignright = array(7);
|
||||
$sumcol= array(7);
|
||||
|
||||
$findcols = array('f.id','f.id','f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.betrag', 'f.waehrung');
|
||||
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_belegnr');
|
||||
$findcols = array('f.id','f.id','f.buchungsart', 'f.typ', 'f.datum', 'f.doc_info', 'f.betrag', 'f.waehrung');
|
||||
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_info');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -68,7 +69,7 @@ class Fibu_buchungen {
|
||||
".$app->erp->FormatUCfirst('f.buchungsart').",
|
||||
".$app->erp->FormatUCfirst('f.typ').",
|
||||
".$app->erp->FormatDate('f.datum').",
|
||||
CONCAT(".$app->erp->FormatUCfirst('f.doc_typ').",' ',f.doc_belegnr),
|
||||
CONCAT(".$app->erp->FormatUCfirst('f.doc_typ').",' ',f.doc_info),
|
||||
".$app->erp->FormatMenge('f.betrag',2).",
|
||||
f.waehrung,
|
||||
CONCAT(f.edit_module,'&id=',f.edit_id)
|
||||
@ -147,7 +148,7 @@ class Fibu_buchungen {
|
||||
$width = array( '1%','1%','1%', '20%', '80%', '1%', '1%', '%1' );
|
||||
|
||||
$findcols = array('f.id','f.id','f.typ');
|
||||
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_belegnr');
|
||||
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_info');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -408,7 +409,108 @@ class Fibu_buchungen {
|
||||
//echo($sql." WHERE ".$where." ".$groupby);
|
||||
|
||||
|
||||
break;
|
||||
break;
|
||||
case 'fibu_buchungen_einzelzuordnen':
|
||||
|
||||
$allowed['fibu_buchungen_einzelzuordnen'] = array('list');
|
||||
$heading = array('','Datum','Typ', 'Info', 'Übergeordnet', 'Saldo','Währung','Buchungsbetrag', 'Menü');
|
||||
$width = array( );
|
||||
|
||||
$findcols = array('auswahl','fo.datum','fo.typ','fo.info','fo.parent_info');
|
||||
$searchsql = array('fo.typ','fo.info','fo.parent_info');
|
||||
|
||||
$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/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>';
|
||||
|
||||
$doc_typ = $this->app->User->GetParameter('fibu_buchungen_doc_typ');
|
||||
$doc_id = $this->app->User->GetParameter('fibu_buchungen_doc_id');
|
||||
$greater_0 = $this->app->User->GetParameter('fibu_buchungen_greater_0');
|
||||
|
||||
$auswahl = array (
|
||||
'<input type=\"text\" name=\"ids[]\" value=\"',
|
||||
['sql' => 'fo.typ'],
|
||||
'_',
|
||||
['sql' => 'fo.id'],
|
||||
'" hidden/>',
|
||||
'<input type=\"checkbox\" name=\"auswahl[]\" value="',
|
||||
['sql' => 'fo.typ'],
|
||||
'_',
|
||||
['sql' => 'fo.id'],
|
||||
'"',
|
||||
' />'
|
||||
);
|
||||
|
||||
$objektlink = array (
|
||||
'<a href=\"index.php?action=edit&module=',
|
||||
['sql' => 'fo.typ'],
|
||||
'&id=',
|
||||
['sql' => 'fo.id'],
|
||||
'">',
|
||||
['sql' => 'fo.info'],
|
||||
'</a>'
|
||||
);
|
||||
|
||||
$parentlink = array (
|
||||
'<a href=\"index.php?action=edit&module=',
|
||||
['sql' => 'fo.parent_typ'],
|
||||
'&id=',
|
||||
['sql' => 'fo.parent_id'],
|
||||
'">',
|
||||
['sql' => 'fo.parent_info'],
|
||||
'</a>'
|
||||
);
|
||||
|
||||
$werte = array (
|
||||
'<input type="number" step="0.01" name="werte[]" value="',
|
||||
['sql' => 'COALESCE(-SUM(fba.betrag),0)'],
|
||||
'" min="',
|
||||
['sql' => 'if(COALESCE(-SUM(fba.betrag),0) < 0,COALESCE(-SUM(fba.betrag),0),0)'],
|
||||
'" max="',
|
||||
['sql' => 'if(COALESCE(-SUM(fba.betrag),0) < 0,0,COALESCE(-SUM(fba.betrag),0))'],
|
||||
'"/>'
|
||||
);
|
||||
|
||||
$sql = "SELECT
|
||||
'',
|
||||
".$this->app->erp->ConcatSQL($auswahl)." AS auswahl,
|
||||
".$this->app->erp->FormatDate("fo.datum")." as datum,
|
||||
".$this->app->erp->FormatUCfirst("fo.typ")." as typ,
|
||||
".$this->app->erp->ConcatSQL($objektlink)." AS info,
|
||||
".$this->app->erp->ConcatSQL($parentlink)." AS parent_info,
|
||||
SUM(fba.betrag) as saldonum,
|
||||
waehrung,
|
||||
".$this->app->erp->ConcatSQL($werte)." AS werte
|
||||
FROM
|
||||
fibu_objekte fo
|
||||
LEFT JOIN
|
||||
fibu_buchungen_alle fba
|
||||
ON
|
||||
fba.typ = fo.typ AND fba.id = fo.id
|
||||
";
|
||||
|
||||
$where = "fo.typ <> '".$doc_typ."'";
|
||||
|
||||
// $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";
|
||||
|
||||
//echo($sql." WHERE ".$where." ".$groupby);
|
||||
|
||||
$sumcol= array(6);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
@ -730,6 +832,107 @@ class Fibu_buchungen {
|
||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl");
|
||||
}
|
||||
|
||||
function fibu_buchungen_einzelzuordnen() {
|
||||
$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>";
|
||||
}
|
||||
|
||||
// For transfer to tablesearch
|
||||
$von = $this->app->Secure->GetGET('doc');
|
||||
$von = explode('_',$von);
|
||||
$von_typ = strtolower($von[0]);
|
||||
$von_id = (int) $von[1];
|
||||
$this->app->User->SetParameter('fibu_buchungen_doc_typ', $von_typ);
|
||||
$this->app->User->SetParameter('fibu_buchungen_doc_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_info = $von_row['doc_info'];
|
||||
$von_saldonum = $von_row['saldonum'];
|
||||
$von_saldo = $von_row['saldo'];
|
||||
$von_waehrung = $von_row['waehrung'];
|
||||
|
||||
$this->app->User->SetParameter('fibu_buchungen_greater_0', $von_saldonum > 0);
|
||||
|
||||
if ($submit == 'BUCHEN') {
|
||||
// Process multi action
|
||||
$count_success = 0;
|
||||
$ids = $this->app->Secure->GetPOST('ids');
|
||||
$werte = $this->app->Secure->GetPOST('werte');
|
||||
$auswahl = $this->app->Secure->GetPOST('auswahl');
|
||||
|
||||
if (!empty($auswahl)) {
|
||||
$gesamtnum = 0;
|
||||
foreach ($ids as $id) {
|
||||
$key_ids = array_search($id,$ids);
|
||||
$key_auswahl = array_search($id,$auswahl);
|
||||
|
||||
if ($key_auswahl !== false) {
|
||||
$gesamtnum += $werte[$key_ids];
|
||||
}
|
||||
}
|
||||
$override = $this->app->Secure->GetPOST('override');
|
||||
$diff = $gesamtnum-$von_saldonum;
|
||||
|
||||
if (
|
||||
($von_saldonum < 0 && ($gesamtnum < $von_saldonum)) ||
|
||||
($von_saldonum > 0 && ($gesamtnum > $von_saldonum))
|
||||
) {
|
||||
$msg .= "<div class=\"error\">Buchungssumme ".$this->app->erp->EUR($gesamtnum)." übersteigt Saldosumme ".$this->app->erp->EUR($von_saldonum).". (Abweichung ".$this->app->erp->EUR((float) $gesamtnum - (float) $von_saldonum).")</div>";
|
||||
}
|
||||
else if ($diff != 0 && !$override) {
|
||||
$msg .= "<div class=\"error\">Buchungssumme ".$this->app->erp->EUR($gesamtnum)." entspricht nicht Saldosumme ".$this->app->erp->EUR($von_saldonum).". (Abweichung ".$this->app->erp->EUR((float) $gesamtnum - (float) $von_saldonum).")</div>";
|
||||
} else {
|
||||
foreach ($ids as $id) {
|
||||
$key_ids = array_search($id,$ids);
|
||||
$key_auswahl = array_search($id,$auswahl);
|
||||
|
||||
if ($key_auswahl !== false) {
|
||||
$doc = explode('_',$id);
|
||||
$doc_typ = strtolower($doc[0]);
|
||||
$doc_id = (int) $doc[1];
|
||||
|
||||
$betrag = $werte[$key_ids];
|
||||
|
||||
if ($betrag != 0) {
|
||||
$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."', '".$von_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ührt.</div>";
|
||||
$this->fibu_rebuild_tables();
|
||||
}
|
||||
}
|
||||
|
||||
// Reload after booking
|
||||
$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_info = $von_row['doc_info'];
|
||||
$von_saldonum = $von_row['saldonum'];
|
||||
$von_saldo = $von_row['saldo'];
|
||||
$von_waehrung = $von_row['waehrung'];
|
||||
|
||||
$this->app->Tpl->Set('DOC_ZUORDNUNG', ucfirst($von_typ)." ".$von_info);
|
||||
$this->app->Tpl->Set('DOC_SALDO',$von_saldo." ".$von_waehrung);
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_einzelzuordnen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
|
||||
if (!empty($msg)) {
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
}
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_einzelzuordnen.tpl");
|
||||
}
|
||||
|
||||
function fibu_buchungen_zuordnen() {
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Übersicht");
|
||||
|
@ -670,7 +670,7 @@ class Gutschrift extends GenGutschrift
|
||||
$zahlung['datum'],
|
||||
"<a href=\"index.php?module=".$zahlung['doc_typ']."&action=edit&id=".$zahlung['doc_id']."\">
|
||||
".ucfirst($zahlung['doc_typ'])."
|
||||
".$zahlung['doc_belegnr']."
|
||||
".$zahlung['doc_info']."
|
||||
</a>",
|
||||
$zahlung['betrag'],
|
||||
$zahlung['waehrung']
|
||||
|
@ -2744,7 +2744,7 @@ class Rechnung extends GenRechnung
|
||||
$zahlung['datum'],
|
||||
"<a href=\"index.php?module=".$zahlung['doc_typ']."&action=edit&id=".$zahlung['doc_id']."\">
|
||||
".ucfirst($zahlung['doc_typ'])."
|
||||
".$zahlung['doc_belegnr']."
|
||||
".$zahlung['doc_info']."
|
||||
</a>",
|
||||
$zahlung['betrag'],
|
||||
$zahlung['waehrung']
|
||||
|
Loading…
Reference in New Issue
Block a user