Add AD auth and B1 currency fields
This commit is contained in:
@@ -82,6 +82,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
PurchaseOrderNumber = r.PurchaseOrderNumber,
|
||||
SalesPriceValue = r.SalesPriceValue,
|
||||
SalesCurrency = r.SalesCurrency,
|
||||
DocumentCurrency = r.DocumentCurrency,
|
||||
DocumentTotalForeignCurrency = r.DocumentTotalForeignCurrency,
|
||||
DocumentTotalLocalCurrency = r.DocumentTotalLocalCurrency,
|
||||
VatSumForeignCurrency = r.VatSumForeignCurrency,
|
||||
VatSumLocalCurrency = r.VatSumLocalCurrency,
|
||||
DocumentRate = r.DocumentRate,
|
||||
CompanyCurrency = r.CompanyCurrency,
|
||||
Incoterms2020 = r.Incoterms2020,
|
||||
SalesResponsibleEmployee = r.SalesResponsibleEmployee,
|
||||
InvoiceDate = r.InvoiceDate,
|
||||
@@ -158,14 +165,16 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
Material, Name, ProductGroup, Quantity, SupplierNumber, SupplierName, SupplierCountry,
|
||||
CustomerNumber, CustomerName, CustomerCountry, CustomerIndustry, StandardCost,
|
||||
StandardCostCurrency, PurchaseOrderNumber, SalesPriceValue, SalesCurrency, Incoterms2020,
|
||||
SalesResponsibleEmployee, InvoiceDate, OrderDate, Land, DocumentType
|
||||
DocumentCurrency, DocumentTotalForeignCurrency, DocumentTotalLocalCurrency, VatSumForeignCurrency,
|
||||
VatSumLocalCurrency, DocumentRate, CompanyCurrency, SalesResponsibleEmployee, InvoiceDate, OrderDate, Land, DocumentType
|
||||
)
|
||||
VALUES (
|
||||
$storedAtUtc, $siteId, $sourceSystem, $extractionDate, $tsc, $invoiceNumber, $positionOnInvoice,
|
||||
$material, $name, $productGroup, $quantity, $supplierNumber, $supplierName, $supplierCountry,
|
||||
$customerNumber, $customerName, $customerCountry, $customerIndustry, $standardCost,
|
||||
$standardCostCurrency, $purchaseOrderNumber, $salesPriceValue, $salesCurrency, $incoterms2020,
|
||||
$salesResponsibleEmployee, $invoiceDate, $orderDate, $land, $documentType
|
||||
$documentCurrency, $documentTotalForeignCurrency, $documentTotalLocalCurrency, $vatSumForeignCurrency,
|
||||
$vatSumLocalCurrency, $documentRate, $companyCurrency, $salesResponsibleEmployee, $invoiceDate, $orderDate, $land, $documentType
|
||||
);
|
||||
""";
|
||||
|
||||
@@ -192,6 +201,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
command.Parameters.Add("$purchaseOrderNumber", SqliteType.Text);
|
||||
command.Parameters.Add("$salesPriceValue", SqliteType.Real);
|
||||
command.Parameters.Add("$salesCurrency", SqliteType.Text);
|
||||
command.Parameters.Add("$documentCurrency", SqliteType.Text);
|
||||
command.Parameters.Add("$documentTotalForeignCurrency", SqliteType.Real);
|
||||
command.Parameters.Add("$documentTotalLocalCurrency", SqliteType.Real);
|
||||
command.Parameters.Add("$vatSumForeignCurrency", SqliteType.Real);
|
||||
command.Parameters.Add("$vatSumLocalCurrency", SqliteType.Real);
|
||||
command.Parameters.Add("$documentRate", SqliteType.Real);
|
||||
command.Parameters.Add("$companyCurrency", SqliteType.Text);
|
||||
command.Parameters.Add("$incoterms2020", SqliteType.Text);
|
||||
command.Parameters.Add("$salesResponsibleEmployee", SqliteType.Text);
|
||||
command.Parameters.Add("$invoiceDate", SqliteType.Text);
|
||||
@@ -227,6 +243,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
command.Parameters["$purchaseOrderNumber"].Value = record.PurchaseOrderNumber ?? string.Empty;
|
||||
command.Parameters["$salesPriceValue"].Value = record.SalesPriceValue;
|
||||
command.Parameters["$salesCurrency"].Value = record.SalesCurrency ?? string.Empty;
|
||||
command.Parameters["$documentCurrency"].Value = record.DocumentCurrency ?? string.Empty;
|
||||
command.Parameters["$documentTotalForeignCurrency"].Value = record.DocumentTotalForeignCurrency;
|
||||
command.Parameters["$documentTotalLocalCurrency"].Value = record.DocumentTotalLocalCurrency;
|
||||
command.Parameters["$vatSumForeignCurrency"].Value = record.VatSumForeignCurrency;
|
||||
command.Parameters["$vatSumLocalCurrency"].Value = record.VatSumLocalCurrency;
|
||||
command.Parameters["$documentRate"].Value = record.DocumentRate;
|
||||
command.Parameters["$companyCurrency"].Value = record.CompanyCurrency ?? string.Empty;
|
||||
command.Parameters["$incoterms2020"].Value = record.Incoterms2020 ?? string.Empty;
|
||||
command.Parameters["$salesResponsibleEmployee"].Value = record.SalesResponsibleEmployee ?? string.Empty;
|
||||
command.Parameters["$invoiceDate"].Value = record.InvoiceDate?.ToString("O") ?? (object)DBNull.Value;
|
||||
|
||||
@@ -332,6 +332,13 @@ public class ConfigTransferService : IConfigTransferService
|
||||
PurchaseOrderNumber = record.PurchaseOrderNumber,
|
||||
SalesPriceValue = record.SalesPriceValue,
|
||||
SalesCurrency = record.SalesCurrency,
|
||||
DocumentCurrency = record.DocumentCurrency,
|
||||
DocumentTotalForeignCurrency = record.DocumentTotalForeignCurrency,
|
||||
DocumentTotalLocalCurrency = record.DocumentTotalLocalCurrency,
|
||||
VatSumForeignCurrency = record.VatSumForeignCurrency,
|
||||
VatSumLocalCurrency = record.VatSumLocalCurrency,
|
||||
DocumentRate = record.DocumentRate,
|
||||
CompanyCurrency = record.CompanyCurrency,
|
||||
Incoterms2020 = record.Incoterms2020,
|
||||
SalesResponsibleEmployee = record.SalesResponsibleEmployee,
|
||||
InvoiceDate = record.InvoiceDate,
|
||||
|
||||
@@ -103,6 +103,13 @@ CREATE TABLE CentralSalesRecords (
|
||||
PurchaseOrderNumber TEXT NOT NULL,
|
||||
SalesPriceValue TEXT NOT NULL,
|
||||
SalesCurrency TEXT NOT NULL,
|
||||
DocumentCurrency TEXT NOT NULL DEFAULT '',
|
||||
DocumentTotalForeignCurrency TEXT NOT NULL DEFAULT '0',
|
||||
DocumentTotalLocalCurrency TEXT NOT NULL DEFAULT '0',
|
||||
VatSumForeignCurrency TEXT NOT NULL DEFAULT '0',
|
||||
VatSumLocalCurrency TEXT NOT NULL DEFAULT '0',
|
||||
DocumentRate TEXT NOT NULL DEFAULT '0',
|
||||
CompanyCurrency TEXT NOT NULL DEFAULT '',
|
||||
Incoterms2020 TEXT NOT NULL,
|
||||
SalesResponsibleEmployee TEXT NOT NULL,
|
||||
InvoiceDate TEXT NULL,
|
||||
|
||||
@@ -40,6 +40,13 @@ public class DatabaseSchemaMaintenanceService : IDatabaseSchemaMaintenanceServic
|
||||
EnsureSapJoinTable(db);
|
||||
EnsureSapFieldMappingTable(db);
|
||||
EnsureCentralSalesRecordTable(db);
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "DocumentCurrency", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "DocumentTotalForeignCurrency", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "DocumentTotalLocalCurrency", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "VatSumForeignCurrency", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "VatSumLocalCurrency", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "DocumentRate", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "CompanyCurrency", "TEXT NOT NULL DEFAULT ''");
|
||||
EnsureAppEventLogTable(db);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,13 @@ public class ExcelExportService : IExcelExportService
|
||||
"Purchase Order number",
|
||||
"Sales Price/Value",
|
||||
"Sales Currency",
|
||||
"Document Currency",
|
||||
"Document Total FC",
|
||||
"Document Total LC",
|
||||
"VAT Sum FC",
|
||||
"VAT Sum LC",
|
||||
"Document Rate",
|
||||
"Company Currency",
|
||||
"Incoterms 2020",
|
||||
"Sales responsible employee",
|
||||
"invoice date",
|
||||
@@ -97,12 +104,19 @@ public class ExcelExportService : IExcelExportService
|
||||
ws.Cell(row, 18).Value = record.PurchaseOrderNumber;
|
||||
ws.Cell(row, 19).Value = record.SalesPriceValue;
|
||||
ws.Cell(row, 20).Value = record.SalesCurrency;
|
||||
ws.Cell(row, 21).Value = record.Incoterms2020;
|
||||
ws.Cell(row, 22).Value = record.SalesResponsibleEmployee;
|
||||
ws.Cell(row, 23).Value = record.InvoiceDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 24).Value = record.OrderDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 25).Value = record.Land;
|
||||
ws.Cell(row, 26).Value = record.DocumentType;
|
||||
ws.Cell(row, 21).Value = record.DocumentCurrency;
|
||||
ws.Cell(row, 22).Value = record.DocumentTotalForeignCurrency;
|
||||
ws.Cell(row, 23).Value = record.DocumentTotalLocalCurrency;
|
||||
ws.Cell(row, 24).Value = record.VatSumForeignCurrency;
|
||||
ws.Cell(row, 25).Value = record.VatSumLocalCurrency;
|
||||
ws.Cell(row, 26).Value = record.DocumentRate;
|
||||
ws.Cell(row, 27).Value = record.CompanyCurrency;
|
||||
ws.Cell(row, 28).Value = record.Incoterms2020;
|
||||
ws.Cell(row, 29).Value = record.SalesResponsibleEmployee;
|
||||
ws.Cell(row, 30).Value = record.InvoiceDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 31).Value = record.OrderDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 32).Value = record.Land;
|
||||
ws.Cell(row, 33).Value = record.DocumentType;
|
||||
row++;
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,13 @@ public class HanaQueryService : IHanaQueryService
|
||||
PurchaseOrderNumber = reader["purchase_order_number"]?.ToString() ?? string.Empty,
|
||||
SalesPriceValue = Convert.ToDecimal(reader["sales_value"]),
|
||||
SalesCurrency = reader["sales_currency"]?.ToString() ?? string.Empty,
|
||||
DocumentCurrency = reader["document_currency"]?.ToString() ?? string.Empty,
|
||||
DocumentTotalForeignCurrency = Convert.ToDecimal(reader["document_total_fc"]),
|
||||
DocumentTotalLocalCurrency = Convert.ToDecimal(reader["document_total_lc"]),
|
||||
VatSumForeignCurrency = Convert.ToDecimal(reader["vat_sum_fc"]),
|
||||
VatSumLocalCurrency = Convert.ToDecimal(reader["vat_sum_lc"]),
|
||||
DocumentRate = Convert.ToDecimal(reader["document_rate"]),
|
||||
CompanyCurrency = reader["company_currency"]?.ToString() ?? string.Empty,
|
||||
Incoterms2020 = reader["incoterms_2020"]?.ToString() ?? string.Empty,
|
||||
SalesResponsibleEmployee = reader["sales_responsible"]?.ToString() ?? string.Empty,
|
||||
OrderDate = reader.IsDBNull(reader.GetOrdinal("order_date")) ? null : reader.GetDateTime(reader.GetOrdinal("order_date")),
|
||||
@@ -217,12 +224,19 @@ SELECT
|
||||
COALESCE(cust_adr.""Country"", '') AS customer_country,
|
||||
COALESCE(ind.""IndName"", '') AS customer_industry,
|
||||
p.""StockPrice"" AS standard_cost,
|
||||
COALESCE(p.""Currency"", h.""DocCur"") AS standard_cost_currency,
|
||||
COALESCE(adm.""MainCurncy"", '') AS standard_cost_currency,
|
||||
CASE WHEN p.""BaseType"" = 22
|
||||
THEN CAST(p.""BaseRef"" AS NVARCHAR(20))
|
||||
ELSE '' END AS purchase_order_number,
|
||||
p.""LineTotal"" AS sales_value,
|
||||
COALESCE(p.""Currency"", h.""DocCur"") AS sales_currency,
|
||||
COALESCE(h.""DocCur"", '') AS document_currency,
|
||||
COALESCE(h.""DocTotalFC"", 0) AS document_total_fc,
|
||||
COALESCE(h.""DocTotal"", 0) AS document_total_lc,
|
||||
COALESCE(h.""VatSumFC"", 0) AS vat_sum_fc,
|
||||
COALESCE(h.""VatSum"", 0) AS vat_sum_lc,
|
||||
COALESCE(h.""DocRate"", 0) AS document_rate,
|
||||
COALESCE(adm.""MainCurncy"", '') AS company_currency,
|
||||
'' AS incoterms_2020,
|
||||
COALESCE(emp.""SlpName"", '') AS sales_responsible,
|
||||
CASE WHEN p.""BaseType"" = 17
|
||||
@@ -232,6 +246,7 @@ SELECT
|
||||
'INV' AS doc_type
|
||||
FROM {quotedSchema}.""OINV"" h
|
||||
INNER JOIN {quotedSchema}.""INV1"" p ON h.""DocEntry"" = p.""DocEntry""
|
||||
CROSS JOIN {quotedSchema}.""OADM"" adm
|
||||
LEFT JOIN {quotedSchema}.""OITM"" itm ON p.""ItemCode"" = itm.""ItemCode""
|
||||
LEFT JOIN {quotedSchema}.""OITB"" grp ON itm.""ItmsGrpCod"" = grp.""ItmsGrpCod""
|
||||
LEFT JOIN {quotedSchema}.""OCRD"" cust ON h.""CardCode"" = cust.""CardCode""
|
||||
@@ -269,16 +284,24 @@ SELECT
|
||||
COALESCE(cust_adr.""Country"", '') AS customer_country,
|
||||
COALESCE(ind.""IndName"", '') AS customer_industry,
|
||||
p.""StockPrice"" AS standard_cost,
|
||||
COALESCE(p.""Currency"", h.""DocCur"") AS standard_cost_currency,
|
||||
COALESCE(adm.""MainCurncy"", '') AS standard_cost_currency,
|
||||
'' AS purchase_order_number,
|
||||
p.""LineTotal"" * -1 AS sales_value,
|
||||
COALESCE(p.""Currency"", h.""DocCur"") AS sales_currency,
|
||||
COALESCE(h.""DocCur"", '') AS document_currency,
|
||||
COALESCE(h.""DocTotalFC"", 0) * -1 AS document_total_fc,
|
||||
COALESCE(h.""DocTotal"", 0) * -1 AS document_total_lc,
|
||||
COALESCE(h.""VatSumFC"", 0) * -1 AS vat_sum_fc,
|
||||
COALESCE(h.""VatSum"", 0) * -1 AS vat_sum_lc,
|
||||
COALESCE(h.""DocRate"", 0) AS document_rate,
|
||||
COALESCE(adm.""MainCurncy"", '') AS company_currency,
|
||||
'' AS incoterms_2020,
|
||||
COALESCE(emp.""SlpName"", '') AS sales_responsible,
|
||||
NULL AS order_date,
|
||||
'CRN' AS doc_type
|
||||
FROM {quotedSchema}.""ORIN"" h
|
||||
INNER JOIN {quotedSchema}.""RIN1"" p ON h.""DocEntry"" = p.""DocEntry""
|
||||
CROSS JOIN {quotedSchema}.""OADM"" adm
|
||||
LEFT JOIN {quotedSchema}.""OITM"" itm ON p.""ItemCode"" = itm.""ItemCode""
|
||||
LEFT JOIN {quotedSchema}.""OITB"" grp ON itm.""ItmsGrpCod"" = grp.""ItmsGrpCod""
|
||||
LEFT JOIN {quotedSchema}.""OCRD"" cust ON h.""CardCode"" = cust.""CardCode""
|
||||
|
||||
@@ -28,6 +28,17 @@ public class ManualExcelImportService : IManualExcelImportService
|
||||
["purchaseordernumber"] = nameof(SalesRecord.PurchaseOrderNumber),
|
||||
["salespricevalue"] = nameof(SalesRecord.SalesPriceValue),
|
||||
["salescurrency"] = nameof(SalesRecord.SalesCurrency),
|
||||
["documentcurrency"] = nameof(SalesRecord.DocumentCurrency),
|
||||
["documenttotalfc"] = nameof(SalesRecord.DocumentTotalForeignCurrency),
|
||||
["documenttotalforeigncurrency"] = nameof(SalesRecord.DocumentTotalForeignCurrency),
|
||||
["documenttotallc"] = nameof(SalesRecord.DocumentTotalLocalCurrency),
|
||||
["documenttotallocalcurrency"] = nameof(SalesRecord.DocumentTotalLocalCurrency),
|
||||
["vatsumfc"] = nameof(SalesRecord.VatSumForeignCurrency),
|
||||
["vatsumforeigncurrency"] = nameof(SalesRecord.VatSumForeignCurrency),
|
||||
["vatsumlc"] = nameof(SalesRecord.VatSumLocalCurrency),
|
||||
["vatsumlocalcurrency"] = nameof(SalesRecord.VatSumLocalCurrency),
|
||||
["documentrate"] = nameof(SalesRecord.DocumentRate),
|
||||
["companycurrency"] = nameof(SalesRecord.CompanyCurrency),
|
||||
["incoterms2020"] = nameof(SalesRecord.Incoterms2020),
|
||||
["salesresponsibleemployee"] = nameof(SalesRecord.SalesResponsibleEmployee),
|
||||
["invoicedate"] = nameof(SalesRecord.InvoiceDate),
|
||||
@@ -75,6 +86,13 @@ public class ManualExcelImportService : IManualExcelImportService
|
||||
PurchaseOrderNumber = ReadString(headerIndexes, row, nameof(SalesRecord.PurchaseOrderNumber)),
|
||||
SalesPriceValue = ReadDecimal(headerIndexes, row, nameof(SalesRecord.SalesPriceValue)),
|
||||
SalesCurrency = ReadString(headerIndexes, row, nameof(SalesRecord.SalesCurrency)),
|
||||
DocumentCurrency = ReadString(headerIndexes, row, nameof(SalesRecord.DocumentCurrency)),
|
||||
DocumentTotalForeignCurrency = ReadDecimal(headerIndexes, row, nameof(SalesRecord.DocumentTotalForeignCurrency)),
|
||||
DocumentTotalLocalCurrency = ReadDecimal(headerIndexes, row, nameof(SalesRecord.DocumentTotalLocalCurrency)),
|
||||
VatSumForeignCurrency = ReadDecimal(headerIndexes, row, nameof(SalesRecord.VatSumForeignCurrency)),
|
||||
VatSumLocalCurrency = ReadDecimal(headerIndexes, row, nameof(SalesRecord.VatSumLocalCurrency)),
|
||||
DocumentRate = ReadDecimal(headerIndexes, row, nameof(SalesRecord.DocumentRate)),
|
||||
CompanyCurrency = ReadString(headerIndexes, row, nameof(SalesRecord.CompanyCurrency)),
|
||||
Incoterms2020 = ReadString(headerIndexes, row, nameof(SalesRecord.Incoterms2020)),
|
||||
SalesResponsibleEmployee = ReadString(headerIndexes, row, nameof(SalesRecord.SalesResponsibleEmployee)),
|
||||
InvoiceDate = ReadDate(headerIndexes, row, nameof(SalesRecord.InvoiceDate)),
|
||||
|
||||
Reference in New Issue
Block a user