private void txtNotaBeli_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { if (this._supplier == null || txtSupplier.Text.Length == 0) { MsgHelper.MsgWarning("Maaf isian data belum lengkap !"); txtSupplier.Focus(); return; } var nota = ((TextBox)sender).Text; IBeliProdukBll bll = new BeliProdukBll(_log); var listOfBeli = bll.GetNotaSupplier(this._supplier.supplier_id, nota); if (listOfBeli.Count == 0) { MsgHelper.MsgWarning("Data nota beli tidak ditemukan"); txtNotaBeli.Focus(); txtNotaBeli.SelectAll(); } else if (listOfBeli.Count == 1) { _beli = listOfBeli[0]; _beli.item_beli = bll.GetItemBeli(_beli.beli_produk_id).ToList(); txtNotaBeli.Text = _beli.nota; KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupNota("Data Nota Pembelian", listOfBeli); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
private void txtNotaJual_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { if (this._customer == null || txtCustomer.Text.Length == 0) { MsgHelper.MsgWarning("Maaf isian data belum lengkap !"); txtCustomer.Focus(); return; } var nota = ((TextBox)sender).Text; IJualProdukBll bll = new JualProdukBll(_log); var listOfJual = bll.GetNotaCustomer(this._customer.customer_id, nota); if (listOfJual.Count == 0) { MsgHelper.MsgWarning("Data nota jual tidak ditemukan"); txtNotaJual.Focus(); txtNotaJual.SelectAll(); } else if (listOfJual.Count == 1) { _jual = listOfJual[0]; _jual.item_jual = bll.GetItemJual(_jual.jual_id).ToList(); txtNotaJual.Text = _jual.nota; KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupNota("Data Nota Penjualan", listOfJual); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
private void gridControl_CurrentCellKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { var grid = (GridControl)sender; var rowIndex = grid.CurrentCell.RowIndex; var colIndex = grid.CurrentCell.ColIndex; switch (colIndex) { case 2: // kolom nota if (this._supplier == null || txtSupplier.Text.Length == 0) { MsgHelper.MsgWarning("Nama supplier belum diinputkan"); txtSupplier.Focus(); return; } var cc = grid.CurrentCell; var nota = cc.Renderer.ControlValue.ToString(); IList <BeliProduk> listOfBeli = null; IBeliProdukBll bll = new BeliProdukBll(MainProgram.isUseWebAPI, MainProgram.baseUrl, _log); if (nota.Length > 0) // menampilkan nota kredit berdasarkan nota { listOfBeli = bll.GetNotaKreditByNota(this._supplier.supplier_id, nota); } else { listOfBeli = bll.GetNotaKreditBySupplier(this._supplier.supplier_id, false); } if (listOfBeli.Count == 0) { MsgHelper.MsgWarning("Data pembelian kredit tidak ditemukan"); GridListControlHelper.SelectCellText(grid, rowIndex, colIndex); } else if (listOfBeli.Count == 1) { var beli = listOfBeli[0]; if (!IsExist(beli.nota)) { SetItemBayar(grid, rowIndex, colIndex, beli); grid.Refresh(); GridListControlHelper.SetCurrentCell(grid, rowIndex, 5); // kolom pembayaran } else { MsgHelper.MsgWarning("Data pembayaran sudah diinputkan"); GridListControlHelper.SelectCellText(grid, rowIndex, colIndex); } } else // data nota lebih dari satu, tampilkan di form lookup { _rowIndex = rowIndex; _colIndex = colIndex; var frmLookup = new FrmLookupNota("Data Nota Pembelian", listOfBeli); frmLookup.Listener = this; frmLookup.ShowDialog(); } break; case 6: // keterangan if (grid.RowCount == rowIndex) { _listOfItemPembayaranHutang.Add(new ItemPembayaranHutangProduk()); grid.RowCount = _listOfItemPembayaranHutang.Count; } GridListControlHelper.SetCurrentCell(grid, rowIndex + 1, 2); // fokus ke kolom nota beli break; default: break; } } }