public void GetItemJualTest() { var index = 2; var jualId = "d1dbd28a-592f-4841-bfb6-bc41f48acf32"; var oList = _bll.GetItemJual(jualId); var itemBeli = oList[index]; Assert.AreEqual("7f09a4aa-e660-4de3-a3aa-4b3244675f9f", itemBeli.Produk.produk_id); Assert.AreEqual("201607000000051", itemBeli.Produk.kode_produk); Assert.AreEqual("Access Point TPLINK TC-WA 500G", itemBeli.Produk.nama_produk); Assert.AreEqual(77000, itemBeli.harga_jual); Assert.AreEqual(22, itemBeli.jumlah); }
protected override void Perbaiki() { var index = this.gridList.SelectedIndex; if (!base.IsSelectedItem(index, this.TabText)) { return; } var jual = _listOfJual[index]; jual.tanggal_tempo_old = jual.tanggal_tempo; jual.item_jual = _bll.GetItemJual(jual.jual_id); LogicalThreadContext.Properties["OldValue"] = jual.ToJson(); var frm = new FrmEntryPenjualanProduk("Edit Data " + this.Text, jual, _bll); frm.Listener = this; frm.ShowDialog(); }
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); } }