Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PaymentTermService ¶
type PaymentTermService struct {
// contains filtered or unexported fields
}
PaymentTermService handles operations related to payment terms.
It utilizes a GORM database instance and an ERP context to perform CRUD operations on payment terms, as well as other context-related functionalities.
func NewPaymentTermService ¶
func NewPaymentTermService(db *gorm.DB, ctx *context.ERPContext) *PaymentTermService
NewPaymentTermService creates a new instance of PaymentTermService.
It initializes the service with the provided GORM database and ERP context. The database is used for performing operations on payment terms, while the context provides authentication and authorization capabilities.
func (*PaymentTermService) GetPaymentTerms ¶
func (s *PaymentTermService) GetPaymentTerms() []models.PaymentTermModel
GetPaymentTerms retrieves all payment terms from the database.
It returns a slice of PaymentTermModel containing all the payment terms stored in the database.
func (*PaymentTermService) GroupPaymentTermsByCategory ¶
func (s *PaymentTermService) GroupPaymentTermsByCategory() map[string][]models.PaymentTermModel
GroupPaymentTermsByCategory groups the payment terms by their category.
It returns a map where the keys are category names and the values are slices of PaymentTermModel corresponding to each category.
func (*PaymentTermService) InitPaymentTerms ¶
func (s *PaymentTermService) InitPaymentTerms() error
InitPaymentTerms initializes the payment terms in the database.
This method populates the database with predefined payment terms if they do not already exist.