Exemplo n.º 1
0
        private void btnTambah_Click(object sender, EventArgs e)
        {
            double harga;

            va = new validasi(this.groupBox1.Controls, this.eValidasi);
            if (va.doValidation() == false)
            {
                return;
            }
            for (int i = 0; i < lvObat.Items.Count; i++)
            {
                if (lvObat.Items[i].SubItems[0].Text == cmbIdobat.Text)
                {
                    lvObat.Items[i].Remove();
                }
            }
            ListViewItem lv = new ListViewItem(cmbIdobat.Text);

            lv.SubItems.Add(tbNamaobat.Text);
            lv.SubItems.Add(tbHargaobat.Text);
            lv.SubItems.Add(nupStok.Value.ToString());
            harga = Double.Parse(tbHargaobat.Text) * (int)nupStok.Value;
            lv.SubItems.Add(harga.ToString());
            lvObat.Items.Add(lv);
            va.clear("cmbIdobat");

            if (lvObat.Items.Count == 1)
            {
                tbTotal.Text = lvObat.Items[0].SubItems[4].Text;
            }

            else
            {
                for (int i = 1; i < lvObat.Items.Count; i++)
                {
                    tbTotal.Text = (int.Parse(tbTotal.Text) + int.Parse(lvObat.Items[i].SubItems[4].Text)).ToString();
                }
            }
            btnHapus.Enabled = true;
        }
Exemplo n.º 2
0
        private void btnBayar_Click(object sender, EventArgs e)
        {
            try
            {
                va = new validasi(this.groupBox2.Controls, this.eValidasi);
                if (va.doValidation() == false)
                {
                    return;
                }
                if (int.Parse(textBox1.Text) <= int.Parse(tbTotal.Text))
                {
                    MessageBox.Show("Uang anda tidak mencukupi!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                aksi();
                String kembali = (int.Parse(textBox1.Text) - int.Parse(tbTotal.Text)).ToString();
                MessageBox.Show(" Berhasil melakukan pembayaran\n Kembalian anda adalah Rp." + kembali + "\n Terima kasih", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }

            catch (Exception err)
            {
                MessageBox.Show("Terjadi kesalahan", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
 public frmAntrian(frmUtama frm)
 {
     InitializeComponent();
     va       = new validasi(this.Controls, this.eValidasi);
     this.frm = frm;
 }
Exemplo n.º 4
0
 public frmAntrian()
 {
     InitializeComponent();
     va = new validasi(this.Controls, this.eValidasi);
 }
Exemplo n.º 5
0
 public frmDiagnosa()
 {
     InitializeComponent();
     va = new validasi(this.Controls, this.eValidasi);
 }
Exemplo n.º 6
0
 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
     va = new validasi(this.groupBox2.Controls, this.eValidasi);
     va.numberFormat(e);
 }