mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
add kolom lokasi to export
This commit is contained in:
@@ -22,9 +22,9 @@ func TestBuildPurchaseExportWorkbookHeadersAndRows(t *testing.T) {
|
||||
nil,
|
||||
"catatan",
|
||||
[]entity.PurchaseItem{
|
||||
buildPurchaseItemForExportTest(11, "Pakan Starter", 1000000),
|
||||
buildPurchaseItemForExportTest(12, "Vitamin A", 350000),
|
||||
buildPurchaseItemForExportTest(11, "Pakan Starter", 0),
|
||||
buildPurchaseItemForExportTest(11, "Pakan Starter", 1000000, "Location A"),
|
||||
buildPurchaseItemForExportTest(12, "Vitamin A", 350000, "Location B"),
|
||||
buildPurchaseItemForExportTest(11, "Pakan Starter", 0, ""),
|
||||
},
|
||||
),
|
||||
buildPurchaseForExportTest(
|
||||
@@ -37,7 +37,7 @@ func TestBuildPurchaseExportWorkbookHeadersAndRows(t *testing.T) {
|
||||
ptrApprovalAction(entity.ApprovalActionRejected),
|
||||
"",
|
||||
[]entity.PurchaseItem{
|
||||
buildPurchaseItemForExportTest(21, "Obat X", 75000),
|
||||
buildPurchaseItemForExportTest(21, "Obat X", 75000, ""),
|
||||
},
|
||||
),
|
||||
})
|
||||
@@ -56,10 +56,11 @@ func TestBuildPurchaseExportWorkbookHeadersAndRows(t *testing.T) {
|
||||
"B1": "PO Number",
|
||||
"C1": "Tanggal PO",
|
||||
"D1": "Supplier",
|
||||
"E1": "Status",
|
||||
"F1": "Grand Total",
|
||||
"G1": "Products",
|
||||
"H1": "Notes",
|
||||
"E1": "Lokasi",
|
||||
"F1": "Status",
|
||||
"G1": "Grand Total",
|
||||
"H1": "Products",
|
||||
"I1": "Notes",
|
||||
}
|
||||
for cell, expected := range expectedHeaders {
|
||||
got, err := file.GetCellValue(purchaseExportSheetName, cell)
|
||||
@@ -75,18 +76,20 @@ func TestBuildPurchaseExportWorkbookHeadersAndRows(t *testing.T) {
|
||||
assertPurchaseCellEquals(t, file, "B2", "PO-00011")
|
||||
assertPurchaseCellEquals(t, file, "C2", "22-04-2026")
|
||||
assertPurchaseCellEquals(t, file, "D2", "Supplier A")
|
||||
assertPurchaseCellEquals(t, file, "E2", "Manager Purchase")
|
||||
assertPurchaseCellEquals(t, file, "F2", "Rp 1.350.000")
|
||||
assertPurchaseCellEquals(t, file, "G2", "Pakan Starter, Vitamin A")
|
||||
assertPurchaseCellEquals(t, file, "H2", "catatan")
|
||||
assertPurchaseCellEquals(t, file, "E2", "Location A")
|
||||
assertPurchaseCellEquals(t, file, "F2", "Manager Purchase")
|
||||
assertPurchaseCellEquals(t, file, "G2", "Rp 1.350.000")
|
||||
assertPurchaseCellEquals(t, file, "H2", "Pakan Starter, Vitamin A")
|
||||
assertPurchaseCellEquals(t, file, "I2", "catatan")
|
||||
|
||||
assertPurchaseCellEquals(t, file, "A3", "PR-00012")
|
||||
assertPurchaseCellEquals(t, file, "B3", "-")
|
||||
assertPurchaseCellEquals(t, file, "C3", "-")
|
||||
assertPurchaseCellEquals(t, file, "E3", "Ditolak")
|
||||
assertPurchaseCellEquals(t, file, "F3", "Rp 75.000")
|
||||
assertPurchaseCellEquals(t, file, "G3", "Obat X")
|
||||
assertPurchaseCellEquals(t, file, "H3", "-")
|
||||
assertPurchaseCellEquals(t, file, "E3", "-")
|
||||
assertPurchaseCellEquals(t, file, "F3", "Ditolak")
|
||||
assertPurchaseCellEquals(t, file, "G3", "Rp 75.000")
|
||||
assertPurchaseCellEquals(t, file, "H3", "Obat X")
|
||||
assertPurchaseCellEquals(t, file, "I3", "-")
|
||||
}
|
||||
|
||||
func assertPurchaseCellEquals(t *testing.T, file *excelize.File, cell, expected string) {
|
||||
@@ -141,8 +144,8 @@ func buildPurchaseForExportTest(
|
||||
}
|
||||
}
|
||||
|
||||
func buildPurchaseItemForExportTest(productID uint, productName string, totalPrice float64) entity.PurchaseItem {
|
||||
return entity.PurchaseItem{
|
||||
func buildPurchaseItemForExportTest(productID uint, productName string, totalPrice float64, locationName string) entity.PurchaseItem {
|
||||
item := entity.PurchaseItem{
|
||||
ProductId: productID,
|
||||
TotalPrice: totalPrice,
|
||||
Product: &entity.Product{
|
||||
@@ -150,6 +153,20 @@ func buildPurchaseItemForExportTest(productID uint, productName string, totalPri
|
||||
Name: productName,
|
||||
},
|
||||
}
|
||||
|
||||
if locationName != "" {
|
||||
locationID := productID + 1000
|
||||
warehouseID := productID + 500
|
||||
item.Warehouse = &entity.Warehouse{
|
||||
Id: warehouseID,
|
||||
Location: &entity.Location{
|
||||
Id: locationID,
|
||||
Name: locationName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
func ptrApprovalAction(value entity.ApprovalAction) *entity.ApprovalAction {
|
||||
|
||||
Reference in New Issue
Block a user