Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-28 19:36:23 +03:00
parent 9ba5ac434e
commit 945868d83d
4 changed files with 33 additions and 1 deletions
+3
View File
@@ -33,6 +33,9 @@ type ProductionHasCostProductRow struct {
LTutarTL float64 `json:"lTutarTL"` LTutarTL float64 `json:"lTutarTL"`
LTutarUSD float64 `json:"lTutarUSD"` LTutarUSD float64 `json:"lTutarUSD"`
LTutarEURO float64 `json:"lTutarEURO"` LTutarEURO float64 `json:"lTutarEURO"`
IscilikTutari float64 `json:"IscilikTutari"`
IscilikPrBr string `json:"IscilikPrBr"`
IscilikUSDTutari float64 `json:"IscilikUSDTutari"`
DteGuncellemeTarihi string `json:"dteGuncellemeTarihi"` DteGuncellemeTarihi string `json:"dteGuncellemeTarihi"`
SGuncellemeKullaniciAdi string `json:"sGuncellemeKullaniciAdi"` SGuncellemeKullaniciAdi string `json:"sGuncellemeKullaniciAdi"`
NUrtReceteID string `json:"nUrtReceteID"` NUrtReceteID string `json:"nUrtReceteID"`
+23
View File
@@ -927,6 +927,9 @@ SELECT
ISNULL(OM.lTutarTL, 0) AS lTutarTL, ISNULL(OM.lTutarTL, 0) AS lTutarTL,
ISNULL(OM.lTutarUSD, 0) AS lTutarUSD, ISNULL(OM.lTutarUSD, 0) AS lTutarUSD,
ISNULL(OM.lTutarEURO, 0) AS lTutarEURO, ISNULL(OM.lTutarEURO, 0) AS lTutarEURO,
ISNULL(CM.IscilikTutari, 0) AS IscilikTutari,
ISNULL(CM.IscilikPrBr, '') AS IscilikPrBr,
ISNULL(CM.IscilikUSDTutari, 0) AS IscilikUSDTutari,
CONVERT(VARCHAR(10), OM.dteGuncellemeTarihi, 23) AS dteGuncellemeTarihi, CONVERT(VARCHAR(10), OM.dteGuncellemeTarihi, 23) AS dteGuncellemeTarihi,
ISNULL(OM.sGuncellemeKullaniciAdi, '') AS sGuncellemeKullaniciAdi, ISNULL(OM.sGuncellemeKullaniciAdi, '') AS sGuncellemeKullaniciAdi,
RTRIM(CONVERT(VARCHAR(32), ISNULL(OM.nUrtReceteID, 0))) AS nUrtReceteID, RTRIM(CONVERT(VARCHAR(32), ISNULL(OM.nUrtReceteID, 0))) AS nUrtReceteID,
@@ -941,6 +944,26 @@ SELECT
FROM SonOnMaliyet OM FROM SonOnMaliyet OM
LEFT JOIN SonSiparis SS LEFT JOIN SonSiparis SS
ON SS.UrunKodu = LTRIM(RTRIM(OM.UrunKodu)) ON SS.UrunKodu = LTRIM(RTRIM(OM.UrunKodu))
OUTER APPLY (
SELECT
SUM(ISNULL(D.fiyat_girilen, 0) * ISNULL(D.lMiktar, 0)) AS IscilikTutari,
CASE
WHEN COUNT(DISTINCT UPPER(ISNULL(NULLIF(LTRIM(RTRIM(D.fiyat_doviz)), ''), 'USD'))) = 1
THEN MAX(UPPER(ISNULL(NULLIF(LTRIM(RTRIM(D.fiyat_doviz)), ''), 'USD')))
WHEN COUNT(*) > 0 THEN 'MIX'
ELSE ''
END AS IscilikPrBr,
SUM(ISNULL(D.lMiktar, 0) * ISNULL(D.lDovizFiyati, 0)) AS IscilikUSDTutari
FROM dbo.spUrtOnMLMasDet D
LEFT JOIN dbo.spUrtOnMLHammaddeTuru T
ON T.nHammaddeTuruNo = D.nHammaddeTuruNo
WHERE D.nOnMLNo = OM.nOnMLNo
AND ISNULL(D.fiyat_girilen, 0) > 0
AND (
UPPER(ISNULL(NULLIF(LTRIM(RTRIM(D.sAciklama3)), ''), LTRIM(RTRIM(ISNULL(T.sAciklama3, ''))))) LIKE '%CM1%'
OR UPPER(ISNULL(NULLIF(LTRIM(RTRIM(D.sAciklama3)), ''), LTRIM(RTRIM(ISNULL(T.sAciklama3, ''))))) LIKE '%CM2%'
)
) CM
WHERE OM.rn = 1 WHERE OM.rn = 1
AND ( AND (
@p1 = '' @p1 = ''
+3
View File
@@ -221,6 +221,9 @@ func GetProductionHasCostProductsHandler(w http.ResponseWriter, r *http.Request)
&item.LTutarTL, &item.LTutarTL,
&item.LTutarUSD, &item.LTutarUSD,
&item.LTutarEURO, &item.LTutarEURO,
&item.IscilikTutari,
&item.IscilikPrBr,
&item.IscilikUSDTutari,
&item.DteGuncellemeTarihi, &item.DteGuncellemeTarihi,
&item.SGuncellemeKullaniciAdi, &item.SGuncellemeKullaniciAdi,
&item.NUrtReceteID, &item.NUrtReceteID,
@@ -189,6 +189,9 @@ const columns = [
{ name: 'lTutarTL', label: 'lTutarTL', field: 'lTutarTL', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' }, { name: 'lTutarTL', label: 'lTutarTL', field: 'lTutarTL', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' },
{ name: 'lTutarUSD', label: 'lTutarUSD', field: 'lTutarUSD', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' }, { name: 'lTutarUSD', label: 'lTutarUSD', field: 'lTutarUSD', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' },
{ name: 'lTutarEURO', label: 'lTutarEURO', field: 'lTutarEURO', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' }, { name: 'lTutarEURO', label: 'lTutarEURO', field: 'lTutarEURO', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' },
{ name: 'IscilikTutari', label: 'Iscilik Tutari', field: 'IscilikTutari', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' },
{ name: 'IscilikPrBr', label: 'Iscilik Pr.Br.', field: 'IscilikPrBr', align: 'center', sortable: true, style: 'width:5%', headerStyle: 'width:5%' },
{ name: 'IscilikUSDTutari', label: 'Iscilik USD Tutari', field: 'IscilikUSDTutari', align: 'right', sortable: true, format: val => formatMoney(val), style: 'width:6%', headerStyle: 'width:6%' },
{ name: 'dteGuncellemeTarihi', label: 'dteGuncellemeTarihi', field: 'dteGuncellemeTarihi', align: 'center', sortable: true, format: val => formatDateTR(val), style: 'width:7%', headerStyle: 'width:7%' }, { name: 'dteGuncellemeTarihi', label: 'dteGuncellemeTarihi', field: 'dteGuncellemeTarihi', align: 'center', sortable: true, format: val => formatDateTR(val), style: 'width:7%', headerStyle: 'width:7%' },
{ name: 'sGuncellemeKullaniciAdi', label: 'sGuncellemeKullaniciAdi', field: 'sGuncellemeKullaniciAdi', align: 'left', sortable: true, style: 'width:7%', headerStyle: 'width:7%' }, { name: 'sGuncellemeKullaniciAdi', label: 'sGuncellemeKullaniciAdi', field: 'sGuncellemeKullaniciAdi', align: 'left', sortable: true, style: 'width:7%', headerStyle: 'width:7%' },
{ name: 'nUrtReceteID', label: 'nUrtReceteID', field: 'nUrtReceteID', align: 'left', sortable: true, style: 'width:6%', headerStyle: 'width:6%' }, { name: 'nUrtReceteID', label: 'nUrtReceteID', field: 'nUrtReceteID', align: 'left', sortable: true, style: 'width:6%', headerStyle: 'width:6%' },
@@ -393,7 +396,7 @@ function escapeExcelCsvCell (value) {
return `"${text.replace(/"/g, '""')}"` return `"${text.replace(/"/g, '""')}"`
} }
const excelNumericColumns = new Set(['ceketDepoGiris', 'pantolonDepoGiris', 'yelekDepoGiris', 'lTutarTL', 'lTutarUSD', 'lTutarEURO']) const excelNumericColumns = new Set(['ceketDepoGiris', 'pantolonDepoGiris', 'yelekDepoGiris', 'lTutarTL', 'lTutarUSD', 'lTutarEURO', 'IscilikTutari', 'IscilikUSDTutari'])
function formatExcelCsvCell (col, rawValue, displayValue) { function formatExcelCsvCell (col, rawValue, displayValue) {
if (excelNumericColumns.has(col?.name)) { if (excelNumericColumns.has(col?.name)) {