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;