0% found this document useful (0 votes)
20 views3 pages

Using Using Using Using Using Using Using Using Using: //nama: Muhammad Harry Antomy //NIM: F1E119044

The document contains code for a C# Windows Forms application that implements a simple cashier application. It includes code to initialize form controls like dropdown lists and text boxes. Functions are defined to add item details to a list view when an "Add" button is clicked, clear fields, and check for user confirmation before closing. Conditionals populate price and promotion fields depending on the selected item name.

Uploaded by

Agama SI 2019
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)
20 views3 pages

Using Using Using Using Using Using Using Using Using: //nama: Muhammad Harry Antomy //NIM: F1E119044

The document contains code for a C# Windows Forms application that implements a simple cashier application. It includes code to initialize form controls like dropdown lists and text boxes. Functions are defined to add item details to a list view when an "Add" button is clicked, clear fields, and check for user confirmation before closing. Conditionals populate price and promotion fields depending on the selected item name.

Uploaded by

Agama SI 2019
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/ 3

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;

//NAMA : MUHAMMAD HARRY ANTOMY


//NIM : F1E119044

namespace Aplikasi_Kasir_Sederhana
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
List<string> nlist = new List<string>();
nlist.Add("Le Mineral");
nlist.Add("Teh Botol");
nlist.Add("Coca Cola");
nlist.Add("Sprite");
nlist.Add("Roti Gandum");
nlist.Add("SariRoti");
nlist.Add("Sabun");
nlist.Add("Shampo");

cmb_nama.DataSource = nlist;

delete();
}
private void delete()
{
cmb_nama.SelectedIndex = -1;
txt_harga.Clear();
num_jml.Value = 0;
cmb_promo.SelectedIndex = -1;
}

private void Button1_Click(object sender, EventArgs e)


{

if (string.IsNullOrEmpty(txt_harga.Text))
{
MessageBox.Show("Silakan Pilih Item Terlebih
Dahulu","Peringatan",MessageBoxButtons.OK,MessageBoxIcon.Warning);
} else
{
ListViewItem item = new ListViewItem(cmb_nama.Text);

item.SubItems.Add("Rp " + txt_harga.Text);


item.SubItems.Add(num_jml.Value.ToString());
item.SubItems.Add(cmb_promo.Text);
log_history_view.Items.Add(item);

delete();
}

}
private void Btn_Hapus_log_Click(object sender, EventArgs e)
{
if (log_history_view.Items.Count >= 1)
{
if ( MessageBox.Show("Apakah Anda Ingin Menghapus ?", "Peringatan",
MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
log_history_view.Items.Clear();
} else
{

} else
{
MessageBox.Show("Silakan Pilih Item Terlebih Dahulu", "Peringatan",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

private void Btn_keluar_Click(object sender, EventArgs e)


{
if (MessageBox.Show("Apakah Yakin ?", "Konfirmasi", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
MessageBox.Show("Terimakasih", "Konfirmasi", MessageBoxButtons.OK);

Close();
} else
{

private void Cmb_nama_SelectedIndexChanged(object sender, EventArgs e)


{
if (cmb_nama.Text == "Le Mineral")
{
txt_harga.Text = "3000";
num_jml.Value = 1;

List<string> nlist = new List<string>();


nlist.Add("Diskon 25%");
nlist.Add("Beli 1 Gratis 1");
nlist.Add("Promo Akhir Tahun");

cmb_promo.DataSource = nlist;
}
else if (cmb_nama.Text == "Teh Botol")
{
txt_harga.Text = "2000";
num_jml.Value = 1;

List<string> nlist = new List<string>();


nlist.Add("Diskon 15%");

cmb_promo.DataSource = nlist;
}
else if (cmb_nama.Text == "Coca Cola")
{
txt_harga.Text = "9000";
num_jml.Value = 1;

List<string> nlist = new List<string>();


nlist.Add("Diskon 10%");

cmb_promo.DataSource = nlist;
}
else if (cmb_nama.Text == "Sprite")
{
txt_harga.Text = "10000";
num_jml.Value = 1;

List<string> nlist = new List<string>();


nlist.Add("Diskon 65%");

cmb_promo.DataSource = nlist;
}
else if (cmb_nama.Text == "Roti Gandum")
{
txt_harga.Text = "2000";
num_jml.Value = 1;

List<string> nlist = new List<string>();


nlist.Add("-");

cmb_promo.DataSource = nlist;
}

}
}
}

You might also like