mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
[FIX/BE-US] recording,reporting,closing and uniformity
This commit is contained in:
@@ -201,18 +201,48 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin
|
||||
switch strings.ToLower(item.JenisTransaksi) {
|
||||
case "pembelian", "adjustment masuk", "mutasi masuk":
|
||||
row.QtyIn += item.QtyMasuk
|
||||
row.TotalAmount += item.Nilai
|
||||
if row.UnitPrice == 0 {
|
||||
if item.QtyMasuk > 0 && item.Nilai > 0 {
|
||||
row.UnitPrice = item.Nilai / item.QtyMasuk
|
||||
} else if item.Harga > 0 {
|
||||
row.UnitPrice = item.Harga
|
||||
}
|
||||
}
|
||||
if strings.ToLower(item.JenisTransaksi) == "mutasi masuk" {
|
||||
ref := strings.ToUpper(strings.TrimSpace(item.NoReferensi))
|
||||
if strings.HasPrefix(ref, "TL-") {
|
||||
row.Notes = "TRANSFER LAYING"
|
||||
} else if strings.HasPrefix(ref, "ST-") {
|
||||
row.Notes = "TRANSFER STOCK"
|
||||
}
|
||||
}
|
||||
case "pemakaian", "adjustment keluar":
|
||||
price := row.UnitPrice
|
||||
if price == 0 {
|
||||
price = item.Harga
|
||||
}
|
||||
row.QtyUsed += item.QtyKeluar
|
||||
case "mutasi keluar":
|
||||
row.TotalAmount += item.QtyKeluar * price
|
||||
case "mutasi keluar", "penjualan":
|
||||
price := row.UnitPrice
|
||||
if price == 0 {
|
||||
price = item.Harga
|
||||
}
|
||||
row.QtyOut += item.QtyKeluar
|
||||
if strings.ToLower(item.JenisTransaksi) == "mutasi keluar" {
|
||||
ref := strings.ToUpper(strings.TrimSpace(item.NoReferensi))
|
||||
if strings.HasPrefix(ref, "TL-") {
|
||||
row.Notes = "TRANSFER LAYING"
|
||||
} else if strings.HasPrefix(ref, "ST-") {
|
||||
row.Notes = "TRANSFER STOCK"
|
||||
}
|
||||
}
|
||||
default:
|
||||
row.QtyIn += item.QtyMasuk
|
||||
row.TotalAmount += item.Nilai
|
||||
}
|
||||
|
||||
if row.QtyIn > 0 {
|
||||
row.UnitPrice = row.TotalAmount / row.QtyIn
|
||||
if row.QtyIn > 0 {
|
||||
row.UnitPrice = row.TotalAmount / row.QtyIn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,8 +263,8 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin
|
||||
total += r.TotalAmount
|
||||
}
|
||||
avg := 0.0
|
||||
if qtyIn > 0 {
|
||||
avg = total / qtyIn
|
||||
if qtyUsed > 0 {
|
||||
avg = total / qtyUsed
|
||||
}
|
||||
cat.Total = SapronakCategoryTotalDTO{
|
||||
Label: label,
|
||||
|
||||
Reference in New Issue
Block a user