mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
72 lines
2.5 KiB
Go
72 lines
2.5 KiB
Go
package dto
|
|
|
|
import (
|
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
customerDTO "gitlab.com/mbugroup/lti-api.git/internal/modules/master/customers/dto"
|
|
)
|
|
|
|
type BalanceMonitoringAyamDTO struct {
|
|
Ekor float64 `json:"ekor"`
|
|
Kg float64 `json:"kg"`
|
|
Nominal float64 `json:"nominal"`
|
|
}
|
|
|
|
type BalanceMonitoringTelurDTO struct {
|
|
Butir float64 `json:"butir"`
|
|
Kg float64 `json:"kg"`
|
|
Nominal float64 `json:"nominal"`
|
|
}
|
|
|
|
type BalanceMonitoringTradingDTO struct {
|
|
Qty float64 `json:"qty"`
|
|
Kg float64 `json:"kg"`
|
|
Nominal float64 `json:"nominal"`
|
|
}
|
|
|
|
type BalanceMonitoringRowDTO struct {
|
|
Customer customerDTO.CustomerRelationDTO `json:"customer"`
|
|
SaldoAwal float64 `json:"saldo_awal"`
|
|
PenjualanAyam BalanceMonitoringAyamDTO `json:"penjualan_ayam"`
|
|
PenjualanTelur BalanceMonitoringTelurDTO `json:"penjualan_telur"`
|
|
PenjualanTrading BalanceMonitoringTradingDTO `json:"penjualan_trading"`
|
|
Pembayaran float64 `json:"pembayaran"`
|
|
Aging int `json:"aging"`
|
|
AgingRataRata float64 `json:"aging_rata_rata"`
|
|
SaldoAkhir float64 `json:"saldo_akhir"`
|
|
}
|
|
|
|
type BalanceMonitoringTotalsDTO struct {
|
|
SaldoAwal float64 `json:"saldo_awal"`
|
|
PenjualanAyam BalanceMonitoringAyamDTO `json:"penjualan_ayam"`
|
|
PenjualanTelur BalanceMonitoringTelurDTO `json:"penjualan_telur"`
|
|
PenjualanTrading BalanceMonitoringTradingDTO `json:"penjualan_trading"`
|
|
Pembayaran float64 `json:"pembayaran"`
|
|
Aging int `json:"aging"`
|
|
AgingRataRata float64 `json:"aging_rata_rata"`
|
|
SaldoAkhir float64 `json:"saldo_akhir"`
|
|
}
|
|
|
|
func ToBalanceMonitoringRowDTO(
|
|
customer entity.Customer,
|
|
saldoAwal float64,
|
|
ayam BalanceMonitoringAyamDTO,
|
|
telur BalanceMonitoringTelurDTO,
|
|
trading BalanceMonitoringTradingDTO,
|
|
pembayaran float64,
|
|
aging int,
|
|
agingRataRata float64,
|
|
) BalanceMonitoringRowDTO {
|
|
saldoAkhir := saldoAwal + pembayaran - (ayam.Nominal + telur.Nominal + trading.Nominal)
|
|
return BalanceMonitoringRowDTO{
|
|
Customer: customerDTO.ToCustomerRelationDTO(customer),
|
|
SaldoAwal: saldoAwal,
|
|
PenjualanAyam: ayam,
|
|
PenjualanTelur: telur,
|
|
PenjualanTrading: trading,
|
|
Pembayaran: pembayaran,
|
|
Aging: aging,
|
|
AgingRataRata: agingRataRata,
|
|
SaldoAkhir: saldoAkhir,
|
|
}
|
|
}
|