public void GetListItemNotaTerakhirTest() { var penggunaId = "00b5acfa-b533-454b-8dfd-e7881edd180f"; var mesinId = "b0df248f-3cf9-4b28-95ae-1691d4465a80"; var obj = _bll.GetListItemNotaTerakhir(penggunaId, mesinId); Assert.IsNotNull(obj); Assert.AreEqual("eeb4d5c2-6dc9-49bb-af80-515bcd63d927", obj.jual_id); Assert.AreEqual("201710180515", obj.nota); Assert.AreEqual("b0df248f-3cf9-4b28-95ae-1691d4465a80", obj.mesin_id); Assert.AreEqual("b0df248f-3cf9-4b28-95ae-1691d4465a80", obj.Mesin.mesin_id); Assert.AreEqual(150000, obj.Mesin.saldo_awal); // cek item var index = 1; Assert.AreEqual(2, obj.item_jual.Count); Assert.AreEqual("11112", obj.item_jual[index].Produk.kode_produk); Assert.AreEqual("LAN Tester", obj.item_jual[index].Produk.nama_produk); }
private void Shortcut(object sender, KeyEventArgs e) { double total = 0; try { if (e.Modifiers == Keys.Control && e.KeyCode == Keys.B) // pembatalan transaksi { total = SumGrid(_listOfItemJual); if (total > 0) { ResetTransaksi(); // reset transaksi dengan menampilkan pesan konfirmasi } } else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D) // hapus item transaksi { total = SumGrid(_listOfItemJual); if (total > 0) { HapusItemTransaksi(); // hapus item transaksi } } else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.N) // tanpa nota/struk { if (_isCetakStruk) { _isCetakStruk = false; ShowMessage("Tanpa nota/struk transaksi", true); } } else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.X) // tutup form aktif { this.Close(); } else { if (KeyPressHelper.IsShortcutKey(Keys.F5, e) || KeyPressHelper.IsShortcutKey(Keys.F6, e) || KeyPressHelper.IsShortcutKey(Keys.F7, e)) { var colIndex = 5; var rowIndex = this.gridControl.CurrentCell.RowIndex; switch (e.KeyCode) { case Keys.F5: // edit jumlah colIndex = 5; break; case Keys.F6: // edit diskon colIndex = 6; break; case Keys.F7: // edit harga colIndex = 7; break; default: break; } if (gridControl.RowCount > 1 && gridControl.RowCount == rowIndex) { gridControl.Focus(); GridListControlHelper.SetCurrentCell(gridControl, _listOfItemJual.Count - 1, colIndex); } } else { switch (e.KeyCode) { case Keys.F3: // input produk gridControl.Focus(); GridListControlHelper.SetCurrentCell(gridControl, _listOfItemJual.Count, 2); // fokus ke kolom kode produk break; case Keys.F4: // cari/reset pelanggan if (_customer == null) // cari pelanggan { txtCustomer.Enabled = true; txtCustomer.Focus(); } else // reset pelanggan { _customer = null; txtCustomer.Clear(); lblStatusBar.Text = lblStatusBar.Text.Replace("Reset Pelanggan", "Cari Pelanggan"); } break; case Keys.F8: // cek nota terakhir var jual = _bll.GetListItemNotaTerakhir(_pengguna.pengguna_id, MainProgram.mesinId); if (jual == null) { ShowMessage("Belum ada info nota terakhir", true); return; } jual.item_jual = _bll.GetItemJual(jual.jual_id); var frmInfoNota = new FrmInfoNotaTerakhir("Info Nota Terakhir", jual); frmInfoNota.ShowDialog(); break; case Keys.F10: // bayar e.SuppressKeyPress = true; if (this._jual == null) { _jual = new JualProduk(); } _jual.total_nota = SumGrid(_listOfItemJual); if (!(_jual.total_nota > 0)) { ShowMessage("Anda belum melengkapi inputan data produk !", true); return; } _jual.pengguna_id = this._pengguna.pengguna_id; _jual.Pengguna = this._pengguna; if (this._customer != null) { _jual.customer_id = this._customer.customer_id; _jual.Customer = this._customer; } _jual.nota = _currentNota; _jual.tanggal = DateTime.Today; _jual.tanggal_tempo = DateTimeHelper.GetNullDateTime(); _jual.is_tunai = true; _jual.item_jual = this._listOfItemJual.Where(f => f.Produk != null).ToList(); foreach (var item in _jual.item_jual) { if (!(item.harga_beli > 0)) { item.harga_beli = item.Produk.harga_beli; } if (!(item.harga_jual > 0)) { item.harga_jual = GetHargaJualFix(item.Produk, item.jumlah - item.jumlah_retur, item.Produk.harga_jual); } } DisplayTotal(lblTotal.Text); var frmBayar = new FrmBayar("Pembayaran", _jual, _bll); frmBayar.Listener = this; frmBayar.ShowDialog(); break; default: break; } } } } catch (Exception ex) { _log.Error("Error:", ex); } }