mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 04:27:14 +01:00
Compare commits
11 Commits
1e04647dae
...
265d815534
Author | SHA1 | Date | |
---|---|---|---|
|
265d815534 | ||
|
7c17b2aed9 | ||
|
174909c178 | ||
|
b8cfa9efbb | ||
|
5da0490260 | ||
|
9fbd0eb85a | ||
|
1c1c7034f1 | ||
|
2c7f113d6b | ||
|
1f6caa8632 | ||
|
73725a31bb | ||
|
06686a6020 |
@ -6576,7 +6576,7 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
|
|||||||
r.zahlungsweise as zahlungsweise,
|
r.zahlungsweise as zahlungsweise,
|
||||||
FORMAT(r.soll,2{$extended_mysql55} ) as soll,
|
FORMAT(r.soll,2{$extended_mysql55} ) as soll,
|
||||||
ifnull(r.waehrung,'EUR'),
|
ifnull(r.waehrung,'EUR'),
|
||||||
if(r.soll-r.ist=0 AND r.ist > 0 AND r.zahlungsstatus!='bezahlt','teilbezahlt',r.zahlungsstatus) as zahlung,
|
r.zahlungsstatus as zahlung,
|
||||||
if(r.soll-r.ist!=0 AND r.ist > 0,FORMAT(r.ist-r.soll,2{$extended_mysql55}),FORMAT((r.soll-r.ist)*-1,2{$extended_mysql55})) as fehlt,
|
if(r.soll-r.ist!=0 AND r.ist > 0,FORMAT(r.ist-r.soll,2{$extended_mysql55}),FORMAT((r.soll-r.ist)*-1,2{$extended_mysql55})) as fehlt,
|
||||||
if(r.status = 'storniert' AND r.teilstorno = 1,'TEILSTORNO',UPPER(r.status)) as status,
|
if(r.status = 'storniert' AND r.teilstorno = 1,'TEILSTORNO',UPPER(r.status)) as status,
|
||||||
".(!empty($zusatzcols)?implode(', ',$zusatzcols).',':'')."
|
".(!empty($zusatzcols)?implode(', ',$zusatzcols).',':'')."
|
||||||
@ -9478,7 +9478,7 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
|
|||||||
if(bearbeiter!="",bearbeiter,a2.name) as bearbeiter,
|
if(bearbeiter!="",bearbeiter,a2.name) as bearbeiter,
|
||||||
CONCAT(UCASE(LEFT(d.typ, 1)), SUBSTRING(d.typ, 2)) as art,
|
CONCAT(UCASE(LEFT(d.typ, 1)), SUBSTRING(d.typ, 2)) as art,
|
||||||
CONCAT(IF(d.sent = 1, "JA", "NEIN"),"<a data-type=dokumente data-id=", d.id, "></a>") as gesendet,
|
CONCAT(IF(d.sent = 1, "JA", "NEIN"),"<a data-type=dokumente data-id=", d.id, "></a>") as gesendet,
|
||||||
"" as pdf,
|
concat("<a href=\"index.php?module=dateien&action=send&id=",(SELECT datei FROM datei_stichwoerter WHERE subjekt="anhang" AND objekt="dokument" AND parameter = d.id LIMIT 1),"\"><img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/pdf.svg></a>") as pdf,
|
||||||
concat("1","-",d.id) as did,d.content as suchtext,d.internebezeichnung
|
concat("1","-",d.id) as did,d.content as suchtext,d.internebezeichnung
|
||||||
FROM
|
FROM
|
||||||
dokumente d
|
dokumente d
|
||||||
|
@ -28975,7 +28975,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bestellvorschlag",
|
"name": "bestellvorschlag",
|
||||||
"collation": "utf8mb4_general_ci",
|
"collation": "utf8mb3_general_ci",
|
||||||
"type": "BASE TABLE",
|
"type": "BASE TABLE",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
@ -39026,7 +39026,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fibu_buchungen",
|
"name": "fibu_buchungen",
|
||||||
"collation": "utf8mb4_general_ci",
|
"collation": "utf8mb3_general_ci",
|
||||||
"type": "BASE TABLE",
|
"type": "BASE TABLE",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
@ -39164,13 +39164,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fibu_buchungen_alle",
|
"name": "fibu_buchungen_alle",
|
||||||
"collation": "utf8mb4_general_ci",
|
"collation": "utf8mb3_general_ci",
|
||||||
"type": "BASE TABLE",
|
"type": "BASE TABLE",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"Field": "buchungsart",
|
"Field": "buchungsart",
|
||||||
"Type": "varchar(9)",
|
"Type": "varchar(9)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39203,7 +39203,7 @@
|
|||||||
{
|
{
|
||||||
"Field": "datum",
|
"Field": "datum",
|
||||||
"Type": "varchar(10)",
|
"Type": "varchar(10)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "YES",
|
"Null": "YES",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39269,7 +39269,7 @@
|
|||||||
{
|
{
|
||||||
"Field": "edit_module",
|
"Field": "edit_module",
|
||||||
"Type": "varchar(15)",
|
"Type": "varchar(15)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39293,13 +39293,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fibu_objekte",
|
"name": "fibu_objekte",
|
||||||
"collation": "utf8mb4_general_ci",
|
"collation": "utf8mb3_general_ci",
|
||||||
"type": "BASE TABLE",
|
"type": "BASE TABLE",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"Field": "datum",
|
"Field": "datum",
|
||||||
"Type": "varchar(10)",
|
"Type": "varchar(10)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "YES",
|
"Null": "YES",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39310,7 +39310,7 @@
|
|||||||
{
|
{
|
||||||
"Field": "typ",
|
"Field": "typ",
|
||||||
"Type": "varchar(15)",
|
"Type": "varchar(15)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39343,7 +39343,7 @@
|
|||||||
{
|
{
|
||||||
"Field": "parent_typ",
|
"Field": "parent_typ",
|
||||||
"Type": "varchar(7)",
|
"Type": "varchar(7)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -39354,7 +39354,7 @@
|
|||||||
{
|
{
|
||||||
"Field": "parent_id",
|
"Field": "parent_id",
|
||||||
"Type": "varchar(11)",
|
"Type": "varchar(11)",
|
||||||
"Collation": "utf8mb4_general_ci",
|
"Collation": "utf8mb3_general_ci",
|
||||||
"Null": "NO",
|
"Null": "NO",
|
||||||
"Key": "",
|
"Key": "",
|
||||||
"Default": null,
|
"Default": null,
|
||||||
@ -101383,7 +101383,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "subscription_cycle_job",
|
"name": "subscription_cycle_job",
|
||||||
"collation": "utf8mb4_general_ci",
|
"collation": "utf8mb3_general_ci",
|
||||||
"type": "BASE TABLE",
|
"type": "BASE TABLE",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
@ -117603,6 +117603,89 @@
|
|||||||
"Non_unique": ""
|
"Non_unique": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mahnwesen",
|
||||||
|
"collation": "utf8mb3_general_ci",
|
||||||
|
"type": "BASE TABLE",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"Field": "id",
|
||||||
|
"Type": "int(11)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "PRI",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "auto_increment",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "name",
|
||||||
|
"Type": "varchar(50)",
|
||||||
|
"Collation": "utf8mb3_general_ci",
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "tage",
|
||||||
|
"Type": "int(11)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "gebuehr",
|
||||||
|
"Type": "decimal(10,2)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "mail",
|
||||||
|
"Type": "int(11)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Field": "druck",
|
||||||
|
"Type": "int(11)",
|
||||||
|
"Collation": null,
|
||||||
|
"Null": "NO",
|
||||||
|
"Key": "",
|
||||||
|
"Default": null,
|
||||||
|
"Extra": "",
|
||||||
|
"Privileges": "select,insert,update,references",
|
||||||
|
"Comment": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"keys": [
|
||||||
|
{
|
||||||
|
"Key_name": "PRIMARY",
|
||||||
|
"Index_type": "BTREE",
|
||||||
|
"columns": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"Non_unique": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"views": [
|
"views": [
|
||||||
|
@ -5426,6 +5426,18 @@ title: 'Abschicken',
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace {VARS} with texts given in array
|
||||||
|
* Input array(key => value)
|
||||||
|
*/
|
||||||
|
function ParseVars(array $mapping, $text) {
|
||||||
|
foreach ($mapping as $key => $value) {
|
||||||
|
$text = str_replace('{'.strtoupper($key).'}',$value,$text);
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @refactor Document Komponente
|
// @refactor Document Komponente
|
||||||
function CheckBearbeiter($id,$module)
|
function CheckBearbeiter($id,$module)
|
||||||
{
|
{
|
||||||
@ -13780,6 +13792,19 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ReplaceKontorahmen($db,$value,$fromform = null) {
|
||||||
|
$value = $this->app->DB->real_escape_string($value);
|
||||||
|
|
||||||
|
if ($db) {
|
||||||
|
$sachkonto = explode(' ',$value)[0];
|
||||||
|
$kontoid = $this->app->DB->Select("SELECT id FROM kontorahmen WHERE sachkonto = '$sachkonto' LIMIT 1");
|
||||||
|
return($kontoid);
|
||||||
|
} else {
|
||||||
|
$sachkonto = $this->app->DB->Select("SELECT CONCAT(sachkonto,' ',beschriftung) FROM kontorahmen WHERE id = '$value' LIMIT 1");
|
||||||
|
return($sachkonto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// @refactor FormHelper Komponente
|
// @refactor FormHelper Komponente
|
||||||
function ReplaceLieferant($db,$value,$fromform)
|
function ReplaceLieferant($db,$value,$fromform)
|
||||||
{
|
{
|
||||||
@ -14535,156 +14560,6 @@ function get_emails ($str)
|
|||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @refactor Mahnwesen Modul
|
|
||||||
function MahnwesenBody($id,$als,$_datum=null,$sprache='')
|
|
||||||
{
|
|
||||||
if($id > 0)
|
|
||||||
{
|
|
||||||
$rechnungarr = $this->app->DB->SelectRow("SELECT r.*,DATE_FORMAT(datum,'%d.%m.%Y') as datum_de,DATE_FORMAT(mahnwesen_datum,'%d.%m.%Y') as mahnwesen_datum_de,r.mahnwesen_datum
|
|
||||||
FROM rechnung AS r WHERE r.id=$id LIMIT 1");
|
|
||||||
}
|
|
||||||
if(empty($rechnungarr))
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$adresse = $rechnungarr['adresse'];
|
|
||||||
if($sprache==''){
|
|
||||||
$sprache = $rechnungarr['sprache'];
|
|
||||||
}
|
|
||||||
if($sprache==''){
|
|
||||||
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
|
|
||||||
}
|
|
||||||
// OfferNo, customerId, OfferDate
|
|
||||||
|
|
||||||
$kundennummer = $rechnungarr['kundennummer'];
|
|
||||||
$projekt = $rechnungarr['projekt'];
|
|
||||||
$auftrag= $rechnungarr['auftrag'];
|
|
||||||
$buchhaltung= $rechnungarr['buchhaltung'];
|
|
||||||
$lieferschein = $rechnungarr['lieferschein'];
|
|
||||||
$lieferscheinid = $lieferschein;
|
|
||||||
if($lieferscheinid){
|
|
||||||
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferschein' LIMIT 1");
|
|
||||||
}else{
|
|
||||||
$lieferschein = '';
|
|
||||||
}
|
|
||||||
$bestellbestaetigung = $rechnungarr['kundennummer'];
|
|
||||||
$datum = $rechnungarr['datum_de'];
|
|
||||||
$datum_sql = $rechnungarr['datum'];
|
|
||||||
$belegnr = $rechnungarr['belegnr'];
|
|
||||||
$doppel = $rechnungarr['doppel'];
|
|
||||||
$freitext = $rechnungarr['freitext'];
|
|
||||||
$ustid = $rechnungarr['ustid'];
|
|
||||||
$soll = $rechnungarr['soll'];
|
|
||||||
$ist = $rechnungarr['ist'];
|
|
||||||
$land = $rechnungarr['land'];
|
|
||||||
$mahnwesen_datum = $rechnungarr['mahnwesen_datum'];
|
|
||||||
$mahnwesen_datum_deutsch = $rechnungarr['mahnwesen_datum_de'];
|
|
||||||
$zahlungsweise = $rechnungarr['zahlungsweise'];
|
|
||||||
$zahlungsstatus = $rechnungarr['zahlungsstatus'];
|
|
||||||
$zahlungszieltage = $rechnungarr['zahlungszieltage'];
|
|
||||||
$zahlungszieltageskonto = $rechnungarr['zahlungszieltageskonto'];
|
|
||||||
$zahlungszielskonto = $rechnungarr['zahlungszielskonto'];
|
|
||||||
$waehrung = $rechnungarr['waehrung'];
|
|
||||||
|
|
||||||
$zahlungdatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltage DAY),'%d.%m.%Y') FROM rechnung WHERE id='$id' LIMIT 1");
|
|
||||||
|
|
||||||
if($_datum!=null)
|
|
||||||
{
|
|
||||||
$mahnwesen_datum = $this->app->String->Convert($_datum,'%1.%2.%3','%3-%2-%1');
|
|
||||||
$mahnwesen_datum_deutsch = $_datum;
|
|
||||||
}
|
|
||||||
|
|
||||||
$zahlungsweise = strtolower($zahlungsweise);
|
|
||||||
|
|
||||||
if($als=='zahlungserinnerung')
|
|
||||||
{
|
|
||||||
$body = $this->GetGeschaeftsBriefText("MahnwesenZahlungserinnerung",$sprache,$projekt,"rechnung",$id);
|
|
||||||
$tage = $this->GetKonfiguration('mahnwesen_m1_tage');
|
|
||||||
}
|
|
||||||
else if($als=='mahnung1')
|
|
||||||
{
|
|
||||||
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung1",$sprache,$projekt,"rechnung",$id);
|
|
||||||
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m1_gebuehr');
|
|
||||||
$tage = $this->GetKonfiguration('mahnwesen_m2_tage');
|
|
||||||
}
|
|
||||||
else if($als=='mahnung2')
|
|
||||||
{
|
|
||||||
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung2",$sprache,$projekt,"rechnung",$id);
|
|
||||||
$tage = $this->GetKonfiguration('mahnwesen_m3_tage');
|
|
||||||
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m2_gebuehr');
|
|
||||||
}
|
|
||||||
else if($als=='mahnung3')
|
|
||||||
{
|
|
||||||
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung3",$sprache,$projekt,"rechnung",$id);
|
|
||||||
$tage = $this->GetKonfiguration('mahnwesen_ik_tage');
|
|
||||||
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m3_gebuehr');
|
|
||||||
}
|
|
||||||
else if($als=='inkasso')
|
|
||||||
{
|
|
||||||
$body = $this->GetGeschaeftsBriefText("MahnwesenInkasso",$sprache,$projekt,"rechnung",$id);
|
|
||||||
//$tage = $this->GetKonfiguration("mahnwesen_ik_tage");
|
|
||||||
$tage = 3; //eigentlich vorbei
|
|
||||||
$mahngebuehr = $this->GetKonfiguration('mahnwesen_ik_gebuehr');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$body = $this->app->erp->Beschriftung("dokument_anschreiben");
|
|
||||||
}
|
|
||||||
|
|
||||||
if($tage <=0) $tage = 0;
|
|
||||||
|
|
||||||
$datummahnung= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$mahnwesen_datum', INTERVAL $tage DAY),'%d.%m.%Y')");
|
|
||||||
$datumrechnungzahlungsziel= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$datum_sql', INTERVAL $zahlungszieltage DAY),'%d.%m.%Y')");
|
|
||||||
|
|
||||||
$tage_ze = $zahlungszieltage + $this->GetKonfiguration('mahnwesen_m1_tage');
|
|
||||||
$datumzahlungserinnerung= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$datum_sql', INTERVAL $tage_ze DAY),'%d.%m.%Y')");
|
|
||||||
|
|
||||||
// checkstamp $this->CheckStamp("jhdskKUHsiusakiakuhsd"); // errechnet aus laufzeit und kundenid // wenn es nicht drinnen ist darf es nicht gehen
|
|
||||||
|
|
||||||
if($mahngebuehr=='' || !is_numeric($mahngebuehr))
|
|
||||||
$mahngebuehr = 0;
|
|
||||||
|
|
||||||
//$offen= '11,23';
|
|
||||||
$body = str_replace('{RECHNUNG}',$belegnr,$body);
|
|
||||||
$body = str_replace('{BELEGNR}',$belegnr,$body);
|
|
||||||
$body = str_replace('{DATUMRECHNUNG}',$datum,$body);
|
|
||||||
$body = str_replace('{TAGE}',$tage,$body);
|
|
||||||
$body = str_replace('{OFFEN}',$this->formatMoney($soll - $ist,$waehrung),$body);
|
|
||||||
$body = str_replace('{SOLL}',$this->formatMoney($soll,$waehrung),$body);
|
|
||||||
$body = str_replace('{SUMME}',$this->formatMoney($soll - $ist + $mahngebuehr,$waehrung),$body);
|
|
||||||
$body = str_replace('{IST}',$this->formatMoney($ist,$waehrung),$body);
|
|
||||||
$body = str_replace('{DATUM}',$datummahnung,$body);
|
|
||||||
$body = str_replace('{MAHNGEBUEHR}',$this->formatMoney($mahngebuehr,$waehrung),$body);
|
|
||||||
$body = str_replace('{OFFENMITMAHNGEBUEHR}',$this->formatMoney($mahngebuehr + $soll - $ist,$waehrung),$body);
|
|
||||||
$body = str_replace('{MAHNDATUM}',$mahnwesen_datum_deutsch,$body);
|
|
||||||
|
|
||||||
|
|
||||||
// Im Protokoll suchen Datum von Zahlungserinnerung, Mahnung 1, Mahnung 2, Mahnung 3
|
|
||||||
|
|
||||||
$mahnung1 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$id'
|
|
||||||
AND grund LIKE 'Mahnung1 versendet%' ORDER by Zeit DESC LIMIT 1");
|
|
||||||
|
|
||||||
$mahnung2 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$id'
|
|
||||||
AND grund LIKE 'Mahnung2 versendet%' ORDER by Zeit DESC LIMIT 1");
|
|
||||||
|
|
||||||
$mahnung3 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$id'
|
|
||||||
AND grund LIKE 'Mahnung3 versendet%' ORDER by Zeit DESC LIMIT 1");
|
|
||||||
|
|
||||||
$body = str_replace('{DATUMMAHNUNG1}',$mahnung1,$body);
|
|
||||||
$body = str_replace('{DATUMMAHNUNG2}',$mahnung2,$body);
|
|
||||||
$body = str_replace('{DATUMMAHNUNG3}',$mahnung3,$body);
|
|
||||||
|
|
||||||
$body = str_replace('{DATUMZAHLUNGSERINNERUNGFAELLIG}',$datumzahlungserinnerung,$body);
|
|
||||||
$body = str_replace('{DATUMZAHLUNGSERINNERUNG}',$datumzahlungserinnerung,$body);
|
|
||||||
$body = str_replace('{DATUMRECHNUNGZAHLUNGSZIEL}',$datumrechnungzahlungsziel,$body);
|
|
||||||
|
|
||||||
$body = $this->ParseUserVars('rechnung',$id,$body);
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**@deprecated */
|
/**@deprecated */
|
||||||
function AufragZuDTA($auftrag,$rechnung="1")
|
function AufragZuDTA($auftrag,$rechnung="1")
|
||||||
{
|
{
|
||||||
@ -18108,7 +17983,8 @@ function Gegenkonto($ust_befreit,$ustid='', $doctype = '', $doctypeId = 0)
|
|||||||
created = NOW(),
|
created = NOW(),
|
||||||
uhrzeit = "' . $data['uhrzeit'] . '",
|
uhrzeit = "' . $data['uhrzeit'] . '",
|
||||||
projekt = "' . $data['projekt'] . '",
|
projekt = "' . $data['projekt'] . '",
|
||||||
bearbeiter = "' . $data['bearbeiter'] . '"
|
bearbeiter = "' . $data['bearbeiter'] . '",
|
||||||
|
sent = "' . $data['sent'] . '"
|
||||||
');
|
');
|
||||||
|
|
||||||
return $this->app->DB->GetInsertID();
|
return $this->app->DB->GetInsertID();
|
||||||
@ -36033,7 +35909,7 @@ function Firmendaten($field,$projekt="")
|
|||||||
* Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
|
* Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
|
||||||
* returns array(betrag, waehrung) or empty array if multiple
|
* returns array(betrag, waehrung) or empty array if multiple
|
||||||
*/
|
*/
|
||||||
public function GetSaldoDokument(int $id, string $type) : array {
|
public function GetSaldoDokument(int $id, string $type, string $buchungsart = '', string $datum_bis = '') : array {
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
@ -36042,10 +35918,15 @@ function Firmendaten($field,$projekt="")
|
|||||||
FROM
|
FROM
|
||||||
fibu_buchungen_alle
|
fibu_buchungen_alle
|
||||||
WHERE
|
WHERE
|
||||||
typ = '".$type."' AND id = ".$id."
|
typ = '".$type."'
|
||||||
|
AND
|
||||||
|
id = ".$id."
|
||||||
|
AND
|
||||||
|
(buchungsart = '".$buchungsart."' OR '".$buchungsart."' = '')
|
||||||
|
AND
|
||||||
|
(datum <= '".$datum_bis."' OR '".$datum_bis."' = '')
|
||||||
GROUP BY
|
GROUP BY
|
||||||
waehrung";
|
waehrung";
|
||||||
|
|
||||||
$result = $this->app->DB->SelectArr($sql);
|
$result = $this->app->DB->SelectArr($sql);
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
@ -36067,6 +35948,28 @@ function Firmendaten($field,$projekt="")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Refresh fibu buchung_alle tables
|
||||||
|
* using module fibu_buchungen
|
||||||
|
*/
|
||||||
|
public function fibu_rebuild_tables() {
|
||||||
|
$fibu_buchungen = $this->app->loadModule('fibu_buchungen', false);
|
||||||
|
if($fibu_buchungen !== null && method_exists($fibu_buchungen, 'fibu_buchungen_buchen')) {
|
||||||
|
return $fibu_buchungen->fibu_rebuild_tables();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Recalculate payment status and skonto
|
||||||
|
* using module rechnung
|
||||||
|
*/
|
||||||
|
public function rechnung_zahlstatus_berechnen() {
|
||||||
|
$rechnung = $this->app->loadModule('rechnung', false);
|
||||||
|
if($rechnung !== null && method_exists($rechnung, 'rechnung_zahlstatus_berechnen')) {
|
||||||
|
return $rechnung->rechnung_zahlstatus_berechnen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ANABREGSNeuberechnen($id,$art,$force=false)
|
public function ANABREGSNeuberechnen($id,$art,$force=false)
|
||||||
{
|
{
|
||||||
|
@ -43,9 +43,9 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
parent::__construct($this->app,$projekt,$styleData);
|
parent::__construct($this->app,$projekt,$styleData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetRechnung($id,$als="",$doppeltmp=0, $_datum = null)
|
public function GetRechnung($id, $titel_abw="",$doppeltmp=0, $_datum = null, $text_abw = '')
|
||||||
{
|
{
|
||||||
$this->parameter = $als;
|
|
||||||
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
|
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
|
||||||
{
|
{
|
||||||
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
||||||
@ -124,10 +124,10 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
|
|
||||||
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
|
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
|
||||||
|
|
||||||
if(empty($als) || $als === 'doppel') {
|
/* if(empty($als) || $als === 'doppel') {
|
||||||
$rechnungsnummeranzeigen = false;
|
$rechnungsnummeranzeigen = false;
|
||||||
}
|
}
|
||||||
elseif(!empty($belegnr)){
|
else*/if(!empty($belegnr)){
|
||||||
$rechnungsnummeranzeigen = true;
|
$rechnungsnummeranzeigen = true;
|
||||||
}
|
}
|
||||||
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
|
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
|
||||||
@ -172,7 +172,7 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
$zahlungsweisetext = $this->app->erp->Zahlungsweisetext("rechnung",$id);
|
$zahlungsweisetext = $this->app->erp->Zahlungsweisetext("rechnung",$id);
|
||||||
|
|
||||||
|
|
||||||
if($doppel==1) $als = "doppel";
|
// if($doppel==1) $als = "doppel";
|
||||||
|
|
||||||
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
|
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
|
||||||
else {
|
else {
|
||||||
@ -181,7 +181,7 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$posanzeigen = true;
|
$posanzeigen = true;
|
||||||
if($als=="zahlungserinnerung")
|
/* if($als=="zahlungserinnerung")
|
||||||
{
|
{
|
||||||
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_zahlungserinnerung")." ".(is_null($_datum)?$mahnwesen_datum:$_datum);
|
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_zahlungserinnerung")." ".(is_null($_datum)?$mahnwesen_datum:$_datum);
|
||||||
if($this->app->erp->GetKonfiguration("mahnwesen_ze_pos") === '0')$posanzeigen = false;
|
if($this->app->erp->GetKonfiguration("mahnwesen_ze_pos") === '0')$posanzeigen = false;
|
||||||
@ -207,14 +207,12 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
if($this->app->erp->GetKonfiguration("mahnwesen_inkasso_pos") === '0')$posanzeigen = false;
|
if($this->app->erp->GetKonfiguration("mahnwesen_inkasso_pos") === '0')$posanzeigen = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{*/
|
||||||
if($rechnungersatz)
|
if($rechnungersatz)
|
||||||
$this->doctypeOrig=($this->app->erp->Beschriftung("bezeichnungrechnungersatz")?$this->app->erp->Beschriftung("bezeichnungrechnungersatz"):$this->app->erp->Beschriftung("dokument_rechnung"))." $belegnr";
|
$this->doctypeOrig=($this->app->erp->Beschriftung("bezeichnungrechnungersatz")?$this->app->erp->Beschriftung("bezeichnungrechnungersatz"):$this->app->erp->Beschriftung("dokument_rechnung"))." $belegnr";
|
||||||
else
|
else
|
||||||
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_rechnung")." $belegnr";
|
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_rechnung")." $belegnr";
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->zusatzfooter = " (RE$belegnr)";
|
$this->zusatzfooter = " (RE$belegnr)";
|
||||||
|
|
||||||
@ -407,12 +405,12 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($als!="" && $als!="doppel")
|
/* if($als!="" && $als!="doppel")
|
||||||
{
|
{
|
||||||
$body = $this->app->erp->MahnwesenBody($id,$als,$_datum);
|
$body = $this->app->erp->MahnwesenBody($id,$als,$_datum);
|
||||||
$footer =$this->app->erp->ParseUserVars("rechnung",$id, $this->app->erp->Beschriftung("rechnung_footer"));
|
$footer =$this->app->erp->ParseUserVars("rechnung",$id, $this->app->erp->Beschriftung("rechnung_footer"));
|
||||||
}
|
}
|
||||||
else {
|
else {*/
|
||||||
$body = $this->app->erp->Beschriftung("rechnung_header");
|
$body = $this->app->erp->Beschriftung("rechnung_header");
|
||||||
if($bodyzusatz!="") $body=$body."\r\n".$bodyzusatz;
|
if($bodyzusatz!="") $body=$body."\r\n".$bodyzusatz;
|
||||||
$body = $this->app->erp->ParseUserVars("rechnung",$id,$body);
|
$body = $this->app->erp->ParseUserVars("rechnung",$id,$body);
|
||||||
@ -442,6 +440,14 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
$footer = $versandinfo."$freitext"."\r\n".$this->app->erp->ParseUserVars("rechnung",$id,$this->app->erp->Beschriftung("rechnung_footer").
|
$footer = $versandinfo."$freitext"."\r\n".$this->app->erp->ParseUserVars("rechnung",$id,$this->app->erp->Beschriftung("rechnung_footer").
|
||||||
"\r\n$steuer\r\n$zahlungsweisetext").$systemfreitext;
|
"\r\n$steuer\r\n$zahlungsweisetext").$systemfreitext;
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($titel_abw != '') {
|
||||||
|
$this->doctypeOrig = $titel_abw;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($text_abw != '') {
|
||||||
|
$body = $text_abw;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setTextDetails(array(
|
$this->setTextDetails(array(
|
||||||
@ -686,10 +692,10 @@ class RechnungPDF extends BriefpapierCustom {
|
|||||||
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
|
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
|
||||||
$tmp_name = str_replace('.','',$tmp_name);
|
$tmp_name = str_replace('.','',$tmp_name);
|
||||||
|
|
||||||
if($als=="" || $als=="doppel")
|
if($titel_abw != "")
|
||||||
$this->filename = $datum2."_RE".$belegnr.".pdf";
|
$this->filename = $datum2."_RE".$belegnr."_INFO.pdf";
|
||||||
else
|
else
|
||||||
$this->filename = $datum2."_MA".$belegnr.".pdf";
|
$this->filename = $datum2."_RE".$belegnr.".pdf";
|
||||||
|
|
||||||
$this->setBarcode($belegnr);
|
$this->setBarcode($belegnr);
|
||||||
}
|
}
|
||||||
|
@ -6417,7 +6417,7 @@ function AdresseVerein()
|
|||||||
if(bearbeiter!="",bearbeiter,a2.name) as bearbeiter,
|
if(bearbeiter!="",bearbeiter,a2.name) as bearbeiter,
|
||||||
CONCAT(UCASE(LEFT(d.typ, 1)), SUBSTRING(d.typ, 2)) as art,
|
CONCAT(UCASE(LEFT(d.typ, 1)), SUBSTRING(d.typ, 2)) as art,
|
||||||
CONCAT(IF(d.sent = 1, "JA", "NEIN"),"<a data-type=dokumente data-id=", d.id, "></a>") as gesendet,
|
CONCAT(IF(d.sent = 1, "JA", "NEIN"),"<a data-type=dokumente data-id=", d.id, "></a>") as gesendet,
|
||||||
"" as pdf,
|
concat("<a href=\"index.php?module=dateien&action=send&id=",(SELECT datei FROM datei_stichwoerter WHERE subjekt="anhang" AND objekt="dokument" AND parameter = d.id LIMIT 1),"\"><img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/pdf.svg></a>") as pdf,
|
||||||
concat("1","-",d.id) as did,
|
concat("1","-",d.id) as did,
|
||||||
d.content as suchtext,
|
d.content as suchtext,
|
||||||
d.internebezeichnung
|
d.internebezeichnung
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Bearbeiter:</td>
|
<td>Bearbeiter:</td>
|
||||||
<td colspan="3"><input type="text" name="von" id="von" value="[SENDER]" style="width: 370px;"></td>
|
<td colspan="3"><input type="text" name="von" id="von" value="[BEARBEITER]" style="width: 370px;"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="100">{|Projekt|}:</td>
|
<td width="100">{|Projekt|}:</td>
|
||||||
|
@ -68,13 +68,13 @@
|
|||||||
<td width="25%" style="position:relative"><a href="index.php?module=versandarten&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a></td>
|
<td width="25%" style="position:relative"><a href="index.php?module=versandarten&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a></td>
|
||||||
<td width="25%" style="position:relative"><a href="index.php?module=zahlungsweisen&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a></td>
|
<td width="25%" style="position:relative"><a href="index.php?module=zahlungsweisen&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a></td>
|
||||||
<td width="25%" style="position:relative"><a [LIEFERBEDINGUNGENLINK]><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a>[GREYLIEFERBEDINGUNGEN]</td>
|
<td width="25%" style="position:relative"><a [LIEFERBEDINGUNGENLINK]><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_16.gif" border="0" width="30%"></a>[GREYLIEFERBEDINGUNGEN]</td>
|
||||||
<td width="25%"></td>
|
<td width="25%" style="position:relative"><a href="index.php?module=mahnwesen&action=einstellungen"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_11.gif" border="0" width="30%"></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr align="center">
|
<tr align="center">
|
||||||
<td><a href="index.php?module=versandarten&action=list">{|Versandarten|}</a></td>
|
<td><a href="index.php?module=versandarten&action=list">{|Versandarten|}</a></td>
|
||||||
<td><a href="index.php?module=zahlungsweisen&action=list">{|Zahlungsweisen|}</a></td>
|
<td><a href="index.php?module=zahlungsweisen&action=list">{|Zahlungsweisen|}</a></td>
|
||||||
<td><a [LIEFERBEDINGUNGENLINK]>{|Lieferbedingungen|}</a></td>
|
<td><a [LIEFERBEDINGUNGENLINK]>{|Lieferbedingungen|}</a></td>
|
||||||
<td></td>
|
<td><a href="index.php?module=mahnwesen&action=einstellungen">{|Mahnwesen|}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
@ -1109,7 +1109,10 @@
|
|||||||
<legend>{|Finanzbuchhaltung Einstellungen|}</legend>
|
<legend>{|Finanzbuchhaltung Einstellungen|}</legend>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="300">Buchungen erzeugen ab Datum:</td><td colspan="3"><input type="text" id= "fibu_buchungen_startdatum" name="fibu_buchungen_startdatum" size="10" value="[FIBU_BUCHUNGEN_STARTDATUM]"></td>
|
<td width="300">Buchungen erzeugen ab Datum:</td><td colspan="3"><input type="text" id= "fibu_buchungen_startdatum" name="fibu_buchungen_startdatum" size="10" value="[FIBU_BUCHUNGEN_STARTDATUM]"><i>Für die Nutzung mit dem Modul Buchhaltung-Buchungen (Zahlungseingang, Zahlungsstatus, Mahnwesen)</i></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="300">Konto für Rechnung-Skontobuchungen:</td><td colspan="3"><input type="text" id= "rechnung_skonto_kontorahmen" name="rechnung_skonto_kontorahmen" size="10" value="[RECHNUNG_SKONTO_KONTORAHMEN]"><i>Auf dieses Sachkonto werden Skontobuchungen mithilfe der Funktion "Zahlungsstatus berechnen" im Rechnungsmodul gebucht</i></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" id="angeboteoffen"> Fehlende Artikel</td>
|
<td><input type="checkbox" id="angeboteoffen"> Fehlende Artikel</td>
|
||||||
<td><input type="checkbox" id="angeboteoffen"> Artikel im Zulauf</td>
|
<td><input type="checkbox" id="angeboteoffen"> Artikel im Zulauf</td>
|
||||||
<td><input type="checkbox" id="angeboteheute"> Gersperrte Artikel</td>
|
<td><input type="checkbox" id="angeboteheute"> Gesperrte Artikel</td>
|
||||||
<td>Artikelgruppen: <select><option>alle</option><option>Waren 700000</option></select></td>
|
<td>Artikelgruppen: <select><option>alle</option><option>Waren 700000</option></select></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
</center>
|
</center>
|
||||||
@ -121,6 +121,7 @@
|
|||||||
<li>{|ZahlungDiff|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}, {ANSCHREIBEN}, {INTERNET}</i></li>
|
<li>{|ZahlungDiff|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}, {ANSCHREIBEN}, {INTERNET}</i></li>
|
||||||
<li>{|Stornierung|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {INTERNET}</i></li>
|
<li>{|Stornierung|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {INTERNET}</i></li>
|
||||||
<li>{|ZahlungMiss|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}, {ANSCHREIBEN}, {INTERNET}</i></li>
|
<li>{|ZahlungMiss|} <i>{|Variablen|}: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}, {ANSCHREIBEN}, {INTERNET}</i></li>
|
||||||
|
<li>Mahnung <i>Variablen: {BELEGNR}, {DATUM}, {OFFEN}, {MAHNGEBUEHR}, {HEUTE}</i></li>
|
||||||
<li>{|Versand|} <i>{|Variablen|}: {VERSAND}, {VERSANDTYPE}, {VERSANDBEZEICHNUNG}, {TRACKINGNUMMER}, {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}, {LIEFERADRESSE}, {LIEFERADRESSELANG}</i></li>
|
<li>{|Versand|} <i>{|Variablen|}: {VERSAND}, {VERSANDTYPE}, {VERSANDBEZEICHNUNG}, {TRACKINGNUMMER}, {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}, {LIEFERADRESSE}, {LIEFERADRESSELANG}</i></li>
|
||||||
<li>{|VersandMailDokumente|} <i>{|Variablen|}: {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
<li>{|VersandMailDokumente|} <i>{|Variablen|}: {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
||||||
<li>{|Erweiterte Freigabe|} <i>{|Variablen|}: {REQUESTER}, {LINK}, {LINKFREIGABEUEBERSICHT}, {DOCTYPE}, {DOCTYPE_ID}</i></li>
|
<li>{|Erweiterte Freigabe|} <i>{|Variablen|}: {REQUESTER}, {LINK}, {LINKFREIGABEUEBERSICHT}, {DOCTYPE}, {DOCTYPE_ID}</i></li>
|
||||||
|
142
www/pages/content/mahnwesen_edit.tpl
Normal file
142
www/pages/content/mahnwesen_edit.tpl
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1"></a></li>
|
||||||
|
</ul>
|
||||||
|
<!-- Example for multiple tabs
|
||||||
|
<ul hidden">
|
||||||
|
<li><a href="#tabs-1">First Tab</a></li>
|
||||||
|
<li><a href="#tabs-2">Second Tab</a></li>
|
||||||
|
</ul>
|
||||||
|
-->
|
||||||
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
|
<form action="" method="post">
|
||||||
|
[FORMHANDLEREVENT]
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-12 col-md-12 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{|<!--Legend for this form area goes here>-->Mahnwesen-Einstellungen|}</legend>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Name|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" id="name" value="[NAME]" size="20"><i>Entspricht "Typ" in der Geschäftsbrief-Vorlage</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Tage|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="tage" id="tage" value="[TAGE]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Gebuehr|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" step="0.01" name="gebuehr" id="gebuehr" value="[GEBUEHR]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|E-Mail senden|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="mail" id="mail" [MAIL] size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Mahnung ausdrucken|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="druck" id="druck" [DRUCK] size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Example for 2nd row
|
||||||
|
<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>{|Another legend|}</legend>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Name|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" id="name" value="[NAME]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Tage|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="tage" id="tage" value="[TAGE]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Gebuehr|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="gebuehr" id="gebuehr" value="[GEBUEHR]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{|Versandmethode|}:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="versandmethode" id="versandmethode" value="[VERSANDMETHODE]" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<!-- Example for 2nd tab
|
||||||
|
<div id="tabs-2">
|
||||||
|
[MESSAGE]
|
||||||
|
<form action="" method="post">
|
||||||
|
[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>{|...|}</legend>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
...
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
|
10
www/pages/content/mahnwesen_einstellungen.tpl
Normal file
10
www/pages/content/mahnwesen_einstellungen.tpl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||||
|
</ul>
|
||||||
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
|
[TAB1]
|
||||||
|
[TAB1NEXT]
|
||||||
|
</div>
|
||||||
|
</div>
|
64
www/pages/content/mahnwesen_list.tpl
Normal file
64
www/pages/content/mahnwesen_list.tpl
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||||
|
</ul>
|
||||||
|
<div id="tabs-1">
|
||||||
|
<form method="post" action="#">
|
||||||
|
<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="zu_mahnen" class="switch">
|
||||||
|
<input type="checkbox" id="zu_mahnen">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="zu_mahnen">{|Nur zu mahnende|}</label>
|
||||||
|
</li>
|
||||||
|
<li class="filter-item">
|
||||||
|
<label for="inkl_bezahlte" class="switch">
|
||||||
|
<input type="checkbox" id="inkl_bezahlte">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="inkl_bezahlte">{|Inkl. bezahlte|}</label>
|
||||||
|
</li>
|
||||||
|
<li class="filter-item">
|
||||||
|
<label for="inkl_gesperrte" class="switch">
|
||||||
|
<input type="checkbox" id="inkl_gesperrte">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label for="inkl_gesperrte">{|Inkl. gesperrte|}</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<input type="submit" class="btnBlue" name="mahnstufe_berechnen" value="{|Mahnstufe berechnen|}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<form method="post" action="#">
|
||||||
|
[MESSAGE]
|
||||||
|
[TAB1]
|
||||||
|
[TAB1NEXT]
|
||||||
|
<fieldset>
|
||||||
|
<legend>{|Stapelverarbeitung|}</legend>
|
||||||
|
<input type="checkbox" id="auswahlalle" onchange="alleauswaehlen();" /> {|alle markieren|}
|
||||||
|
<select id="sel_aktion" name="sel_aktion">
|
||||||
|
<option value="">{|bitte wählen|} ...</option>
|
||||||
|
[ALSBEZAHLTMARKIEREN]
|
||||||
|
<option value="offen">{|als offen markieren|}</option>
|
||||||
|
<option value="mahnung_reset">{|Mahnstatus zurücksetzen|}</option>
|
||||||
|
<option value="mahnen">{|Mahnung durchführen|}</option>
|
||||||
|
<!-- <option value="email">{|Mahnung durchführen (nur E-Mail)|}</option>
|
||||||
|
<option value="email">{|Mahnung durchführen (nur Drucken)|}</option> -->
|
||||||
|
</select> {|Drucker|}: <select name="seldrucker">[SELDRUCKER]</select> <input type="submit" class="btnBlue" name="ausfuehren" value="{|ausführen|}" />
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function alleauswaehlen()
|
||||||
|
{
|
||||||
|
var wert = $('#auswahlalle').prop('checked');
|
||||||
|
$('#mahnwesen_list').find(':checkbox').prop('checked',wert);
|
||||||
|
}
|
||||||
|
</script>
|
@ -39,9 +39,13 @@
|
|||||||
<label for="rechnungenstorniert">{|Storniert|}</label>
|
<label for="rechnungenstorniert">{|Storniert|}</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<form method="post" action="#">
|
||||||
|
<input type="submit" class="btnBlue" name="zahlungsstatus_berechnen" value="{|Zahlungsstatus berechnen|}" />
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
[MESSAGE]
|
[MESSAGE]
|
||||||
<form method="post" action="#">
|
<form method="post" action="#">
|
||||||
[TAB1]
|
[TAB1]
|
||||||
|
@ -1043,7 +1043,7 @@ class Firmendaten {
|
|||||||
'arbeitsnachweis_header','arbeitsnachweis_footer','provisionsgutschrift_header','provisionsgutschrift_footer','proformarechnung_header','proformarechnung_footer','eu_lieferung_vermerk','export_lieferung_vermerk'
|
'arbeitsnachweis_header','arbeitsnachweis_footer','provisionsgutschrift_header','provisionsgutschrift_footer','proformarechnung_header','proformarechnung_footer','eu_lieferung_vermerk','export_lieferung_vermerk'
|
||||||
,'wareneingang_kamera_waage','layout_iconbar','passwort','host','port','mailssl','signatur','email','absendername','bcc1','bcc2','bcc3'
|
,'wareneingang_kamera_waage','layout_iconbar','passwort','host','port','mailssl','signatur','email','absendername','bcc1','bcc2','bcc3'
|
||||||
,'firmenfarbe','name','strasse','plz','ort','steuernummer','projekt','steuer_positionen_export','tabsnavigationfarbe','tabsnavigationfarbeschrift'
|
,'firmenfarbe','name','strasse','plz','ort','steuernummer','projekt','steuer_positionen_export','tabsnavigationfarbe','tabsnavigationfarbeschrift'
|
||||||
,"buchhaltung_berater","buchhaltung_mandant","buchhaltung_wj_beginn","buchhaltung_sachkontenlaenge", "fibu_buchungen_startdatum"
|
,"buchhaltung_berater","buchhaltung_mandant","buchhaltung_wj_beginn","buchhaltung_sachkontenlaenge", "fibu_buchungen_startdatum", "rechnung_skonto_kontorahmen"
|
||||||
);
|
);
|
||||||
|
|
||||||
if(isset($sql2a)){
|
if(isset($sql2a)){
|
||||||
@ -1380,9 +1380,10 @@ class Firmendaten {
|
|||||||
$this->app->YUI->AutoComplete('steuersatz_normal','steuersatz',1);
|
$this->app->YUI->AutoComplete('steuersatz_normal','steuersatz',1);
|
||||||
$this->app->YUI->AutoComplete('steuersatz_ermaessigt','steuersatz',1);
|
$this->app->YUI->AutoComplete('steuersatz_ermaessigt','steuersatz',1);
|
||||||
|
|
||||||
|
|
||||||
$this->app->YUI->DatePicker('fibu_buchungen_startdatum');
|
$this->app->YUI->DatePicker('fibu_buchungen_startdatum');
|
||||||
|
|
||||||
|
$this->app->YUI->AutoComplete('rechnung_skonto_kontorahmen', 'sachkonto');
|
||||||
|
|
||||||
$this->app->Tpl->Parse('PAGE','firmendaten.tpl');
|
$this->app->Tpl->Parse('PAGE','firmendaten.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1849,6 +1850,7 @@ class Firmendaten {
|
|||||||
|
|
||||||
// Fibu
|
// Fibu
|
||||||
$this->app->Tpl->Set('FIBU_BUCHUNGEN_STARTDATUM', $this->app->erp->ReplaceDatum(false,$data[0]['fibu_buchungen_startdatum'],false));
|
$this->app->Tpl->Set('FIBU_BUCHUNGEN_STARTDATUM', $this->app->erp->ReplaceDatum(false,$data[0]['fibu_buchungen_startdatum'],false));
|
||||||
|
$this->app->Tpl->Set('RECHNUNG_SKONTO_KONTORAHMEN', $this->app->erp->ReplaceKontorahmen(false,$data[0]['rechnung_skonto_kontorahmen']));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2292,6 +2294,7 @@ class Firmendaten {
|
|||||||
$data['buchhaltung_sachkontenlaenge'] = ($this->app->Secure->POST["buchhaltung_sachkontenlaenge"]);
|
$data['buchhaltung_sachkontenlaenge'] = ($this->app->Secure->POST["buchhaltung_sachkontenlaenge"]);
|
||||||
|
|
||||||
$data['fibu_buchungen_startdatum'] = $this->app->erp->ReplaceDatum(true,$this->app->Secure->POST["fibu_buchungen_startdatum"],false);
|
$data['fibu_buchungen_startdatum'] = $this->app->erp->ReplaceDatum(true,$this->app->Secure->POST["fibu_buchungen_startdatum"],false);
|
||||||
|
$data['rechnung_skonto_kontorahmen'] = $this->app->erp->ReplaceKontorahmen(true,$this->app->Secure->POST["rechnung_skonto_kontorahmen"]);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
721
www/pages/mahnwesen.php
Normal file
721
www/pages/mahnwesen.php
Normal file
@ -0,0 +1,721 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 OpenXE project
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||||
|
|
||||||
|
class Mahnwesen {
|
||||||
|
|
||||||
|
function __construct($app, $intern = false) {
|
||||||
|
$this->app = $app;
|
||||||
|
if ($intern)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$this->app->ActionHandlerInit($this);
|
||||||
|
$this->app->ActionHandler("list", "mahnwesen_list");
|
||||||
|
$this->app->ActionHandler("create", "mahnwesen_edit"); // This automatically adds a "New" button
|
||||||
|
$this->app->ActionHandler("edit", "mahnwesen_edit");
|
||||||
|
$this->app->ActionHandler("einstellungen", "mahnwesen_einstellungen");
|
||||||
|
$this->app->ActionHandler("delete", "mahnwesen_delete");
|
||||||
|
$this->app->DefaultActionHandler("list");
|
||||||
|
$this->app->ActionHandlerListen($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Install() {
|
||||||
|
/* Fill out manually later */
|
||||||
|
}
|
||||||
|
|
||||||
|
public function TableSearch($app, $name, $erlaubtevars) {
|
||||||
|
switch ($name) {
|
||||||
|
case "mahnwesen_list":
|
||||||
|
|
||||||
|
$extended_mysql55 = ",'de_DE'";
|
||||||
|
|
||||||
|
$allowed['mahnwesen_list'] = array('list');
|
||||||
|
$heading = array('', '', 'Rechnung', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt', 'Zahlung', 'Betrag (brutto)', 'Währung', 'Zahlstatus', 'Differenz', 'Status','Fällig am','Tage','Mahnstufe','Brief','E-Mail','Gemahnt','Mahn-Datum','Sperre','Interne Bemerkung','Menü');
|
||||||
|
$width = array('1%','1%','01%', '01%', '01%', '05%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '01%', '20%', '1%'); // Fill out manually later
|
||||||
|
|
||||||
|
// columns that are aligned right (numbers etc)
|
||||||
|
// $alignright = array(4,5,6,7,8);
|
||||||
|
|
||||||
|
$faellig_datum = "DATE_ADD(r.datum, INTERVAL r.zahlungszieltage DAY)";
|
||||||
|
$faellig_tage = "DATEDIFF(CURRENT_DATE,DATE_ADD(r.datum, INTERVAL r.zahlungszieltage DAY))";
|
||||||
|
$mahn_druck = "if(m.druck,'Ja','')";
|
||||||
|
$mahn_mail = "if(m.mail,'Ja','')";
|
||||||
|
$mahn_versendet = "if(r.versendet_mahnwesen,'Ja','')";
|
||||||
|
|
||||||
|
$findcols = array('r.id','r.id','r.belegnr', 'r.datum', 'r.kundennummer','r.name', 'r.land','p.abkuerzung','r.zahlungsweise','r.soll','r.waehrung','r.zahlungsstatus','r.soll','r.status',$faellig_datum,$faellig_tage,'m.name',$mahn_druck,$mahn_mail,$mahn_versendet,'mahnwesen_datum');
|
||||||
|
$searchsql = array('r.belegnr', 'r.name', $faellig_datum, 'r.kundennummer');
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',r.id,'\" />') AS `auswahl`";
|
||||||
|
|
||||||
|
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=rechnung&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||||
|
|
||||||
|
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||||
|
r.id,
|
||||||
|
$dropnbox,
|
||||||
|
r.belegnr,
|
||||||
|
".$app->erp->FormatDateShort('r.datum')." as vom,
|
||||||
|
if(r.kundennummer <> '',r.kundennummer,adr.kundennummer),
|
||||||
|
CONCAT(" . $app->erp->MarkerUseredit("r.name", "r.useredittimestamp") . ", if(r.internebezeichnung!='',CONCAT('<br><i style=color:#999>',r.internebezeichnung,'</i>'),'')) as kunde,
|
||||||
|
r.land as land,
|
||||||
|
p.abkuerzung as projekt,
|
||||||
|
r.zahlungsweise as zahlungsweise,
|
||||||
|
FORMAT(r.soll,2{$extended_mysql55} ) as soll,
|
||||||
|
ifnull(r.waehrung,'EUR'),
|
||||||
|
r.zahlungsstatus as zahlung,
|
||||||
|
if(r.soll-r.ist!=0 AND r.ist > 0,FORMAT(r.ist-r.soll,2{$extended_mysql55}),FORMAT((r.soll-r.ist)*-1,2{$extended_mysql55})) as fehlt,
|
||||||
|
if(r.status = 'storniert' AND r.teilstorno = 1,'TEILSTORNO',UPPER(r.status)) as status,
|
||||||
|
".$app->erp->FormatDateShort($faellig_datum)." as faellig_datum,
|
||||||
|
if(".$faellig_tage.">0,".$faellig_tage.",'') as faellig_tage,
|
||||||
|
m.name,
|
||||||
|
".$mahn_druck.",
|
||||||
|
".$mahn_mail.",
|
||||||
|
".$mahn_versendet.",
|
||||||
|
if(mahnwesen_datum <> '0000-00-00',".$app->erp->FormatDateShort('mahnwesen_datum').",''),
|
||||||
|
if(r.mahnwesen_gesperrt,'Ja',''),
|
||||||
|
REPLACE(r.mahnwesen_internebemerkung,'\r\n','<br> '),
|
||||||
|
r.id
|
||||||
|
FROM rechnung r LEFT JOIN projekt p ON p.id=r.projekt LEFT JOIN adresse adr ON r.adresse=adr.id LEFT JOIN auftrag au ON au.id = r.auftragid LEFT JOIN mahnwesen m ON r.mahnwesen = m.id";
|
||||||
|
|
||||||
|
$where = " r.belegnr <> ''";
|
||||||
|
|
||||||
|
// Toggle filters
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#zu_mahnen').click( function() { fnFilterColumn1( 0 ); } );");
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#inkl_bezahlte').click( function() { fnFilterColumn2( 0 ); } );");
|
||||||
|
$this->app->Tpl->Add('JQUERYREADY', "$('#inkl_gesperrte').click( function() { fnFilterColumn3( 0 ); } );");
|
||||||
|
for ($r = 1;$r <= 3;$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 = $app->Secure->GetGET("more_data1");
|
||||||
|
if ($more_data1 == 1) {
|
||||||
|
$where .= " AND NOT r.versendet_mahnwesen AND r.mahnwesen <> ''";
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
$more_data2 = $app->Secure->GetGET("more_data2");
|
||||||
|
if ($more_data2 == 1) {
|
||||||
|
} else {
|
||||||
|
$where .= " AND r.zahlungsstatus <> 'bezahlt' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$more_data3 = $app->Secure->GetGET("more_data3");
|
||||||
|
if ($more_data3 == 1) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$where .= " AND NOT r.mahnwesen_gesperrt ";
|
||||||
|
}
|
||||||
|
// END Toggle filters
|
||||||
|
|
||||||
|
|
||||||
|
$count = "SELECT count(DISTINCT id) FROM rechnung r WHERE $where";
|
||||||
|
// $groupby = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "mahnwesen_einstellungen":
|
||||||
|
$allowed['mahnwesen_list'] = array('list');
|
||||||
|
$heading = array('', 'Tage', 'Name', 'Gebuehr', 'E-Mail', 'Druck', 'Menü');
|
||||||
|
$width = array('1%','1%','10%'); // Fill out manually later
|
||||||
|
|
||||||
|
// columns that are aligned right (numbers etc)
|
||||||
|
// $alignright = array(4,5,6,7,8);
|
||||||
|
|
||||||
|
$findcols = array('m.id', 'm.tage','m.name', 'm.gebuehr', 'm.mail','m.druck');
|
||||||
|
$searchsql = array('m.name','m.tage', 'm.gebuehr', 'm.versandmethode');
|
||||||
|
|
||||||
|
$defaultorder = 1;
|
||||||
|
$defaultorderdesc = 1;
|
||||||
|
|
||||||
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`";
|
||||||
|
|
||||||
|
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=mahnwesen&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=mahnwesen&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||||
|
|
||||||
|
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||||
|
m.id,
|
||||||
|
$dropnbox,
|
||||||
|
m.tage,
|
||||||
|
m.name,
|
||||||
|
".$this->app->erp->FormatMenge('m.gebuehr',2).",
|
||||||
|
if(m.mail,'Ja',''),
|
||||||
|
if(m.druck,'Ja',''),
|
||||||
|
m.id FROM mahnwesen m";
|
||||||
|
|
||||||
|
$where = "1";
|
||||||
|
$count = "SELECT count(DISTINCT id) FROM mahnwesen WHERE $where";
|
||||||
|
// $groupby = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$erg = false;
|
||||||
|
|
||||||
|
foreach ($erlaubtevars as $k => $v) {
|
||||||
|
if (isset($$v)) {
|
||||||
|
$erg[$v] = $$v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $erg;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mahnwesen_list() {
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=list", "Übersicht");
|
||||||
|
// $this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=create", "Neu anlegen");
|
||||||
|
// $this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=einstellungen", "Einstellungen");
|
||||||
|
|
||||||
|
if($this->app->Secure->GetPOST('mahnstufe_berechnen') && $this->app->erp->RechteVorhanden('rechnung', 'edit')) {
|
||||||
|
$this->app->erp->rechnung_zahlstatus_berechnen();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
r.id, r.mahnwesen, rid_mid.mahnwesen_neu
|
||||||
|
FROM
|
||||||
|
rechnung r
|
||||||
|
INNER JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
id_tage.id,
|
||||||
|
m.id AS mahnwesen_neu
|
||||||
|
FROM
|
||||||
|
mahnwesen m
|
||||||
|
INNER JOIN(
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
MAX(tage) AS tage
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
r.id,
|
||||||
|
m.tage
|
||||||
|
FROM
|
||||||
|
rechnung r
|
||||||
|
INNER JOIN mahnwesen m ON
|
||||||
|
DATEDIFF(
|
||||||
|
CURRENT_DATE,
|
||||||
|
DATE_ADD(
|
||||||
|
r.datum,
|
||||||
|
INTERVAL r.zahlungszieltage DAY
|
||||||
|
)
|
||||||
|
) > m.tage
|
||||||
|
WHERE
|
||||||
|
r.zahlungsstatus = 'offen'
|
||||||
|
ORDER BY
|
||||||
|
`r`.`id` ASC
|
||||||
|
) temp
|
||||||
|
GROUP BY
|
||||||
|
id
|
||||||
|
) id_tage
|
||||||
|
ON
|
||||||
|
m.tage = id_tage.tage
|
||||||
|
) rid_mid
|
||||||
|
ON r.id = rid_mid.id
|
||||||
|
";
|
||||||
|
$offene_rechnungen = $this->app->DB->SelectArr($sql);
|
||||||
|
|
||||||
|
foreach ($offene_rechnungen as $offene_rechnung) {
|
||||||
|
if ($offene_rechnung['mahnwesen'] != $offene_rechnung['mahnwesen_neu']) {
|
||||||
|
$sql = "UPDATE rechnung set mahnwesen = ".$offene_rechnung['mahnwesen_neu'].", versendet_mahnwesen = 0 WHERE id = ".$offene_rechnung['id'];
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->app->Secure->GetPOST('sel_aktion') && $this->app->erp->RechteVorhanden('rechnung', 'edit'))
|
||||||
|
{
|
||||||
|
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
||||||
|
$aktion = $this->app->Secure->GetPOST('sel_aktion');
|
||||||
|
$auswahl = $this->app->Secure->GetPOST('auswahl');
|
||||||
|
if($drucker > 0) {
|
||||||
|
$this->app->erp->BriefpapierHintergrundDisable($drucker);
|
||||||
|
}
|
||||||
|
if(is_array($auswahl)) {
|
||||||
|
foreach($auswahl as $auswahlKey => $auswahlValue) {
|
||||||
|
if((int)$auswahlValue > 0) {
|
||||||
|
$auswahl[$auswahlKey] = (int)$auswahlValue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
unset($auswahl[$auswahlKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch($aktion)
|
||||||
|
{
|
||||||
|
case 'bezahlt':
|
||||||
|
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='bezahlt', bezahlt_am = now(), mahnwesenfestsetzen='1',mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt markiert am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
|
||||||
|
break;
|
||||||
|
case 'offen':
|
||||||
|
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen',bezahlt_am = NULL, mahnwesen_internebemerkung=CONCAT(mahnwesen_internebemerkung,'\r\n','Manuell als bezahlt entfernt am ".date('d.m.Y')."') WHERE id IN (".implode(', ',$auswahl).')');
|
||||||
|
break;
|
||||||
|
case 'mahnung_reset':
|
||||||
|
$sql = "UPDATE rechnung SET mahnwesen='', versendet_mahnwesen ='', mahnwesen_datum = '0000-00-00' WHERE id IN (".implode(', ',$auswahl).')';
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
break;
|
||||||
|
case 'mahnen':
|
||||||
|
|
||||||
|
$mails = 0;
|
||||||
|
$drucke = 0;
|
||||||
|
foreach ($auswahl as $rechnung_id) {
|
||||||
|
$mahnung = $this->MahnwesenMessage($rechnung_id);
|
||||||
|
|
||||||
|
// Check first
|
||||||
|
if (empty($mahnung)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($mahnung['mail'] && empty($mahnung['rechnung']['email'])) {
|
||||||
|
$msg .= "<div class=\"error\">Keine E-Mail-Adresse hinterlegt bei Rechnung ".$mahnung['rechnung']['belegnr'].".</div>";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($mahnung['druck']) {
|
||||||
|
$drucker = $this->app->Secure->GetPOST('seldrucker');
|
||||||
|
if($drucker > 0) {
|
||||||
|
$this->app->erp->BriefpapierHintergrundDisable($drucker);
|
||||||
|
} else {
|
||||||
|
$msg .= "<div class=\"error\">Kein Drucker gewählt.</div>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create PDF
|
||||||
|
if(class_exists('RechnungPDFCustom')) {
|
||||||
|
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Brief = new RechnungPDF($this->app,$projekt);
|
||||||
|
}
|
||||||
|
$Brief->GetRechnung($rechnung_id,$mahnung['betreff'],0,null,$mahnung['body']);
|
||||||
|
$tmpfile = $Brief->displayTMP();
|
||||||
|
|
||||||
|
$fileid = $this->app->erp->CreateDatei($Brief->filename,$mahnung['betreff'],"","",$tmpfile,$this->app->User->GetName());
|
||||||
|
|
||||||
|
if ($mahnung['druck']) {
|
||||||
|
$this->app->printer->Drucken($drucker,$tmpfile);
|
||||||
|
$this->MahnungCRM('brief',$mahnung['rechnung'], $mahnung['betreff'], $mahnung['body'],$fileid,$Brief->filename);
|
||||||
|
$this->app->erp->RechnungProtokoll($rechnung_id,'Mahnung gedruckt');
|
||||||
|
$drucke++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mahnung['mail']) {
|
||||||
|
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||||
|
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||||
|
// function MailSend($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false)
|
||||||
|
$result = $this->app->erp->MailSend(
|
||||||
|
$senderAddress,
|
||||||
|
$senderName,
|
||||||
|
$mahnung['rechnung']['email'],
|
||||||
|
$mahnung['rechnung']['email'],
|
||||||
|
htmlentities($mahnung['betreff']),
|
||||||
|
htmlentities($mahnung['body']),
|
||||||
|
[$tmpfile],
|
||||||
|
$mahnung['rechnung']['projekt'],
|
||||||
|
true,
|
||||||
|
$cc,
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result = 0) {
|
||||||
|
$msg .= "<div class=\"error\">Fehler beim E-Mail-Versand bei Rechnung ".$mahnung['rechnung']['belegnr'].".</div>";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->MahnungCRM('email',$mahnung['rechnung'], $mahnung['betreff'], $mahnung['body'],$fileid,$Brief->filename);
|
||||||
|
$this->app->erp->RechnungProtokoll($rechnung_id,'Mahnung versendet');
|
||||||
|
$mails++;
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink($tmpfile);
|
||||||
|
|
||||||
|
$sql = "UPDATE rechnung set mahnwesen_datum = CURRENT_DATE, versendet_mahnwesen = 1 WHERE id IN (".implode(', ',$auswahl).')';
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
|
||||||
|
}
|
||||||
|
$msg .= "<div class=\"success\">$mails E-Mails versendet, $drucke Dokumente gedruckt.</div>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // ende ausfuehren
|
||||||
|
|
||||||
|
if (!empty($msg)) {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->app->erp->RechteVorhanden('rechnung', 'manuellbezahltmarkiert')){
|
||||||
|
$this->app->Tpl->Set('ALSBEZAHLTMARKIEREN', '<option value="bezahlt">{|als bezahlt markieren|}</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('SELDRUCKER', $this->app->erp->GetSelectDrucker($this->app->User->GetParameter('rechnung_list_drucker')));
|
||||||
|
|
||||||
|
$this->app->YUI->TableSearch('TAB1', 'mahnwesen_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->Tpl->Parse('PAGE', "mahnwesen_list.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
function mahnwesen_einstellungen() {
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=einstellungen", "Übersicht");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=create", "Neu anlegen");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=einstellungen&action=list", "Zurück");
|
||||||
|
$this->app->erp->Headlines('Mahnwesen Einstellungen');
|
||||||
|
|
||||||
|
$this->app->YUI->TableSearch('TAB1', 'mahnwesen_einstellungen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->Tpl->Parse('PAGE', "mahnwesen_einstellungen.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mahnwesen_delete() {
|
||||||
|
$id = (int) $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
|
$this->app->DB->Delete("DELETE FROM `mahnwesen` WHERE `id` = '{$id}'");
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gelöscht.</div>");
|
||||||
|
|
||||||
|
$this->mahnwesen_einstellungen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Edit mahnwesen item
|
||||||
|
* If id is empty, create a new one
|
||||||
|
*/
|
||||||
|
|
||||||
|
function mahnwesen_edit() {
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
|
||||||
|
// Check if other users are editing this id
|
||||||
|
if($this->app->erp->DisableModul('artikel',$id))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('ID', $id);
|
||||||
|
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=edit&id=$id", "Details");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=mahnwesen&action=einstellungen", "Zurück zur Übersicht");
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
$input = $this->GetInput();
|
||||||
|
$submit = $this->app->Secure->GetPOST('submit');
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
// New item
|
||||||
|
$id = 'NULL';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($submit != '')
|
||||||
|
{
|
||||||
|
|
||||||
|
// Write to database
|
||||||
|
|
||||||
|
// Add checks here
|
||||||
|
|
||||||
|
$columns = "id, ";
|
||||||
|
$values = "$id, ";
|
||||||
|
$update = "";
|
||||||
|
|
||||||
|
$fix = "";
|
||||||
|
|
||||||
|
foreach ($input as $key => $value) {
|
||||||
|
$columns = $columns.$fix.$key;
|
||||||
|
$values = $values.$fix."'".$value."'";
|
||||||
|
$update = $update.$fix.$key." = '$value'";
|
||||||
|
|
||||||
|
$fix = ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// echo($columns."<br>");
|
||||||
|
// echo($values."<br>");
|
||||||
|
// echo($update."<br>");
|
||||||
|
|
||||||
|
$sql = "INSERT INTO mahnwesen (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||||
|
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
|
||||||
|
if ($id == 'NULL') {
|
||||||
|
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||||
|
header("Location: index.php?module=mahnwesen&action=einstellungen&msg=$msg");
|
||||||
|
} else {
|
||||||
|
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Load values again from database
|
||||||
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',m.id,'\" />') AS `auswahl`";
|
||||||
|
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS m.id, $dropnbox, m.name, m.tage, m.gebuehr, m.mail, m.druck, m.id FROM mahnwesen m"." WHERE id=$id");
|
||||||
|
|
||||||
|
foreach ($result[0] as $key => $value) {
|
||||||
|
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add displayed items later
|
||||||
|
*
|
||||||
|
|
||||||
|
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||||
|
$this->app->Tpl->Add('EMAIL', $email);
|
||||||
|
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MAIL', $result[0]['mail']?'checked':'');
|
||||||
|
$this->app->Tpl->Set('DRUCK', $result[0]['druck']?'checked':'');
|
||||||
|
|
||||||
|
$this->app->Tpl->Parse('PAGE', "mahnwesen_edit.tpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all paramters from html form and save into $input
|
||||||
|
*/
|
||||||
|
public function GetInput(): array {
|
||||||
|
$input = array();
|
||||||
|
$input['name'] = $this->app->Secure->GetPOST('name');
|
||||||
|
$input['tage'] = $this->app->Secure->GetPOST('tage');
|
||||||
|
$input['gebuehr'] = $this->app->Secure->GetPOST('gebuehr');
|
||||||
|
$input['mail'] = $this->app->Secure->GetPOST('mail')?'1':'0';
|
||||||
|
$input['druck'] = $this->app->Secure->GetPOST('druck')?'1':'0';
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set all fields in the page corresponding to $input
|
||||||
|
*/
|
||||||
|
function SetInput($input) {
|
||||||
|
$this->app->Tpl->Set('NAME', $input['name']);
|
||||||
|
$this->app->Tpl->Set('TAGE', $input['tage']);
|
||||||
|
$this->app->Tpl->Set('GEBUEHR', $input['gebuehr']);
|
||||||
|
$this->app->Tpl->Set('MAIL', $input['mail']);
|
||||||
|
$this->app->Tpl->Set('DRUCK', $input['druck']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constuct the Mahnwesen message according to GeschäftsbriefVorlage
|
||||||
|
* Returns Array (string betreff, string body, boolean mail, boolean druck, array rechnung)
|
||||||
|
*/
|
||||||
|
function MahnwesenMessage($rechnung_id) {
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
r.*,
|
||||||
|
".$this->app->erp->FormatDate('datum')." datum,
|
||||||
|
".$this->app->erp->FormatDate('CURRENT_DATE')." heute,
|
||||||
|
m.name as mahn_name,
|
||||||
|
m.tage as mahn_tage,
|
||||||
|
m.gebuehr as mahn_gebuehr,
|
||||||
|
m.mail as mahn_mail,
|
||||||
|
m.druck as mahn_druck
|
||||||
|
FROM
|
||||||
|
rechnung r
|
||||||
|
INNER JOIN
|
||||||
|
mahnwesen m
|
||||||
|
ON
|
||||||
|
r.mahnwesen = m.id WHERE r.id = ".$rechnung_id." LIMIT 1";
|
||||||
|
$rechnungarr = $this->app->DB->SelectArr($sql)[0];
|
||||||
|
|
||||||
|
if (empty($rechnungarr)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$adresse = $rechnungarr['adresse'];
|
||||||
|
if($sprache==''){
|
||||||
|
$sprache = $rechnungarr['sprache'];
|
||||||
|
}
|
||||||
|
if($sprache==''){
|
||||||
|
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
$kundennummer = $rechnungarr['kundennummer'];
|
||||||
|
$projekt = $rechnungarr['projekt'];
|
||||||
|
$auftrag= $rechnungarr['auftrag'];
|
||||||
|
$buchhaltung= $rechnungarr['buchhaltung'];
|
||||||
|
$lieferschein = $rechnungarr['lieferschein'];
|
||||||
|
$lieferscheinid = $lieferschein;
|
||||||
|
if($lieferscheinid){
|
||||||
|
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferschein' LIMIT 1");
|
||||||
|
}else{
|
||||||
|
$lieferschein = '';
|
||||||
|
}
|
||||||
|
$bestellbestaetigung = $rechnungarr['kundennummer'];
|
||||||
|
$datum = $rechnungarr['datum_de'];
|
||||||
|
$datum_sql = $rechnungarr['datum'];
|
||||||
|
$belegnr = $rechnungarr['belegnr'];
|
||||||
|
$doppel = $rechnungarr['doppel'];
|
||||||
|
$freitext = $rechnungarr['freitext'];
|
||||||
|
$ustid = $rechnungarr['ustid'];
|
||||||
|
$soll = $rechnungarr['soll'];
|
||||||
|
$ist = $rechnungarr['ist'];
|
||||||
|
$land = $rechnungarr['land'];
|
||||||
|
$mahnwesen_datum = $rechnungarr['mahnwesen_datum'];
|
||||||
|
$mahnwesen_datum_deutsch = $rechnungarr['mahnwesen_datum_de'];
|
||||||
|
$zahlungsweise = $rechnungarr['zahlungsweise'];
|
||||||
|
$zahlungsstatus = $rechnungarr['zahlungsstatus'];
|
||||||
|
$zahlungszieltage = $rechnungarr['zahlungszieltage'];
|
||||||
|
$zahlungszieltageskonto = $rechnungarr['zahlungszieltageskonto'];
|
||||||
|
$zahlungszielskonto = $rechnungarr['zahlungszielskonto'];
|
||||||
|
$waehrung = $rechnungarr['waehrung'];
|
||||||
|
|
||||||
|
$zahlungdatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltage DAY),'%d.%m.%Y') FROM rechnung WHERE id='$rechnung_id' LIMIT 1");
|
||||||
|
|
||||||
|
if($_datum!=null)
|
||||||
|
{
|
||||||
|
$mahnwesen_datum = $this->app->String->Convert($_datum,'%1.%2.%3','%3-%2-%1');
|
||||||
|
$mahnwesen_datum_deutsch = $_datum;
|
||||||
|
}
|
||||||
|
|
||||||
|
$zahlungsweise = strtolower($zahlungsweise);
|
||||||
|
/*
|
||||||
|
if($als=='zahlungserinnerung')
|
||||||
|
{
|
||||||
|
$body = $this->GetGeschaeftsBriefText("MahnwesenZahlungserinnerung",$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
$tage = $this->GetKonfiguration('mahnwesen_m1_tage');
|
||||||
|
}
|
||||||
|
else if($als=='mahnung1')
|
||||||
|
{
|
||||||
|
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung1",$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m1_gebuehr');
|
||||||
|
$tage = $this->GetKonfiguration('mahnwesen_m2_tage');
|
||||||
|
}
|
||||||
|
else if($als=='mahnung2')
|
||||||
|
{
|
||||||
|
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung2",$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
$tage = $this->GetKonfiguration('mahnwesen_m3_tage');
|
||||||
|
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m2_gebuehr');
|
||||||
|
}
|
||||||
|
else if($als=='mahnung3')
|
||||||
|
{
|
||||||
|
$body = $this->GetGeschaeftsBriefText("MahnwesenMahnung3",$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
$tage = $this->GetKonfiguration('mahnwesen_ik_tage');
|
||||||
|
$mahngebuehr = $this->GetKonfiguration('mahnwesen_m3_gebuehr');
|
||||||
|
}
|
||||||
|
else if($als=='inkasso')
|
||||||
|
{
|
||||||
|
$body = $this->GetGeschaeftsBriefText("MahnwesenInkasso",$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
//$tage = $this->GetKonfiguration("mahnwesen_ik_tage");
|
||||||
|
$tage = 3; //eigentlich vorbei
|
||||||
|
$mahngebuehr = $this->GetKonfiguration('mahnwesen_ik_gebuehr');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$body = $this->app->erp->Beschriftung("dokument_anschreiben");
|
||||||
|
} */
|
||||||
|
|
||||||
|
$betreff = $this->app->erp->GetGeschaeftsBriefBetreff($rechnungarr['mahn_name'],$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
$body = $this->app->erp->GetGeschaeftsBriefText($rechnungarr['mahn_name'],$sprache,$projekt,"rechnung",$rechnung_id);
|
||||||
|
|
||||||
|
if (empty($betreff) || empty($body)) {
|
||||||
|
throw new QueryFailureException("Geschaeftsbrief-Vorlage nicht gefunden: ''".$rechnungarr['mahn_name']."'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$offen = $this->app->erp->GetSaldoDokument($rechnung_id, 'rechnung');
|
||||||
|
|
||||||
|
if($tage <=0) $tage = 0;
|
||||||
|
|
||||||
|
/* $datummahnung= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$mahnwesen_datum', INTERVAL $tage DAY),'%d.%m.%Y')");
|
||||||
|
$datumrechnungzahlungsziel= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$datum_sql', INTERVAL $zahlungszieltage DAY),'%d.%m.%Y')");
|
||||||
|
|
||||||
|
$tage_ze = $zahlungszieltage + $this->GetKonfiguration('mahnwesen_m1_tage');
|
||||||
|
$datumzahlungserinnerung= $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD('$datum_sql', INTERVAL $tage_ze DAY),'%d.%m.%Y')");*/
|
||||||
|
|
||||||
|
// checkstamp $this->CheckStamp("jhdskKUHsiusakiakuhsd"); // errechnet aus laufzeit und kundenid // wenn es nicht drinnen ist darf es nicht gehen
|
||||||
|
/*
|
||||||
|
if($mahngebuehr=='' || !is_numeric($mahngebuehr))
|
||||||
|
$mahngebuehr = 0;
|
||||||
|
|
||||||
|
//$offen= '11,23';
|
||||||
|
$body = str_replace('{RECHNUNG}',$belegnr,$body);
|
||||||
|
$body = str_replace('{BELEGNR}',$belegnr,$body);
|
||||||
|
$body = str_replace('{DATUMRECHNUNG}',$datum,$body);
|
||||||
|
$body = str_replace('{TAGE}',$tage,$body);
|
||||||
|
$body = str_replace('{OFFEN}',$this->app->erp->formatMoney(-$offen['betrag'],$offen['waehrung']),$body);
|
||||||
|
$body = str_replace('{SOLL}',$this->app->erp->formatMoney($soll,$waehrung),$body);
|
||||||
|
$body = str_replace('{SUMME}',$this->app->erp->formatMoney($soll - $ist + $mahngebuehr,$waehrung),$body);
|
||||||
|
$body = str_replace('{IST}',$this->app->erp->formatMoney($ist,$waehrung),$body);
|
||||||
|
$body = str_replace('{DATUM}',$datummahnung,$body);
|
||||||
|
$body = str_replace('{MAHNGEBUEHR}',$this->app->erp->formatMoney($mahngebuehr,$waehrung),$body);
|
||||||
|
$body = str_replace('{OFFENMITMAHNGEBUEHR}',$this->app->erp->formatMoney($mahngebuehr + $soll - $ist,$waehrung),$body);
|
||||||
|
$body = str_replace('{MAHNDATUM}',$mahnwesen_datum_deutsch,$body);
|
||||||
|
|
||||||
|
|
||||||
|
// Im Protokoll suchen Datum von Zahlungserinnerung, Mahnung 1, Mahnung 2, Mahnung 3
|
||||||
|
|
||||||
|
$mahnung1 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$rechnung_id'
|
||||||
|
AND grund LIKE 'Mahnung1 versendet%' ORDER by Zeit DESC LIMIT 1");
|
||||||
|
|
||||||
|
$mahnung2 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$rechnung_id'
|
||||||
|
AND grund LIKE 'Mahnung2 versendet%' ORDER by Zeit DESC LIMIT 1");
|
||||||
|
|
||||||
|
$mahnung3 = $this->app->DB->Select("SELECT DATE_FORMAT(zeit,'%d.%m.%Y') FROM rechnung_protokoll WHERE rechnung='$rechnung_id'
|
||||||
|
AND grund LIKE 'Mahnung3 versendet%' ORDER by Zeit DESC LIMIT 1");
|
||||||
|
|
||||||
|
$body = str_replace('{DATUMMAHNUNG1}',$mahnung1,$body);
|
||||||
|
$body = str_replace('{DATUMMAHNUNG2}',$mahnung2,$body);
|
||||||
|
$body = str_replace('{DATUMMAHNUNG3}',$mahnung3,$body);
|
||||||
|
|
||||||
|
$body = str_replace('{DATUMZAHLUNGSERINNERUNGFAELLIG}',$datumzahlungserinnerung,$body);
|
||||||
|
$body = str_replace('{DATUMZAHLUNGSERINNERUNG}',$datumzahlungserinnerung,$body);
|
||||||
|
$body = str_replace('{DATUMRECHNUNGZAHLUNGSZIEL}',$datumrechnungzahlungsziel,$body);*/
|
||||||
|
|
||||||
|
$mapping = [
|
||||||
|
'rechnung' => $belegnr,
|
||||||
|
'belegnr' => $belegnr,
|
||||||
|
'datum' => $datum_sql,
|
||||||
|
'offen' => $this->app->erp->EUR(-$offen['betrag'])." ".$offen['waehrung'],
|
||||||
|
'mahngebuehr' => $this->app->erp->EUR($rechnungarr['mahn_gebuehr']),
|
||||||
|
'heute' => $rechnungarr['heute']
|
||||||
|
];
|
||||||
|
|
||||||
|
$betreff = $this->app->erp->ParseVars($mapping,$betreff);
|
||||||
|
$body = $this->app->erp->ParseVars($mapping,$body);
|
||||||
|
$body = $this->app->erp->ParseUserVars('rechnung',$rechnung_id,$body);
|
||||||
|
|
||||||
|
return(array(
|
||||||
|
'betreff' => $betreff,
|
||||||
|
'body' => $body,
|
||||||
|
'mail' => $rechnungarr['mahn_mail'] != 0,
|
||||||
|
'druck' => $rechnungarr['mahn_druck'] != 0,
|
||||||
|
'adresse' => $rechnungarr['adresse'],
|
||||||
|
'empfaenger' => $rechnungarr['email'],
|
||||||
|
'projekt' => $rechnungarr['projekt'],
|
||||||
|
'rechnung' => $rechnungarr
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create CRM entry for mahnung
|
||||||
|
* typ = brief, email
|
||||||
|
*/
|
||||||
|
function MahnungCRM(string $typ, array $rechnung, $betreff, $text, $fileid, $filename) {
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['typ'] = $typ;
|
||||||
|
$data['projekt'] = $rechnung['projekt'];
|
||||||
|
$data['datum'] = date('Y-m-d');
|
||||||
|
$data['uhrzeit'] = date('Y-m-d H:i:s');
|
||||||
|
$data['user'] = $rechnung['adresse'];
|
||||||
|
$data['an'] = $rechnung['name'];
|
||||||
|
$data['adresse'] = $rechnung['strasse'];
|
||||||
|
$data['plz'] = $rechnung['plz'];
|
||||||
|
$data['ort'] = $rechnung['ort'];
|
||||||
|
$data['betreff'] = $betreff;
|
||||||
|
$data['content'] = $text;
|
||||||
|
$data['email_an'] = $rechnung['email'];
|
||||||
|
$data['sent'] = 1;
|
||||||
|
|
||||||
|
$crm_id = $this->app->erp->DokumentCreate($data,$this->app->User->GetAdresse());
|
||||||
|
$this->app->erp->AddDateiStichwort($fileid,'anhang','dokument',$crm_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -236,13 +236,6 @@ class Rechnung extends GenRechnung
|
|||||||
$this->app->Location->execute("index.php?module=rechnung&action=edit&id=$id&msg=$msg");
|
$this->app->Location->execute("index.php?module=rechnung&action=edit&id=$id&msg=$msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
function RechnungMahnwesen()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function RechnungLastschriftWdh()
|
function RechnungLastschriftWdh()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -651,7 +644,11 @@ class Rechnung extends GenRechnung
|
|||||||
if($auftragArr[0]['mahnwesen']=='') {
|
if($auftragArr[0]['mahnwesen']=='') {
|
||||||
$auftragArr[0]['mahnwesen']='-';
|
$auftragArr[0]['mahnwesen']='-';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->Tpl->Set('MAHNWESEN',$auftragArr[0]['mahnwesen']);
|
$this->app->Tpl->Set('MAHNWESEN',$auftragArr[0]['mahnwesen']);
|
||||||
|
|
||||||
|
$this->app->Tpl->Set('MAHNWESEN','XXX');
|
||||||
|
|
||||||
if($auftragArr[0]['mahnwesen_datum']=='0000-00-00') {
|
if($auftragArr[0]['mahnwesen_datum']=='0000-00-00') {
|
||||||
$auftragArr[0]['mahnwesen_datum']='-';
|
$auftragArr[0]['mahnwesen_datum']='-';
|
||||||
}
|
}
|
||||||
@ -896,7 +893,7 @@ class Rechnung extends GenRechnung
|
|||||||
$tmp->Query("SELECT zeit,bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' ORDER by zeit DESC",0,"");
|
$tmp->Query("SELECT zeit,bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' ORDER by zeit DESC",0,"");
|
||||||
$tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction");
|
$tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction");
|
||||||
|
|
||||||
|
/*
|
||||||
$query = $this->app->DB->SelectArr("SELECT zeit,bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' ORDER by zeit");
|
$query = $this->app->DB->SelectArr("SELECT zeit,bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' ORDER by zeit");
|
||||||
if($query)
|
if($query)
|
||||||
{
|
{
|
||||||
@ -912,12 +909,12 @@ class Rechnung extends GenRechnung
|
|||||||
{
|
{
|
||||||
|
|
||||||
$tmp2 = new EasyTable($this->app);
|
$tmp2 = new EasyTable($this->app);
|
||||||
$tmp2->Query("SELECT concat('<a href=\"index.php?module=mahnwesen&action=mahnpdf&id=',rechnung,'&datum=',DATE_FORMAT(zeit,'%d.%m.%Y'),'&mahnwesen=',LOWER(LEFT(grund,LOCATE(' ',grund))),'\"><img src=\"themes/{$this->app->Conf->WFconf[defaulttheme]}/images/pdf.svg\" border=\"0\"></a>') as PDF, Date(zeit) as Datum, bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' AND zeit >= '".$zeit."' ORDER by zeit DESC");
|
$tmp2->Query("SELECT concat('<a href=\"index.php?module=mahnwesen&action=mahnpdf&id=',rechnung,'&datum=',DATE_FORMAT(zeit,'%d.%m.%Y'),'&mahnwesen=',LOWER(LEFT(grund,LOCATE(' ',grund))),'\"><img src=\"themes/{$this->app->Conf->WFconf['defaulttheme']}/images/pdf.svg\" border=\"0\"></a>') as PDF, Date(zeit) as Datum, bearbeiter,grund FROM rechnung_protokoll WHERE rechnung='$id' AND zeit >= '".$zeit."' ORDER by zeit DESC");
|
||||||
$tmp2->DisplayNew('MAHNPROTOKOLL',"Protokoll","noAction");
|
$tmp2->DisplayNew('MAHNPROTOKOLL',"Protokoll","noAction");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(class_exists('RechnungPDFCustom'))
|
if(class_exists('RechnungPDFCustom'))
|
||||||
{
|
{
|
||||||
@ -1823,7 +1820,7 @@ class Rechnung extends GenRechnung
|
|||||||
|
|
||||||
if($bezahlt_am=='--')$bezahlt_am='0000-00-00';
|
if($bezahlt_am=='--')$bezahlt_am='0000-00-00';
|
||||||
$alte_mahnstufe = $this->app->DB->Select("SELECT mahnwesen FROM rechnung WHERE id='$id' LIMIT 1");
|
$alte_mahnstufe = $this->app->DB->Select("SELECT mahnwesen FROM rechnung WHERE id='$id' LIMIT 1");
|
||||||
if($alte_mahnstufe!=$mahnwesen) $versendet=0; else $versendet=1;
|
if($alte_mahnstufe!=$mahnwesen) $versendet=0;
|
||||||
|
|
||||||
/* if($mahnwesenfestsetzen=='1')
|
/* if($mahnwesenfestsetzen=='1')
|
||||||
{*/
|
{*/
|
||||||
@ -2243,28 +2240,10 @@ class Rechnung extends GenRechnung
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // ende ausfuehren
|
||||||
|
|
||||||
// refresh all open items
|
if($this->app->Secure->GetPOST('zahlungsstatus_berechnen') && $this->app->erp->RechteVorhanden('rechnung', 'edit')) {
|
||||||
$openids = $this->app->DB->SelectArr("SELECT id, waehrung from rechnung WHERE zahlungsstatus = 'offen'");
|
$this->rechnung_zahlstatus_berechnen();
|
||||||
|
|
||||||
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');
|
||||||
@ -2274,7 +2253,6 @@ class Rechnung extends GenRechnung
|
|||||||
|
|
||||||
$this->app->erp->MenuEintrag('index.php?module=rechnung&action=list','Übersicht');
|
$this->app->erp->MenuEintrag('index.php?module=rechnung&action=list','Übersicht');
|
||||||
$this->app->erp->MenuEintrag('index.php?module=rechnung&action=create','Neue Rechnung anlegen');
|
$this->app->erp->MenuEintrag('index.php?module=rechnung&action=create','Neue Rechnung anlegen');
|
||||||
|
|
||||||
if(strlen($backurl)>5){
|
if(strlen($backurl)>5){
|
||||||
$this->app->erp->MenuEintrag("$backurl", 'Zurück');
|
$this->app->erp->MenuEintrag("$backurl", 'Zurück');
|
||||||
}
|
}
|
||||||
@ -2765,4 +2743,72 @@ class Rechnung extends GenRechnung
|
|||||||
return($et->DisplayNew('return',""));
|
return($et->DisplayNew('return',""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Recalculate the payments status with skonto
|
||||||
|
*/
|
||||||
|
|
||||||
|
function rechnung_zahlstatus_berechnen() {
|
||||||
|
// START RECALCULATE
|
||||||
|
$this->app->erp->fibu_rebuild_tables();
|
||||||
|
$offene_rechnungen = $this->app->DB->SelectArr(" SELECT
|
||||||
|
id,
|
||||||
|
soll,
|
||||||
|
waehrung,
|
||||||
|
datum,
|
||||||
|
zahlungszieltage,
|
||||||
|
DATE_ADD(datum, INTERVAL zahlungszieltage DAY) as zieldatum,
|
||||||
|
CURRENT_DATE > DATE_ADD(datum, INTERVAL zahlungszieltage DAY) as faellig,
|
||||||
|
zahlungszielskonto,
|
||||||
|
TRUNCATE(soll*(1-(zahlungszielskonto/100)),2) as skontosoll,
|
||||||
|
zahlungszieltageskonto,
|
||||||
|
DATE_ADD(datum, INTERVAL zahlungszieltageskonto DAY) as zieldatumskonto
|
||||||
|
FROM
|
||||||
|
rechnung
|
||||||
|
WHERE
|
||||||
|
belegnr <> '' AND zahlungsstatus = 'offen'
|
||||||
|
");
|
||||||
|
|
||||||
|
foreach ($offene_rechnungen as $offene_rechnung) {
|
||||||
|
$saldo = $this->app->erp->GetSaldoDokument($offene_rechnung['id'],'rechnung');
|
||||||
|
if (!empty($saldo)) {
|
||||||
|
if ($saldo['waehrung'] == $offene_rechnung['waehrung']) {
|
||||||
|
$offene_rechnung['ist'] = $offene_rechnung['soll']+$saldo['betrag'];
|
||||||
|
// Check for skonto
|
||||||
|
$skontorelevante_zahlungen = $this->app->erp->GetSaldoDokument($offene_rechnung['id'],'rechnung','zubuchung',$offene_rechnung['zieldatumskonto'])['betrag'];
|
||||||
|
$zielkonforme_zahlungen = $this->app->erp->GetSaldoDokument($offene_rechnung['id'],'rechnung','zubuchung',$offene_rechnung['zieldatum'])['betrag'];
|
||||||
|
// Check overall value
|
||||||
|
if ($saldo['betrag'] == 0) {
|
||||||
|
// ok -> will be marked as paid
|
||||||
|
} else if ($skontorelevante_zahlungen >= $offene_rechnung['skontosoll']) {
|
||||||
|
// Skonto ok -> book difference
|
||||||
|
$sachkonto = $this->app->erp->Firmendaten('rechnung_skonto_kontorahmen');
|
||||||
|
if (!empty($sachkonto)) {
|
||||||
|
$this->app->erp->fibu_buchungen_buchen('rechnung',$offene_rechnung['id'],'kontorahmen',$sachkonto,-$saldo['betrag'],$offene_rechnung['waehrung'],date('Y-m-d'),'');
|
||||||
|
$offene_rechnung['ist'] = $offene_rechnung['soll'];
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
} else if ($offene_rechnung['faellig']) {
|
||||||
|
// Overdue
|
||||||
|
} else {
|
||||||
|
// Not due
|
||||||
|
}
|
||||||
|
// Update rechnung
|
||||||
|
$sql = "UPDATE
|
||||||
|
rechnung
|
||||||
|
SET
|
||||||
|
ist = ".$saldo['betrag']."+soll,
|
||||||
|
zahlungsstatus = IF(".$saldo['betrag']." = 0,'bezahlt','offen')
|
||||||
|
WHERE id=".$offene_rechnung['id'];
|
||||||
|
$this->app->DB->Update($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->app->DB->Update("UPDATE rechnung SET ist = null WHERE id=".$offene_rechnung['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->app->erp->fibu_rebuild_tables();
|
||||||
|
// END RECALCULATE
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
[STECHUHRDEVICE]
|
[STECHUHRDEVICE]
|
||||||
<div class="field-row">
|
<div class="field-row">
|
||||||
[MULTIDB]
|
[MULTIDB]
|
||||||
<div class="field">
|
<!-- <div class="field">
|
||||||
<select id="language" name="language">
|
<select id="language" name="language">
|
||||||
<option value="">- Sprache wählen -</option>
|
<option value="">- Sprache wählen -</option>
|
||||||
<option [OPTIONLANGUAGEGERMAN] value="german">Deutsch</option>
|
<option [OPTIONLANGUAGEGERMAN] value="german">Deutsch</option>
|
||||||
<option [OPTIONLANGUAGEENGLISH] value="englisch">English</option>
|
<option [OPTIONLANGUAGEENGLISH] value="englisch">English</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-wrapper field-row">
|
<div class="btn-wrapper field-row">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
@ -133,12 +133,19 @@ class WidgetGenrechnung
|
|||||||
|
|
||||||
$field = new HTMLSelect("mahnwesen",0,"mahnwesen","","","0");
|
$field = new HTMLSelect("mahnwesen",0,"mahnwesen","","","0");
|
||||||
$field->AddOption('','');
|
$field->AddOption('','');
|
||||||
$field->AddOption('Zahlungserinnerung','zahlungserinnerung');
|
/* $field->AddOption('Zahlungserinnerung','zahlungserinnerung');
|
||||||
$field->AddOption('Mahnung 1','mahnung1');
|
$field->AddOption('Mahnung 1','mahnung1');
|
||||||
$field->AddOption('Mahnung 2','mahnung2');
|
$field->AddOption('Mahnung 2','mahnung2');
|
||||||
$field->AddOption('Mahnung 3','mahnung3');
|
$field->AddOption('Mahnung 3','mahnung3');
|
||||||
$field->AddOption('Inkasso','inkasso');
|
$field->AddOption('Inkasso','inkasso');
|
||||||
$field->AddOption('Forderungsverlust','forderungsverlust');
|
$field->AddOption('Forderungsverlust','forderungsverlust');*/
|
||||||
|
|
||||||
|
$mahnstufen = $this->app->DB->SelectArr("Select name,id FROM mahnwesen ORDER BY tage DESC");
|
||||||
|
|
||||||
|
foreach ($mahnstufen as $mahnstufe) {
|
||||||
|
$field->AddOption($mahnstufe['name'],$mahnstufe['id']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->form->NewField($field);
|
$this->form->NewField($field);
|
||||||
|
|
||||||
$field = new HTMLInput("mahnwesen_datum","text","","10","","","","","","","","0","","");
|
$field = new HTMLInput("mahnwesen_datum","text","","10","","","","","","","","0","","");
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<li>ZahlungDiff <i>Variablen: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}</i> </li>
|
<li>ZahlungDiff <i>Variablen: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}</i> </li>
|
||||||
<li>Stornierung <i>Variablen: {AUFTRAG}, {DATUM}</i></li>
|
<li>Stornierung <i>Variablen: {AUFTRAG}, {DATUM}</i></li>
|
||||||
<li>ZahlungMiss <i>Variablen: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}</i></li>
|
<li>ZahlungMiss <i>Variablen: {AUFTRAG}, {DATUM}, {GESAMT}, {REST}</i></li>
|
||||||
|
<li>Mahnung <i>Variablen: {BELEGNR}, {DATUM}, {OFFEN}, {MAHNGEBUEHR}, {HEUTE}</i></li>
|
||||||
<li>Versand <i>Variablen: {VERSAND}, {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
<li>Versand <i>Variablen: {VERSAND}, {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
||||||
<li>VersandMailDokumente <i>Variablen: {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
<li>VersandMailDokumente <i>Variablen: {NAME}, {ANSCHREIBEN}, {BELEGNR}, {IHREBESTELLNUMMER}, {INTERNET}, {AUFTRAGDATUM}</i></li>
|
||||||
<li>Selbstabholer</li>
|
<li>Selbstabholer</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user