/// <summary>
        /// fixing table a_ap_document
        /// </summary>
        public static bool FixAPDocument(StringCollection AColumnNames, ref string[] ANewRow)
        {
            TSequenceWriter.LoadSequences();
            LoadAPDocumentNumberToId();

            string LedgerNumberAndAPNumber =
                GetValue(AColumnNames, ANewRow, "a_ledger_number_i") + "_" +
                GetValue(AColumnNames, ANewRow, "a_ap_number_i");

            if (APDocumentNumberToId.ContainsKey(LedgerNumberAndAPNumber))
            {
                SetValue(AColumnNames, ref ANewRow, "a_ap_document_id_i", APDocumentNumberToId[LedgerNumberAndAPNumber].ToString());
            }
            else
            {
                long newValue = TSequenceWriter.GetNextSequenceValue("seq_ap_document");

                SetValue(AColumnNames, ref ANewRow, "a_ap_document_id_i", newValue.ToString());
                APDocumentNumberToId.Add(LedgerNumberAndAPNumber, newValue);
            }

            if (GetValue(AColumnNames, ANewRow, "a_date_issued_d") == "\\N")
            {
                SetValue(AColumnNames, ref ANewRow, "a_date_issued_d",
                         GetValue(AColumnNames, ANewRow, "a_date_entered_d"));
            }

            // we need to set a_currency_code_c which is stored with the supplier
            SetValue(AColumnNames, ref ANewRow, "a_currency_code_c",
                     GetSupplierCurrency(Convert.ToInt64(GetValue(AColumnNames, ANewRow, "p_partner_key_n"))));

            return(true);
        }
        /// <summary>
        /// fixing table a_ap_document_payment
        /// </summary>
        public static bool FixAPDocumentPayment(StringCollection AColumnNames, ref string[] ANewRow)
        {
            TSequenceWriter.LoadSequences();
            LoadAPDocumentNumberToId();

            // a_ap_document_payment does not contain a_ap_number_i anymore, but the value has been copied into a_ap_document_id_i
            string LedgerNumberAndAPNumber =
                GetValue(AColumnNames, ANewRow, "a_ledger_number_i") + "_" +
                GetValue(AColumnNames, ANewRow, "a_ap_document_id_i");

            if (APDocumentNumberToId.ContainsKey(LedgerNumberAndAPNumber))
            {
                SetValue(AColumnNames, ref ANewRow, "a_ap_document_id_i", APDocumentNumberToId[LedgerNumberAndAPNumber].ToString());
            }
            else
            {
                long newValue = TSequenceWriter.GetNextSequenceValue("seq_ap_document");

                SetValue(AColumnNames, ref ANewRow, "a_ap_document_id_i", newValue.ToString());
                APDocumentNumberToId.Add(LedgerNumberAndAPNumber, newValue);
            }

            return(true);
        }