Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-10 10:31:03 +03:00
parent 6f2a6df3d4
commit d590732f38

View File

@@ -26,7 +26,7 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
;WITH VendorPiyasa AS ;WITH VendorPiyasa AS
( (
SELECT SELECT
Cari8 = LEFT(REPLACE(P.CurrAccCode, ' ', ''), 8), Cari8 = LEFT(P.CurrAccCode, 8),
VendorAtt01 = MAX(P.VendorAtt01) VendorAtt01 = MAX(P.VendorAtt01)
FROM FROM
( (
@@ -53,14 +53,14 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
) pvt ) pvt
GROUP BY CurrAccTypeCode, CurrAccCode GROUP BY CurrAccTypeCode, CurrAccCode
) P ) P
GROUP BY LEFT(REPLACE(P.CurrAccCode, ' ', ''), 8) GROUP BY LEFT(P.CurrAccCode, 8)
) )
SELECT SELECT
x.AccountCode, x.AccountCode,
MAX(x.AccountName) AS AccountName MAX(x.AccountName) AS AccountName
FROM ( FROM (
SELECT SELECT
LEFT(REPLACE(b.CurrAccCode, ' ', ''), 8) AS AccountCode, LEFT(b.CurrAccCode, 8) AS AccountCode,
COALESCE(d.CurrAccDescription, '') AS AccountName COALESCE(d.CurrAccDescription, '') AS AccountName
FROM trCurrAccBook b FROM trCurrAccBook b
LEFT JOIN cdCurrAccDesc d LEFT JOIN cdCurrAccDesc d
@@ -71,7 +71,7 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
ON f2.CurrAccTypeCode = b.CurrAccTypeCode ON f2.CurrAccTypeCode = b.CurrAccTypeCode
AND f2.CurrAccCode = b.CurrAccCode AND f2.CurrAccCode = b.CurrAccCode
LEFT JOIN VendorPiyasa vp LEFT JOIN VendorPiyasa vp
ON vp.Cari8 = LEFT(REPLACE(b.CurrAccCode, ' ', ''), 8) ON vp.Cari8 = LEFT(b.CurrAccCode, 8)
WHERE b.CurrAccTypeCode IN (1,3) WHERE b.CurrAccTypeCode IN (1,3)
AND %s AND %s
) x ) x
@@ -114,10 +114,9 @@ func formatAccountDisplayCode(code string) string {
} }
func normalizeAccountCode8(code string) string { func normalizeAccountCode8(code string) string {
trimmed := strings.TrimSpace(strings.ReplaceAll(code, " ", "")) runes := []rune(code)
runes := []rune(trimmed)
if len(runes) > 8 { if len(runes) > 8 {
return string(runes[:8]) return string(runes[:8])
} }
return trimmed return code
} }