为什么销售税不会增加小计和总计?
//Value from xQuantity
double quantity = Convert.ToDouble(xQuantity.Text);
//Value from xUnitPrice
double unitPrice = Convert.ToDouble(xUnitPrice.Text);
//Value from xSubTotal and xTotalPrice
double SubTotal = quantity * unitPrice;
xSubTotalTextBox.Text = Convert.ToString(subTotal);
double Tax = subTotal * 1.06 + subTotal;
xSubTotalTextBox.Text = Convert.ToString(subTotal);
xTotalPrice.Text = Convert.ToString(totalPrice);
//Calculate subtotal and totalprice
subTotal = Convert.ToDouble(xQuantity.Text) * Convert.ToDouble(xUnitPrice.Text);
xSubTotalTextBox.Text = subTotal.ToString();
xTotalPrice.Text = (subTotal * Tax).ToString();
}
private void xBalance_Click(object sender, EventArgs e)
{
xRetTextBox.Visible = true;
xReturn.Visible = true;
double totalPrice = Convert.ToDouble(xTotalPrice.Text);
double receive = Convert.ToDouble(xRecvTextBox.Text);
double subTotal = totalPrice - receive;
xRetTextBox.Text = Convert.ToString(totalPrice);
if (totalPrice < .01) xRetTextBox.BackColor = Color.Green;
else xRetTextBox.BackColor = Color.Red;
}
答案 0 :(得分:3)
因为这一行:
double Tax = subTotal * 1.06 + subTotal;
应该是错的。税不能是subTotal*1.06+subTotal
;
也许你的意思是:
double totalPrice = subTotal * (1.06/100) + subTotal ;
xSubTotalTextBox.Text = Convert.ToString(subTotal);
xTotalPrice.Text = Convert.ToString(totalPrice);
答案 1 :(得分:1)
实际税额为0.06 * subTotal(假设为6%)。总额(含税)为1.06 * subTotal。