Update Product POS
This commit is contained in:
parent
57f019b1e9
commit
97d02c3537
@ -230,6 +230,7 @@ type OrderPrintDetail struct {
|
|||||||
ID int64 `gorm:"column:id"`
|
ID int64 `gorm:"column:id"`
|
||||||
Logo string `gorm:"logo"`
|
Logo string `gorm:"logo"`
|
||||||
PartnerName string `gorm:"column:partner_name"`
|
PartnerName string `gorm:"column:partner_name"`
|
||||||
|
SiteName string `gorm:"column:site_name"`
|
||||||
OrderID string `gorm:"column:order_id"`
|
OrderID string `gorm:"column:order_id"`
|
||||||
VisitDate time.Time `gorm:"column:visit_date"`
|
VisitDate time.Time `gorm:"column:visit_date"`
|
||||||
PaymentType string `gorm:"column:payment_type"`
|
PaymentType string `gorm:"column:payment_type"`
|
||||||
|
|||||||
@ -94,7 +94,8 @@ func (b *ProductList) ToProductList() []*Product {
|
|||||||
|
|
||||||
func (b *ProductList) ToProductListPOS() []*Product {
|
func (b *ProductList) ToProductListPOS() []*Product {
|
||||||
var Products []*Product
|
var Products []*Product
|
||||||
today := time.Now().Weekday()
|
location, _ := time.LoadLocation("Asia/Jakarta")
|
||||||
|
today := time.Now().In(location).Weekday()
|
||||||
isWeekend := today == time.Saturday || today == time.Sunday
|
isWeekend := today == time.Saturday || today == time.Sunday
|
||||||
|
|
||||||
for _, p := range *b {
|
for _, p := range *b {
|
||||||
|
|||||||
@ -451,6 +451,7 @@ func MapOrderToPrintDetailResponse(order *entity.OrderPrintDetail, casherName st
|
|||||||
Quantity: item.Quantity,
|
Quantity: item.Quantity,
|
||||||
Price: item.Price,
|
Price: item.Price,
|
||||||
Name: item.Product.Name,
|
Name: item.Product.Name,
|
||||||
|
IsSeasonTicket: item.Product.IsSeasonTicket,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +466,7 @@ func MapOrderToPrintDetailResponse(order *entity.OrderPrintDetail, casherName st
|
|||||||
VisitTime: time.Now().Format("15:04:05"),
|
VisitTime: time.Now().Format("15:04:05"),
|
||||||
OrderItems: orderItems,
|
OrderItems: orderItems,
|
||||||
CasheerName: casherName,
|
CasheerName: casherName,
|
||||||
PartnerName: order.PartnerName,
|
PartnerName: order.SiteName,
|
||||||
Logo: order.Logo,
|
Logo: order.Logo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,6 +151,7 @@ type CreateOrderItemResponse struct {
|
|||||||
Quantity int64 `json:"quantity"`
|
Quantity int64 `json:"quantity"`
|
||||||
Price float64 `json:"price"`
|
Price float64 `json:"price"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
IsSeasonTicket bool `json:"is_season_ticket"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductDailySales struct {
|
type ProductDailySales struct {
|
||||||
|
|||||||
@ -70,10 +70,11 @@ func (r *OrderRepository) FindPrintDetailByID(ctx context.Context, id int64) (*e
|
|||||||
|
|
||||||
err := r.db.WithContext(ctx).
|
err := r.db.WithContext(ctx).
|
||||||
Table("orders").
|
Table("orders").
|
||||||
Select("orders.id, partners.name as partner_name, partners.logo as logo, orders.ref_id as order_id, "+
|
Select("orders.id, partners.name as partner_name, sites.name as site_name, partners.logo as logo, orders.ref_id as order_id, "+
|
||||||
"orders.visit_date, orders.payment_type, orders.source, "+
|
"orders.visit_date, orders.payment_type, orders.source, "+
|
||||||
"orders.ticket_status, orders.total, orders.fee").
|
"orders.ticket_status, orders.total, orders.fee").
|
||||||
Joins("JOIN partners ON partners.id = orders.partner_id").
|
Joins("JOIN partners ON partners.id = orders.partner_id").
|
||||||
|
Joins("JOIN sites ON sites.id = orders.site_id").
|
||||||
Where("orders.id = ?", id).
|
Where("orders.id = ?", id).
|
||||||
Scan(&printDetail).Error
|
Scan(&printDetail).Error
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user