Einzelnen Beitrag anzeigen

manfred_h

Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
 
Delphi XE2 Enterprise
 
#27

Re: Buchhaltungsprobelm / Grundlage

  Alt 18. Feb 2009, 10:12
Habe jezt eine Lösung gefunden.
@mkinzler: Danke für deinen Denkanstoss.
@mjustin: Danke für Deine Anregugen.
@Hansa: Danke für die Anmerkung betreffs der Feldnamen

Habe eine zusätzliche Tabelle BOOKKEEPING_BOOKING_PRINT erstellt. Darin werden die Daten vor dem Ausdruck "gesammelt" und "aufbereitet".

Delphi-Quellcode:
  dm.pFIBScript.Script.Text :='INSERT INTO BOOKKEEPING_BOOKING_PRINT (C_NO, U_NO, ACNO, ACTEXT, BDATE, VOUCHER_NO, BTEXT, DEBIT_AMOUNT, CREDIT_AMOUNT, ACNO_CROSS, DEBIT_ACNO, CREDIT_ACNO, DEBIT_ACTYPE, CREDIT_ACTYPE)'+
                              'SELECT '+
                              'BOOKKEEPING_BOOKING.C_NO,'+
                              'BOOKKEEPING_BOOKING.U_NO,'+
                              'BOOKKEEPING_CHART_ACCOUNTS.ACNO,'+
                              'BOOKKEEPING_CHART_ACCOUNTS.ACTEXT,'+
                              'BOOKKEEPING_BOOKING.BDATE,'+
                              'BOOKKEEPING_BOOKING.VOUCHER_NO,'+
                              'BOOKKEEPING_BOOKING.BTEXT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACTYPE > 999 AND BOOKKEEPING_BOOKING.DEBIT_ACTYPE < 2000 '+
                              'THEN BOOKKEEPING_BOOKING.AMOUNT END )DEBIT_AMOUNT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACTYPE > 1999 AND BOOKKEEPING_BOOKING.DEBIT_ACTYPE < 3000 '+
                              'THEN BOOKKEEPING_BOOKING.AMOUNT END )CREDIT_AMOUNT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACNO = BOOKKEEPING_CHART_ACCOUNTS.ACNO '+
                              'THEN BOOKKEEPING_BOOKING.CREDIT_ACNO ELSE BOOKKEEPING_BOOKING.DEBIT_ACNO END ) ACNO_CROSS,'+
                              'BOOKKEEPING_BOOKING.DEBIT_ACNO,'+
                              'BOOKKEEPING_BOOKING.CREDIT_ACNO,'+
                              'BOOKKEEPING_BOOKING.DEBIT_ACTYPE,'+
                              'BOOKKEEPING_BOOKING.CREDIT_ACTYPE '+
                              'FROM BOOKKEEPING_BOOKING '+
                              'INNER JOIN BOOKKEEPING_CHART_ACCOUNTS ON (BOOKKEEPING_BOOKING.CREDIT_ACNO = BOOKKEEPING_CHART_ACCOUNTS.ACNO);'+
                              'COMMIT WORK;'+
                              'INSERT INTO BOOKKEEPING_BOOKING_PRINT (C_NO, U_NO, ACNO, ACTEXT, BDATE, VOUCHER_NO, BTEXT, DEBIT_AMOUNT, CREDIT_AMOUNT, ACNO_CROSS, DEBIT_ACNO, CREDIT_ACNO, DEBIT_ACTYPE, CREDIT_ACTYPE)'+
                              'SELECT '+
                              'BOOKKEEPING_BOOKING.C_NO,'+
                              'BOOKKEEPING_BOOKING.U_NO,'+
                              'BOOKKEEPING_CHART_ACCOUNTS.ACNO,'+
                              'BOOKKEEPING_CHART_ACCOUNTS.ACTEXT,'+
                              'BOOKKEEPING_BOOKING.BDATE,'+
                              'BOOKKEEPING_BOOKING.VOUCHER_NO,'+
                              'BOOKKEEPING_BOOKING.BTEXT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACTYPE > 999 AND BOOKKEEPING_BOOKING.DEBIT_ACTYPE < 2000 '+
                              'THEN BOOKKEEPING_BOOKING.AMOUNT END )DEBIT_AMOUNT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACTYPE > 1999 AND BOOKKEEPING_BOOKING.DEBIT_ACTYPE < 3000 '+
                              'THEN BOOKKEEPING_BOOKING.AMOUNT END )CREDIT_AMOUNT,'+
                              '(CASE '+
                              'WHEN BOOKKEEPING_BOOKING.DEBIT_ACNO = BOOKKEEPING_CHART_ACCOUNTS.ACNO '+
                              'THEN BOOKKEEPING_BOOKING.CREDIT_ACNO ELSE BOOKKEEPING_BOOKING.DEBIT_ACNO END ) ACNO_CROSS,'+
                              'BOOKKEEPING_BOOKING.DEBIT_ACNO,'+
                              'BOOKKEEPING_BOOKING.CREDIT_ACNO,'+
                              'BOOKKEEPING_BOOKING.DEBIT_ACTYPE,'+
                              'BOOKKEEPING_BOOKING.CREDIT_ACTYPE '+
                              'FROM BOOKKEEPING_BOOKING '+
                              'INNER JOIN BOOKKEEPING_CHART_ACCOUNTS ON (BOOKKEEPING_BOOKING.DEBIT_ACNO = BOOKKEEPING_CHART_ACCOUNTS.ACNO);'+
                              'COMMIT WORK;';
  dm.pFIBScript.ExecuteScript;
Shalom
Manfred
  Mit Zitat antworten Zitat