feat: export input progress report for expenses, marketings, purchases, and recordings

This commit is contained in:
Adnan Zahir
2026-04-21 21:24:19 +07:00
parent a98a709766
commit 5e7c51e9c2
18 changed files with 1378 additions and 0 deletions
@@ -1,10 +1,13 @@
package controller
import (
"fmt"
"math"
"strconv"
"strings"
"time"
"gitlab.com/mbugroup/lti-api.git/internal/common/exportprogress"
m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
"gitlab.com/mbugroup/lti-api.git/internal/modules/marketing/dto"
service "gitlab.com/mbugroup/lti-api.git/internal/modules/marketing/services"
@@ -27,6 +30,25 @@ func NewDeliveryOrdersController(deliveryOrdersService service.DeliveryOrdersSer
}
func (u *DeliveryOrdersController) GetAll(c *fiber.Ctx) error {
if exportprogress.IsProgressExportRequest(c) {
query, err := exportprogress.ParseQuery(c)
if err != nil {
return err
}
rows, err := u.DeliveryOrdersService.GetProgressRows(c, query)
if err != nil {
return err
}
content, err := exportprogress.BuildWorkbook("Marketings", query, rows)
if err != nil {
return fiber.NewError(fiber.StatusInternalServerError, "failed to generate progress excel file")
}
filename := fmt.Sprintf("marketings_progress_%s.xlsx", time.Now().Format("20060102_150405"))
c.Set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
c.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, filename))
return c.Status(fiber.StatusOK).Send(content)
}
parseUintListParam := func(param string) ([]uint, error) {
if param == "" {
return nil, nil