0% found this document useful (0 votes)
5 views4 pages

Tinhtiencf

The document contains code for a C# Windows Forms application that calculates coffee order totals. It handles selecting different coffee types and discounts, calculating order subtotals, and resetting values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Tinhtiencf

The document contains code for a C# Windows Forms application that calculates coffee order totals. It handles selecting different coffee types and discounts, calculating order subtotals, and resetting values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace tinhtiencf
{
public partial class Form1 : Form

{
public float tongtien;
public int tongkhach;
public string mon;
public Form1()
{
InitializeComponent();
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)


{

private void btnthoat_Click(object sender, EventArgs e)


{
DialogResult thoat = MessageBox.Show("bạn có muốn thoát", "Đóng form",
MessageBoxButtons.YesNo);
if (thoat == DialogResult.Yes)
Application.Exit();
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{

private void lbnten_Click(object sender, EventArgs e)


{

private void txtten_TextChanged(object sender, EventArgs e)


{

private void btntinhtien_Click(object sender, EventArgs e)


{

tongkhach++;
if (rdloai.Checked == true && cbsv.Checked == false)
{
tongtien += 20000;
mon = "1 cafe đá";
}
else if (rdloai.Checked == true && cbsv.Checked == true)
{
tongtien += 20000 * 80 / 100;
mon = "1 cafe đá";
}
else if (rdloai2.Checked == true && cbsv.Checked == false)
{
tongtien += 25000;
mon = "1 cafe sữa";
}
else if (rdloai2.Checked == true && cbsv.Checked == true)
{
tongtien += 25000 * 80 / 100;
mon = "1 cafe sữa";
}
else if (rdloai3.Checked == true && cbsv.Checked == false)
{
tongtien += 30000;
mon = "1 cafe sữa đá";
}
else if (rdloai3.Checked == true && cbsv.Checked == true)
{
tongtien += 30000 * 80 / 100;
mon = "1 cafe sữa đá";
}
else if (raloai4.Checked == true && cbsv.Checked == false)
{
tongtien += 25000;
mon = "1 cafe đá";
}
else if (raloai4.Checked == true && cbsv.Checked == true)
{
tongtien += 25000 * 80 / 100;
mon = "1 cafe đá";
}
else if (raloai5.Checked == true && cbsv.Checked == false)
{
tongtien += 30000;
mon = "1 cafe kem";
}
else
{
tongtien += 30000 * 80 / 100;
mon = "1 cafe kem";
}
MessageBox.Show("thêm: " + mon, "Hóa Đơn", MessageBoxButtons.OK);
btnthanhtoan.Enabled = true;
btnnhaplai.Enabled = true;
txtthanhtoan.Text = tongtien.ToString();
txttong.Text = tongkhach.ToString();
}

private void txtten_Leave(object sender, EventArgs e)


{
if (txtten.Text == "")
{
MessageBox.Show("Vui lòng nhập tên", "Thông báo");
}
}

private void Form1_Load(object sender, EventArgs e)


{
btnnhaplai.Enabled = false;
btnthanhtoan.Enabled = false;
btnnhaplai.Enabled = false;
// rdloai.Enabled = raloai4.Enabled = raloai5.Enabled = rdloai2.Enabled =
false;
}

private void rdloai_CheckedChanged(object sender, EventArgs e)


{
if (txtten.TextLength > 0 && rdloai.Checked == true)
{
btntinhtien.Enabled = true;
}
}

private void btnthanhtoan_Click(object sender, EventArgs e)


{
MessageBox.Show("Tổng tiền bạn cần thanh toán: " + tongtien, "Hóa
Đơn",MessageBoxButtons.OK);
tongtien = 0;
tongkhach = 0;
txtten.Text = null;
cbsv.Checked = false;
rdloai.Checked = false;
rdloai2.Checked = false;
rdloai3.Checked = false;
raloai4.Checked = false;
raloai5.Checked = false;
txttong.Text = null;
txtthanhtoan.Text = null;
btntinhtien.Enabled = false;
btnthanhtoan.Enabled = false;
btnnhaplai.Enabled = false;
}

private void rdloai2_CheckedChanged(object sender, EventArgs e)


{
if (txtten.TextLength > 0 && rdloai2.Checked == true)
{
btntinhtien.Enabled = true;
}
}

private void rdloai3_CheckedChanged(object sender, EventArgs e)


{
if (txtten.TextLength > 0 && rdloai3.Checked == true)
{
btntinhtien.Enabled = true;
}
}

private void raloai4_CheckedChanged(object sender, EventArgs e)


{
if (txtten.TextLength > 0 && raloai4.Checked == true)
{
btntinhtien.Enabled = true;
}
}

private void raloai5_CheckedChanged(object sender, EventArgs e)


{
if (txtten.TextLength > 0 && raloai5.Checked == true)
{
btntinhtien.Enabled = true;
}
}

private void btnnhaplai_Click(object sender, EventArgs e)


{
tongkhach = 0;
tongtien = 0;
txtten.Text = null;
cbsv.Checked = false;
rdloai.Checked = false;
rdloai2.Checked = false;
rdloai3.Checked = false;
raloai4.Checked = false;
raloai5.Checked = false;
txttong.Text = null;
txtthanhtoan.Text = null;
btntinhtien.Enabled = false;
btnthanhtoan.Enabled = false;
btnnhaplai.Enabled = false;
}
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy