From c220639e826cdf05759aa8753e68fb717ee39351 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Sat, 25 Mar 2023 17:50:04 +0100
Subject: [PATCH] Zahlungsstatus Rechnung Gutschrift reworked with
fibu_buchungen
---
phpwf/plugins/class.yui.php | 14 +-
upgrade/data/db_schema.json | 20 +-
www/lib/class.erpapi.php | 143 ++--
www/pages/content/gutschrift_minidetail.tpl | 2 +-
www/pages/content/rechnung_minidetail.tpl | 2 +-
www/pages/gutschrift.php | 117 ++--
www/pages/rechnung.php | 133 ++--
www/widgets/_gen/widget.gen.gutschrift.php | 601 ++++++++---------
www/widgets/_gen/widget.gen.rechnung.php | 682 ++++++++++----------
www/widgets/templates/_gen/gutschrift.tpl | 37 +-
www/widgets/templates/_gen/rechnung.tpl | 77 +--
www/widgets/widget.rechnung.php | 1 -
12 files changed, 887 insertions(+), 942 deletions(-)
diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php
index a2288551..afdc3318 100644
--- a/phpwf/plugins/class.yui.php
+++ b/phpwf/plugins/class.yui.php
@@ -6081,11 +6081,11 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
$heading = array('', '', 'Gutschrift', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt',
- 'Zahlweise', 'Betrag (brutto)', 'bezahlt','RE-Nr.', 'Status','Monitor' ,'Menü'
+ 'Zahlweise', 'Betrag (brutto)', 'Zahlstatus','Differenz','RE-Nr.', 'Status','Monitor' ,'Menü'
);
- $width = array('1%', '1%', '10%', '10%', '10%', '25%', '5%', '1%', '1%', '1%', '1%', '1%','5%', '1%','1%', '1%');
- $findcols = array('open', 'r.belegnr', 'r.belegnr', 'r.datum', 'adr.kundennummer', 'r.name', 'r.land', 'p.abkuerzung', 'r.zahlungsweise', 'r.soll','re.belegnr', 'r.zahlungsstatus', 'r.status', 'pt.payement_status' ,'id');
+ $width = array('1%', '1%', '10%', '10%', '10%', '25%', '5%', '1%', '1%', '1%', '1%', '1%', '1%','5%', '1%','1%', '1%');
+ $findcols = array('open', 'r.belegnr', 'r.belegnr', 'r.datum', 'adr.kundennummer', 'r.name', 'r.land', 'p.abkuerzung', 'r.zahlungsweise', 'r.soll','re.belegnr', 'r.zahlungsstatus','differenz', 'r.status', 'pt.payement_status' ,'id');
$searchsql = array('DATE_FORMAT(r.datum,\'%d.%m.%Y\')', 'r.belegnr', 'adr.kundennummer', 'r.name', 'r.land', 'p.abkuerzung','re.belegnr', 'r.status', "FORMAT(r.soll,2{$extended_mysql55})", 'adr.freifeld1', 'r.ihrebestellnummer','r.internebezeichnung','au.internet');
$defaultorder = 13; //Optional wenn andere Reihenfolge gewuenscht
@@ -6127,7 +6127,7 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
$menu .= "";
- $menucol = 14;
+ $menucol = 15;
$parameter = $this->app->User->GetParameter('table_filter_gutschrift');
$parameter = base64_decode($parameter);
@@ -6139,7 +6139,7 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
DATE_FORMAT(r.datum,'%d.%m.%Y') as vom, adr.kundennummer as kundennummer,
CONCAT(" . $this->app->erp->MarkerUseredit("r.name", "r.useredittimestamp") . ", if(r.internebezeichnung!='',CONCAT('
',r.internebezeichnung,''),'')) as kunde,
r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
- FORMAT(r.soll,2{$extended_mysql55}) as soll, r.zahlungsstatus as zahlung, re.belegnr as rechnung, UPPER(r.status) as status,
+ FORMAT(r.soll,2{$extended_mysql55}) as soll, r.zahlungsstatus as zahlung, r.soll-r.ist as differenz, re.belegnr as rechnung, UPPER(r.status) as status,
".$this->IconsSQLReturnOrder()." ,r.id
FROM gutschrift r
LEFT JOIN rechnung re ON re.id=r.rechnungid
@@ -6564,8 +6564,8 @@ r.land as land, p.abkuerzung as projekt, r.zahlungsweise as zahlungsweise,
r.zahlungsweise as zahlungsweise,
FORMAT(r.soll,2{$extended_mysql55} ) as soll,
ifnull(r.waehrung,'EUR'),
- if(r.soll-r.ist+r.skonto_gegeben!=0 AND r.ist > 0 AND r.zahlungsstatus!='bezahlt','teilbezahlt',r.zahlungsstatus) as zahlung,
- if(r.soll-r.ist+r.skonto_gegeben!=0 AND r.ist > 0,FORMAT(r.ist-r.soll+r.skonto_gegeben,2{$extended_mysql55}),FORMAT((r.soll-r.ist+r.skonto_gegeben)*-1,2{$extended_mysql55})) as fehlt,
+ if(r.soll-r.ist=0 AND r.ist > 0 AND r.zahlungsstatus!='bezahlt','teilbezahlt',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,
".(!empty($zusatzcols)?implode(', ',$zusatzcols).',':'')."
r.id
diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json
index 8728a1d6..0af678c8 100644
--- a/upgrade/data/db_schema.json
+++ b/upgrade/data/db_schema.json
@@ -77689,13 +77689,13 @@
"Privileges": "select,insert,update,references",
"Comment": ""
},
- {
+ {
"Field": "buchhaltung_berater",
"Type": "varchar(64)",
- "Collation": null,
+ "Collation": "utf8mb3_general_ci",
"Null": "NO",
"Key": "",
- "Default": "",
+ "Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
@@ -77703,10 +77703,10 @@
{
"Field": "buchhaltung_mandant",
"Type": "varchar(64)",
- "Collation": null,
+ "Collation": "utf8mb3_general_ci",
"Null": "NO",
"Key": "",
- "Default": "",
+ "Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
@@ -77714,14 +77714,14 @@
{
"Field": "buchhaltung_wj_beginn",
"Type": "varchar(4)",
- "Collation": null,
+ "Collation": "utf8mb3_general_ci",
"Null": "NO",
"Key": "",
"Default": "'0101'",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
- },
+ },
{
"Field": "buchhaltung_sachkontenlaenge",
"Type": "int(1)",
@@ -77733,7 +77733,6 @@
"Privileges": "select,insert,update,references",
"Comment": ""
}
-
],
"keys": [
{
@@ -114359,6 +114358,11 @@
"name": "belegeregs",
"type": "VIEW",
"Create": "CREATE VIEW `belegeregs` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe`,`rechnung`.`projekt` AS `projekt` from `rechnung` union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,`gutschrift`.`umsatz_netto` * -1 AS `umsatz_netto*-1`,`gutschrift`.`erloes_netto` * -1 AS `erloes_netto*-1`,`gutschrift`.`deckungsbeitrag` * -1 AS `deckungsbeitrag*-1`,`gutschrift`.`provision_summe` * -1 AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe`,`gutschrift`.`projekt` AS `projekt` from `gutschrift`"
+ },
+ {
+ "name": "fibu_buchungen_alle",
+ "type": "VIEW",
+ "Create": "CREATE VIEW `fibu_buchungen_alle` AS select `fb`.`buchungsart` AS `buchungsart`,`fb`.`typ` AS `typ`,`fb`.`id` AS `id`,if(`bl`.`datum` <> '',`bl`.`datum`,`fb`.`datum`) AS `datum`,`fb`.`gegen_typ` AS `doc_typ`,`fb`.`gegen_id` AS `doc_id`,`bl`.`belegnr` AS `doc_belegnr`,`fb`.`soll` AS `betrag`,`fb`.`waehrung` AS `waehrung` from ((select 'umsatz' collate utf8mb4_general_ci AS `buchungsart`,'rechnung' collate utf8mb4_general_ci AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`soll` AS `soll`,`rechnung`.`waehrung` AS `waehrung`,'rechnung' collate utf8mb4_general_ci AS `gegen_typ`,`rechnung`.`id` AS `gegen_id`,`rechnung`.`datum` AS `datum` from `rechnung` where `rechnung`.`belegnr` <> '' union select 'umsatz' AS `umsatz`,'gutschrift' collate utf8mb4_general_ci AS `'gutschrift' COLLATE utf8mb4_general_ci`,`gutschrift`.`id` AS `id`,-`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' collate utf8mb4_general_ci AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select 'abbuchung' collate utf8mb4_general_ci AS `abbuchung`,'gutschrift' collate utf8mb4_general_ci AS `rechnung`,`gutschrift`.`id` AS `id`,`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'rechnung' collate utf8mb4_general_ci AS `gutschrift`,`gutschrift`.`rechnungid` AS `rechnungid`,`gutschrift`.`datum` AS `datum` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'abbuchung' collate utf8mb4_general_ci AS `abbuchung`,'rechnung' collate utf8mb4_general_ci AS `rechnung`,`gutschrift`.`rechnungid` AS `rechnungid`,-`gutschrift`.`soll` AS `- ``openxe``.``gutschrift``.``soll```,`gutschrift`.`waehrung` AS `waehrung`,'gutschrift' collate utf8mb4_general_ci AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`datum` AS `datum` from `gutschrift` where `gutschrift`.`rechnungid` > 0 and `gutschrift`.`belegnr` <> '' union select 'aufwand' collate utf8mb4_general_ci AS `aufwand`,'verbindlichkeit' collate utf8mb4_general_ci AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,-`verbindlichkeit`.`betrag` AS `- ``openxe``.``verbindlichkeit``.``betrag```,`verbindlichkeit`.`waehrung` AS `waehrung`,'verbindlichkeit' collate utf8mb4_general_ci AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select 'abbuchung' collate utf8mb4_general_ci AS `abbuchung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,-`fibu_buchungen`.`betrag` AS `- ``openxe``.``fibu_buchungen``.``betrag```,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,`fibu_buchungen`.`zeit` AS `zeit` from `fibu_buchungen` union select 'zubuchung' collate utf8mb4_general_ci AS `zubuchung`,`fibu_buchungen`.`nach_typ` AS `nach_typ`,`fibu_buchungen`.`nach_id` AS `nach_id`,`fibu_buchungen`.`betrag` AS `betrag`,`fibu_buchungen`.`waehrung` AS `waehrung`,`fibu_buchungen`.`von_typ` AS `von_typ`,`fibu_buchungen`.`von_id` AS `von_id`,`fibu_buchungen`.`zeit` AS `zeit` from `fibu_buchungen`) `fb` left join (select `rechnung`.`datum` AS `datum`,'rechnung' collate utf8mb4_general_ci AS `typ`,`rechnung`.`id` AS `id`,`rechnung`.`belegnr` AS `belegnr` from `rechnung` where `rechnung`.`belegnr` <> '' union select `gutschrift`.`datum` AS `datum`,'gutschrift' collate utf8mb4_general_ci AS `gutschrift`,`gutschrift`.`id` AS `id`,`gutschrift`.`belegnr` AS `belegnr` from `gutschrift` where `gutschrift`.`belegnr` <> '' union select `verbindlichkeit`.`rechnungsdatum` AS `rechnungsdatum`,'verbindlichkeit' collate utf8mb4_general_ci AS `verbindlichkeit`,`verbindlichkeit`.`id` AS `id`,`verbindlichkeit`.`belegnr` AS `belegnr` from `verbindlichkeit` where `verbindlichkeit`.`belegnr` <> '' union select `kontoauszuege`.`buchung` AS `buchung`,'kontoauszuege' collate utf8mb4_general_ci AS `kontoauszuege`,`kontoauszuege`.`id` AS `id`,`kontoauszuege`.`buchungstext` AS `buchungstext` from `kontoauszuege` union select '','kontorahmen' collate utf8mb4_general_ci AS `'kontorahmen' COLLATE utf8mb4_general_ci`,`kontorahmen`.`id` AS `id`,`kontorahmen`.`beschriftung` AS `beschriftung` from `kontorahmen`) `bl` on(`fb`.`gegen_typ` = `bl`.`typ` and `fb`.`gegen_id` = `bl`.`id`))"
}
]
}
diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php
index 15dfc44c..e3d96046 100644
--- a/www/lib/class.erpapi.php
+++ b/www/lib/class.erpapi.php
@@ -36093,9 +36093,10 @@ function Firmendaten($field,$projekt="")
/*
* Calculate the payments of a document (rechnung, gutschrift, auftrag, verbindlichkeit)
- * Results array of payments with information
+ * Results array of payments (datum, doc_type, doc_id, doc_belegnr, betrag, waehrung)
* Gutschrift -> Rechnungid, Rechnung -> Auftragid
*/
+
public function GetZahlungen(int $id, string $type, bool $cascade = false, string $lastlevel = 'auftrag') : array {
if ($cascade) {
@@ -36108,91 +36109,91 @@ function Firmendaten($field,$projekt="")
return(array());
}
- $zahlungen = array();
-
- $tables = array(
- array(
- 'minus' => '',
- 'table' => 'kontoauszuege_zahlungseingang',
- ),
- array (
- 'minus' => '-',
- 'table' => 'kontoauszuege_zahlungsausgang'
- )
- );
+ $ids = array();
foreach ($documents as $document) {
-
- foreach ($tables as $table) {
-
- $sql = "
- SELECT
- '".$document['type']."' as `doc_type`,
- '".$document['id']."' as `doc_id`,
- '".$document['belegnr']."' as `doc_belegnr`,
- ko.bezeichnung AS konto,
- DATE_FORMAT(ke.datum, '%d.%m.%Y') AS datum,
- k.id AS kontoauszuege,
- ".$table['minus']."ke.betrag AS betrag,
- k.id AS zeile,
- k.waehrung
- FROM
- ".$table['table']." ke
- LEFT JOIN kontoauszuege k ON
- ke.kontoauszuege = k.id
- LEFT JOIN konten ko ON
- k.konto = ko.id
- WHERE
- ke.objekt = '".$document['type']."' AND ke.parameter = '".$document['id']."'
- ";
-
- $result = $this->app->DB->SelectArr($sql);
-
- if (!empty($result)) {
- $zahlungen = array_merge($zahlungen,$result);
- }
- }
+ $ids[] = $document['type'].$document['id'];
}
- return($zahlungen);
- }
- public function GetZahlung(int $id, string $type, bool $cascade = false, string $lastlevel = 'auftrag') {
- $zahlungen = $this->GetZahlungen($id, $type, $cascade);
- if (empty($zahlungen)) {
- $zahlbetrag = 0;
- } else {
- $zahlbetrag = array_sum(array_column($zahlungen,'betrag'));
- }
- return($zahlbetrag);
+ $sql = "
+ SELECT
+ typ,
+ id,
+ ".$this->app->erp->FormatDate('datum')." as datum,
+ doc_typ,
+ doc_id,
+ doc_belegnr,
+ ".$this->app->erp->FormatMenge('betrag',2)." as betrag,
+ waehrung
+ FROM
+ fibu_buchungen_alle
+ WHERE
+ CONCAT(typ,id) IN ('".implode("','",$ids)."')
+ ORDER BY
+ (SELECT datum) ASC
+ ";
+
+ $result = $this->app->DB->SelectArr($sql);
+
+ if (empty($result)) {
+ return(array());
+ }
+ return($result);
}
/*
- * Calculate the payment saldo of a document
+ * Calculate the payment saldo information of a document
* Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
+ * returns array(array(betrag, waehrung)) one line per waehrung
*/
- public function GetSaldoDokument($id, $type, string $lastlevel = 'auftrag') {
+ public function GetSaldenDokument($id, $type, string $lastlevel = 'auftrag') : array {
- $zahlbetrag = $this->GetZahlung($id, $type, false);
-
- $sollspalten = array(
- 'auftrag' => 'gesamtsumme',
- 'rechnung' => 'soll',
- 'gutschrift' => 'soll',
- 'verbindlichkeit' => 'betrag'
- );
-
- $sql = "SELECT ".$sollspalten[$type]." as sollbetrag FROM ".$type." WHERE id =".$id;
-
-// echo($sql);
+ $sql = "
+ SELECT
+ ".$this->app->erp->FormatMenge('SUM(betrag)',2)." as betrag,
+ waehrung
+ FROM
+ fibu_buchungen_alle
+ WHERE
+ typ = '".$type."' AND id = ".$id."
+ GROUP BY
+ waehrung";
$result = $this->app->DB->SelectArr($sql);
if (!empty($result)) {
- $sollbetrag = $result[0]['sollbetrag'];
- } else {
- $sollbetrag = 0;
+ return($result);
+ }
+ return(array());
+ }
+
+
+ /*
+ * Calculate the payment amount of a document
+ * Auftrag: gesamtsumme, rechnung: soll, gutschrift: soll verbindlichkeit: betrag
+ * returns array(array(betrag, waehrung)) or empty array
+ */
+ public function GetSaldoDokument($id, $type) : array {
+
+ $sql = "
+ SELECT
+ SUM(betrag) as betrag,
+ waehrung
+ FROM
+ fibu_buchungen_alle
+ WHERE
+ typ = '".$type."' AND id = ".$id."
+ GROUP BY
+ waehrung";
+
+ $result = $this->app->DB->SelectArr($sql);
+
+ if (!empty($result)) {
+ if (count($result) == 1) {
+ return($result[0]);
+ }
}
- return($sollbetrag-$zahlbetrag);
+ return(array());
}
public function ANABREGSNeuberechnen($id,$art,$force=false)
diff --git a/www/pages/content/gutschrift_minidetail.tpl b/www/pages/content/gutschrift_minidetail.tpl
index 3f005fef..8c8d4a31 100644
--- a/www/pages/content/gutschrift_minidetail.tpl
+++ b/www/pages/content/gutschrift_minidetail.tpl
@@ -39,7 +39,7 @@
-
Zahlungsübersicht
+
Buchungen
[ZAHLUNGEN]
diff --git a/www/pages/gutschrift.php b/www/pages/gutschrift.php
index 1ea5fdae..712d153d 100644
--- a/www/pages/gutschrift.php
+++ b/www/pages/gutschrift.php
@@ -659,59 +659,37 @@ class Gutschrift extends GenGutschrift
{
$id = $this->app->Secure->GetGET('id');
- $zahlungen = $this->app->erp->GetZahlungen($id,'gutschrift',true);
+ $zahlungen = $this->app->erp->GetZahlungen($id,'gutschrift');
+ if (!empty($zahlungen)) {
+ $et = new EasyTable($this->app);
-// print_r($zahlungen);
+ $et->headings = array('Datum','Beleg','Betrag','Währung');
- $result = "";
+ foreach ($zahlungen as $zahlung) {
+ $row = array(
+ $zahlung['datum'],
+ "
+ ".ucfirst($zahlung['doc_typ'])."
+ ".$zahlung['doc_belegnr']."
+ ",
+ $zahlung['betrag'],
+ $zahlung['waehrung']
+ );
+ $et->AddRow($row);
+ }
- foreach ($zahlungen as $zahlung) {
- $result .= "
-
-
- ".$zahlung['datum']."
- |
-
-
- ".ucfirst($zahlung['doc_type'])."
- ".$zahlung['doc_belegnr']."
-
- |
-
- ".$zahlung['konto']."
- |
-
-
- ".$zahlung['betrag']." ".$zahlung['waehrung']."
-
- |
-
";
- }
-
- $sum = array_sum(array_column($zahlungen,'betrag'))." ".$zahlung['waehrung'];
-
- if ($sum != 0) {
- $result .= "
-
-
- |
-
- |
-
-
- Summe:
-
- |
-
-
- ".$sum."
-
- |
-
- ";
- }
-
- return("
");
+ $salden = $this->app->erp->GetSaldenDokument($id,'gutschrift');
+ foreach ($salden as $saldo) {
+ $row = array(
+ '',
+ '
Saldo',
+ "
".$saldo['betrag']."",
+ "
".$saldo['waehrung'].""
+ );
+ $et->AddRow($row);
+ }
+ return($et->DisplayNew('return',""));
+ }
}
@@ -1136,7 +1114,6 @@ class Gutschrift extends GenGutschrift
$this->app->erp->CheckBearbeiter($id,"gutschrift");
$this->app->erp->CheckBuchhaltung($id,"gutschrift");
-
$this->app->erp->GutschriftNeuberechnen($id);
$this->app->erp->DisableVerband();
@@ -1145,14 +1122,11 @@ class Gutschrift extends GenGutschrift
$this->app->Tpl->Set('ICONMENU',$this->GutschriftIconMenu($id));
$this->app->Tpl->Set('ICONMENU2',$this->GutschriftIconMenu($id,2));
-
$belegnr = $this->app->DB->Select("SELECT belegnr FROM gutschrift WHERE id='$id' LIMIT 1");
$nummer = $this->app->DB->Select("SELECT belegnr FROM gutschrift WHERE id='$id' LIMIT 1");
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM gutschrift WHERE id='$id' LIMIT 1");
$adresse = $this->app->DB->Select("SELECT adresse FROM gutschrift WHERE id='$id' LIMIT 1");
-
-
$status= $this->app->DB->Select("SELECT status FROM gutschrift WHERE id='$id' LIMIT 1");
$schreibschutz= $this->app->DB->Select("SELECT schreibschutz FROM gutschrift WHERE id='$id' LIMIT 1");
if($status !== 'angelegt' && $status !== 'angelegta' && $status !== 'a')
@@ -1201,7 +1175,12 @@ class Gutschrift extends GenGutschrift
if($zahlungsweise=="einzugsermaechtigung" || $zahlungsweise=="lastschrift") $this->app->Tpl->Set('EINZUGSERMAECHTIGUNG',"");
if($zahlungsweise=="vorkasse" || $zahlungsweise=="kreditkarte" || $zahlungsweise=="paypal" || $zahlungsweise=="bar") $this->app->Tpl->Set('VORKASSE',"");
+ $zahlungsinfo = $this->app->DB->SelectArr("SELECT zahlungsstatus, ".$this->app->erp->FormatMenge('soll*(-1)',2)." as betrag FROM gutschrift WHERE id='$id' LIMIT 1");
+ $this->app->Tpl->Set('ZAHLUNGSSTATUS_DB',$zahlungsinfo[0]['zahlungsstatus']);
+ $this->app->Tpl->Set('SOLL',$zahlungsinfo[0]['betrag']);
+ $ist = $this->app->erp->EUR($this->app->erp->GetSaldoDokument($id,'gutschrift')['betrag']);
+ $this->app->Tpl->Set('ISTDB',$ist);
if($schreibschutz=="1" && $this->app->erp->RechteVorhanden("gutschrift","schreibschutz"))
{
@@ -1213,6 +1192,17 @@ class Gutschrift extends GenGutschrift
$this->app->erp->CommonReadonly();
}
+ if($schreibschutz=='1' && $this->app->erp->RechteVorhanden('gutschrift','edit'))
+ {
+ $this->app->erp->RemoveReadonly('zahlungsstatus');
+
+ if ($aktion = $this->app->Secure->GetPOST('speichern') == 'Speichern') {
+ $zahlungsstatus = $this->app->Secure->GetPOST('zahlungsstatus');
+ $this->app->DB->Update("UPDATE gutschrift SET zahlungsstatus='".$zahlungsstatus."' WHERE id='$id' LIMIT 1");
+ }
+
+ }
+
$rechnungid = $this->app->DB->Select("SELECT rechnungid FROM gutschrift WHERE id='$id' LIMIT 1");
$rechnungid = $this->app->DB->Select("SELECT id FROM rechnung WHERE id='$rechnungid' AND belegnr!='' LIMIT 1");
@@ -1392,6 +1382,25 @@ class Gutschrift extends GenGutschrift
{
$this->app->Tpl->Set('UEBERSCHRIFT', 'Gutschriften');
+ $this->app->DB->Update("UPDATE gutschrift SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
+
+ // First refresh all open items
+ $openids = $this->app->DB->SelectArr("SELECT id, waehrung from gutschrift WHERE zahlungsstatus != 'bezahlt'");
+
+ foreach ($openids as $openid) {
+ $saldo = $this->app->erp->GetSaldoDokument($openid['id'],'gutschrift');
+
+ if (!empty($saldo)) {
+ if ($saldo['waehrung'] == $openid['waehrung']) {
+ $sql = "UPDATE gutschrift SET ist = '".$saldo['betrag']."'+soll WHERE id=".$openid['id'];
+ $result = $this->app->DB->Update($sql);
+ }
+ }
+ else {
+ $this->app->DB->Update("UPDATE gutschrift SET ist = null WHERE id=".$openid['id']);
+ }
+ }
+
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('gutschrift', 'edit')) {
$drucker = $this->app->Secure->GetPOST('seldrucker');
$aktion = $this->app->Secure->GetPOST('sel_aktion');
diff --git a/www/pages/rechnung.php b/www/pages/rechnung.php
index 13adc7d8..50244957 100644
--- a/www/pages/rechnung.php
+++ b/www/pages/rechnung.php
@@ -887,31 +887,9 @@ class Rechnung extends GenRechnung
$this->app->Tpl->Set('ANGEBOTFARBE',"grey");
$this->app->Tpl->Set('ANGEBOTTEXT',"Das Angebot wird bearbeitet und wurde noch nicht freigegeben und abgesendet!");
}
-
-
-// $this->app->Tpl->Set('ZAHLUNGEN',"
Erst ab Version Enterprise verfügbar
");
+
$this->app->Tpl->Set('ZAHLUNGEN',$this->RechnungZahlung(true));
- if (!is_null($gutschrift)) {
-
- if((!empty($gutschrift)?count($gutschrift):0) > 0)
- $this->app->Tpl->Add('ZAHLUNGEN',"
Zu dieser Rechnung existiert eine Gutschrift!
");
- else {
-
- if($auftragArr[0]['zahlungsstatus']!="bezahlt")
- $this->app->Tpl->Add('ZAHLUNGEN',"
Diese Rechnung ist noch nicht komplett bezahlt!
");
- else
- {
- if(!empty($auftragArr[0]['bezahlt_am']) && $auftragArr[0]['bezahlt_am'] != '0000-00-00')
- {
- $this->app->Tpl->Add('ZAHLUNGEN',"
Diese Rechnung wurde am ".$this->app->String->Convert($auftragArr[0]['bezahlt_am'],"%1-%2-%3","%3.%2.%1")." bezahlt.
");
- }else{
- $this->app->Tpl->Add('ZAHLUNGEN',"
Diese Rechnung ist bezahlt.
");
- }
- }
- }
- }
-
$this->app->Tpl->Set('RECHNUNGADRESSE',$this->Rechnungsadresse($auftragArr[0]['id']));
$tmp = new EasyTable($this->app);
@@ -1770,13 +1748,9 @@ class Rechnung extends GenRechnung
$this->app->Tpl->Set('VORKASSE','');
}
- $ist = $this->app->erp->EUR($this->app->erp->GetZahlung($id,'rechnung'));
+ $ist = $this->app->erp->EUR($this->app->erp->GetSaldoDokument($id,'rechnung')['betrag']);
$this->app->Tpl->Set('ISTDB',$ist);
- $istgs = $this->app->erp->EUR($this->app->erp->GetZahlung($id,'rechnung',true,'rechnung'));
- $this->app->Tpl->Set('ISTGS',$istgs);
-
-
if($schreibschutz=="1" && $this->app->erp->RechteVorhanden('rechnung','schreibschutz'))
{
$this->app->Tpl->Set('MESSAGE',"
Diese Rechnung ist schreibgeschützt und darf daher nicht mehr bearbeitet werden!
");
@@ -1822,8 +1796,10 @@ class Rechnung extends GenRechnung
}
$speichern = $this->app->Secure->GetPOST('speichern');
+
if($speichern!='' && $this->app->erp->RechteVorhanden('rechnung','mahnwesen'))
{
+
$mahnwesen_datum = $this->app->Secure->GetPOST('mahnwesen_datum');
$bezahlt_am = $this->app->Secure->GetPOST('bezahlt_am');
$mahnwesen_gesperrt = $this->app->Secure->GetPOST('mahnwesen_gesperrt');
@@ -1849,17 +1825,16 @@ class Rechnung extends GenRechnung
$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($mahnwesenfestsetzen=='1')
- {
+/* if($mahnwesenfestsetzen=='1')
+ {*/
$this->app->DB->Update("UPDATE rechnung SET mahnwesen_internebemerkung='$mahnwesen_internebemerkung',zahlungsstatus='$zahlungsstatus',versendet_mahnwesen='$versendet',
mahnwesen_gesperrt='$mahnwesen_gesperrt',mahnwesen_datum='$mahnwesen_datum', mahnwesenfestsetzen='$mahnwesenfestsetzen',internebemerkung='$internebemerkung',
mahnwesen='$mahnwesen',ist='$ist',skonto_gegeben='$skonto_gegeben',bezahlt_am='$bezahlt_am' WHERE id='$id' LIMIT 1");
- } else {
+/* } else {
$this->app->DB->Update("UPDATE rechnung SET mahnwesen='$mahnwesen', mahnwesenfestsetzen='$mahnwesenfestsetzen', mahnwesen_internebemerkung='$mahnwesen_internebemerkung', mahnwesen_gesperrt='$mahnwesen_gesperrt',mahnwesen_datum='$mahnwesen_datum' WHERE id='$id' LIMIT 1");
- }
+ }*/
}
-
if($status=='')
$this->app->DB->Update("UPDATE rechnung SET status='angelegt' WHERE id='$id' LIMIT 1");
@@ -2091,11 +2066,20 @@ class Rechnung extends GenRechnung
$this->app->DB->Update("UPDATE rechnung SET zahlungsstatus='offen' WHERE zahlungsstatus=''");
// First refresh all open items
- $openids = $this->app->DB->SelectArr("SELECT id from rechnung WHERE zahlungsstatus = 'offen'");
+ $openids = $this->app->DB->SelectArr("SELECT id, waehrung from rechnung WHERE zahlungsstatus = 'offen'");
foreach ($openids as $openid) {
$saldo = $this->app->erp->GetSaldoDokument($openid['id'],'rechnung');
- $this->app->DB->Update("UPDATE rechnung SET ist = soll-".$saldo." WHERE id=".$openid['id']);
+
+ if (!empty($saldo)) {
+ if ($saldo['waehrung'] == $openid['waehrung']) {
+ $sql = "UPDATE rechnung SET ist = ".$saldo['betrag']."+soll WHERE id=".$openid['id'];
+ $this->app->DB->Update($sql);
+ }
+ }
+ else {
+ $this->app->DB->Update("UPDATE rechnung SET ist = null");
+ }
}
if($this->app->Secure->GetPOST('ausfuehren') && $this->app->erp->RechteVorhanden('rechnung', 'edit'))
@@ -2744,61 +2728,36 @@ class Rechnung extends GenRechnung
{
$id = $this->app->Secure->GetGET('id');
- $zahlungen = $this->app->erp->GetZahlungen($id,'rechnung',true);
+ $zahlungen = $this->app->erp->GetZahlungen($id,'rechnung');
+ if (!empty($zahlungen)) {
+ $et = new EasyTable($this->app);
-// print_r($zahlungen);
+ $et->headings = array('Datum','Beleg','Betrag','Währung');
- $result = "";
+ foreach ($zahlungen as $zahlung) {
+ $row = array(
+ $zahlung['datum'],
+ "
+ ".ucfirst($zahlung['doc_typ'])."
+ ".$zahlung['doc_belegnr']."
+ ",
+ $zahlung['betrag'],
+ $zahlung['waehrung']
+ );
+ $et->AddRow($row);
+ }
- foreach ($zahlungen as $zahlung) {
- $result .= "
-
-
- ".$zahlung['datum']."
- |
-
-
- ".ucfirst($zahlung['doc_type'])."
- ".$zahlung['doc_belegnr']."
-
- |
-
- ".$zahlung['konto']."
- |
-
-
- ".$zahlung['betrag']." ".$zahlung['waehrung']."
-
- |
-
- ";
+ $salden = $this->app->erp->GetSaldenDokument($id,'rechnung');
+ foreach ($salden as $saldo) {
+ $row = array(
+ '',
+ '
Saldo',
+ "
".$saldo['betrag']."",
+ "
".$saldo['waehrung'].""
+ );
+ $et->AddRow($row);
+ }
+ return($et->DisplayNew('return',""));
}
-
- $sum = array_sum(array_column($zahlungen,'betrag'))." ".$zahlung['waehrung'];
-
- if ($sum != 0) {
- $result .= "
-
-
- |
-
- |
-
-
- Summe:
-
- |
-
-
- ".$sum."
-
- |
-
- ";
- }
-
- return("
");
}
-
-
}
diff --git a/www/widgets/_gen/widget.gen.gutschrift.php b/www/widgets/_gen/widget.gen.gutschrift.php
index c2db558c..f53d6e44 100644
--- a/www/widgets/_gen/widget.gen.gutschrift.php
+++ b/www/widgets/_gen/widget.gen.gutschrift.php
@@ -1,300 +1,307 @@
-app = $app;
- $this->parsetarget = $parsetarget;
- $this->Form();
- }
-
- public function gutschriftDelete()
- {
-
- $this->form->Execute("gutschrift","delete");
-
- $this->gutschriftList();
- }
-
- function Edit()
- {
- $this->form->Edit();
- }
-
- function Copy()
- {
- $this->form->Copy();
- }
-
- public function Create()
- {
- $this->form->Create();
- }
-
- public function Search()
- {
- $this->app->Tpl->Set($this->parsetarget,"SUUUCHEEE");
- }
-
- public function Summary()
- {
- $this->app->Tpl->Set($this->parsetarget,"grosse Tabelle");
- }
-
- function Form()
- {
- $this->form = $this->app->FormHandler->CreateNew("gutschrift");
- $this->form->UseTable("gutschrift");
- $this->form->UseTemplate("gutschrift.tpl",$this->parsetarget);
-
- $field = new HTMLInput("lieferid","hidden","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ansprechpartnerid","hidden","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("adresse","text","","20","","","","","","","pflicht","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("aktion","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("projekt","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rechnungid","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kundennummer_buchhaltung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ihrebestellnummer","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("internebezeichnung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("lieferdatum","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("datum","text","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("stornorechnung","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("schreibschutz","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("nicht_umsatzmindernd","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("manuell_vorabbezahlt","text","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("manuell_vorabbezahlt_hinweis",5,30,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("typ",0,"typ","","","0");
- $field->AddOption('Firma','firma');
- $field->AddOption('Herr','herr');
- $field->AddOption('Frau','frau');
- $this->form->NewField($field);
-
- $field = new HTMLInput("name","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
- $this->form->AddMandatory("name","notempty","Pflichfeld!","MSGNAME");
-
- $field = new HTMLInput("titel","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ansprechpartner","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("abteilung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("unterabteilung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("adresszusatz","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("strasse","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("plz","text","","5","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ort","text","","19","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("gln","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("telefon","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("telefax","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("email","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("anschreiben","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("freitext",5,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("bodyzusatz",5,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("zahlungsweise",0,"zahlungsweise","","","0");
- $field->AddOption('Kreditkarte','kreditkarte');
- $field->AddOption('Überweisung','ueberweisung');
- $field->AddOption('Bar','bar');
- $field->AddOption('PayPal','paypal');
- $this->form->NewField($field);
-
- $field = new HTMLInput("lieferbedingung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bearbeiter","text","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("vertrieb","text","","40","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bearbeiter","text","","40","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ohne_briefpapier","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ohne_artikeltext","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_inhaber","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_institut","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_blz","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_konto","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("paypalaccount","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_typ",0,"kreditkarte_typ","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_inhaber","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_nummer","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_pruefnummer","text","","5","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_monat",0,"kreditkarte_monat","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_jahr",0,"kreditkarte_jahr","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("zahlungszielskonto","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt1","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt2","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt3","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt4","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt5","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("internebemerkung",2,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ustid","text","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("ust_befreit",0,"ust_befreit","","","0");
- $field->AddOption('{|Inland|}','0');
- $field->AddOption('{|EU-Lieferung / Lieferschwelle|}','1');
- $field->AddOption('{|Export|}','2');
- $field->AddOption('{|Steuerfrei Inland|}','3');
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("keinsteuersatz","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ustbrief","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ustbrief_eingang","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ustbrief_eingang_am","text","","35","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("anzeigesteuer",0,"anzeigesteuer","","","0");
- $field->AddOption('automatisch','0');
- $field->AddOption('netto','3');
- $field->AddOption('brutto','4');
- $this->form->NewField($field);
-
- $field = new HTMLInput("waehrung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("sprache","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kurs","text","","15","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kostenstelle","text","","15","","","","","","","","0","","");
- $this->form->NewField($field);
-
-
- }
-
-}
-
-?>
\ No newline at end of file
+app = $app;
+ $this->parsetarget = $parsetarget;
+ $this->Form();
+ }
+
+ public function gutschriftDelete()
+ {
+
+ $this->form->Execute("gutschrift","delete");
+
+ $this->gutschriftList();
+ }
+
+ function Edit()
+ {
+ $this->form->Edit();
+ }
+
+ function Copy()
+ {
+ $this->form->Copy();
+ }
+
+ public function Create()
+ {
+ $this->form->Create();
+ }
+
+ public function Search()
+ {
+ $this->app->Tpl->Set($this->parsetarget,"SUUUCHEEE");
+ }
+
+ public function Summary()
+ {
+ $this->app->Tpl->Set($this->parsetarget,"grosse Tabelle");
+ }
+
+ function Form()
+ {
+ $this->form = $this->app->FormHandler->CreateNew("gutschrift");
+ $this->form->UseTable("gutschrift");
+ $this->form->UseTemplate("gutschrift.tpl",$this->parsetarget);
+
+ $field = new HTMLInput("lieferid","hidden","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ansprechpartnerid","hidden","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("adresse","text","","20","","","","","","","pflicht","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("aktion","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("projekt","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rechnungid","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kundennummer_buchhaltung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ihrebestellnummer","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("internebezeichnung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("lieferdatum","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("datum","text","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("stornorechnung","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("schreibschutz","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("nicht_umsatzmindernd","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("manuell_vorabbezahlt","text","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("manuell_vorabbezahlt_hinweis",5,30,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("typ",0,"typ","","","0");
+ $field->AddOption('Firma','firma');
+ $field->AddOption('Herr','herr');
+ $field->AddOption('Frau','frau');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("name","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+ $this->form->AddMandatory("name","notempty","Pflichfeld!","MSGNAME");
+
+ $field = new HTMLInput("titel","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ansprechpartner","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("abteilung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("unterabteilung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("adresszusatz","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("strasse","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("plz","text","","5","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ort","text","","19","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("gln","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("telefon","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("telefax","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("email","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("anschreiben","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("freitext",5,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("bodyzusatz",5,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("zahlungsweise",0,"zahlungsweise","","","0");
+ $field->AddOption('Kreditkarte','kreditkarte');
+ $field->AddOption('Überweisung','ueberweisung');
+ $field->AddOption('Bar','bar');
+ $field->AddOption('PayPal','paypal');
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("zahlungsstatus",0,"zahlungsstatus","","","0");
+ $field->AddOption('offen','offen');
+ $field->AddOption('bezahlt','bezahlt');
+// $field->AddOption('forderungsverlust','forderungsverlust');
+// $field->AddOption('abgebucht (bei Lastschrift)','abgebucht');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("lieferbedingung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bearbeiter","text","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("vertrieb","text","","40","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bearbeiter","text","","40","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ohne_briefpapier","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ohne_artikeltext","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_inhaber","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_institut","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_blz","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_konto","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("paypalaccount","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_typ",0,"kreditkarte_typ","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_inhaber","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_nummer","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_pruefnummer","text","","5","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_monat",0,"kreditkarte_monat","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_jahr",0,"kreditkarte_jahr","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("zahlungszielskonto","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt1","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt2","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt3","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt4","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt5","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("internebemerkung",2,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ustid","text","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("ust_befreit",0,"ust_befreit","","","0");
+ $field->AddOption('{|Inland|}','0');
+ $field->AddOption('{|EU-Lieferung / Lieferschwelle|}','1');
+ $field->AddOption('{|Export|}','2');
+ $field->AddOption('{|Steuerfrei Inland|}','3');
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("keinsteuersatz","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ustbrief","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ustbrief_eingang","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ustbrief_eingang_am","text","","35","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("anzeigesteuer",0,"anzeigesteuer","","","0");
+ $field->AddOption('automatisch','0');
+ $field->AddOption('netto','3');
+ $field->AddOption('brutto','4');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("waehrung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("sprache","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kurs","text","","15","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kostenstelle","text","","15","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+
+ }
+
+}
+
+?>
diff --git a/www/widgets/_gen/widget.gen.rechnung.php b/www/widgets/_gen/widget.gen.rechnung.php
index 159c6def..84170459 100644
--- a/www/widgets/_gen/widget.gen.rechnung.php
+++ b/www/widgets/_gen/widget.gen.rechnung.php
@@ -1,344 +1,344 @@
-app = $app;
- $this->parsetarget = $parsetarget;
- $this->Form();
- }
-
- public function rechnungDelete()
- {
-
- $this->form->Execute("rechnung","delete");
-
- $this->rechnungList();
- }
-
- function Edit()
- {
- $this->form->Edit();
- }
-
- function Copy()
- {
- $this->form->Copy();
- }
-
- public function Create()
- {
- $this->form->Create();
- }
-
- public function Search()
- {
- $this->app->Tpl->Set($this->parsetarget,"SUUUCHEEE");
- }
-
- public function Summary()
- {
- $this->app->Tpl->Set($this->parsetarget,"grosse Tabelle");
- }
-
- function Form()
- {
- $this->form = $this->app->FormHandler->CreateNew("rechnung");
- $this->form->UseTable("rechnung");
- $this->form->UseTemplate("rechnung.tpl",$this->parsetarget);
-
- $field = new HTMLInput("lieferid","hidden","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ansprechpartnerid","hidden","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("adresse","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("projekt","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("aktion","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("auftragid","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kundennummer_buchhaltung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ihrebestellnummer","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("internebezeichnung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("lieferdatum","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("lieferschein","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("datum","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("doppel","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("schreibschutz","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("abweichendebezeichnung","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("mahnwesenfestsetzen","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("zahlungsstatus",0,"zahlungsstatus","","","0");
- $field->AddOption('offen','offen');
- $field->AddOption('bezahlt','bezahlt');
- $field->AddOption('forderungsverlust','forderungsverlust');
- $field->AddOption('abgebucht (bei Lastschrift)','abgebucht');
- $this->form->NewField($field);
-
- $field = new HTMLInput("bezahlt_am","text","","10","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ist","text","","10","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("skonto_gegeben","text","","10","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("mahnwesen",0,"mahnwesen","","","0");
- $field->AddOption('','');
- $field->AddOption('Zahlungserinnerung','zahlungserinnerung');
- $field->AddOption('Mahnung 1','mahnung1');
- $field->AddOption('Mahnung 2','mahnung2');
- $field->AddOption('Mahnung 3','mahnung3');
- $field->AddOption('Inkasso','inkasso');
- $field->AddOption('Forderungsverlust','forderungsverlust');
- $this->form->NewField($field);
-
- $field = new HTMLInput("mahnwesen_datum","text","","10","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("mahnwesen_gesperrt","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("mahnwesen_internebemerkung",4,60,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("typ",0,"typ","","","0");
- $field->AddOption('Firma','firma');
- $field->AddOption('Herr','herr');
- $field->AddOption('Frau','frau');
- $this->form->NewField($field);
-
- $field = new HTMLInput("name","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
- $this->form->AddMandatory("name","notempty","Pflichfeld!","MSGNAME");
-
- $field = new HTMLInput("titel","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ansprechpartner","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("abteilung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("unterabteilung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("adresszusatz","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("strasse","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("plz","text","","5","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ort","text","","19","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("telefon","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("telefax","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("email","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("anschreiben","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("freitext",5,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("bodyzusatz",5,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("zahlungsweise",0,"zahlungsweise","","","0");
- $field->AddOption('Rechnung','rechnung');
- $field->AddOption('Vorkasse','vorkasse');
- $field->AddOption('Nachnahme','nachnahme');
- $field->AddOption('Kreditkarte','kreditkarte');
- $field->AddOption('Einzugsermaechtigung','einzugsermaechtigung');
- $field->AddOption('Bar','bar');
- $field->AddOption('PayPal','paypal');
- $this->form->NewField($field);
-
- $field = new HTMLInput("lieferbedingung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("buchhaltung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("vertrieb","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bearbeiter","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ohne_briefpapier","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ohne_artikeltext","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("gln","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("zahlungszieltage","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("zahlungszieltageskonto","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("einzugsdatum","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_inhaber","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_institut","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_blz","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("bank_konto","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_typ",0,"kreditkarte_typ","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_inhaber","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_nummer","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kreditkarte_pruefnummer","text","","5","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_monat",0,"kreditkarte_monat","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("kreditkarte_jahr",0,"kreditkarte_jahr","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("zahlungszielskonto","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt1","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt2","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt3","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt4","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("rabatt5","text","","4","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLTextarea("internebemerkung",2,110,"","","","","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ustid","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("ust_befreit",0,"ust_befreit","","","0");
- $field->AddOption('{|Inland|}','0');
- $field->AddOption('{|EU-Lieferung / Lieferschwelle|}','1');
- $field->AddOption('{|Export|}','2');
- $field->AddOption('{|Steuerfrei Inland|}','3');
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("keinsteuersatz","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ustbrief","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLCheckbox("ustbrief_eingang","","","1","0","0");
- $this->form->NewField($field);
-
- $field = new HTMLInput("ustbrief_eingang_am","text","","","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLSelect("anzeigesteuer",0,"anzeigesteuer","","","0");
- $field->AddOption('automatisch','0');
- $field->AddOption('netto','3');
- $field->AddOption('brutto','4');
- $this->form->NewField($field);
-
- $field = new HTMLInput("waehrung","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("sprache","text","","30","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kurs","text","","15","","","","","","","","0","","");
- $this->form->NewField($field);
-
- $field = new HTMLInput("kostenstelle","text","","15","","","","","","","","0","","");
- $this->form->NewField($field);
-
-
- }
-
-}
-
-?>
\ No newline at end of file
+app = $app;
+ $this->parsetarget = $parsetarget;
+ $this->Form();
+ }
+
+ public function rechnungDelete()
+ {
+
+ $this->form->Execute("rechnung","delete");
+
+ $this->rechnungList();
+ }
+
+ function Edit()
+ {
+ $this->form->Edit();
+ }
+
+ function Copy()
+ {
+ $this->form->Copy();
+ }
+
+ public function Create()
+ {
+ $this->form->Create();
+ }
+
+ public function Search()
+ {
+ $this->app->Tpl->Set($this->parsetarget,"SUUUCHEEE");
+ }
+
+ public function Summary()
+ {
+ $this->app->Tpl->Set($this->parsetarget,"grosse Tabelle");
+ }
+
+ function Form()
+ {
+ $this->form = $this->app->FormHandler->CreateNew("rechnung");
+ $this->form->UseTable("rechnung");
+ $this->form->UseTemplate("rechnung.tpl",$this->parsetarget);
+
+ $field = new HTMLInput("lieferid","hidden","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ansprechpartnerid","hidden","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("adresse","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("projekt","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("aktion","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("auftragid","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kundennummer_buchhaltung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ihrebestellnummer","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("internebezeichnung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("lieferdatum","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("lieferschein","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("datum","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("doppel","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("schreibschutz","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("abweichendebezeichnung","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("mahnwesenfestsetzen","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("zahlungsstatus",0,"zahlungsstatus","","","0");
+ $field->AddOption('offen','offen');
+ $field->AddOption('bezahlt','bezahlt');
+// $field->AddOption('forderungsverlust','forderungsverlust');
+// $field->AddOption('abgebucht (bei Lastschrift)','abgebucht');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bezahlt_am","text","","10","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ist","text","","10","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("skonto_gegeben","text","","10","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("mahnwesen",0,"mahnwesen","","","0");
+ $field->AddOption('','');
+ $field->AddOption('Zahlungserinnerung','zahlungserinnerung');
+ $field->AddOption('Mahnung 1','mahnung1');
+ $field->AddOption('Mahnung 2','mahnung2');
+ $field->AddOption('Mahnung 3','mahnung3');
+ $field->AddOption('Inkasso','inkasso');
+ $field->AddOption('Forderungsverlust','forderungsverlust');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("mahnwesen_datum","text","","10","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("mahnwesen_gesperrt","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("mahnwesen_internebemerkung",4,60,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("typ",0,"typ","","","0");
+ $field->AddOption('Firma','firma');
+ $field->AddOption('Herr','herr');
+ $field->AddOption('Frau','frau');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("name","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+ $this->form->AddMandatory("name","notempty","Pflichfeld!","MSGNAME");
+
+ $field = new HTMLInput("titel","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ansprechpartner","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("abteilung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("unterabteilung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("adresszusatz","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("strasse","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("plz","text","","5","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ort","text","","19","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("telefon","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("telefax","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("email","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("anschreiben","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("freitext",5,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("bodyzusatz",5,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("zahlungsweise",0,"zahlungsweise","","","0");
+ $field->AddOption('Rechnung','rechnung');
+ $field->AddOption('Vorkasse','vorkasse');
+ $field->AddOption('Nachnahme','nachnahme');
+ $field->AddOption('Kreditkarte','kreditkarte');
+ $field->AddOption('Einzugsermaechtigung','einzugsermaechtigung');
+ $field->AddOption('Bar','bar');
+ $field->AddOption('PayPal','paypal');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("lieferbedingung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("buchhaltung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("vertrieb","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bearbeiter","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ohne_briefpapier","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ohne_artikeltext","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("gln","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("zahlungszieltage","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("zahlungszieltageskonto","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("einzugsdatum","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_inhaber","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_institut","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_blz","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("bank_konto","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_typ",0,"kreditkarte_typ","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_inhaber","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_nummer","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kreditkarte_pruefnummer","text","","5","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_monat",0,"kreditkarte_monat","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("kreditkarte_jahr",0,"kreditkarte_jahr","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("zahlungszielskonto","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt1","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt2","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt3","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt4","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("rabatt5","text","","4","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLTextarea("internebemerkung",2,110,"","","","","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ustid","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("ust_befreit",0,"ust_befreit","","","0");
+ $field->AddOption('{|Inland|}','0');
+ $field->AddOption('{|EU-Lieferung / Lieferschwelle|}','1');
+ $field->AddOption('{|Export|}','2');
+ $field->AddOption('{|Steuerfrei Inland|}','3');
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("keinsteuersatz","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ustbrief","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLCheckbox("ustbrief_eingang","","","1","0","0");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("ustbrief_eingang_am","text","","","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLSelect("anzeigesteuer",0,"anzeigesteuer","","","0");
+ $field->AddOption('automatisch','0');
+ $field->AddOption('netto','3');
+ $field->AddOption('brutto','4');
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("waehrung","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("sprache","text","","30","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kurs","text","","15","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+ $field = new HTMLInput("kostenstelle","text","","15","","","","","","","","0","","");
+ $this->form->NewField($field);
+
+
+ }
+
+}
+
+?>
diff --git a/www/widgets/templates/_gen/gutschrift.tpl b/www/widgets/templates/_gen/gutschrift.tpl
index d5b38ef9..2fc7aee2 100644
--- a/www/widgets/templates/_gen/gutschrift.tpl
+++ b/www/widgets/templates/_gen/gutschrift.tpl
@@ -61,7 +61,7 @@
-
+
+
+
diff --git a/www/widgets/templates/_gen/rechnung.tpl b/www/widgets/templates/_gen/rechnung.tpl
index a2521c3b..bc29928d 100644
--- a/www/widgets/templates/_gen/rechnung.tpl
+++ b/www/widgets/templates/_gen/rechnung.tpl
@@ -1,39 +1,3 @@
-
[SAVEPAGEREALLY]
@@ -141,17 +105,10 @@
[MAHNWESENIF]