Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -17,6 +17,9 @@ type OrderProductionItem struct {
|
|||||||
OldDim2 string `json:"OldDim2"`
|
OldDim2 string `json:"OldDim2"`
|
||||||
OldDesc string `json:"OldDesc"`
|
OldDesc string `json:"OldDesc"`
|
||||||
OldQty float64 `json:"OldQty"`
|
OldQty float64 `json:"OldQty"`
|
||||||
|
OldDocCurrencyCode string `json:"OldDocCurrencyCode"`
|
||||||
|
OldNetAmount float64 `json:"OldNetAmount"`
|
||||||
|
OldNetAmountUSD float64 `json:"OldNetAmountUSD"`
|
||||||
|
|
||||||
NewItemCode string `json:"NewItemCode"`
|
NewItemCode string `json:"NewItemCode"`
|
||||||
NewColor string `json:"NewColor"`
|
NewColor string `json:"NewColor"`
|
||||||
|
|||||||
@@ -36,6 +36,26 @@ SELECT
|
|||||||
ISNULL(l.LineDescription,'') AS OldDesc,
|
ISNULL(l.LineDescription,'') AS OldDesc,
|
||||||
CAST(ISNULL(l.Qty1, 0) AS FLOAT) AS OldQty,
|
CAST(ISNULL(l.Qty1, 0) AS FLOAT) AS OldQty,
|
||||||
|
|
||||||
|
ISNULL(h.DocCurrencyCode,'TRY') AS OldDocCurrencyCode,
|
||||||
|
CAST(ISNULL(c.NetAmount, 0) AS FLOAT) AS OldNetAmount,
|
||||||
|
CAST(
|
||||||
|
CASE
|
||||||
|
WHEN ISNULL(h.DocCurrencyCode,'TRY') = 'USD'
|
||||||
|
THEN ISNULL(c.NetAmount,0)
|
||||||
|
|
||||||
|
WHEN ISNULL(h.DocCurrencyCode,'TRY') = 'TRY'
|
||||||
|
AND usd.Rate > 0
|
||||||
|
THEN ISNULL(c.NetAmount,0) / usd.Rate
|
||||||
|
|
||||||
|
WHEN ISNULL(h.DocCurrencyCode,'TRY') IN ('EUR','GBP')
|
||||||
|
AND cur.Rate > 0
|
||||||
|
AND usd.Rate > 0
|
||||||
|
THEN (ISNULL(c.NetAmount,0) * cur.Rate) / usd.Rate
|
||||||
|
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
AS FLOAT) AS OldNetAmountUSD,
|
||||||
|
|
||||||
CAST('' AS NVARCHAR(60)) AS NewItemCode,
|
CAST('' AS NVARCHAR(60)) AS NewItemCode,
|
||||||
CAST('' AS NVARCHAR(30)) AS NewColor,
|
CAST('' AS NVARCHAR(30)) AS NewColor,
|
||||||
CAST('' AS NVARCHAR(30)) AS NewDim2,
|
CAST('' AS NVARCHAR(30)) AS NewDim2,
|
||||||
@@ -46,6 +66,33 @@ SELECT
|
|||||||
|
|
||||||
CAST(0 AS bit) AS IsVariantMissing
|
CAST(0 AS bit) AS IsVariantMissing
|
||||||
FROM dbo.trOrderLine l
|
FROM dbo.trOrderLine l
|
||||||
|
JOIN dbo.trOrderHeader h
|
||||||
|
ON h.OrderHeaderID = l.OrderHeaderID
|
||||||
|
LEFT JOIN dbo.trOrderLineCurrency c WITH (NOLOCK)
|
||||||
|
ON c.OrderLineID = l.OrderLineID
|
||||||
|
AND c.CurrencyCode = ISNULL(h.DocCurrencyCode,'TRY')
|
||||||
|
|
||||||
|
OUTER APPLY (
|
||||||
|
SELECT TOP 1 Rate
|
||||||
|
FROM dbo.AllExchangeRates
|
||||||
|
WHERE CurrencyCode = 'USD'
|
||||||
|
AND RelationCurrencyCode = 'TRY'
|
||||||
|
AND ExchangeTypeCode = 6
|
||||||
|
AND Rate > 0
|
||||||
|
AND Date <= CAST(GETDATE() AS date)
|
||||||
|
ORDER BY Date DESC
|
||||||
|
) usd
|
||||||
|
|
||||||
|
OUTER APPLY (
|
||||||
|
SELECT TOP 1 Rate
|
||||||
|
FROM dbo.AllExchangeRates
|
||||||
|
WHERE CurrencyCode = ISNULL(h.DocCurrencyCode,'TRY')
|
||||||
|
AND RelationCurrencyCode = 'TRY'
|
||||||
|
AND ExchangeTypeCode = 6
|
||||||
|
AND Rate > 0
|
||||||
|
AND Date <= CAST(GETDATE() AS date)
|
||||||
|
ORDER BY Date DESC
|
||||||
|
) cur
|
||||||
WHERE l.OrderHeaderID = @p1
|
WHERE l.OrderHeaderID = @p1
|
||||||
AND ISNULL(l.ItemCode,'') LIKE 'U%'
|
AND ISNULL(l.ItemCode,'') LIKE 'U%'
|
||||||
ORDER BY l.SortOrder, l.OrderLineID
|
ORDER BY l.SortOrder, l.OrderLineID
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ func OrderProductionItemsRoute(mssql *sql.DB) http.Handler {
|
|||||||
&o.OldDim2,
|
&o.OldDim2,
|
||||||
&o.OldDesc,
|
&o.OldDesc,
|
||||||
&o.OldQty,
|
&o.OldQty,
|
||||||
|
&o.OldDocCurrencyCode,
|
||||||
|
&o.OldNetAmount,
|
||||||
|
&o.OldNetAmountUSD,
|
||||||
&o.NewItemCode,
|
&o.NewItemCode,
|
||||||
&o.NewColor,
|
&o.NewColor,
|
||||||
&o.NewDim2,
|
&o.NewDim2,
|
||||||
|
|||||||
@@ -456,6 +456,30 @@ const columns = [
|
|||||||
{ name: 'OldDesc', label: 'Eski Aciklama', field: 'OldDesc', align: 'left', sortable: false, style: 'min-width:130px;', headerStyle: 'min-width:130px;', headerClasses: 'col-old col-desc', classes: 'col-old col-desc' },
|
{ name: 'OldDesc', label: 'Eski Aciklama', field: 'OldDesc', align: 'left', sortable: false, style: 'min-width:130px;', headerStyle: 'min-width:130px;', headerClasses: 'col-old col-desc', classes: 'col-old col-desc' },
|
||||||
{ name: 'OldSizes', label: 'Bedenler', field: 'OldSizesLabel', align: 'left', sortable: false, style: 'min-width:90px;', headerStyle: 'min-width:90px;', headerClasses: 'col-old col-wrap', classes: 'col-old col-wrap' },
|
{ name: 'OldSizes', label: 'Bedenler', field: 'OldSizesLabel', align: 'left', sortable: false, style: 'min-width:90px;', headerStyle: 'min-width:90px;', headerClasses: 'col-old col-wrap', classes: 'col-old col-wrap' },
|
||||||
{ name: 'OldTotalQty', label: 'Siparis Adedi', field: 'OldTotalQtyLabel', align: 'right', sortable: false, style: 'min-width:90px;', headerStyle: 'min-width:90px;', headerClasses: 'col-old', classes: 'col-old' },
|
{ name: 'OldTotalQty', label: 'Siparis Adedi', field: 'OldTotalQtyLabel', align: 'right', sortable: false, style: 'min-width:90px;', headerStyle: 'min-width:90px;', headerClasses: 'col-old', classes: 'col-old' },
|
||||||
|
{
|
||||||
|
name: 'OldTotalAmount',
|
||||||
|
label: 'Tutar',
|
||||||
|
field: 'OldTotalAmount',
|
||||||
|
align: 'right',
|
||||||
|
sortable: true,
|
||||||
|
style: 'min-width:110px;white-space:nowrap',
|
||||||
|
headerStyle: 'min-width:110px;white-space:nowrap',
|
||||||
|
headerClasses: 'col-old',
|
||||||
|
classes: 'col-old',
|
||||||
|
format: (val, row) => `${Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${row?.OldDocCurrencyCode || ''}`.trim()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'OldTotalAmountUSD',
|
||||||
|
label: 'Tutar (USD)',
|
||||||
|
field: 'OldTotalAmountUSD',
|
||||||
|
align: 'right',
|
||||||
|
sortable: true,
|
||||||
|
style: 'min-width:110px;white-space:nowrap',
|
||||||
|
headerStyle: 'min-width:110px;white-space:nowrap',
|
||||||
|
headerClasses: 'col-old',
|
||||||
|
classes: 'col-old',
|
||||||
|
format: val => `${Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} USD`
|
||||||
|
},
|
||||||
{ name: 'OldDueDate', label: 'Eski Termin', field: 'OldDueDate', align: 'left', sortable: true, style: 'min-width:100px;', headerStyle: 'min-width:100px;', headerClasses: 'col-old', classes: 'col-old' },
|
{ name: 'OldDueDate', label: 'Eski Termin', field: 'OldDueDate', align: 'left', sortable: true, style: 'min-width:100px;', headerStyle: 'min-width:100px;', headerClasses: 'col-old', classes: 'col-old' },
|
||||||
{ name: 'NewItemCode', label: 'Yeni Urun Kodu', field: 'NewItemCode', align: 'left', sortable: false, style: 'min-width:130px;', headerStyle: 'min-width:130px;', headerClasses: 'col-new col-new-first', classes: 'col-new col-new-first' },
|
{ name: 'NewItemCode', label: 'Yeni Urun Kodu', field: 'NewItemCode', align: 'left', sortable: false, style: 'min-width:130px;', headerStyle: 'min-width:130px;', headerClasses: 'col-new col-new-first', classes: 'col-new col-new-first' },
|
||||||
{ name: 'NewColor', label: 'Yeni Urun Rengi', field: 'NewColor', align: 'left', sortable: false, style: 'min-width:100px;', headerStyle: 'min-width:100px;', headerClasses: 'col-new', classes: 'col-new' },
|
{ name: 'NewColor', label: 'Yeni Urun Rengi', field: 'NewColor', align: 'left', sortable: false, style: 'min-width:100px;', headerStyle: 'min-width:100px;', headerClasses: 'col-new', classes: 'col-new' },
|
||||||
@@ -1735,6 +1759,9 @@ function groupItems (items, prevRows = []) {
|
|||||||
OldSizesLabel: '',
|
OldSizesLabel: '',
|
||||||
OldTotalQty: 0,
|
OldTotalQty: 0,
|
||||||
OldTotalQtyLabel: '0',
|
OldTotalQtyLabel: '0',
|
||||||
|
OldDocCurrencyCode: String(it?.OldDocCurrencyCode || '').trim() || 'TRY',
|
||||||
|
OldTotalAmount: 0,
|
||||||
|
OldTotalAmountUSD: 0,
|
||||||
NewItemCode: prev.NewItemCode || '',
|
NewItemCode: prev.NewItemCode || '',
|
||||||
NewColor: prev.NewColor || '',
|
NewColor: prev.NewColor || '',
|
||||||
NewDim2: prev.NewDim2 || '',
|
NewDim2: prev.NewDim2 || '',
|
||||||
@@ -1770,6 +1797,8 @@ function groupItems (items, prevRows = []) {
|
|||||||
g.__sizeMap[size] = (g.__sizeMap[size] || 0) + 1
|
g.__sizeMap[size] = (g.__sizeMap[size] || 0) + 1
|
||||||
}
|
}
|
||||||
g.__oldQtyTotal = Number(g.__oldQtyTotal || 0) + Number(it?.OldQty || 0)
|
g.__oldQtyTotal = Number(g.__oldQtyTotal || 0) + Number(it?.OldQty || 0)
|
||||||
|
g.__oldAmountTotal = Number(g.__oldAmountTotal || 0) + Number(it?.OldNetAmount || 0)
|
||||||
|
g.__oldAmountUsdTotal = Number(g.__oldAmountUsdTotal || 0) + Number(it?.OldNetAmountUSD || 0)
|
||||||
if (it?.IsVariantMissing) g.IsVariantMissing = true
|
if (it?.IsVariantMissing) g.IsVariantMissing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1780,6 +1809,8 @@ function groupItems (items, prevRows = []) {
|
|||||||
g.OldSizesLabel = sizes.label
|
g.OldSizesLabel = sizes.label
|
||||||
g.OldTotalQty = Number(g.__oldQtyTotal || 0)
|
g.OldTotalQty = Number(g.__oldQtyTotal || 0)
|
||||||
g.OldTotalQtyLabel = formatQtyLabel(g.OldTotalQty)
|
g.OldTotalQtyLabel = formatQtyLabel(g.OldTotalQty)
|
||||||
|
g.OldTotalAmount = Number(g.__oldAmountTotal || 0)
|
||||||
|
g.OldTotalAmountUSD = Number(g.__oldAmountUsdTotal || 0)
|
||||||
const info = store.classifyItemCode(g.NewItemCode)
|
const info = store.classifyItemCode(g.NewItemCode)
|
||||||
g.NewItemCode = info.normalized
|
g.NewItemCode = info.normalized
|
||||||
g.NewItemMode = info.mode
|
g.NewItemMode = info.mode
|
||||||
@@ -1789,6 +1820,8 @@ function groupItems (items, prevRows = []) {
|
|||||||
}
|
}
|
||||||
delete g.__sizeMap
|
delete g.__sizeMap
|
||||||
delete g.__oldQtyTotal
|
delete g.__oldQtyTotal
|
||||||
|
delete g.__oldAmountTotal
|
||||||
|
delete g.__oldAmountUsdTotal
|
||||||
out.push(g)
|
out.push(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -686,6 +686,8 @@ async function saveKeys (keys) {
|
|||||||
clearDirty()
|
clearDirty()
|
||||||
// after saving, clear save selection to avoid accidental re-save
|
// after saving, clear save selection to avoid accidental re-save
|
||||||
saveSelectedKeyMap.value = {}
|
saveSelectedKeyMap.value = {}
|
||||||
|
// after saving, also clear the search input so the sheet reloads unfiltered
|
||||||
|
filters.value.search = ''
|
||||||
await refreshAll()
|
await refreshAll()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const detail = await extractApiErrorDetail(e)
|
const detail = await extractApiErrorDetail(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user