Upload Benning

This commit is contained in:
2024-06-19 12:52:05 +02:00
parent 777919b647
commit 99a1c8ee03
2 changed files with 537 additions and 0 deletions

446
Benning/BEN_ax_export.jpl Normal file
View File

@@ -0,0 +1,446 @@
proc ax_export( doku_id_ref, file_destination, import_ok, user, doc_type_short )
{
if ( ( doc_type_short == "FAKER" ) && ( dok_dat_feld[ 44 ] == "INVOICE_READER" ) )
{
///////////////////////////////////////////////////////////////////////////////
// Export der Eingangsrechnungen zu Microsoft Dynamics AX
///////////////////////////////////////////////////////////////////////////////
call xlog( 4, "AX-EXP: erzeuge Output für Microsoft Dynamics AX ... ")
vars ablagepfad = "D\:\\d3\\apps\\fuer_AX\\"
//vars ablagepfad = "D\:\\d3\\Import\\D3T\\Axapta\\d3scan\\"
//vars ablagepfad = "\\\\tbbsrv28\\Bereich\\AxaptaImportExport\\DE1\\Eingangsrechnungen\\"
vars dateiname, anzahl_treffer, i
vars system_id, company_code, invoice_number, invoice_date, document_type, posting_date, scan_date, vendor_number, po_numbers, net_amount_invoice_currency
vars tax_amount, currency, invoicetype, accounting_clerk, verifier, approved_by, wfl_type, wfl_external_state, schluessel, ergebnis, po_numbers_arr[1000]
vars abteilung, kostenstelle, kostentraeger, gegenkonto, roundoff, enddisc, cashdisc_date, cashdisc_amount
vars sz_nr[100]
vars sz_kuerzel[100]
vars sz_text[100]
vars sz_betrag[100]
vars dummy = ""
call xlog( 4, "AX-EXP: hole Kopfdaten ... " )
///////////////////////////////////////////////////////////////////////////////
// Kopfdaten
///////////////////////////////////////////////////////////////////////////////
// Als System-ID wird in Zukunft der Barcode übergeben. Der Barcode kommt vom Scanning
// in DDF 4.
if ( dok_dat_feld[ 4 ] == "" )
{
system_id = doku_id_ref
}
else
{
system_id = dok_dat_feld[ 4 ]
}
dateiname = doku_id_ref ## ".jpl"
company_code = dok_dat_feld[ 45 ]
invoice_number = dok_dat_feld[ 22 ]
invoice_date = dok_dat_feld[ 54 ]
document_type = "FAKER"
posting_date = dok_dat_feld[ 55 ]
scan_date = dok_dat_feld[ 50 ]
vendor_number = dok_dat_feld[ 82 ]
po_numbers = dok_dat_feld[ 13 ]
net_amount_invoice_currency = dok_dat_feld[ 75 ]
// bruttobetrag doc_field_70
ergebnis = api_function( "string_replace", net_amount_invoice_currency, ",", "." )
net_amount_invoice_currency = api_converted_string
tax_amount = dok_dat_feld[ 70 ]
ergebnis = api_function( "string_replace", tax_amount, ",", "." )
tax_amount = api_converted_string
////// neue Felder
roundoff = dok_dat_feld[ 73 ]
ergebnis = api_function( "string_replace", roundoff, ",", "." )
roundoff = api_converted_string
enddisc = dok_dat_feld[ 74 ]
ergebnis = api_function( "string_replace", enddisc, ",", "." )
enddisc = api_converted_string
currency = dok_dat_feld[ 43 ]
invoicetype = dok_dat_feld[ 34 ]
abteilung = dok_dat_feld[ 27 ]
kostenstelle = dok_dat_feld[ 23 ]
kostentraeger = dok_dat_feld[ 24 ]
gegenkonto = dok_dat_feld[ 21 ]
accounting_clerk = "" // wird nicht geliefert
verifier = dok_dat_feld[ 28 ]
approved_by = dok_dat_feld[ 8 ]
schluessel = dok_dat_feld[ 48 ]
wfl_type = dok_dat_feld[ 20 ]
wfl_external_state = "" // ????
cashdisc_date = dok_dat_feld[ 57 ]
cashdisc_amount = dok_dat_feld[ 76 ]
call xlog( 4, "AX-EXP: Ablagepfad <:ablagepfad> " )
call xlog( 4, "AX-EXP: Dateiname <:dateiname> " )
call xlog( 4, "AX-EXP: ------------------------------------------- " )
call xlog( 5, "AX-EXP: system_id <:system_id> " )
call xlog( 5, "AX-EXP: doku_id <:doku_id_ref> " )
call xlog( 5, "AX-EXP: company_code <:company_code> " )
call xlog( 5, "AX-EXP: invoice_number <:invoice_number> " )
call xlog( 5, "AX-EXP: invoice_date <:invoice_date> " )
call xlog( 5, "AX-EXP: document_type <:document_type> " )
call xlog( 5, "AX-EXP: posting_date <:posting_date> " )
call xlog( 5, "AX-EXP: scan_date <:scan_date> " )
call xlog( 5, "AX-EXP: vendor_number <:vendor_number> " )
//call xlog( 5, "AX-EXP: po_numbers <:po_numbers> " )
ergebnis = api_function( "string_split", po_numbers, "," )
if ( ergebnis >= 0 )
{
for i = 1 while ( i <= ergebnis ) step 1
{
po_numbers_arr[i] = api_splitted_string[i]
call xlog( 5, "AX-EXP: po_numbers <:po_numbers_arr[:i]> " )
}
}
call xlog( 5, "AX-EXP: net_amount_invoice_currency <:net_amount_invoice_currency> " )
call xlog( 5, "AX-EXP: tax_amount <:tax_amount> " )
call xlog( 5, "AX-EXP: currency <:currency> " )
call xlog( 5, "AX-EXP: invoice_type <:invoicetype> " )
call xlog( 5, "AX-EXP: abteilung <:abteilung> " )
call xlog( 5, "AX-EXP: kostenstelle <:kostenstelle> " )
call xlog( 5, "AX-EXP: kostentraeger <:kostentraeger> " )
call xlog( 5, "AX-EXP: gegenkonto <:gegenkonto> " )
call xlog( 5, "AX-EXP: accounting_clerk <:accounting_clerk> " )
call xlog( 5, "AX-EXP: verifier <:verifier> " )
call xlog( 5, "AX-EXP: approved_by <:approved_by> " )
call xlog( 5, "AX-EXP: schluessel <:schluessel> " )
call xlog( 5, "AX-EXP: wfl_type <:wfl_type> " )
call xlog( 5, "AX-EXP: wfl_external_state <:wfl_external_state> " )
call xlog( 5, "AX-EXP: cashdisc_date <:cashdisc_date> " )
call xlog( 5, "AX-EXP: cashdisc_amount <:cashdisc_amount> " )
call xlog( 4, "AX-EXP: schreibe Kopfdaten ... " )
call api_function( "file_add_line", ablagepfad ## dateiname, "System_ID = \":system_id\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "doku_id = \":doku_id_ref\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Company_Code = \":company_code\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Invoice_Number = \":invoice_number\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Invoice_Date = \":invoice_date\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Document_Type = \":document_type\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Posting_Date = \":posting_date\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Scan_Date = \":scan_date\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Vendor_Number = \":vendor_number\" " , "APPEND" )
//call api_function( "file_add_line", ablagepfad ## dateiname, "PO_Numbers = \":po_numbers\" " , "APPEND" )
if ( dok_dat_feld[ 2 ] == "Rechnung mit Bestellbezug" )
{
if ( ergebnis >= 0 )
{
for i = 1 while ( i <= ergebnis ) step 1
{
call api_function( "file_add_line", ablagepfad ## dateiname, "PO_Number[:i] = \":po_numbers_arr[:i]\" " , "APPEND" )
}
}
}
call api_function( "file_add_line", ablagepfad ## dateiname, "Net_Amount_Invoice_Currency = \":net_amount_invoice_currency\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Tax_Amount = \":tax_amount\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Currency = \":currency\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Invoice_Type = \":invoicetype\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Accounting_Clerk = \":accounting_clerk\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Verifier = \":verifier\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Approved_By = \":approved_by\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Header_Dimension1 = \":abteilung\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Header_Dimension2 = \":kostenstelle\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Header_Dimension3 = \":kostentraeger\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "Header_ACaccount = \":gegenkonto\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "wfl_type = \":wfl_type\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "wfl_external_state = \":wfl_external_state\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "ROUNDOFF = \":roundoff\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "ENDDISC = \":enddisc\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "CASHDISC_DATE = \":cashdisc_date\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "CASHDISC_AMOUNT = \":cashdisc_amount\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, " " , "APPEND" )
///////////////////////////////////////////////////////////////////////////////
// sonstige Zuschläge (Kopfebene)
///////////////////////////////////////////////////////////////////////////////
if ( dok_dat_feld[ 2 ] == "Rechnung mit Bestellbezug" )
{
call xlog( 4, "AX-EXP: hole kopfbezogene Zuschläge (Schlüssel <:schluessel>) ..." )
//dbms declare ta_session connection for user 'd3scan' password 'D3_Scan' datasource 'D3T'
//dbms with connection ta_session
dbms alias sz_nr, sz_kuerzel, sz_text, sz_betrag
//dbms with connection ta_session
dbms sql select sz_nr, sz_kuerzel, sz_text, sz_betrag from ax_sz_kopf where schluessel = :+schluessel order by sz_nr
anzahl_treffer = @dmrowcount
//dbms with connection ta_session alias
dbms alias
//dbms close connection ta_session
if ( anzahl_treffer > 0 )
{
for i = 1 while i <= 100 step 1
{
if ( sz_kuerzel[i] == "" )
{
i = i - 1
break
}
call api_function( "file_add_line", ablagepfad ## dateiname, "HEADER_Markup_Code:i = \":sz_kuerzel[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "HEADER_Markup_Desc:i = \":sz_text[:i]\" " , "APPEND" )
ergebnis = api_function( "string_replace", sz_betrag[ i ], ",", "." )
sz_betrag[ i ] = api_converted_string
call api_function( "file_add_line", ablagepfad ## dateiname, "HEADER_Markup_Amount:i = \":sz_betrag[:i]\" " , "APPEND" )
}
call xlog( 4, "AX-EXP: :i kopfbezogene Zuschläge exportiert." )
call api_function( "file_add_line", ablagepfad ## dateiname, " " , "APPEND" )
}
else
{
call xlog( 3, "AX-EXP: keine kopfbezogenen Zuschläge gefunden!" )
}
}
///////////////////////////////////////////////////////////////////////////////
// Positionsdaten und positionsbezogene sonstige Zuschläge
///////////////////////////////////////////////////////////////////////////////
if ( dok_dat_feld[ 2 ] == "Rechnung mit Bestellbezug" )
{
call xlog( 4, "AX-EXP: hole Positionsdaten und positionsbezogene Zuschläge (Schlüssel <:schluessel>) ..." )
vars lid_po_number[1000], lid_po_line_number[1000], lid_po_inventtransid[1000], lid_item_number[1000], lid_configid[1000], lid_sizeid[1000]
vars lid_colorid[1000], lid_delivery_note_number[1000], lid_quantity[1000], lid_unit[1000], lid_discpercent[1000], lid_discamount[1000]
vars lid_item_amount[1000], lid_amount[1000], lid_approver[1000], sp_ok[1000], pos_nr[1000], sp_e_art_nr[1000], sp_art_besch[1000]
vars lid_priceunit[1000]
vars lid_markup_code1[1000], lid_markup_desc1[1000], lid_markup_amount1[1000]
vars lid_markup_code2[1000], lid_markup_desc2[1000], lid_markup_amount2[1000]
vars lid_markup_code3[1000], lid_markup_desc3[1000], lid_markup_amount3[1000]
vars lid_markup_code4[1000], lid_markup_desc4[1000], lid_markup_amount4[1000]
//dbms declare ta_session2 connection for user 'd3scan' password 'D3_Scan' datasource 'D3T'
//dbms with connection ta_session2
dbms alias pos_nr, sp_ok, lid_po_number, lid_po_line_number, lid_po_inventtransid, \
lid_item_number, sp_e_art_nr, sp_art_besch, lid_delivery_note_number, lid_quantity, lid_item_amount, lid_amount, \
lid_priceunit, \
lid_markup_code1, lid_markup_amount1, lid_markup_code2, lid_markup_amount2, \
lid_markup_code3, lid_markup_amount3, lid_markup_code4, lid_markup_amount4
//dbms with connection ta_session2
dbms sql select pos_nr, sp_ok, sp_best_nr, sp_best_pos, sp_lager_nr, sp_i_art_nr, sp_e_art_nr, \
sp_art_besch, sp_lief_nr, sp_menge, sp_preis, sp_posbetrag, sp_preismenge, \
sz_kuerzel_01, sz_betrag_01, \
sz_kuerzel_02, sz_betrag_02, \
sz_kuerzel_03, sz_betrag_03, \
sz_kuerzel_04, sz_betrag_04 from ax_pos_tabelle where schluessel = :+schluessel order by pos_nr
anzahl_treffer = @dmrowcount
//dbms with connection ta_session2 alias
dbms alias
//dbms close connection ta_session2
call xlog( 5, "AX-EXP: Es wurden :anzahl_treffer Treffer gefunden." )
if ( anzahl_treffer > 0 )
{
for i = 1 while i <= 1000 step 1
{
if ( lid_po_number[i] == "" )
{
i = i - 1
break
}
call xlog( 4, "AX-EXP: schreibe Positionszeile :i .... " )
call xlog( 4, "AX-EXP: LID_PO_Number[:i] = \":lid_po_number[:i]\" " )
call xlog( 4, "AX-EXP: LID_PO_Line_Number[:i] = \":lid_po_line_number[:i]\" " )
call xlog( 4, "AX-EXP: LID_PO_InventTransId[:i] = \":lid_po_inventtransid[:i]\" " )
call xlog( 4, "AX-EXP: LID_Item_Number[:i] = \":lid_item_number[:i]\" " )
call xlog( 4, "AX-EXP: LID_ConfigId[:i] = \":lid_configid[:i]\" " )
call xlog( 4, "AX-EXP: LID_SizeId[:i] = \":lid_sizeid[:i]\" " )
call xlog( 4, "AX-EXP: LID_ColorId[:i] = \":lid_colorid[:i]\" " )
call xlog( 4, "AX-EXP: LID_Delivery_Note_Number[:i] = \":lid_delivery_note_number[:i]\" " )
call xlog( 4, "AX-EXP: LID_Quantity[:i] = \":lid_quantity[:i]\" " )
call xlog( 4, "AX-EXP: LID_Unit[:i] = \":lid_unit[:i]\" " )
call xlog( 4, "AX-EXP: LID_DiscPercent[:i] = \":lid_discpercent[:i]\" " )
call xlog( 4, "AX-EXP: LID_Item_Amount[:i] = \":lid_item_amount[:i]\" " )
ergebnis = api_function( "string_replace", lid_item_amount[ i ], ",", "." )
lid_item_amount[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_Item_Amount[:i] = \":lid_item_amount[:i]\" " )
call xlog( 4, "AX-EXP: LID_Amount[:i] = \":lid_amount[:i]\" " )
ergebnis = api_function( "string_replace", lid_amount[ i ], ",", "." )
lid_amount[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_Amount[:i] = \":lid_amount[:i]\" " )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_PO_Number[:i] = \":lid_po_number[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_PO_Line_Number[:i] = \":lid_po_line_number[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_PO_InventTransId[:i] = \":lid_po_inventtransid[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Item_Number[:i] = \":lid_item_number[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_ConfigId[:i] = \":lid_configid[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_SizeId[:i] = \":lid_sizeid[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_ColorId[:i] = \":lid_colorid[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Delivery_Note_Number[:i] = \":lid_delivery_note_number[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Quantity[:i] = \":lid_quantity[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Unit[:i] = \":lid_unit[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_DiscPercent[:i] = \":lid_discpercent[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_DiscAmount[:i] = \":lid_discamount[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Item_Amount[:i] = \":lid_item_amount[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Amount[:i] = \":lid_amount[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_PRICEUNIT[:i] = \":lid_priceunit[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, " " , "APPEND" )
call xlog( 4, "AX-EXP: schreibe sonstige Zuschläge für Position :i ... " )
call xlog( 4, "AX-EXP: LID_MARKUP_CODE1[:i] = \":lid_markup_code1[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_DESC1[:i] = \":dummy\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_AMOUNT1[:i] = \":lid_markup_amount1[:i]\" " )
ergebnis = api_function( "string_replace", lid_markup_amount1[ i ], ",", "." )
lid_markup_amount1[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_MARKUP_AMOUNT1[:i] = \":lid_markup_amount1[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_CODE2[:i] = \":lid_markup_code2[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_DESC2[:i] = \":dummy\" " )
ergebnis = api_function( "string_replace", lid_markup_amount2[ i ], ",", "." )
lid_markup_amount2[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_MARKUP_AMOUNT2[:i] = \":lid_markup_amount2[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_CODE3[:i] = \":lid_markup_code3[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_DESC3[:i] = \":dummy\" " )
ergebnis = api_function( "string_replace", lid_markup_amount3[ i ], ",", "." )
lid_markup_amount3[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_MARKUP_AMOUNT3[:i] = \":lid_markup_amount3[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_CODE4[:i] = \":lid_markup_code4[:i]\" " )
call xlog( 4, "AX-EXP: LID_MARKUP_DESC4[:i] = \":dummy\" " )
ergebnis = api_function( "string_replace", lid_markup_amount4[ i ], ",", "." )
lid_markup_amount4[ i ] = api_converted_string
call xlog( 4, "AX-EXP: LID_MARKUP_AMOUNT4[:i] = \":lid_markup_amount4[:i]\" " )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_CODE1[:i] = \":lid_markup_code1[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_DESC1[:i] = \":dummy\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_AMOUNT1[:i] = \":lid_markup_amount1[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_CODE2[:i] = \":lid_markup_code2[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_DESC2[:i] = \":dummy\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_AMOUNT2[:i] = \":lid_markup_amount2[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_CODE3[:i] = \":lid_markup_code3[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_DESC3[:i] = \":dummy\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_AMOUNT3[:i] = \":lid_markup_amount3[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_CODE4[:i] = \":lid_markup_code4[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_DESC4[:i] = \":dummy\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_MARKUP_AMOUNT4[:i] = \":lid_markup_amount4[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, " " , "APPEND" )
}
call xlog( 4, "AX-EXP: :i Positionszeilen exportiert." )
}
else
{
call xlog( 3, "AX-EXP: keine Positionszeilen gefunden!" )
}
}
else
{
call xlog( 4, "AX-EXP: hole RoB-Zeilen (Schlüssel <:schluessel>) ..." )
vars pos_nr[1000], sp_gegen_konto[1000], sp_buchungs_text[1000], sp_kosten_stelle[1000], sp_kosten_traeger[1000], sp_mwst_gruppe[1000], sp_art_mwst_gruppe[1000], sp_mwst_code[1000], sp_projekt[1000], sp_abteilung[1000], sp_posbetrag[1000]
dbms alias pos_nr, sp_gegen_konto, sp_buchungs_text, sp_kosten_stelle, sp_kosten_traeger, sp_mwst_gruppe, sp_art_mwst_gruppe, sp_mwst_code, sp_projekt, sp_abteilung, sp_posbetrag
dbms sql select pos_nr, sp_gegen_konto, sp_buchungs_text, sp_kosten_stelle, sp_kosten_traeger, sp_mwst_gruppe, sp_art_mwst_gruppe, sp_mwst_code, sp_projekt, sp_abteilung, sp_posbetrag \
from ax_pos_tabelle \
where schluessel = :+schluessel
anzahl_treffer = @dmrowcount
dbms alias
//call xlog( 4, "Anzahl Treffer: " ## anzahl_treffer )
if ( anzahl_treffer > 0 )
{
for i = 1 while i <= anzahl_treffer step 1
{
if ( pos_nr[i] == "" )
{
i = i - 1
break
}
call xlog( 4, "AX-EXP: pos_nr " ## pos_nr[ i ] )
call xlog( 4, "AX-EXP: sp_gegen_konto " ## sp_gegen_konto[ i ] )
call xlog( 4, "AX-EXP: sp_kosten_stelle " ## sp_kosten_stelle[ i ] )
call xlog( 4, "AX-EXP: sp_kosten_traeger " ## sp_kosten_traeger[ i ] )
//call xlog( 4, "AX-EXP: sp_mwst_gruppe " ## sp_mwst_gruppe[ i ] )
call xlog( 4, "AX-EXP: sp_art_mwst_gruppe " ## sp_art_mwst_gruppe[ i ] )
//call xlog( 4, "AX-EXP: sp_mwst_code " ## sp_mwst_code[ i ] )
call xlog( 4, "AX-EXP: sp_projekt " ## sp_projekt[ i ] )
call xlog( 4, "AX-EXP: sp_abteilung " ## sp_abteilung[ i ] )
call xlog( 4, "AX-EXP: sp_posbetrag " ## sp_posbetrag[ i ] )
call xlog( 4, "AX-EXP: sp_buchungs_text " ## sp_buchungs_text[ i ] )
//call api_function( "file_add_line", ablagepfad ## dateiname, "HEADER_Markup_Code:i = \":sz_kuerzel[:i]\" " , "APPEND" )
//call api_function( "file_add_line", ablagepfad ## dateiname, "LID_ID[:i] = \":i\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_GL_Account[:i] = \":sp_gegen_konto[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Dimension2[:i] = \":sp_kosten_stelle[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Dimension3[:i] = \":sp_kosten_traeger[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Tax_Code[:i] = \":sp_art_mwst_gruppe[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Dimension1[:i] = \":sp_abteilung[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Amount[:i] = \":sp_posbetrag[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Dimension4[:i] = \":sp_projekt[:i]\" " , "APPEND" )
call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Text[:i] = \":sp_buchungs_text[:i]\" " , "APPEND" )
//call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Amount[:i] = \":sp_mwst_code[:i]\" " , "APPEND" )
//call api_function( "file_add_line", ablagepfad ## dateiname, "LID_Amount[:i] = \":sp_mwst_gruppe[:i]\" " , "APPEND" )
}
call xlog( 4, "AX-EXP: :i RoB-Zeilen exportiert." )
}
else
{
call xlog( 3, "AX-EXP: keine RoB-Zeilen gefunden!" )
}
}
}
}

91
Benning/readme.txt Normal file
View File

@@ -0,0 +1,91 @@
Der Hook setzt folgende DB-Tabellen voraus:
CREATE TABLE [dbo].[ax_sz_kopf](
[SCHLUESSEL] [varchar](10) NULL,
[SZ_NR] [int] NULL,
[SZ_KUERZEL] [varchar](200) NULL,
[SZ_TEXT] [varchar](200) NULL,
[SZ_BETRAG] [decimal](15, 2) NULL
);
CREATE TABLE [dbo].[ax_pos_tabelle](
[SCHLUESSEL] [varchar](10) NULL,
[POS_NR] [int] NULL,
[SP_OK] [varchar](200) NULL,
[SP_BEST_NR] [varchar](200) NULL,
[SP_BEST_POS] [varchar](200) NULL,
[SP_LAGER_NR] [varchar](200) NULL,
[SP_I_ART_NR] [varchar](200) NULL,
[SP_E_ART_NR] [varchar](200) NULL,
[SP_ART_BESCH] [varchar](200) NULL,
[SP_LIEF_NR] [varchar](200) NULL,
[SP_MENGE] [varchar](200) NULL,
[SP_PREIS] [decimal](15, 2) NULL,
[SP_POSBETRAG] [decimal](15, 2) NULL,
[SZ_KUERZEL_01] [varchar](200) NULL,
[SZ_BETRAG_01] [decimal](15, 2) NULL,
[SZ_KUERZEL_02] [varchar](200) NULL,
[SZ_BETRAG_02] [decimal](15, 2) NULL,
[SZ_KUERZEL_03] [varchar](200) NULL,
[SZ_BETRAG_03] [decimal](15, 2) NULL,
[SZ_KUERZEL_04] [varchar](200) NULL,
[SZ_BETRAG_04] [decimal](15, 2) NULL,
[SP_PREISMENGE] [decimal](15, 2) NULL,
[SP_GEGEN_KONTO] [varchar](200) NULL,
[SP_KOSTEN_STELLE] [varchar](200) NULL,
[SP_KOSTEN_TRAEGER] [varchar](200) NULL,
[SP_MWST_GRUPPE] [varchar](200) NULL,
[SP_ART_MWST_GRUPPE] [varchar](200) NULL,
[SP_MWST_CODE] [varchar](200) NULL,
[SP_PROJEKT] [varchar](200) NULL,
[SP_ABTEILUNG] [varchar](200) NULL
);
Die Tabellen stehen hier in SQL-Server-Notation (siehe mein Testsystem), der Kunde setzt Oracle ein. Hier sehen die Tabellen so aus:
SQL> desc ax_sz_kopf;
Name Null? Typ
----------------------- -------- ----------------
SCHLUESSEL VARCHAR2(10)
SZ_NR NUMBER(38)
SZ_KUERZEL VARCHAR2(200)
SZ_TEXT VARCHAR2(200)
SZ_BETRAG NUMBER(15,2)
SQL> desc ax_pos_tabelle;
Name Null? Typ
----------------------- -------- --------------
SCHLUESSEL VARCHAR2(10)
POS_NR NUMBER(38)
SP_OK VARCHAR2(200)
SP_BEST_NR VARCHAR2(200)
SP_BEST_POS VARCHAR2(200)
SP_LAGER_NR VARCHAR2(200)
SP_I_ART_NR VARCHAR2(200)
SP_E_ART_NR VARCHAR2(200)
SP_ART_BESCH VARCHAR2(200)
SP_LIEF_NR VARCHAR2(200)
SP_MENGE VARCHAR2(200)
SP_PREIS NUMBER(15,2)
SP_POSBETRAG NUMBER(15,2)
SZ_KUERZEL_01 VARCHAR2(200)
SZ_BETRAG_01 NUMBER(15,2)
SZ_KUERZEL_02 VARCHAR2(200)
SZ_BETRAG_02 NUMBER(15,2)
SZ_KUERZEL_03 VARCHAR2(200)
SZ_BETRAG_03 NUMBER(15,2)
SZ_KUERZEL_04 VARCHAR2(200)
SZ_BETRAG_04 NUMBER(15,2)
SP_PREISMENGE NUMBER(15,2)
SP_GEGEN_KONTO VARCHAR2(200)
SP_KOSTEN_STELLE VARCHAR2(200)
SP_KOSTEN_TRAEGER VARCHAR2(200)
SP_MWST_GRUPPE VARCHAR2(200)
SP_ART_MWST_GRUPPE VARCHAR2(200)
SP_MWST_CODE VARCHAR2(200)
SP_PROJEKT VARCHAR2(200)
SP_ABTEILUNG VARCHAR2(200)
Die Export-Prozedur wird im insert_entry-Hook aufgerufen.