private void buttonSave_Click(object sender, EventArgs e) { try { Supplier supplierDipilih = (Supplier)comboBoxSupplier.SelectedItem; Pembayaran pembayaranDipilih = (Pembayaran)comboBoxPayment.SelectedItem; notaBeli = new NotaBeli(textBoxNoNota.Text, dateTimePickerDate.Value, formMenu.pegawaiLogin, supplierDipilih, pembayaranDipilih); for (int i = 0; i < dataGridViewNotaBeli.Rows.Count; i++) { string IdBuku = dataGridViewNotaBeli.Rows[i].Cells["IdBuku"].Value.ToString(); listBuku = Buku.BacaData("B.IdBuku", IdBuku); int harga = int.Parse(dataGridViewNotaBeli.Rows[i].Cells[textBoxHarga.Text].Value.ToString()); int jumlah = int.Parse(dataGridViewNotaBeli.Rows[i].Cells["Jumlah"].Value.ToString()); notaBeli.TambahNotaBeliDetil(listBuku[0], harga, jumlah); } NotaBeli.TambahData(notaBeli); MessageBox.Show("Data Nota Pembelian Telah Tersimpan.", "Informasi"); } catch (Exception ex) { MessageBox.Show("Gagal Menyimpan Nota. Pesan Kesalahan : " + ex.Message, "Kesalahan"); } }
private void buttonSave_Click(object sender, EventArgs e) { try { Customers pelangganDipilih = (Customers)comboBoxPelanggan.SelectedItem; Pembayaran pembayaranDipilih = (Pembayaran)comboBoxPayment.SelectedItem; notaJual = new NotaJual(textBoxNoNota.Text, dateTimePickerDate.Value, formMenu.pegawaiLogin, pelangganDipilih, pembayaranDipilih); for (int i = 0; i < dataGridViewNotaJual.Rows.Count; i++) { string idBuku = dataGridViewNotaJual.Rows[i].Cells["IdBuku"].Value.ToString(); listBuku = Buku.BacaData("B.IdBuku", idBuku); int harga = int.Parse(dataGridViewNotaJual.Rows[i].Cells["HargaJual"].Value.ToString()); int jumlah = int.Parse(dataGridViewNotaJual.Rows[i].Cells["Jumlah"].Value.ToString()); notaJual.TambahNotaJualDetil(listBuku[0], harga, jumlah); } NotaJual.TambahData(notaJual); MessageBox.Show("Data Nota Jual Telah Tersimpan.", "Informasi"); buttonPrint_Click(sender, e);// untuk memanggil event handler button cetak } catch (Exception ex) { MessageBox.Show("Gagal Menyimpan Nota. Pesan Kesalahan : " + ex.Message, "Kesalahan"); } }
private void comboBoxNoNotaBeli_SelectedIndexChanged(object sender, EventArgs e) { listHasilData.Clear(); string hasilBaca = Pembayaran.BacaDataPembayaran("noNotaPembelian", comboBoxNoNotaBeli.Text, listHasilData2); if (hasilBaca == "1") { textBoxNominal.Clear(); if (listHasilData2.Count > 0) { textBoxNominal.Text = listHasilData2[0].TotalHarga.ToString(); btsDiskon = listHasilData2[0].TglBatasDiskon; diskon = listHasilData2[0].Diskon; //untuk mendapatkan diskon if (diskon > 0) // apabila terdapat diskon, maka tampilkan info diskon dan batas diskon { MessageBox.Show(" Mendapatkan diskon " + diskon + "%, apabila membayar sebelum atau tanggal : " + btsDiskon.ToString("dddd, dd MMMM yyyy"), "Info Diskon"); } else //apabila tidak ada diskon { MessageBox.Show("Tidak ada diskon", "Info Diskon"); } } } else { textBoxNominal.Clear(); } }
public MainWindow() { InitializeComponent(); Pembayaran = new Pembayaran(this); KeranjangBelanja keranjangBelanja = new KeranjangBelanja(Pembayaran, this); controller = new MainWindowController(keranjangBelanja, Pembayaran); listKeranjangBelanja.ItemsSource = controller.getItems(); listPromo.ItemsSource = controller.getVoucher(); initializeView(); }
public MainWindow() { InitializeComponent(); pembayaran = new Pembayaran(this); pembayaran.setBalance(500000); pembayaran.setOngkir(15000); pembayaran.setPromo(5000); Keranjang keranjang = new Keranjang(pembayaran, this); controller = new MainWindowController(keranjang); listBoxPesanan.ItemsSource = controller.getSelectedItems(); initializeView(); }
private void FormAddPurchaseBill_Load(object sender, EventArgs e) { listSupplier = Supplier.BacaData("", ""); comboBoxSupplier.DataSource = listSupplier; comboBoxSupplier.DisplayMember = "Nama"; comboBoxSupplier.DropDownStyle = ComboBoxStyle.DropDownList; listPembayaran = Pembayaran.BacaData("", ""); comboBoxPayment.DataSource = listPembayaran; comboBoxPayment.DisplayMember = "JenisPembayaran"; comboBoxPayment.DropDownStyle = ComboBoxStyle.DropDownList; textBoxNoNota.Text = NotaBeli.GenerateNoNota(); textBoxBarcode.MaxLength = 13; FormatDataGrid(); dateTimePickerDate.Value = DateTime.Now; }
public void FormDaftarPembayaran_Load(object sender, EventArgs e) { this.Location = new Point(0, 0); comboBoxCari.DropDownStyle = ComboBoxStyle.DropDownList; FormatDataGrid(); string hasilBaca = Pembayaran.BacaData("", "", listHasilData); if (hasilBaca == "1") { dataGridViewPembayaran.Rows.Clear(); for (int i = 0; i < listHasilData.Count; i++) { //tampilkan data sesuai urutan di format data grid string harga = listHasilData[i].Nominal.ToString("RP 0,###"); dataGridViewPembayaran.Rows.Add(listHasilData[i].IdPembayaran, listHasilData[i].NotaPembelian.NoNotaPembelian, listHasilData[i].Tgl.ToString("dddd, dd MMMM yyyy"), listHasilData[i].CaraPembayaran, harga); } } }
private void FormTambahPembayaran_Load(object sender, EventArgs e) { string noNotaBaru; pPeriode = Periode.GetPeriodeTerbaru(); comboBoxNoNotaBeli.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxCaraPemb.DropDownStyle = ComboBoxStyle.DropDownList; string hasilGenerate = Pembayaran.GenerateNoNota(out noNotaBaru); textBoxNoPembayaran.Clear(); if (hasilGenerate == "1") { textBoxNoPembayaran.Text = noNotaBaru; } else { MessageBox.Show("Gagal melakukan generate code. Pesan kesalahan: " + hasilGenerate); } dateTimePickerTgl.Value = DateTime.Now; dateTimePickerTgl.Enabled = false; string hasilBaca = Pembayaran.BacaDataPembayaran("", "", listHasilData2); if (hasilBaca == "1") { comboBoxNoNotaBeli.Items.Clear(); for (int i = 0; i < listHasilData2.Count; i++) { comboBoxNoNotaBeli.Items.Add(listHasilData2[i].NoNotaPembelian); } } else { comboBoxNoNotaBeli.Items.Clear(); } comboBoxCaraPemb.SelectedIndex = 0; }
private void buttonSave_Click(object sender, EventArgs e) { Loan = new Loan(); Loan.BankName = textBoxBankName.Text; Loan.StartDate = dateTimePickerStartDate.Value; Loan.GracePeriod = (int)numericGracePeriod.Value; Loan.InterestMonth = (int)numericInterest.Value; Loan.InterestRate = (double)numericInterestRate.Value; Loan.Limit = (double)numericLimit.Value; Loan.Margin = (double)numericMargin.Value; Loan.Name = textBoxProfileName.Text; Loan.RepaymentMonth = (int)numericRepayment.Value; Loan.Tenor = (int)numericTenor.Value; Loan.IsUsingFirstRepaymentDate = checkBoxUseFirstRepayment.Checked; if (Loan.IsUsingFirstRepaymentDate) { Loan.FirstRepaymentDate = dateTimePickerFirstRepayment.Value; } DateTime currentDate = Loan.StartDate; List <Penarikan> penarikans = new List <Penarikan>(); foreach (DataGridViewRow item in dataGridViewPenarikan.Rows) { if (item.Cells[0].Value != null && item.Cells[1].Value != null) { double jumlah = double.Parse(item.Cells[0].Value.ToString()); DateTime tanggal = DateTime.Parse(item.Cells[1].Value.ToString()); Penarikan p = new Penarikan() { Jumlah = jumlah, Tanggal = tanggal }; penarikans.Add(p); penarikans.OrderBy(x => x.Tanggal); } } Loan.ListPenarikan = new List <Penarikan>(); Loan.ListPenarikan.AddRange(penarikans); List <Pembayaran> pembayarans = new List <Pembayaran>(); foreach (DataGridViewRow item in dataGridViewPembayaran.Rows) { if (item.Cells[0].Value != null && item.Cells[1].Value != null) { double jumlah = double.Parse(item.Cells[0].Value.ToString()); DateTime tanggal = DateTime.Parse(item.Cells[1].Value.ToString()); Pembayaran p = new Pembayaran() { Jumlah = jumlah, Tanggal = tanggal }; pembayarans.Add(p); pembayarans.OrderBy(x => x.Tanggal); } } Loan.ListPembayaran = new List <Pembayaran>(); Loan.ListPembayaran.AddRange(pembayarans); Loan.LoanDetails = Calculator.CalculateLoanDetails(Loan); DialogResult = DialogResult.OK; Close(); }
public MainWindowController(KeranjangBelanja keranjangBelanja, Pembayaran Pembayaran) { this.keranjangBelanja = keranjangBelanja; }
public static DataTable CalculateLoanDetailsOld(Loan Loan) { DateTime currentDate = Loan.StartDate; DataTable table = new DataTable(); table.Columns.Add("Tanggal", typeof(DateTime)); table.Columns.Add("Penarikan", typeof(double)); table.Columns.Add("Saldo Akhir Hutang", typeof(double)); table.Columns.Add("Tanggal Jatuh Tempo", typeof(DateTime)); table.Columns.Add("Jumlah Hari", typeof(int)); table.Columns.Add("% JIBOR", typeof(double)); table.Columns.Add("% Bunga", typeof(double)); table.Columns.Add("Perhitungan Bunga", typeof(double)); table.Columns.Add("Pokok", typeof(double)); table.Columns.Add("Pembayaran Bunga", typeof(double)); table.Columns.Add("Total", typeof(double)); //int daydiff = (currentDate - LoanProfile.StartDate).Days; //table.Rows.Add(currentDate, 0, 0, currentDate, daydiff, numericInterestRate.Value, numericInterestRate.Value + numericMargin.Value, 0, 0, 0, 0); if (Loan.ListPenarikan.Count > 0) { int totalTenor = Loan.Tenor * 12; int firstPokokRepayment = Loan.GracePeriod + 6; int pokokRepaymentSpreading = ((totalTenor - firstPokokRepayment) / Loan.RepaymentMonth) + 1; int interestRepaymentSpreading = (int)Math.Ceiling((double)(totalTenor / Loan.InterestMonth)) + 1; double pokok = 0; double totalPenarikan = 0; foreach (var item in Loan.ListPenarikan) { totalPenarikan += item.Jumlah; } pokok = totalPenarikan / pokokRepaymentSpreading; DateTime firstRepaymentDate = Loan.ListPenarikan[0].Tanggal.AddMonths(firstPokokRepayment); if (Loan.IsUsingFirstRepaymentDate) { firstRepaymentDate = Loan.FirstRepaymentDate; } List <DateTime> jadwalBayarPokok = new List <DateTime>(); for (int i = 0; i < pokokRepaymentSpreading; i++) { jadwalBayarPokok.Add(firstRepaymentDate.AddMonths(i * Loan.RepaymentMonth)); } DateTime firstInterestRepaymentDate = Loan.ListPenarikan[0].Tanggal.AddMonths(Loan.InterestMonth); List <DateTime> jadwalBayarInterest = new List <DateTime>(); for (int i = 0; i < interestRepaymentSpreading; i++) { jadwalBayarInterest.Add(firstInterestRepaymentDate.AddMonths(i * Loan.InterestMonth)); } DateTime end = Loan.ListPenarikan[0].Tanggal.AddYears(Loan.Tenor); //Generate row int tanggalPatokan = Loan.StartDate.Day; List <DateTime> rowDates = new List <DateTime>(); int beforeFirstPenarikan = Math.Abs(currentDate.TotalMonths(Loan.ListPenarikan[0].Tanggal)); for (int i = 0; i < beforeFirstPenarikan; i++) { rowDates.Add(currentDate.AddMonths(i)); } tanggalPatokan = Loan.ListPenarikan[0].Tanggal.Day; currentDate = Loan.ListPenarikan[0].Tanggal; for (int i = 0; i < (Loan.Tenor + 1) * 12; i++) { rowDates.Add(currentDate.AddMonths(i)); } foreach (var item in Loan.ListPenarikan) { rowDates.Add(item.Tanggal); } foreach (var item in Loan.ListPembayaran) { rowDates.Add(item.Tanggal); } rowDates.Sort(); DateTime preDate = rowDates.First(); bool isValidDay = firstRepaymentDate.Day <= DateTime.DaysInMonth(rowDates.Last().Year, rowDates.Last().Month); DateTime postDate = rowDates.Last(); for (int i = 0; i < 12; i++) { rowDates.Add(preDate.AddMonths(-i)); } rowDates.Sort(); rowDates = rowDates.Distinct().ToList(); foreach (var item in rowDates) { double jumlahPenarikan = 0; double saldoakhirhutang = 0; double persenBunga = Loan.InterestRate + Loan.Margin; int dayCount = 0; bool mustPayPokok = jadwalBayarPokok.Any(x => x == item); double currentPokok = 0; if (mustPayPokok) { currentPokok = pokok; pokokRepaymentSpreading--; } if (Loan.ListPenarikan.Any(x => x.Tanggal == item)) { Penarikan p = Loan.ListPenarikan.SingleOrDefault(x => x.Tanggal == item); jumlahPenarikan = p.Jumlah; } if (Loan.ListPembayaran.Any(x => x.Tanggal == item)) { Pembayaran p = Loan.ListPembayaran.SingleOrDefault(x => x.Tanggal == item); jumlahPenarikan -= p.Jumlah; } double perhitunganBunga = 0; if (table.Rows.Count == 0) { dayCount = (item - Loan.StartDate).Days; saldoakhirhutang = jumlahPenarikan; perhitunganBunga = 0; } else { dayCount = (item - DateTime.Parse(table.Rows[table.Rows.Count - 1][3].ToString())).Days; saldoakhirhutang = (double)table.Rows[table.Rows.Count - 1][2] + jumlahPenarikan - (double)table.Rows[table.Rows.Count - 1][8]; perhitunganBunga = persenBunga * (double)table.Rows[table.Rows.Count - 1][2] * dayCount / 360 / 100; if (Math.Round(saldoakhirhutang, 2) <= 0) { perhitunganBunga = 0; } } bool bayarBunga = jadwalBayarInterest.Any(x => x == item); double currentBunga = 0; if (bayarBunga) { currentBunga += perhitunganBunga; for (int i = 1; i < Loan.InterestMonth; i++) { currentBunga += (double)table.Rows[table.Rows.Count - i][7]; } } DataRow row = table.NewRow(); row[0] = item; row[1] = jumlahPenarikan; row[2] = Math.Round(saldoakhirhutang, 2); row[3] = item; row[4] = dayCount; row[5] = Loan.InterestRate; row[6] = persenBunga; row[7] = Math.Round(perhitunganBunga, 2); row[8] = Math.Round(currentPokok, 2); row[9] = Math.Round(currentBunga, 2); row[10] = Math.Round(currentPokok + perhitunganBunga, 2); table.Rows.Add(row); } } return(table); }
public static DataTable CalculateLoanDetails(Loan Loan) { List <Jibor> jiborList = new List <Jibor>(); using (XLWorkbook workbook = new XLWorkbook("Data\\Jibor.xlsx")) { IXLWorksheet workSheet = workbook.Worksheet(1); bool firstRow = true; foreach (IXLRow row in workSheet.Rows()) { if (firstRow) { firstRow = false; } else { Jibor jibor = new Jibor(); jibor.Tanggal = row.Cell(1).GetDateTime(); jibor.Rate = (double)row.Cell(2).Value; jiborList.Add(jibor); } } } DateTime currentDate = Loan.StartDate; DateTime pivotDate = new DateTime(); DataTable table = new DataTable(); table.Columns.Add("Tanggal", typeof(DateTime)); table.Columns.Add("Penarikan", typeof(double)); table.Columns.Add("Saldo Akhir Hutang", typeof(double)); table.Columns.Add("Tanggal Jatuh Tempo", typeof(DateTime)); table.Columns.Add("Jumlah Hari", typeof(int)); table.Columns.Add("% JIBOR", typeof(double)); table.Columns.Add("% Bunga", typeof(double)); table.Columns.Add("Perhitungan Bunga", typeof(double)); table.Columns.Add("Pokok", typeof(double)); table.Columns.Add("Pembayaran Bunga", typeof(double)); table.Columns.Add("Total", typeof(double)); //int daydiff = (currentDate - LoanProfile.StartDate).Days; //table.Rows.Add(currentDate, 0, 0, currentDate, daydiff, numericInterestRate.Value, numericInterestRate.Value + numericMargin.Value, 0, 0, 0, 0); if (Loan.ListPenarikan.Count > 0) { int totalTenor = Loan.Tenor * 12; int firstPokokRepayment = Loan.GracePeriod + 6; int pokokRepaymentSpreading = ((totalTenor - firstPokokRepayment) / Loan.RepaymentMonth) + 1; int interestRepaymentSpreading = (int)Math.Ceiling((double)(totalTenor / Loan.InterestMonth)) + 1; double pokok = 0; double totalPenarikan = 0; double rate = Loan.InterestRate; foreach (var item in Loan.ListPenarikan) { totalPenarikan += item.Jumlah; } pokok = totalPenarikan / pokokRepaymentSpreading; pivotDate = Loan.ListPenarikan[0].Tanggal; if (Loan.IsUsingFirstRepaymentDate) { pivotDate = Loan.FirstRepaymentDate; } DateTime firstRepaymentDate = pivotDate.AddMonths(firstPokokRepayment); List <DateTime> jadwalBayarPokok = new List <DateTime>(); for (int i = 0; i < pokokRepaymentSpreading; i++) { jadwalBayarPokok.Add(firstRepaymentDate.AddMonths(i * Loan.RepaymentMonth)); } DateTime firstInterestRepaymentDate = pivotDate.AddMonths(Loan.InterestMonth); List <DateTime> jadwalBayarInterest = new List <DateTime>(); for (int i = 0; i < interestRepaymentSpreading; i++) { jadwalBayarInterest.Add(firstInterestRepaymentDate.AddMonths(i * Loan.InterestMonth)); } DateTime end = pivotDate.AddYears(Loan.Tenor); //Generate row int tanggalPatokan = Loan.StartDate.Day; List <DateTime> rowDates = new List <DateTime>(); int beforeFirstPenarikan = Math.Abs(currentDate.TotalMonths(pivotDate)); for (int i = 0; i < beforeFirstPenarikan; i++) { rowDates.Add(currentDate.AddMonths(i)); } tanggalPatokan = pivotDate.Day; currentDate = pivotDate; for (int i = 0; i < (Loan.Tenor + 1) * 12; i++) { rowDates.Add(currentDate.AddMonths(i)); } foreach (var item in Loan.ListPenarikan) { rowDates.Add(item.Tanggal); } foreach (var item in Loan.ListPembayaran) { rowDates.Add(item.Tanggal); } rowDates.Sort(); DateTime preDate = rowDates.First(); bool isValidDay = firstRepaymentDate.Day <= DateTime.DaysInMonth(rowDates.Last().Year, rowDates.Last().Month); DateTime postDate = rowDates.Last(); for (int i = 0; i < 12; i++) { rowDates.Add(preDate.AddMonths(-i)); } rowDates.Sort(); rowDates = rowDates.Distinct().ToList(); foreach (var item in rowDates) { double jumlahPenarikan = 0; double saldoakhirhutang = 0; bool mustPayInterest = jadwalBayarInterest.Any(x => x == item); DateTime nextInterestPayment = item; if (!mustPayInterest) { for (int i = 0; i < Loan.InterestMonth; i++) { if (jadwalBayarInterest.Any(x => x.Date == nextInterestPayment.AddMonths(i).Date)) { nextInterestPayment = nextInterestPayment.AddMonths(i); } } } if (jiborList.Any(x => x.Tanggal.Date == nextInterestPayment.AddMonths(-3).AddDays(-2).Date)) { rate = 0; int backdate = 0; while (rate == 0) { Jibor jibor = jiborList.FirstOrDefault(x => x.Tanggal.Date == nextInterestPayment.AddMonths(-3).AddDays(-2 - backdate).Date); if (jibor != null) { rate = jibor.Rate; if (rate == 0) { backdate++; } } else { backdate++; } } } else { rate = Loan.InterestRate; } double persenInterest = rate + Loan.Margin; int dayCount = 0; bool mustPayPokok = jadwalBayarPokok.Any(x => x == item); double currentPokok = 0; if (mustPayPokok) { currentPokok = pokok; pokokRepaymentSpreading--; } if (Loan.ListPenarikan.Any(x => x.Tanggal == item)) { Penarikan p = Loan.ListPenarikan.SingleOrDefault(x => x.Tanggal == item); jumlahPenarikan = p.Jumlah; } if (Loan.ListPembayaran.Any(x => x.Tanggal == item)) { Pembayaran p = Loan.ListPembayaran.SingleOrDefault(x => x.Tanggal == item); jumlahPenarikan -= p.Jumlah; } double perhitunganInterest = 0; if (table.Rows.Count == 0) { dayCount = (item - Loan.StartDate).Days; saldoakhirhutang = jumlahPenarikan; perhitunganInterest = 0; } else { dayCount = (item - DateTime.Parse(table.Rows[table.Rows.Count - 1][3].ToString())).Days; saldoakhirhutang = (double)table.Rows[table.Rows.Count - 1][2] + jumlahPenarikan - (double)table.Rows[table.Rows.Count - 1][8]; perhitunganInterest = persenInterest * (double)table.Rows[table.Rows.Count - 1][2] * dayCount / 360 / 100; if (Math.Round(saldoakhirhutang, 2) <= 0) { perhitunganInterest = 0; } } double currentInterest = 0; if (mustPayInterest) { currentInterest += perhitunganInterest; for (int i = 1; i < Loan.InterestMonth; i++) { currentInterest += (double)table.Rows[table.Rows.Count - i][7]; } } DataRow row = table.NewRow(); row[0] = item; row[1] = jumlahPenarikan; row[2] = Math.Round(saldoakhirhutang, 2); row[3] = item; row[4] = dayCount; row[5] = rate; row[6] = persenInterest; row[7] = Math.Round(perhitunganInterest, 2); row[8] = Math.Round(currentPokok, 2); row[9] = Math.Round(currentInterest, 2); row[10] = Math.Round(currentPokok + perhitunganInterest, 2); table.Rows.Add(row); } } return(table); }
private void btnTambah_Click(object sender, EventArgs e) { if (toAngka(txtTotal.Text).Equals("0") || nama_pelanggan.Text.Equals("")) { MessageBox.Show("Masukkan data dengan benar", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Pembayaran pembayaran = new Pembayaran(txtTotal.Text); pembayaran.ShowDialog(this); if (pembayaran.berhasil) { MessageBox.Show("Transaksi berhasil...", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { return; } try { string connectionString = Program.getConstring(); SqlConnection connection = new SqlConnection(connectionString); SqlCommand myCommand = new SqlCommand("sp_inputTBeliKomponen", connection); myCommand.CommandType = CommandType.StoredProcedure; connection.Open(); id_transaksi = "tbk-" + getLastID(); myCommand.Parameters.AddWithValue("no_transaksi_pembelian", id_transaksi); myCommand.Parameters.AddWithValue("tanggal_transaksi", DateTime.Now.ToString("yyyyMMdd")); myCommand.Parameters.AddWithValue("jumlah_komponen", txtBarang.Text); myCommand.Parameters.AddWithValue("total_jenis", txtJenis.Text); myCommand.Parameters.AddWithValue("total_harga", toAngka(txtTotal.Text)); myCommand.Parameters.AddWithValue("id_pelayan", id_karyawan); //myCommand.Parameters.AddWithValue("id_pelayan", "PLY-0001"); myCommand.Parameters.AddWithValue("id_customer", getIDPelanggan(nama_pelanggan.Text)); myCommand.ExecuteNonQuery(); connection.Close(); detailtransaksi(); //by = 1; //btnUpdate.Enabled = true; } catch (Exception ex) { MessageBox.Show("Error btnBayar_Click : " + ex.ToString()); //btnUpdate.Enabled = false; //clear(); } addDataKomponen(); }
private void btnLogin_Click(object sender, EventArgs e) { txtID.Text = LC.getIDPegawaiYangLogin(txtUsername.Text).ToString(); if (txtID.Text == "" || txtPass.Text == "") { MessageBox.Show("Silahkan lengkapi form yang tersedia", "iNBC", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { if (LC.cekLogin(txtUsername.Text, txtPass.Text) == true) { int role = LC.GetRoleUser(txtUsername.Text, txtPass.Text); if (role == 1) { this.Hide(); KKUI KKUI = new KKUI(); KKUI.ShowDialog(); this.Close(); } if (role == 2) { this.Hide(); PengelolaanPegawai kelola = new PengelolaanPegawai(); kelola.setToolStripUser("Pengguna: Admin - " + txtUsername.Text); kelola.ShowDialog(); this.Close(); } if (role == 3) { this.Hide(); CSUI wlc = new CSUI(); //wlc.setToolStripUser("Pengguna: Customer Service - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 4) { this.Hide(); Pemeriksaan wlc = new Pemeriksaan(); wlc.setToolStripUser("Pengguna: Dokter - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 5) { this.Hide(); Pembayaran wlc = new Pembayaran(); wlc.setToolStripUser("Pengguna: Kasir - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 6) { this.Hide(); BTCUI wlc = new BTCUI(); // wlc.setToolStripUser("Pengguna: Beautician - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } else { MessageBox.Show("Role tersebut tidak tersedia"); } } else { MessageBox.Show("Maaf, username / password salah", "iNBC", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void buttonSimpan_Click(object sender, EventArgs e) { FormDaftarPembayaran form = (FormDaftarPembayaran)this.Owner; int hutang = int.Parse(textBoxNominal.Text); DateTime tglPemb = dateTimePickerTgl.Value; // pngecekan apabila tanggal pembayaran sebelum tanggal batas diskon if (tglPemb <= btsDiskon) // apabila sebelum batas diskon { diskon = diskon / 100; } else // apabila melewati tanggal batas diskon { diskon = 0; } int hargaDiskon = (int)(hutang * diskon); // hitung total yang harus dibayar //buat object bertipe notaBeli NotaPembelian nota = new NotaPembelian(); nota.NoNotaPembelian = comboBoxNoNotaBeli.Text; nota.Status = "L"; Pembayaran lunas = new Pembayaran(); lunas.IdPembayaran = textBoxNoPembayaran.Text; lunas.CaraPembayaran = comboBoxCaraPemb.Text; lunas.Tgl = dateTimePickerTgl.Value; lunas.Nominal = hutang - hargaDiskon; //lunas.NotaPembelian = nota; string hasilTambahNota = Pembayaran.TambahData(lunas, nota); if (hasilTambahNota == "1") //jika berhasil maka insert jurnal dan detil jurnal { MessageBox.Show("Data Pembayaran telah tersimpan", "Info"); //tambah posting ke jurnal string idJurnal = Jurnal.GenerateIdJurnal(); Transaksi trans = new Transaksi(); //transaksi penjualan tunai (id transkasi 008); trans.IdTransaksi = "009"; trans.Keterangan = "Melunasi hutang secara tunai"; //buat object bertipe jurnal Jurnal jurnal = new Jurnal(); //tambahkan data jurnal.IdJurnal = int.Parse(idJurnal); jurnal.Tanggal = dateTimePickerTgl.Value; jurnal.NomorBukti = comboBoxNoNotaBeli.Text; jurnal.Jenis = "JU"; jurnal.Periode = pPeriode; jurnal.Transaksi = trans; //isi detil jurnalnya //apabila diskon tidak 0 atau tidak ada diskon // //apabila ada diskon jurnal.TambahDetilJurnalPembayaranHutangTunai(hutang, hargaDiskon); //simpan ke tabel _jurnal string hasilTambahJurnal = Jurnal.TambahData(jurnal); if (hasilTambahJurnal == "1") { MessageBox.Show("berhasil posting ke jurnal"); FormUtama frmUtama = (FormUtama)this.Owner.MdiParent; this.Close(); form.FormDaftarPembayaran_Load(sender, e); } else { MessageBox.Show("gagal posting ke jurnal" + hasilTambahJurnal); } } else { MessageBox.Show("Data pembayaran gagal tersimpan. Pesan kesalahan : " + hasilTambahNota, "Kesalahan"); } }