mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 06:45:43 +00:00
implement bop for expedition must recheck and qty in staff purchase need info
This commit is contained in:
@@ -19,10 +19,9 @@ type PurchaseRepository interface {
|
||||
repository.BaseRepository[entity.Purchase]
|
||||
CreateWithItems(ctx context.Context, purchase *entity.Purchase, items []*entity.PurchaseItem) error
|
||||
CreateItems(ctx context.Context, purchaseID uint, items []*entity.PurchaseItem) error
|
||||
UpdatePricing(ctx context.Context, purchaseID uint, updates []PurchasePricingUpdate, grandTotal float64) error
|
||||
UpdatePricing(ctx context.Context, purchaseID uint, updates []PurchasePricingUpdate) error
|
||||
UpdateReceivingDetails(ctx context.Context, purchaseID uint, updates []PurchaseReceivingUpdate) error
|
||||
DeleteItems(ctx context.Context, purchaseID uint, itemIDs []uint) error
|
||||
UpdateGrandTotal(ctx context.Context, purchaseID uint, grandTotal float64) error
|
||||
NextPrNumber(ctx context.Context, tx *gorm.DB) (string, error)
|
||||
NextPoNumber(ctx context.Context, tx *gorm.DB) (string, error)
|
||||
}
|
||||
@@ -99,7 +98,6 @@ func (r *PurchaseRepositoryImpl) UpdatePricing(
|
||||
ctx context.Context,
|
||||
purchaseID uint,
|
||||
updates []PurchasePricingUpdate,
|
||||
grandTotal float64,
|
||||
) error {
|
||||
if len(updates) == 0 {
|
||||
return errors.New("pricing updates cannot be empty")
|
||||
@@ -133,14 +131,6 @@ func (r *PurchaseRepositoryImpl) UpdatePricing(
|
||||
}
|
||||
}
|
||||
|
||||
if err := db.Model(&entity.Purchase{}).
|
||||
Where("id = ?", purchaseID).
|
||||
Updates(map[string]interface{}{
|
||||
"grand_total": grandTotal,
|
||||
}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -201,20 +191,6 @@ func (r *PurchaseRepositoryImpl) UpdateReceivingDetails(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *PurchaseRepositoryImpl) UpdateGrandTotal(
|
||||
ctx context.Context,
|
||||
purchaseID uint,
|
||||
grandTotal float64,
|
||||
) error {
|
||||
return r.DB().WithContext(ctx).
|
||||
Model(&entity.Purchase{}).
|
||||
Where("id = ?", purchaseID).
|
||||
Updates(map[string]interface{}{
|
||||
"grand_total": grandTotal,
|
||||
"updated_at": gorm.Expr("NOW()"),
|
||||
}).Error
|
||||
}
|
||||
|
||||
func (r *PurchaseRepositoryImpl) DeleteItems(ctx context.Context, purchaseID uint, itemIDs []uint) error {
|
||||
if len(itemIDs) == 0 {
|
||||
return errors.New("itemIDs cannot be empty")
|
||||
|
||||
Reference in New Issue
Block a user