123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- COGNOS QUERY
- STRUCTURE,1,1
- DATABASE,GC_LOCOSOFT
- DATASOURCENAME,C:\GlobalCube\System\LOCOSOFT\IQD\op\OP_aus_LOC_Belege_Deb_Saldo.imr
- TITLE,OP_aus_LOC_Belege_Deb_Saldo.imr
- BEGIN SQL
- select c1 as c1,
- c2 as c2,
- c3 as c3,
- c4 as c4,
- c5 as c5,
- c6 as c6,
- c7 as c7,
- c8 as c8,
- c9 as c9,
- c10 as c10,
- c11 as c11,
- c12 as c12,
- c13 as c13,
- c14 as c14,
- c15 as c15,
- c16 as c16,
- c17 as c17,
- c18 as c18,
- c19 as c19,
- c20 as c20,
- c21 as c21,
- c22 as c22,
- c23 as c23,
- c24 as c24,
- c25 as c25,
- c26 as c26,
- c27 as c27,
- c28 as c28,
- c29 as c29,
- c30 as c30,
- c31 as c31,
- c32 as c32,
- c33 as c33,
- c34 as c34,
- c35 as c35,
- c36 as c36,
- c37 as c37,
- c38 as c38,
- c39 as c39,
- c40 as c40,
- c41 as c41,
- c42 as c42,
- c43 as c43,
- c44 as c44,
- c45 as c45,
- c46 as c46,
- c47 as c47,
- c48 as c48,
- c49 as c49,
- c50 as c50,
- c51 as c51,
- c52 as c52,
- c53 as c53,
- c54 as c54,
- c55 as c55,
- c56 as c56,
- c57 as c57,
- c58 as c58,
- XSUM(c50 for c53) as c59,
- c60 as c60,
- c61 as c61,
- c62 as c62,
- c63 as c63,
- c64 as c64,
- c65 as c65,
- c66 as c66,
- c67 as c67,
- c68 as c68,
- c69 as c69,
- c70 as c70,
- c71 as c71,
- c72 as c72,
- c73 as c73,
- c74 as c74,
- c75 as c75,
- c76 as c76,
- c77 as c77,
- c78 as c78,
- c79 as c79
- from
- (select c112 as c1,
- c154 as c2,
- c153 as c3,
- c152 as c4,
- c109 as c5,
- c151 as c6,
- c150 as c7,
- c149 as c8,
- c148 as c9,
- c147 as c10,
- c146 as c11,
- c145 as c12,
- c144 as c13,
- c143 as c14,
- c142 as c15,
- c141 as c16,
- c140 as c17,
- c139 as c18,
- c138 as c19,
- c137 as c20,
- c136 as c21,
- c135 as c22,
- c134 as c23,
- c133 as c24,
- c132 as c25,
- c131 as c26,
- c130 as c27,
- c129 as c28,
- c128 as c29,
- c127 as c30,
- c126 as c31,
- c125 as c32,
- c124 as c33,
- c123 as c34,
- c122 as c35,
- c121 as c36,
- c120 as c37,
- c119 as c38,
- c118 as c39,
- c117 as c40,
- c116 as c41,
- c115 as c42,
- c114 as c43,
- c113 as c44,
- c99 as c45,
- c84 as c46,
- c112 as c47,
- c111 as c48,
- '1' as c49,
- c96 as c50,
- c110 as c51,
- c109 as c52,
- c83 as c53,
- c108 as c54,
- c107 as c55,
- c106 as c56,
- c105 as c57,
- c104 as c58,
- c103 as c60,
- c102 as c61,
- c101 as c62,
- c100 as c63,
- c99 as c64,
- c98 as c65,
- c97 as c66,
- c96 as c67,
- c95 as c68,
- c94 as c69,
- c93 as c70,
- c92 as c71,
- c91 as c72,
- c90 as c73,
- c89 as c74,
- c88 as c75,
- c87 as c76,
- c86 as c77,
- c85 as c78,
- c84 as c79,
- XSUM(c96 for c83) as c80
- from
- (select T5."customer_number" as c83,
- ((cast_numberToString(cast_integer(T1."branch_number")))) as c84,
- CASE WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 2 for 1)) BETWEEN '1' AND '4')) THEN ('0' || (substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 2 for 1))) ELSE null END as c85,
- CASE WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '1') THEN ('Neuwagen') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '2') THEN ('Gebrauchtwagen') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '3') THEN ('Service') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '6') THEN ('Teile') ELSE ('nicht zuzuordnen') END as c86,
- CASE WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('2','3','4'))) THEN ('Service') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('5'))) THEN ('Teile') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('6'))) THEN ('Garantie') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('7'))) THEN ('Neuwagen') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('8'))) THEN ('Gebrauchtwagen') WHEN (T1."document_type" = 'R') THEN ('Rent') ELSE ('nicht zuzuordnen') END as c87,
- (char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END))) as c88,
- T4."name" as c89,
- T4."employee_number" as c90,
- ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END)) as c91,
- CASE WHEN (T5."first_name" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T5."customer_number"))),7)) || ' - ' || T5."first_name" || ' ' || T5."family_name") ELSE ((od_left((cast_numberToString(cast_integer(T5."customer_number"))),7)) || ' - ' || T5."family_name") END as c92,
- CASE WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 0 AND 14) THEN ('< 2 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 15 AND 28) THEN ('2 - 4 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 29 AND 42) THEN ('4 - 6 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 43 AND 84) THEN ('6 - 12 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) > 84) THEN ('> 12 Wochen') ELSE null END as c93,
- (extract(DAY FROM (now()) - (cdatetime(T1."accounting_date")))) as c94,
- CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END as c95,
- (CASE WHEN (T1."debit_or_credit" = 'H') THEN (T1."posted_value" / 100 * -1) ELSE (T1."posted_value" / 100) END) as c96,
- CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END as c97,
- CASE WHEN (T7."subsidiary" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T7."subsidiary"))),1))) ELSE ('nicht zuzuordnen') END as c98,
- T1."subsidiary_to_company_ref" as c99,
- T7."invoice_date" as c100,
- T7."subsidiary" as c101,
- T7."invoice_number" as c102,
- T7."invoice_type" as c103,
- T6."document_type_description" as c104,
- T6."document_type_in_journal" as c105,
- T5."family_name" as c106,
- T5."first_name" as c107,
- T5."is_supplier" as c108,
- T1."nominal_account_number" as c109,
- CASE WHEN (T1."debit_or_credit" = 'H') THEN (T1."posted_count" / 100 * -1) ELSE (T1."posted_count" / 100) END as c110,
- CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END as c111,
- T1."accounting_date" as c112,
- CASE WHEN ((((((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%RG-BONUS%') or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%GEBURTSTAGS%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%STARTGUTHABEN%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%BONUS F%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%RG-ABZUG%')) THEN ('Bonus/Startguthaben') ELSE ('ohne Bonus/Startguthaben') END as c113,
- T1."free_form_accounting_text" as c114,
- T1."previously_used_account_no" as c115,
- T1."skr51_cost_unit" as c116,
- T1."skr51_sales_channel" as c117,
- T1."skr51_cost_center" as c118,
- T1."skr51_make" as c119,
- T1."skr51_branch" as c120,
- T1."day_of_actual_accounting" as c121,
- (asciiz(extract(YEAR FROM T1."accounting_date"),4) || '-' || asciiz(extract(MONTH FROM T1."accounting_date"),2) || '-' || asciiz(extract(DAY FROM T1."accounting_date"),2)) as c122,
- T1."vat_key" as c123,
- T1."account_statement_page" as c124,
- T1."account_statement_number" as c125,
- T1."vat_id_number" as c126,
- CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END as c127,
- CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END as c128,
- T1."term_of_payment" as c129,
- T1."cash_discount" as c130,
- T1."journal_line" as c131,
- T1."journal_page" as c132,
- T1."last_dunning_date" as c133,
- T1."dunning_level" as c134,
- CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END as c135,
- T1."invoice_date" as c136,
- T1."employee_number" as c137,
- T1."serial_number_each_month" as c138,
- T1."account_form_page_line" as c139,
- T1."account_form_page_number" as c140,
- T1."contra_account_text" as c141,
- T1."nominal_contra_account" as c142,
- T1."customer_contra_account" as c143,
- T1."branch_number" as c144,
- T1."posted_count" as c145,
- T1."debit_or_credit" as c146,
- T1."posted_value" as c147,
- T1."document_date" as c148,
- T1."clearing_number" as c149,
- T1."is_balanced" as c150,
- T1."customer_number" as c151,
- T1."position_in_document" as c152,
- (intdiv(T1."document_number",1)) as c153,
- T1."document_type" as c154
- from (((((("journal_accountings" T1 left outer join "vehicles" T2 on (od_right(T1."vehicle_reference",17)) = T2."vin") left outer join "employees" T3 on (T2."salesman_number" <> 0) and (T2."salesman_number" = T3."salesman_number")) left outer join "LOCOSOFT"."dbo"."employees" T4 on T1."employee_number" = T4."employee_number") left outer join "LOCOSOFT"."dbo"."customers_suppliers" T5 on T5."customer_number" = T1."customer_number") left outer join "document_types" T6 on T6."document_type_in_journal" = T1."document_type") left outer join "invoices" T7 on T7."invtype_invnr" = T1."invoice_number")
- where (((((T1."nominal_account_number" IN (1400,1409,1451,1408,1525)) and (T1."clearing_number" = 0)) and (T1."customer_number" IS NOT NULL)) and (not T6."document_type_in_journal" IN ('A','E','U','V'))) and (T5."customer_number" IS NOT NULL))
- ) D2
- ) D1
- where (c80 <> 0)
- order by c6 asc,c57 asc,c5 asc
- END SQL
- COLUMN,0,Accounting Date
- COLUMN,1,Document Type
- COLUMN,2,Document Number
- COLUMN,3,Position In Document
- COLUMN,4,Nominal Account Number
- COLUMN,5,Customer Number
- COLUMN,6,Is Balanced
- COLUMN,7,Clearing Number
- COLUMN,8,Document Date
- COLUMN,9,Posted Value
- COLUMN,10,Debit Or Credit
- COLUMN,11,Posted Count
- COLUMN,12,Branch Number
- COLUMN,13,Customer Contra Account
- COLUMN,14,Nominal Contra Account
- COLUMN,15,Contra Account Text
- COLUMN,16,Account Form Page Number
- COLUMN,17,Account Form Page Line
- COLUMN,18,Serial Number Each Month
- COLUMN,19,Employee Number
- COLUMN,20,Invoice Date
- COLUMN,21,Invoice Number
- COLUMN,22,Dunning Level
- COLUMN,23,Last Dunning Date
- COLUMN,24,Journal Page
- COLUMN,25,Journal Line
- COLUMN,26,Cash Discount
- COLUMN,27,Term Of Payment
- COLUMN,28,Posting Text
- COLUMN,29,Vehicle Reference
- COLUMN,30,Vat Id Number
- COLUMN,31,Account Statement Number
- COLUMN,32,Account Statement Page
- COLUMN,33,Vat Key
- COLUMN,34,Days For Cash Discount
- COLUMN,35,Day Of Actual Accounting
- COLUMN,36,Skr51 Branch
- COLUMN,37,Skr51 Make
- COLUMN,38,Skr51 Cost Center
- COLUMN,39,Skr51 Sales Channel
- COLUMN,40,Skr51 Cost Unit
- COLUMN,41,Previously Used Account No
- COLUMN,42,Free Form Accounting Text
- COLUMN,43,Free Form Document Text
- COLUMN,44,Rechtseinheit
- COLUMN,45,Betrieb
- COLUMN,46,Bookkeep Date
- COLUMN,47,Text
- COLUMN,48,Mandant
- COLUMN,49,Betrag
- COLUMN,50,Menge
- COLUMN,51,Acct Nr
- COLUMN,52,Customer Number_suctomer_supplier
- COLUMN,53,Is Supplier
- COLUMN,54,First Name
- COLUMN,55,Family Name
- COLUMN,56,Document Type In Journal
- COLUMN,57,Document Type Description
- COLUMN,58,Debitorsaldo
- COLUMN,59,Invoice Type_Invoices
- COLUMN,60,Invoice Number_Invoices
- COLUMN,61,Subsidiary_Invoices
- COLUMN,62,Invoice Date_Invoices
- COLUMN,63,Hauptbetrieb
- COLUMN,64,Standort_ori
- COLUMN,65,Sel Name
- COLUMN,66,OP-Saldo_
- COLUMN,67,Kostenstelle
- COLUMN,68,Tage
- COLUMN,69,Staffel
- COLUMN,70,Kunde
- COLUMN,71,Beleg
- COLUMN,72,Employee Number_Employees_journal_accountings
- COLUMN,73,Name_Employees_journal_accountings
- COLUMN,74,Anzahl_Stellen_Invoice_Number
- COLUMN,75,Forderungsart_aus_erste_Stelle_Inv_Number
- COLUMN,76,Forderungsart
- COLUMN,77,Standort_aus_2_Stelle_Invoice_Number
- COLUMN,78,Standort
|