private void AddPrintData(string no_penjualan) { StrukDataset.PenjualanRow penjualanRow = penjualans.NewPenjualanRow(); penjualanRow.no_penjualan = no_penjualan; penjualanRow.nama_kasir = txtKasir.Text; penjualanRow.tgl_beli = DateTime.Now; penjualanRow.nama_member = txtNamaMember.Text; penjualanRow.total_harga = lblSubtotal.Content.ToString(); penjualanRow.total_item = lblJumlahBarang.Content.ToString(); penjualanRow.total = lblTotalPembayaran.Text; penjualanRow.poin_terpakai = Convert.ToInt32(txtPoin.Text); penjualanRow.tunai = Kenko.formatCurrency(double.Parse(Kenko.getNumber2(txtBayar.Text))); penjualanRow.kembalian = lblKembalian.Content.ToString(); penjualans.AddPenjualanRow(penjualanRow); foreach (DataRow row in dtPenjualan.Rows) { double harga = double.Parse(Kenko.getNumber(row["harga"].ToString())); StrukDataset.Detail_PenjualanRow detail_PenjualanRow = detail_Penjualans.NewDetail_PenjualanRow(); detail_PenjualanRow.nama_obat = row["nama_obat"].ToString(); detail_PenjualanRow.jumlah = row["jumlah"].ToString(); detail_PenjualanRow.harga = Kenko.formatCurrency(harga); detail_Penjualans.AddDetail_PenjualanRow(detail_PenjualanRow); } }
private void txtBayar_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { double totalPembayaran = Convert.ToDouble(Kenko.getNumber(lblTotalPembayaran.Text)); double bayar = double.Parse(Kenko.getNumber2(txtBayar.Text)); if (bayar < totalPembayaran) { MessageBox.Show("Uang pembayaran tidak mencukupi", "Gagal", MessageBoxButton.OK, MessageBoxImage.Error); } else { double kembalian = double.Parse(Kenko.getNumber2(txtBayar.Text)) - totalPembayaran; lblKembalian.Content = Kenko.formatCurrency(kembalian); btnBayar.IsEnabled = true; } } }