Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-29 19:50:59 +03:00
parent 7e7197dc0f
commit e93c9c13c9
+8 -1
View File
@@ -911,6 +911,10 @@ func GetProductionHasCostProducts(
nFirmaID int,
) (*sql.Rows, error) {
search = strings.TrimSpace(search)
firmFilterSQL := ""
if nFirmaID > 0 {
firmFilterSQL = " AND ISNULL(OM.nFirmaID, 0) = @p4\n"
}
sqlText := `
WITH SonOnMaliyet AS (
@@ -999,7 +1003,7 @@ OUTER APPLY (
)
) CM
WHERE OM.rn = 1
AND (@p4 <= 0 OR ISNULL(OM.nFirmaID, 0) = @p4)
` + firmFilterSQL + `
AND (
@p1 = ''
OR RTRIM(CONVERT(VARCHAR(32), ISNULL(OM.nOnMLNo, 0))) LIKE '%' + @p1 + '%'
@@ -1014,7 +1018,10 @@ OFFSET @p2 ROWS
FETCH NEXT @p3 ROWS ONLY
`
if nFirmaID > 0 {
return uretimDB.QueryContext(ctx, sqlText, search, offset, limit, nFirmaID)
}
return uretimDB.QueryContext(ctx, sqlText, search, offset, limit)
}
func GetProductionHasCostHistoryByProductCode(