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"`
|
||||||
|
|||||||
@ -21,7 +21,7 @@ type Product struct {
|
|||||||
DeletedAt *time.Time `gorm:"column:deleted_at"`
|
DeletedAt *time.Time `gorm:"column:deleted_at"`
|
||||||
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
||||||
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
||||||
Stock int64 `gorm:"type:int;column:stock"`
|
Stock int64 `gorm:"type:int;column:stock"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Product) TableName() string {
|
func (Product) TableName() string {
|
||||||
@ -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 {
|
||||||
|
|||||||
@ -446,11 +446,12 @@ func MapOrderToPrintDetailResponse(order *entity.OrderPrintDetail, casherName st
|
|||||||
orderItems := make([]response.CreateOrderItemResponse, len(order.OrderItems))
|
orderItems := make([]response.CreateOrderItemResponse, len(order.OrderItems))
|
||||||
for i, item := range order.OrderItems {
|
for i, item := range order.OrderItems {
|
||||||
orderItems[i] = response.CreateOrderItemResponse{
|
orderItems[i] = response.CreateOrderItemResponse{
|
||||||
ID: item.ID,
|
ID: item.ID,
|
||||||
ItemID: item.ItemID,
|
ItemID: item.ItemID,
|
||||||
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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,11 +146,12 @@ type CheckingInquiryResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateOrderItemResponse struct {
|
type CreateOrderItemResponse struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
ItemID int64 `json:"item_id"`
|
ItemID int64 `json:"item_id"`
|
||||||
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