private void chkAktif_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is Produk) // pencarian produk baku { var produk = (Produk)data; if (!IsExist(produk.produk_id)) { SetItemProduk(this.gridControl, _rowIndex, _colIndex + 1, produk); this.gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, _colIndex + 1); } else { MsgHelper.MsgWarning("Data produk sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Supplier) // pencarian supplier { this._supplier = (Supplier)data; txtSupplier.Text = this._supplier.nama_supplier; KeyPressHelper.NextFocus(); } }
private void txtSupplier_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var name = ((TextBox)sender).Text; ISupplierBll bll = new SupplierBll(MainProgram.isUseWebAPI, MainProgram.baseUrl, _log); var listOfSupplier = bll.GetByName(name); if (listOfSupplier.Count == 0) { MsgHelper.MsgWarning("Data supplier tidak ditemukan"); txtSupplier.Focus(); txtSupplier.SelectAll(); } else if (listOfSupplier.Count == 1) { _supplier = listOfSupplier[0]; txtSupplier.Text = _supplier.nama_supplier; KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupReferensi("Data Supplier", listOfSupplier); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
public void Ok(object sender, object data) { if (data is BeliProduk) // pencarian nota { var beli = (BeliProduk)data; if (!IsExist(beli.nota)) { SetItemBayar(this.gridControl, _rowIndex, _colIndex + 1, beli); this.gridControl.Refresh(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 5); // kolom pembayaran } else { MsgHelper.MsgWarning("Data nota sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Supplier) // pencarian supplier { this._supplier = (Supplier)data; txtSupplier.Text = this._supplier.nama_supplier; KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is Produk) // pencarian produk baku { var produk = (Produk)data; if (!IsExist(produk.produk_id)) { double diskon = produk.diskon > 0 ? produk.diskon : produk.Golongan.diskon; SetItemProduk(this.gridControl, _rowIndex, _colIndex + 1, produk, diskon: diskon); this.gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, _colIndex + 1); } else { MsgHelper.MsgWarning("Data produk sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is JualProduk) // pencarian nota { var jual = (JualProduk)data; if (!IsExist(jual.nota)) { SetItemBayar(this.gridControl, _rowIndex, _colIndex + 1, jual); this.gridControl.Refresh(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 5); // kolom pembayaran } else { MsgHelper.MsgWarning("Data nota sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; KeyPressHelper.NextFocus(); } }
private void txtCustomer_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var customerName = ((AdvancedTextbox)sender).Text; ICustomerBll bll = new CustomerBll(_log); var listOfCustomer = bll.GetByName(customerName); if (listOfCustomer.Count == 0) { MsgHelper.MsgWarning("Data customer tidak ditemukan"); txtCustomer.Focus(); txtCustomer.SelectAll(); } else if (listOfCustomer.Count == 1) { _customer = listOfCustomer[0]; txtCustomer.Text = _customer.nama_customer; KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupReferensi("Data Customer", listOfCustomer); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
private void txtKabupatenTujuan_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var kabupaten = ((AdvancedTextbox)sender).Text; IList <KabupatenTujuanRajaOngkir> listOfKabupaten = GetKabupatenByName <KabupatenTujuanRajaOngkir>(kabupaten); if (listOfKabupaten.Count == 0) { MsgHelper.MsgWarning("Data kota/kabupaten tujuan tidak ditemukan"); txtKabupatenTujuan.Focus(); txtKabupatenTujuan.SelectAll(); } else if (listOfKabupaten.Count == 1) { _kabupatenTujuan = listOfKabupaten[0]; txtKabupatenTujuan.Text = _kabupatenTujuan.nama_kabupaten; KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupReferensi("Data Kota/Kabupaten Tujuan", listOfKabupaten); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
private void txtBayarTunai_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { KeyPressHelper.NextFocus(); KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is Produk) // pencarian produk baku { this._produk = (Produk)data; SetDataProduk(this._produk); KeyPressHelper.NextFocus(); } }
/// <summary> /// Override to achieve keyboard operated form /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Enter: KeyPressHelper.NextFocus(); break; } return(base.ProcessCmdKey(ref msg, keyData)); }
public void Ok(object sender, object data) { if (data is Produk) // pencarian produk baku { var produk = (Produk)data; double diskon = 0; if (_customer != null) { diskon = _customer.diskon; } if (!(diskon > 0)) { diskon = produk.diskon > 0 ? produk.diskon : produk.Golongan.diskon; } SetItemProduk(this.gridControl, _rowIndex, _colIndex + 1, produk, diskon: diskon); this.gridControl.Refresh(); RefreshTotal(); if (this.gridControl.RowCount == _rowIndex) { _listOfItemJual.Add(new ItemJualProduk()); this.gridControl.RowCount = _listOfItemJual.Count; } GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex + 1, 2); // pindah kebaris berikutnya } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; KeyPressHelper.NextFocus(); } else if (data is AlamatKirim) { var alamatKirim = (AlamatKirim)data; if (this._jual == null) { this._jual = new JualProduk(); } this._jual.is_sdac = alamatKirim.is_sdac; this._jual.kirim_kepada = alamatKirim.kepada; this._jual.kirim_alamat = alamatKirim.alamat; this._jual.kirim_kecamatan = alamatKirim.kecamatan; this._jual.kirim_kelurahan = alamatKirim.kelurahan; this._jual.kirim_kota = alamatKirim.kota; this._jual.kirim_kode_pos = alamatKirim.kode_pos; this._jual.kirim_telepon = alamatKirim.telepon; } }
public void Ok(object sender, object data) { if (data is KabupatenAsalRajaOngkir) // hasil pencarian kabupaten asal { this._kabupatenAsal = (KabupatenAsalRajaOngkir)data; txtKabupatenAsal.Text = this._kabupatenAsal.nama_kabupaten; KeyPressHelper.NextFocus(); } else if (data is KabupatenTujuanRajaOngkir) // hasil pencarian kabupaten tujuan { this._kabupatenTujuan = (KabupatenTujuanRajaOngkir)data; txtKabupatenTujuan.Text = this._kabupatenTujuan.nama_kabupaten; KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is Produk) // pencarian produk baku { var produk = (Produk)data; SetItemProduk(this.gridControl, _rowIndex, produk); this.gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, _colIndex + 1); } else if (data is Supplier) // pencarian supplier { this._supplier = (Supplier)data; txtSupplier.Text = this._supplier.nama_supplier; KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is ItemJualProduk) // pencarian produk baku { var itemJual = (ItemJualProduk)data; var produk = itemJual.Produk; if (!IsExist(produk.produk_id)) { SetItemProduk(this.gridControl, _rowIndex, itemJual, itemJual.jumlah - itemJual.jumlah_retur, itemJual.harga_jual); this.gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, _colIndex + 1); RefreshTotal(); } else { MsgHelper.MsgWarning("Data produk sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; KeyPressHelper.NextFocus(); } else if (data is JualProduk) // pencarian data jual { IJualProdukBll bll = new JualProdukBll(_log); this._jual = (JualProduk)data; this._jual.item_jual = bll.GetItemJual(this._jual.jual_id).ToList(); txtNotaJual.Text = this._jual.nota; KeyPressHelper.NextFocus(); } }
public void Ok(object sender, object data) { if (data is ItemBeliProduk) // pencarian produk baku { var itemBeli = (ItemBeliProduk)data; var produk = itemBeli.Produk; if (!IsExist(produk.produk_id)) { SetItemProduk(this.gridControl, _rowIndex, itemBeli, itemBeli.jumlah - itemBeli.jumlah_retur, itemBeli.harga); this.gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, _colIndex + 1); RefreshTotal(); } else { MsgHelper.MsgWarning("Data produk sudah diinputkan"); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, _colIndex); } } else if (data is Supplier) // pencarian Customer { this._supplier = (Supplier)data; txtSupplier.Text = this._supplier.nama_supplier; KeyPressHelper.NextFocus(); } else if (data is BeliProduk) // pencarian data jual { IBeliProdukBll bll = new BeliProdukBll(_log); this._beli = (BeliProduk)data; this._beli.item_beli = bll.GetItemBeli(this._beli.beli_produk_id).ToList(); txtNotaBeli.Text = this._beli.nota; KeyPressHelper.NextFocus(); } }
private void txtCustomer_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var customerName = ((AdvancedTextbox)sender).Text; if (customerName.Length == 0) { ShowMessage("Nama pelanggan tidak boleh kosong", true); return; } ICustomerBll bll = new CustomerBll(_log); var listOfCustomer = bll.GetByName(customerName); if (listOfCustomer.Count == 0) { ShowMessage("Data pelanggan tidak ditemukan", true); txtCustomer.Focus(); txtCustomer.SelectAll(); } else if (listOfCustomer.Count == 1) { _customer = listOfCustomer[0]; txtCustomer.Text = _customer.nama_customer; ShowMessage(""); lblStatusBar.Text = lblStatusBar.Text.Replace("Cari Pelanggan", "Reset Pelanggan"); KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupReferensi("Data Pelanggan", listOfCustomer); frmLookup.Listener = this; frmLookup.ShowDialog(); } } }
private void txtKodeProduk_KeyPress(object sender, KeyPressEventArgs e) { if (KeyPressHelper.IsEnter(e)) { var keyword = ((AdvancedTextbox)sender).Text; IProdukBll produkBll = new ProdukBll(MainProgram.isUseWebAPI, MainProgram.baseUrl, _log); this._produk = produkBll.GetByKode(keyword); if (this._produk == null) { var listOfProduk = produkBll.GetByName(keyword); if (listOfProduk.Count == 0) { MsgHelper.MsgWarning("Data produk tidak ditemukan"); txtKodeProduk.Focus(); txtKodeProduk.SelectAll(); } else if (listOfProduk.Count == 1) { this._produk = listOfProduk[0]; SetDataProduk(this._produk); KeyPressHelper.NextFocus(); } else // data lebih dari satu { var frmLookup = new FrmLookupReferensi("Data Produk", listOfProduk); frmLookup.Listener = this; frmLookup.ShowDialog(); } } else { SetDataProduk(this._produk); KeyPressHelper.NextFocus(); } } }
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 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(); } } }
public void Ok(object sender, object data) { // filter berdasarkan data if (data is Produk) // pencarian produk baku { var produk = (Produk)data; IHargaGrosirBll hargaGrosirBll = new HargaGrosirBll(_log); produk.list_of_harga_grosir = hargaGrosirBll.GetListHargaGrosir(produk.produk_id).ToList(); if (!_pengaturanUmum.is_stok_produk_boleh_minus) { if (produk.is_stok_minus) { ShowMessage("Maaf stok produk tidak boleh minus", true); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, 3); return; } } double diskon = 0; if (_customer != null) { diskon = _customer.diskon; } if (!(diskon > 0)) { var diskonProduk = GetDiskonJualFix(produk, 1, produk.diskon); diskon = diskonProduk > 0 ? diskonProduk : produk.Golongan.diskon; } ItemJualProduk itemJual = null; // cek item produk sudah diinputkan atau belum ? var itemProduk = GetExistItemProduk(produk.produk_id); if (itemProduk != null) // sudah ada, tinggal update jumlah { var index = _listOfItemJual.IndexOf(itemProduk); UpdateItemProduk(this.gridControl, index); this.gridControl.GetCellRenderer(_rowIndex, _colIndex).ControlText = string.Empty; itemJual = _listOfItemJual[index]; } else { SetItemProduk(this.gridControl, _rowIndex, produk, diskon: diskon); itemJual = _listOfItemJual[_rowIndex - 1]; if (this.gridControl.RowCount == _rowIndex) { _listOfItemJual.Add(new ItemJualProduk()); this.gridControl.RowCount = _listOfItemJual.Count; } } this.gridControl.Refresh(); RefreshTotal(); DisplayItemProduct(itemJual); if (_pengaturanUmum.is_tampilkan_keterangan_tambahan_item_jual) { // fokus ke kolom keterangan GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 4); } else { if (_pengaturanUmum.is_fokus_input_kolom_jumlah) { GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 5); // fokus ke kolom jumlah } else { if (itemProduk != null) { GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 2); // fokus ke kolom kode } else { GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex + 1, 2); // fokus kebaris berikutnya } } } } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; ShowMessage(""); lblStatusBar.Text = lblStatusBar.Text.Replace("Cari Pelanggan", "Reset Pelanggan"); KeyPressHelper.NextFocus(); } else if (data is JualProduk) // pembayaran { var jual = (JualProduk)data; if (_pengaturanUmum.is_auto_print) { if (_isCetakStruk) { switch (_pengaturanUmum.jenis_printer) { case JenisPrinter.DotMatrix: CetakNotaDotMatrix(_jual); break; case JenisPrinter.MiniPOS: CetakNotaMiniPOS(_jual); break; default: // do nothing break; } } } var kembalian = Math.Abs(jual.jumlah_bayar - jual.grand_total); DisplayKembalian(NumberHelper.NumberToString(kembalian)); tmrDisplayKalimatPenutup.Enabled = true; lblKembalian.Text = string.Format("Kembalian: {0}", NumberHelper.NumberToString(kembalian)); ResetTransaksi(false); } else // filter bardasarkan nama form { var frmName = sender.GetType().Name; switch (frmName) { case "FrmHapusItemTransaksi": var noTransaksi = (int)((dynamic)data).noTransaksi; var itemJual = _listOfItemJual[noTransaksi - 1]; itemJual.entity_state = EntityState.Deleted; _listOfItemJual.Remove(itemJual); gridControl.RowCount = _listOfItemJual.Count(); gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(gridControl, _listOfItemJual.Count, 2); break; default: break; } } }
public void Ok(object sender, object data) { // filter berdasarkan data if (data is Produk) // pencarian produk baku { var produk = (Produk)data; if (!_pengaturanUmum.is_stok_produk_boleh_minus) { if (produk.is_stok_minus) { ShowMessage("Maaf stok produk tidak boleh minus", true); GridListControlHelper.SelectCellText(this.gridControl, _rowIndex, 3); return; } } double diskon = 0; if (_customer != null) { diskon = _customer.diskon; } if (!(diskon > 0)) { var diskonProduk = GetDiskonJualFix(produk, 1, produk.diskon); diskon = diskonProduk > 0 ? diskonProduk : produk.Golongan.diskon; } SetItemProduk(this.gridControl, _rowIndex, _colIndex + 1, produk, diskon: diskon); this.gridControl.Refresh(); RefreshTotal(); if (this.gridControl.RowCount == _rowIndex) { _listOfItemJual.Add(new ItemJualProduk()); this.gridControl.RowCount = _listOfItemJual.Count; } if (_pengaturanUmum.is_fokus_input_kolom_jumlah) { GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex, 4); // fokus ke kolom jumlah } else { GridListControlHelper.SetCurrentCell(this.gridControl, _rowIndex + 1, 2); // pindah kebaris berikutnya } } else if (data is Customer) // pencarian customer { this._customer = (Customer)data; txtCustomer.Text = this._customer.nama_customer; ShowMessage(""); lblStatusBar.Text = lblStatusBar.Text.Replace("Cari Pelanggan", "Reset Pelanggan"); KeyPressHelper.NextFocus(); } else if (data is JualProduk) // pembayaran { var jual = (JualProduk)data; if (_pengaturanUmum.is_auto_print) { if (_isCetakStruk) { switch (_pengaturanUmum.jenis_printer) { case JenisPrinter.DotMatrix: CetakNotaDotMatrix(_jual); break; case JenisPrinter.MiniPOS: CetakNotaMiniPOS(_jual); break; default: // do nothing break; } } } var kembalian = Math.Abs(jual.jumlah_bayar - jual.grand_total); lblKembalian.Text = string.Format("Kembalian: {0}", NumberHelper.NumberToString(kembalian)); ResetTransaksi(false); } else // filter bardasarkan nama form { var frmName = sender.GetType().Name; switch (frmName) { case "FrmHapusItemTransaksi": var noTransaksi = (int)((dynamic)data).noTransaksi; var itemJual = _listOfItemJual[noTransaksi - 1]; itemJual.entity_state = EntityState.Deleted; _listOfItemJual.Remove(itemJual); gridControl.RowCount = _listOfItemJual.Count(); gridControl.Refresh(); RefreshTotal(); GridListControlHelper.SetCurrentCell(gridControl, _listOfItemJual.Count, 2); break; default: break; } } }