Auswertungen
Einführung
In der GEMADE Business Software können Sie über den Abfrage-Designer erstellen. Damit diese Abfragen auch in Tabelle verwendet werden können, müssen Zieltabellen definiert werden. Den Namen der Zieltabelle können Sie bis auf wenige ausnahmen frei wählen. Neben den individuellen Abfragen gibt es auch fest definierte Definierte Zieltabellen.
Fest definierte Zieltabellen
Umsatz-Auswertungen (IST Besteuerung)
Mit der folgenden Abfrage, werden alle gebuchten Rechnung der letzten 3 Jahre aufgelistet. Die Auflistung ist dabei auf Jahr- und Monatsraster zusammengefasst. Das Ergebnis wird in die Zieltabelle SALE gespeichert.
Select Sum(Round(POSTINGSRECORDS.amount, 2)) As amount,
Month(POSTINGSRECORDS.postingrecorddate) As month,
POSTINGSRECORDS.businessyear
From POSTINGSRECORDS
Where POSTINGSRECORDS.businessyear >= (Year(GetDate()) - 3)
Group By Month(POSTINGSRECORDS.postingrecorddate),
POSTINGSRECORDS.businessyear
Auswertungen Offene Posten
Mit der folgenden Abfrage, werden alle offenen Rechnungen ermittelt, welche gedruckt, aber noch nicht abgeschlossen sind.
Das Ergebnis wird in die Zieltabelle OPENRECEIPTS gespeichert.
Select INVOICES.ordernumber,
1103 As dataelementtype,
INVOICES.processtypeid,
INVOICES.customernumber,
INVOICES.orderinformation,
INVOICES.billing_genderid,
INVOICES.billing_name,
INVOICES.billing_company,
INVOICES.billing_name2,
INVOICES.billing_firstname,
INVOICES.billing_lastname,
INVOICES.billing_street,
INVOICES.billing_city,
INVOICES.billing_zipcode,
INVOICES.billing_countryid,
INVOICES.paymentid,
INVOICES.payment_duedate,
INVOICES.description,
INVOICES.datedocument,
INVOICES.datefinished,
INVOICES.pricenet,
INVOICES.tax,
INVOICES.pricegross,
INVOICES.cashdiscountpricegross,
INVOICES.paidamount,
INVOICES.debitamount,
INVOICES.statusid,
INVOICES.currencyid,
INVOICES.exchangerate,
INVOICES.exchangedate,
INVOICES.referencenumber,
INVOICES.date_printed,
INVOICES.contractnumber,
INVOICES.colorstate,
INVOICES.releasedflag,
INVOICES.printedflag,
INVOICES.closedflag,
INVOICES.canceledflag,
INVOICES.delflag,
INVOICES.date_added,
INVOICES.last_modified,
INVOICES.uname,
INVOICES.notaxflag
From INVOICES
Where (INVOICES.colorstate = 2) Or (INVOICES.colorstate = 1)
Union
Select CREDIT.ordernumber,
1104 As dataelementtype,
CREDIT.processtypeid,
CREDIT.customernumber,
CREDIT.orderinformation,
CREDIT.billing_genderid,
CREDIT.billing_name,
CREDIT.billing_company,
CREDIT.billing_name2,
CREDIT.billing_firstname,
CREDIT.billing_lastname,
CREDIT.billing_street,
CREDIT.billing_city,
CREDIT.billing_zipcode,
CREDIT.billing_countryid,
CREDIT.paymentid,
CREDIT.payment_duedate,
CREDIT.description,
CREDIT.datedocument,
CREDIT.datefinished,
CREDIT.pricenet * -1 As pricenet,
CREDIT.tax * -1 As tax,
CREDIT.pricegross * -1 As pricegross,
CREDIT.cashdiscountpricegross * -1 As cashdiscountpricegross,
CREDIT.paidamount * -1 As paidamount,
CREDIT.debitamount,
CREDIT.statusid,
CREDIT.currencyid,
CREDIT.exchangerate,
CREDIT.exchangedate,
CREDIT.referencenumber,
CREDIT.date_printed,
CREDIT.contractnumber,
CREDIT.colorstate,
CREDIT.releasedflag,
CREDIT.printedflag,
CREDIT.closedflag,
CREDIT.canceledflag,
CREDIT.delflag,
CREDIT.date_added,
CREDIT.last_modified,
CREDIT.uname,
CREDIT.notaxflag
From CREDIT
Where CREDIT.colorstate = 2
Auswertungen Einnahmen
Mit der folgenden Abfrage, werden alle erstellten Rechnungen ermittelt, welche gedruckt sind und nicht als storniert oder uneinbringbar gekennzeichnet sind. Diese Abfrage enthält zwei dynamischen Variablen @datefrom und @dateto, welche eine dynamische Ermittlung über einen Zeitraum ermöglicht.
Das Ergebnis wird in die Zieltabelle INCOME gespeichert.
Select INVOICES.ordernumber,
1103 As dataelementtype,
INVOICES.processtypeid,
INVOICES.customernumber,
INVOICES.orderinformation,
INVOICES.billing_genderid,
INVOICES.billing_name,
INVOICES.billing_company,
INVOICES.billing_name2,
INVOICES.billing_firstname,
INVOICES.billing_lastname,
INVOICES.billing_street,
INVOICES.billing_city,
INVOICES.billing_zipcode,
INVOICES.billing_countryid,
INVOICES.paymentid,
INVOICES.payment_duedate,
INVOICES.description,
INVOICES.datedocument,
INVOICES.datefinished,
INVOICES.pricenet,
INVOICES.tax,
INVOICES.pricegross,
INVOICES.cashdiscountpricegross,
INVOICES.paidamount,
INVOICES.debitamount,
INVOICES.statusid,
INVOICES.currencyid,
INVOICES.exchangerate,
INVOICES.exchangedate,
INVOICES.referencenumber,
INVOICES.date_printed,
INVOICES.contractnumber,
INVOICES.colorstate,
INVOICES.releasedflag,
INVOICES.printedflag,
INVOICES.closedflag,
INVOICES.canceledflag,
INVOICES.filename,
INVOICES.delflag,
INVOICES.date_added,
INVOICES.last_modified,
INVOICES.uname,
INVOICES.notaxflag,
POSTINGSRECORDS.paymentdate
From INVOICES
Left Join POSTINGSRECORDS
On INVOICES.ordernumber = POSTINGSRECORDS.invoicenumber
Where INVOICES.datedocument Between @datefrom And @dateto And
INVOICES.colorstate In (1, 2, 3, 7) And INVOICES.printedflag = 1