mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 04:27:14 +01:00
Compare commits
8 Commits
e9c61ebfc7
...
a43ac720b6
Author | SHA1 | Date | |
---|---|---|---|
|
a43ac720b6 | ||
|
170a33687f | ||
|
ea6a6a5dda | ||
|
69172672b2 | ||
|
667b70eaf5 | ||
|
44af8f3b3d | ||
|
82fc367405 | ||
|
828af9ab50 |
@ -39106,6 +39106,17 @@
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "datum",
|
||||
"Type": "date",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "zeit",
|
||||
"Type": "datetime",
|
||||
@ -117352,12 +117363,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`.`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` = ''"
|
||||
"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`.`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') or `fibu_objekte_view`.`datum` = ''"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -22218,8 +22218,8 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
|
||||
$this->app->DB->Delete("DELETE lager_charge FROM lager_charge INNER JOIN lager_platz ON lager_platz.id=lager_charge.lager_platz
|
||||
WHERE lager_platz.verbrauchslager='1' AND lager_platz.id = '$regal'");
|
||||
|
||||
$this->app->DB->Delete("DELETE lager_seriennummer FROM lager_seriennummer
|
||||
INNER JOIN lager_platz ON lager_platz.id=lager_seriennummer.lager_platz
|
||||
$this->app->DB->Delete("DELETE FROM lager_seriennummern
|
||||
INNER JOIN lager_platz ON lager_platz.id=lager_seriennummern.lager_platz
|
||||
WHERE lager_platz.verbrauchslager='1' AND lager_platz.id = '$regal'");
|
||||
|
||||
$this->app->DB->Delete("DELETE lager_mindesthaltbarkeitsdatum FROM lager_mindesthaltbarkeitsdatum
|
||||
@ -22237,8 +22237,8 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
|
||||
$this->app->DB->Delete("DELETE lager_charge FROM lager_charge INNER JOIN lager_platz ON lager_platz.id=lager_charge.lager_platz
|
||||
WHERE lager_platz.verbrauchslager='1'");
|
||||
|
||||
$this->app->DB->Delete("DELETE lager_seriennummer FROM lager_seriennummer
|
||||
INNER JOIN lager_platz ON lager_platz.id=lager_seriennummer.lager_platz
|
||||
$this->app->DB->Delete("DELETE FROM lager_seriennummern
|
||||
INNER JOIN lager_platz ON lager_platz.id=lager_seriennummern.lager_platz
|
||||
WHERE lager_platz.verbrauchslager='1'");
|
||||
|
||||
$this->app->DB->Delete("DELETE lager_mindesthaltbarkeitsdatum FROM lager_mindesthaltbarkeitsdatum
|
||||
@ -34525,7 +34525,7 @@ function Firmendaten($field,$projekt="")
|
||||
$this->CopyBelegZwischenpositionen('rechnung',$id,'gutschrift',$newid);
|
||||
$this->app->DB->Update("UPDATE gutschrift SET stornorechnung='$stornorechnung', ohne_briefpapier='".$ohnebriefpapier."' WHERE id='$newid,' LIMIT 1");
|
||||
|
||||
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1',status='storniert',zahlungsstatus='bezahlt' WHERE id='$id' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1',status='storniert' WHERE id='$id' LIMIT 1");
|
||||
$this->RechnungProtokoll($id, $grund);
|
||||
$this->SchnellFreigabe("gutschrift",$newid);
|
||||
return $newid;
|
||||
@ -35666,7 +35666,7 @@ function Firmendaten($field,$projekt="")
|
||||
$rechnungid = $this->app->DB->Select("SELECT rechnungid FROM gutschrift WHERE id='$id' LIMIT 1");
|
||||
if($rechnungid > 0 && $this->Firmendaten("mahnwesenmitkontoabgleich")=="1")
|
||||
{
|
||||
$this->app->DB->Update("UPDATE rechnung SET ist=0, zahlungsstatus='offen' WHERE id='$rechnungid' AND mahnwesenfestsetzen!=1 LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen' WHERE id='$rechnungid' AND mahnwesenfestsetzen!=1 LIMIT 1");
|
||||
$this->RechnungNeuberechnen($rechnungid);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -35973,7 +35973,7 @@ function Firmendaten($field,$projekt="")
|
||||
* Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
|
||||
* returns array(array(betrag, waehrung)) one line per waehrung
|
||||
*/
|
||||
public function GetSaldenDokument($id, $type, string $cascadelevel = '') : array {
|
||||
public function GetSaldenDokument(int $id, string $type, string $cascadelevel = '') : array {
|
||||
|
||||
if ($cascadelevel != '') {
|
||||
$documents = $this->GetZahlungenAssociatedDocuments($id, $type, $cascadelevel);
|
||||
@ -36014,9 +36014,9 @@ function Firmendaten($field,$projekt="")
|
||||
/*
|
||||
* Calculate the payment amount of a document
|
||||
* Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
|
||||
* returns array(array(betrag, waehrung)) or empty array
|
||||
* returns array(betrag, waehrung) or empty array if multiple
|
||||
*/
|
||||
public function GetSaldoDokument($id, $type) : array {
|
||||
public function GetSaldoDokument(int $id, string $type) : array {
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
|
@ -45,7 +45,7 @@
|
||||
{|Betrag|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="betrag" id="betrag" value="[BETRAG]" size="20">
|
||||
<input type="numeric" name="betrag" id="betrag" value="[BETRAG]" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -66,10 +66,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Zeit|}:
|
||||
{|Datum|}:
|
||||
</td>
|
||||
<td>
|
||||
[ZEIT]
|
||||
<input type="text" name="datum" id="datum" value="[DATUM]" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
66
www/pages/content/fibu_buchungen_einzelzuordnen.tpl
Normal file
66
www/pages/content/fibu_buchungen_einzelzuordnen.tpl
Normal file
@ -0,0 +1,66 @@
|
||||
<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" name="override" form="buchungenform" /> Mit Abweichung buchen </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="1" id="autoalle" /> alle markieren
|
||||
<select form="buchungenform" id="sel_aktion" name="sel_aktion">
|
||||
<option value="buchen">{|auf Ausgewählte buchen|}</option>
|
||||
<option value="buchen_diff_sachkonto">{|auf Ausgewählte buchen, Gegenbeleg auf Sachkonto ausgleichen|}</option>
|
||||
</select>
|
||||
<input type="text" form="buchungenform" id="sachkonto" name="sachkonto" value="">
|
||||
<button name="submit" form="buchungenform" value="BUCHEN" class="ui-button-icon">{|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>
|
||||
</form>
|
||||
</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>
|
@ -10,7 +10,7 @@
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Offene Einzelsalden|}</legend>
|
||||
<legend>{|Einzelsalden|}</legend>
|
||||
<div class="filter-box filter-usersave">
|
||||
<div class="filter-block filter-inline">
|
||||
<div class="filter-title">{|Filter|}</div>
|
||||
@ -22,6 +22,13 @@
|
||||
</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>
|
||||
@ -33,12 +40,25 @@
|
||||
<table>
|
||||
<legend>Stapelverarbeitung</legend>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="1" id="autoalle" /> alle markieren </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>
|
||||
<td><input type="checkbox" value="1" id="autoalle" /> alle markieren
|
||||
<select form="buchungenform" id="sel_aktion" name="sel_aktion">
|
||||
<option value="vorschlag">{|auf Vorschläge buchen|}</option>
|
||||
<option value="vorschlag_diff_sachkonto">{|auf Vorschläge buchen, Gegenbeleg auf Sachkonto ausgleichen|}</option>
|
||||
<option value="sachkonto">{|auf Sachkonto buchen|}</option>
|
||||
</select>
|
||||
<input type="text" form="buchungenform" id="sachkonto" name="sachkonto" value="">
|
||||
<button name="submit" form="buchungenform" value="BUCHEN" class="ui-button-icon">{|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>
|
||||
</form>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@ -19,8 +19,8 @@ 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->ActionHandler("zuordnen", "fibu_buchungen_zuordnen_tablesearch");
|
||||
$this->app->ActionHandler("zuordnen", "fibu_buchungen_zuordnen");
|
||||
$this->app->ActionHandler("einzelzuordnen", "fibu_buchungen_einzelzuordnen");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
|
||||
@ -46,8 +46,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','f.id');
|
||||
$searchsql = array('f.buchungsart', 'f.typ', 'f.datum', 'f.doc_typ', 'f.doc_info');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -56,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>";
|
||||
|
||||
if (!empty($doc_typ) && !empty($doc_id)) {
|
||||
if (!empty($doc_typ) && !empty($doc_id)) {
|
||||
$where = "`doc_typ` = '$doc_typ' AND `doc_id` = $doc_id";
|
||||
} else{
|
||||
$where = "1";
|
||||
@ -68,7 +68,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)
|
||||
@ -80,11 +80,11 @@ class Fibu_buchungen {
|
||||
break;
|
||||
case "fibu_buchungen_salden":
|
||||
$allowed['fibu_buchungen_salden'] = array('list');
|
||||
$heading = array( '', 'Typ','Anzahl', 'Saldo', 'Menü');
|
||||
$width = array( '1%', '96%', '1%', '1%', '1%');
|
||||
$heading = array( 'Typ','Anzahl', 'Saldo', 'Menü');
|
||||
$width = array( '83%', '1%', '1%', '1%');
|
||||
|
||||
$findcols = array('','','typ','anzahl','saldo');
|
||||
$searchsql = array();
|
||||
$findcols = array('typ','','saldonum');
|
||||
$searchsql = array('typ','saldonum');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -107,10 +107,9 @@ class Fibu_buchungen {
|
||||
);
|
||||
|
||||
$sql = "SELECT
|
||||
'',
|
||||
'',
|
||||
".$this->app->erp->FormatUCfirst('typ')." AS typ,
|
||||
count(id) anzahl,
|
||||
count(id) AS anzahl,
|
||||
".$this->app->erp->ConcatSQL($saldolink)." AS saldo,
|
||||
typ
|
||||
FROM
|
||||
@ -143,11 +142,11 @@ class Fibu_buchungen {
|
||||
|
||||
case "fibu_buchungen_wahl":
|
||||
$allowed['fibu_buchungen_wahl'] = array('list');
|
||||
$heading = array('', '', 'Datum', 'Typ', 'Beleg', 'Von','Nach', 'Menü');
|
||||
$heading = array('', '', 'Datum', 'Typ', 'Info', 'Von','Nach', 'Menü');
|
||||
$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');
|
||||
$findcols = array('f.id','f.id','f.datum','f.typ','f.info','f.id','f.id','f.id');
|
||||
$searchsql = array('f.typ','f.info', 'f.datum', 'f.parent_typ', 'f.parent_info');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -176,18 +175,18 @@ class Fibu_buchungen {
|
||||
";
|
||||
|
||||
$where = "1";
|
||||
$count = "SELECT count(DISTINCT id) FROM fibu_buchungen_alle WHERE $where";
|
||||
$count = "SELECT count(id) FROM fibu_objekte";
|
||||
// $groupby = "";
|
||||
|
||||
break;
|
||||
case 'fibu_buchungen_zuordnen':
|
||||
|
||||
$allowed['fibu_buchungen_zuordnung'] = array('list');
|
||||
$heading = array('','','Datum', 'Info', 'Betrag', 'Währung', 'Buchungsbetrag','Vorschlag', 'Menü');
|
||||
$heading = array('','','Datum','Typ', 'Info', 'Betrag', 'Währung', 'Buchungsbetrag','Vorschlag', 'Menü');
|
||||
$width = array( );
|
||||
|
||||
$findcols = array('','auswahl','datum','objektlink','saldo','waehrung','buchwert_input','vorschlag');
|
||||
$searchsql = array();
|
||||
$findcols = array('id','auswahl','datum','typ','objektlink','saldo','waehrung','saldo','vorschlag','doc');
|
||||
$searchsql = array('objektlink','vorschlag');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -209,6 +208,8 @@ class Fibu_buchungen {
|
||||
'</a>'
|
||||
);
|
||||
|
||||
$check_sql = "(fo.info <> '' AND salden.saldonum = -SUM(fbd.betrag))";
|
||||
|
||||
$auswahl = array (
|
||||
'<input type=\"text\" name=\"ids[]\" value=\"',
|
||||
['sql' => 'salden.typ'],
|
||||
@ -220,7 +221,7 @@ class Fibu_buchungen {
|
||||
'_',
|
||||
['sql' => 'salden.id'],
|
||||
'"',
|
||||
['sql' => "if(fo.info <> '','checked','')"],
|
||||
['sql' => "if(".$check_sql.",'checked','')"],
|
||||
' />'
|
||||
);
|
||||
|
||||
@ -234,7 +235,7 @@ class Fibu_buchungen {
|
||||
' ',
|
||||
['sql' => 'COALESCE(fo.info,\'\')'],
|
||||
' ',
|
||||
['sql' => "if (SUM(fbd.betrag) IS NULL,'',CONCAT('(Saldo ',".$this->app->erp->FormatMenge('SUM(fbd.betrag)',2).",')'))"],
|
||||
['sql' => "if (SUM(fbd.betrag) IS NULL,'',CONCAT('(Saldo ',".$this->app->erp->FormatMenge('SUM(fbd.betrag)',2).",', Diff. ',".$this->app->erp->FormatMenge('SUM(fbd.betrag)+saldonum',2).",')'))"],
|
||||
'</a> ',
|
||||
'<input type="text" name="vorschlaege[]" value="',
|
||||
['sql' => 'COALESCE(fo.typ,\'\')'],
|
||||
@ -271,13 +272,16 @@ class Fibu_buchungen {
|
||||
'' AS dummy2,
|
||||
auswahl,
|
||||
datum,
|
||||
".$this->app->erp->FormatUCfirst("typ").",
|
||||
objektlink,
|
||||
saldo,
|
||||
waehrung,
|
||||
wert,
|
||||
vorschlag,
|
||||
doc,
|
||||
doc_id
|
||||
doc,
|
||||
doc_id,
|
||||
doc_saldo,
|
||||
checked
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@ -297,7 +301,8 @@ class Fibu_buchungen {
|
||||
fo.id AS doc_id,
|
||||
fo.info AS doc_info,
|
||||
SUM(fbd.betrag) as doc_saldo,
|
||||
".$this->app->erp->ConcatSQL($doc)." AS doc
|
||||
if(".$check_sql.",'1','0') AS checked,
|
||||
".$this->app->erp->ConcatSQL($doc)." AS doc
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@ -326,9 +331,14 @@ class Fibu_buchungen {
|
||||
SELECT
|
||||
fo.typ,
|
||||
fo.id,
|
||||
fo.info
|
||||
fo.info,
|
||||
SUM(fob.betrag) as doc_saldo
|
||||
FROM
|
||||
fibu_objekte fo
|
||||
fibu_objekte fo
|
||||
INNER JOIN
|
||||
fibu_buchungen_alle fob
|
||||
ON
|
||||
fo.typ = fob.typ AND fo.id = fob.id
|
||||
WHERE fo.is_beleg = 1
|
||||
GROUP BY
|
||||
fo.typ,
|
||||
@ -345,7 +355,9 @@ class Fibu_buchungen {
|
||||
salden.saldonum <> 0
|
||||
GROUP BY
|
||||
salden.typ,
|
||||
salden.id
|
||||
salden.id,
|
||||
fo.typ,
|
||||
fo.id
|
||||
) AS erg
|
||||
";
|
||||
|
||||
@ -353,6 +365,7 @@ class Fibu_buchungen {
|
||||
|
||||
// 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', '
|
||||
@ -378,13 +391,116 @@ class Fibu_buchungen {
|
||||
$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";
|
||||
|
||||
break;
|
||||
//echo($sql." WHERE ".$where." ".$groupby);
|
||||
|
||||
|
||||
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('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');
|
||||
|
||||
$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');
|
||||
|
||||
$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";
|
||||
|
||||
$groupby = "GROUP BY fo.id, fo.typ";
|
||||
|
||||
//echo($sql." WHERE ".$where." ".$groupby);
|
||||
|
||||
$sumcol= array(6);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
@ -500,10 +616,14 @@ class Fibu_buchungen {
|
||||
$input['benutzer'] = $this->app->User->GetId();
|
||||
$input['zeit'] = date("Y-m-d H:i");
|
||||
$input['betrag'] = $this->app->erp->ReplaceBetrag(true,$input['betrag']);
|
||||
$input['zeit'] = date("Y-m-d H:i");
|
||||
|
||||
$input['internebemerkung'] = $this->app->DB->real_escape_string($input['internebemerkung']);
|
||||
|
||||
if (empty($input['datum'])) {
|
||||
$input['datum'] = date("Y-m-d");
|
||||
} else {
|
||||
$input['datum'] = $this->app->erp->ReplaceDatum(true,$input['datum'],true);
|
||||
}
|
||||
|
||||
$columns = "id, ";
|
||||
$values = "$id, ";
|
||||
$update = "";
|
||||
@ -547,6 +667,7 @@ class Fibu_buchungen {
|
||||
".$this->app->erp->FormatDateTime('f.zeit','zeit').",
|
||||
f.internebemerkung,
|
||||
f.id,
|
||||
".$this->app->erp->FormatDate('f.datum','datum').",
|
||||
fvon.info AS von_info,
|
||||
fnach.info AS nach_info
|
||||
FROM
|
||||
@ -596,6 +717,9 @@ class Fibu_buchungen {
|
||||
|
||||
$this->app->Tpl->Set('WAEHRUNG',$this->app->erp->getSelectAsso($this->app->erp->GetWaehrung(), $result[0]['waehrung_von']));
|
||||
|
||||
$this->app->YUI->DatePicker("datum");
|
||||
$this->app->Tpl->Set('DATUM',$this->app->erp->ReplaceDatum(false,$result[0]['datum'],true));
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_wahl', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_edit.tpl");
|
||||
@ -615,7 +739,7 @@ class Fibu_buchungen {
|
||||
$input['betrag'] = $this->app->Secure->GetPOST('betrag');
|
||||
$input['waehrung'] = $this->app->Secure->GetPOST('waehrung');
|
||||
$input['benutzer'] = $this->app->Secure->GetPOST('benutzer');
|
||||
$input['zeit'] = $this->app->Secure->GetPOST('zeit');
|
||||
$input['datum'] = $this->app->Secure->GetPOST('datum');
|
||||
$input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung');
|
||||
|
||||
|
||||
@ -640,9 +764,13 @@ 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");
|
||||
|
||||
function fibu_buchungen_buchen(string $von_typ, int $von_id, string $nach_typ, int $nach_id, $betrag, string $waehrung, $datum, string $internebemerkung) {
|
||||
$sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `datum`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$von_typ."','".$von_id."','".$nach_typ."', '".$nach_id."', '".$datum."', '".$betrag."', '".$waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '".$internebemerkung."')";
|
||||
$this->app->DB->Insert($sql);
|
||||
}
|
||||
|
||||
function fibu_buchungen_zuordnen() {
|
||||
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
if ($submit == 'neuberechnen') {
|
||||
@ -652,41 +780,90 @@ class Fibu_buchungen {
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
$aktion = $this->app->Secure->GetPOST('sel_aktion');
|
||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||
|
||||
$account_id = null;
|
||||
if (!empty($sachkonto)) {
|
||||
$sachkonto_kennung = explode(' ',$sachkonto)[0];
|
||||
$account_id = $this->app->DB->SelectArr("SELECT id from kontorahmen WHERE sachkonto = '".$sachkonto_kennung."'")[0]['id'];
|
||||
}
|
||||
|
||||
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] != '_') {
|
||||
if ($key_auswahl !== false) {
|
||||
|
||||
$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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$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
|
||||
|
||||
$doc_id = null;
|
||||
if ($vorschlaege[$key_ids] != '_') {
|
||||
$doc = $vorschlaege[$key_ids];
|
||||
$doc = explode('_',$doc);
|
||||
$doc_typ = strtolower($doc[0]);
|
||||
$doc_id = (int) $doc[1];
|
||||
}
|
||||
|
||||
switch ($aktion) {
|
||||
case 'vorschlag':
|
||||
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()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($von_typ, $von_id, $doc_typ, $doc_id, -$betrag, $waehrung, $datum, '');
|
||||
}
|
||||
break;
|
||||
case 'sachkonto':
|
||||
// $sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `datum`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$von_typ."','".$von_id."','kontorahmen', '".$account_id."', '".$datum."', '".-$betrag."', '".$waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($von_typ, $von_id, 'kontorahmen', $account_id, -$betrag, $waehrung, $datum, '');
|
||||
break;
|
||||
case 'vorschlag_diff_sachkonto':
|
||||
if ($doc_id) {
|
||||
// Retrieve counter doc saldo
|
||||
$doc_saldo = $this->app->erp->GetSaldoDokument($doc_id, $doc_typ);
|
||||
// $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()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($von_typ, $von_id, $doc_typ, $doc_id, -$betrag, $waehrung, $datum, '');
|
||||
}
|
||||
|
||||
if (!empty($doc_saldo) && ($doc_saldo['waehrung'] == $waehrung) && ($account_id !== null)) {
|
||||
$diff = $betrag+$doc_saldo['betrag'];
|
||||
// $sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `datum`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('".$doc_typ."','".$doc_id."','kontorahmen', '".$account_id."', '".$datum."', '".-$diff."', '".$waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($doc_typ, $doc_id, 'kontorahmen', $account_id, -$diff, $waehrung, $datum, '');
|
||||
} else {
|
||||
$msg .= "<div class=\"warning\">Gegensaldo wurde nicht gebucht. ".count($doc_saldo)." ".$doc_saldo[0]['waehrung']."</div>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // auswahl
|
||||
} // foreach
|
||||
} else { // auswahl
|
||||
$msg .= "<div class=\"warning\">Keine Posten ausgewählt.</div>";
|
||||
}
|
||||
} // submit
|
||||
|
||||
$this->fibu_rebuild_tables();
|
||||
|
||||
@ -695,7 +872,6 @@ class Fibu_buchungen {
|
||||
$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__);
|
||||
|
||||
@ -703,165 +879,151 @@ class Fibu_buchungen {
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
}
|
||||
|
||||
$this->app->YUI->AutoComplete('sachkonto', 'sachkonto');
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Ü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");
|
||||
}
|
||||
|
||||
function fibu_buchungen_zuordnen() {
|
||||
function fibu_buchungen_einzelzuordnen() {
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=list", "Übersicht");
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
if ($submit == 'neuberechnen') {
|
||||
$this->fibu_rebuild_tables();
|
||||
|
||||
$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ührt.</div>";
|
||||
$msg = "<div class=\"info\">Buchungen wurden neu berechnet.</div>";
|
||||
}
|
||||
|
||||
$typ = $this->app->Secure->GetGET('typ');
|
||||
// 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);
|
||||
$aktion = $this->app->Secure->GetPOST('sel_aktion');
|
||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||
|
||||
$objektlink = array (
|
||||
'<a href=\"index.php?action=edit&module=',
|
||||
['sql' => 'fb.typ'],
|
||||
'&id=',
|
||||
['sql' => 'fb.id'],
|
||||
'">',
|
||||
['sql' => 'fo.info'],
|
||||
'</a>'
|
||||
);
|
||||
$account_id = null;
|
||||
if (!empty($sachkonto)) {
|
||||
$sachkonto_kennung = explode(' ',$sachkonto)[0];
|
||||
$account_id = $this->app->DB->SelectArr("SELECT id from kontorahmen WHERE sachkonto = '".$sachkonto_kennung."'")[0]['id'];
|
||||
}
|
||||
|
||||
$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
|
||||
";
|
||||
$this->app->erp->MenuEintrag("index.php?module=fibu_buchungen&action=zuordnen&typ=".$von_typ, "Zurück");
|
||||
|
||||
// echo($sql);
|
||||
$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'];
|
||||
|
||||
$items = $this->app->DB->SelectArr($sql);
|
||||
$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
|
||||
|
||||
//print_r($items);
|
||||
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);
|
||||
|
||||
$et = new EasyTable($this->app);
|
||||
if ($key_auswahl !== false) {
|
||||
$gesamtnum += $werte[$key_ids];
|
||||
}
|
||||
}
|
||||
$override = $this->app->Secure->GetPOST('override');
|
||||
$diff = $gesamtnum-$von_saldonum;
|
||||
|
||||
$et->headings = array('Datum','Typ','Info','Betrag','Buchbetrag','Zuordnung');
|
||||
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);
|
||||
|
||||
foreach ($items as $item) {
|
||||
if ($key_auswahl !== false) {
|
||||
$doc = explode('_',$id);
|
||||
$doc_typ = strtolower($doc[0]);
|
||||
$doc_id = (int) $doc[1];
|
||||
|
||||
$checked = empty($item['doc_typ'])?'':'checked';
|
||||
$betrag = $werte[$key_ids];
|
||||
|
||||
if (empty($item['doc_id'])) {
|
||||
$object_identifier = '';
|
||||
switch ($aktion) {
|
||||
case 'buchen':
|
||||
if ($betrag != 0) {
|
||||
// $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."', '".$von_waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($von_typ, $von_id, $doc_typ, $doc_id, -$betrag, $von_waehrung, $datum, '');
|
||||
$count_success++;
|
||||
}
|
||||
break;
|
||||
case 'buchen_diff_sachkonto':
|
||||
$doc_saldo = $this->app->erp->GetSaldoDokument($doc_id, $doc_typ);
|
||||
if ($betrag != 0) {
|
||||
// $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."', '".$von_waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($von_typ, $von_id, $doc_typ, $doc_id, -$betrag, $von_waehrung, $datum, '');
|
||||
$count_success++;
|
||||
}
|
||||
|
||||
if (!empty($doc_saldo) && ($doc_saldo['waehrung'] == $von_waehrung) && ($account_id !== null)) {
|
||||
$diff = $betrag+$doc_saldo['betrag'];
|
||||
// $sql = "INSERT INTO `fibu_buchungen` (`von_typ`, `von_id`, `nach_typ`, `nach_id`, `datum`, `betrag`, `waehrung`, `benutzer`, `zeit`, `internebemerkung`) VALUES ('kontorahmen','".$account_id."','".$doc_typ."', '".$doc_id."', '".$datum."', '".$diff."', '".$von_waehrung."', '".$this->app->User->GetID()."','".date("Y-m-d H:i")."', '')";
|
||||
// echo($sql."\n");
|
||||
// $this->app->DB->Insert($sql);
|
||||
$this->fibu_buchungen_buchen($doc_typ, $doc_id, 'kontorahmen', $account_id, -$diff, $von_waehrung, $datum, '');
|
||||
} else {
|
||||
$msg .= "<div class=\"warning\">Gegensaldo wurde nicht gebucht.</div>";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$msg .= "<div class=\"info\">".$count_success." Buchung".(($count_success===1)?'':'en')." durchgeführt.</div>";
|
||||
$this->fibu_rebuild_tables();
|
||||
} else {
|
||||
$object_identifier = ucfirst($item['doc_typ'])."-".$item['doc_id']."-".$item['doc_info'];
|
||||
}
|
||||
$msg .= "<div class=\"warning\">Keine Posten ausgewählt.</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$input_id = 'fibu_object_select_'.$item['id'];
|
||||
$object_select = '<input
|
||||
type="text"
|
||||
size="40"
|
||||
id="'.$input_id.'"
|
||||
name="fibu_objekt[]"
|
||||
value="'
|
||||
.$object_identifier.'"/>';
|
||||
// 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'];
|
||||
|
||||
if ($item['saldonum'] < 0) {
|
||||
$min = $item['saldo'];
|
||||
$max = '0';
|
||||
} else {
|
||||
$max = $item['saldo'];
|
||||
$min = '0';
|
||||
}
|
||||
$this->app->Tpl->Set('DOC_ZUORDNUNG', ucfirst($von_typ)." ".$von_info);
|
||||
$this->app->Tpl->Set('DOC_SALDO',$von_saldo." ".$von_waehrung);
|
||||
|
||||
$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->TableSearch('TAB1', 'fibu_buchungen_einzelzuordnen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
|
||||
$this->app->YUI->Autocomplete($input_id,'fibu_objekte');
|
||||
if (!empty($msg)) {
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$et->DisplayNew('TAB1',"Gegenbuchung","noAction");
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_zuordnen.tpl");
|
||||
}
|
||||
$this->app->YUI->AutoComplete('sachkonto', 'sachkonto');
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "fibu_buchungen_einzelzuordnen.tpl");
|
||||
}
|
||||
}
|
||||
|
@ -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']
|
||||
|
@ -32,13 +32,13 @@ class Kontoauszuege {
|
||||
case "kontoauszuege_konto_list":
|
||||
|
||||
$allowed['konten_list'] = array('list');
|
||||
$heading = array('Bezeichnung', 'Kurzbezeichnung', 'Typ', 'Kontostand', 'Saldo','Menü');
|
||||
$heading = array('Bezeichnung', 'Kurzbezeichnung', 'Typ', 'Kontostand','Letzter Import', 'Menü');
|
||||
// $width = array('1%','1%','10%'); // Fill out manually later
|
||||
|
||||
// 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');
|
||||
|
||||
$defaultorder = 1;
|
||||
@ -62,15 +62,13 @@ class Kontoauszuege {
|
||||
k.bezeichnung,
|
||||
k.kurzbezeichnung,
|
||||
".$this->app->erp->FormatUCfirst('k.type').",
|
||||
".$this->app->erp->FormatMenge('SUM(COALESCE(ka.soll,0))',2)." AS kontostand,
|
||||
".$this->app->erp->ConcatSQL($saldolink)." AS saldo,
|
||||
".$this->app->erp->FormatMenge('SUM(COALESCE(ka.soll,0))+k.saldo_betrag',2)." AS kontostand,
|
||||
".$this->app->erp->FormatDatetime("MIN(ka.importdatum)")." AS datum,
|
||||
k.id
|
||||
FROM
|
||||
konten k
|
||||
LEFT JOIN kontoauszuege ka ON
|
||||
k.id = ka.konto
|
||||
LEFT JOIN fibu_buchungen_alle fb ON
|
||||
fb.id = ka.id AND fb.typ = 'kontoauszuege'";
|
||||
k.id = ka.konto";
|
||||
|
||||
$where = " k.aktiv = 1 AND ka.importfehler IS NULL ";
|
||||
|
||||
@ -122,8 +120,8 @@ class Kontoauszuege {
|
||||
|
||||
$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');
|
||||
$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.kurzbezeichnung', 'q.buchung', 'q.soll', 'q.buchungstext','q.internebemerkung');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@ -165,9 +163,9 @@ class Kontoauszuege {
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT
|
||||
k.id,
|
||||
$dropnbox,
|
||||
".$app->erp->FormatDateTimeShort('k.importdatum').",
|
||||
(SELECT kurzbezeichnung FROM konten WHERE konten.id = k.konto),
|
||||
".$app->erp->FormatDate('k.buchung').",
|
||||
".$app->erp->FormatDateTimeShort('k.importdatum')." AS importdatum,
|
||||
(SELECT kurzbezeichnung FROM konten WHERE konten.id = k.konto) as kurzbezeichnung,
|
||||
".$app->erp->FormatDate('k.buchung')." as buchung,
|
||||
IF(
|
||||
k.importfehler,
|
||||
CONCAT(
|
||||
|
@ -277,18 +277,18 @@ 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');
|
||||
$this->app->DB->Update(
|
||||
"UPDATE rechnung
|
||||
SET zahlungsstatus='offen',bezahlt_am = NULL, ist='0',
|
||||
SET zahlungsstatus='offen',bezahlt_am = NULL,
|
||||
mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt entfernt am ".date('d.m.Y')."')
|
||||
WHERE id='$invoiceId'"
|
||||
);
|
||||
|
||||
return true;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public function RechnungManuellBezahltEntfernen()
|
||||
@ -305,7 +305,7 @@ class Rechnung extends GenRechnung
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
$this->app->erp->RechnungProtokoll($id,'Rechnung Stornierung rückgängig gemacht');
|
||||
|
||||
$this->app->DB->Update("UPDATE rechnung SET status='freigegeben',zahlungsstatus='offen',schreibschutz=0,bezahlt_am = NULL, ist='0',mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Rechnung Stornierung rückgängig gemacht ".date('d.m.Y')."') WHERE id='$id'");
|
||||
$this->app->DB->Update("UPDATE rechnung SET status='freigegeben',zahlungsstatus='offen',schreibschutz=0,bezahlt_am = NULL, mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Rechnung Stornierung rückgängig gemacht ".date('d.m.Y')."') WHERE id='$id'");
|
||||
|
||||
$this->app->Location->execute("index.php?module=rechnung&action=edit&id=$id");
|
||||
}
|
||||
@ -324,7 +324,7 @@ class Rechnung extends GenRechnung
|
||||
|
||||
$this->app->DB->Update(
|
||||
"UPDATE rechnung
|
||||
SET zahlungsstatus='bezahlt',bezahlt_am = now(), ist=soll,mahnwesenfestsetzen='1',
|
||||
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='$invoiceId'"
|
||||
);
|
||||
@ -1829,7 +1829,7 @@ class Rechnung extends GenRechnung
|
||||
{*/
|
||||
$this->app->DB->Update("UPDATE rechnung SET mahnwesen_internebemerkung='$mahnwesen_internebemerkung',zahlungsstatus='$zahlungsstatus',versendet_mahnwesen='$versendet',
|
||||
mahnwesen_gesperrt='$mahnwesen_gesperrt',mahnwesen_datum='$mahnwesen_datum', mahnwesenfestsetzen='$mahnwesenfestsetzen',internebemerkung='$internebemerkung',
|
||||
mahnwesen='$mahnwesen',ist='$ist',skonto_gegeben='$skonto_gegeben',bezahlt_am='$bezahlt_am' WHERE id='$id' LIMIT 1");
|
||||
mahnwesen='$mahnwesen',skonto_gegeben='$skonto_gegeben',bezahlt_am='$bezahlt_am' WHERE id='$id' LIMIT 1");
|
||||
/* } else {
|
||||
$this->app->DB->Update("UPDATE rechnung SET mahnwesen='$mahnwesen', mahnwesenfestsetzen='$mahnwesenfestsetzen', mahnwesen_internebemerkung='$mahnwesen_internebemerkung', mahnwesen_gesperrt='$mahnwesen_gesperrt',mahnwesen_datum='$mahnwesen_datum' WHERE id='$id' LIMIT 1");
|
||||
}*/
|
||||
@ -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