Untitled

mail@pastecode.io avatar
unknown
golang
a month ago
1.0 kB
1
Indexable
Never
// calculate ticket paymanet
	promoAkhir := float64(0)
	total := float64(0)
	price := ticketItem.Price
	tax := float64(0)
	platform_fee := float64(0)

	if ticketEvent.Tax != 0 {
		tax = (float64(price) * float64(qty)) * (float64(ticketEvent.Tax) / 100)
	}

	if ticketEvent.PlatFormFee != 0 && ticketEvent.TypePlatformFee == 1 {
		platform_fee = (float64(price) * float64(qty)) * (float64(ticketEvent.PlatFormFee) / 100)
	}

	if ticketEvent.PlatFormFee != 0 && ticketEvent.TypePlatformFee == 2 {
		platform_fee = float64(ticketEvent.PlatFormFee)
	}

	if potongan != 0 {
		total = (float64(price) * float64(qty)) + tax + platform_fee - (float64(potongan) * float64(qty))
		promoAkhir = float64(potongan) * float64(qty)
	} else if disconut != 0 {
		disc := (float64(price) + tax + platform_fee) * float64(disconut) / 100
		total = (float64(price) * float64(qty)) + tax + platform_fee - (disc * float64(qty))
		promoAkhir = disc * float64(qty)
	} else {
		total = (float64(price) * float64(qty)) + tax + platform_fee
	}
Leave a Comment