private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            ReceivableAndPayable v = new ReceivableAndPayable();

            Switcher.SwitchNewReceivableAndPayable(v);
        }
        private void Savereceivable_Click(object sender, RoutedEventArgs e)
        {
            if (cbPaymentType.Text == "" || srcustomer.Name == "" || txtemail.Name == "" || txthp.Name == "" || dtPayment.Text == "" || srnodokumen.Name == "" || txtPaymentNumber.Text == "" || cbCash.Text == "" || txtValue.Text == "" || srstaff.Name == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            RppBLL             rppBLL    = new RppBLL();
            RppBLL             RppBLL    = new RppBLL();
            Rpp                rpp       = new Rpp();
            OrderTransaksiCash ordercash = new OrderTransaksiCash();

            if (this.dropdownPaymentCashActivitySelected != null)
            {
                rpp.PulldownRpp     = this.dropdownPaymentCashActivitySelected.Id;
                rpp.IdKodeTransaksi = this.dropdownPaymentCashActivitySelected.IdKodeTransaksi;
                rpp.KodeTransaksi   = this.dropdownPaymentCashActivitySelected.KodeTransaksi;
            }
            if (this.kontakSelected != null)
            {
                rpp.IdPelanggan   = this.kontakSelected.Id;
                rpp.NamaPelanggan = this.kontakSelected.NamaA;
            }
            rpp.Email            = txtemail.Text;
            rpp.NoHp             = double.Parse(txthp.Text);
            rpp.TanggalTransaksi = DateTime.Parse(dtPayment.Text);
            if (this.dokumenSelected != null)
            {
                rpp.IdNoReferensiDokumen = this.dokumenSelected.Id;
                rpp.NoReferensiDokumen   = this.dokumenSelected.NoReferensiDokumen;
            }
            rpp.NoPembayaran = double.Parse(txtPaymentNumber.Text);
            if (this.dropdownBankKasSelected != null)
            {
                rpp.IdAkunKas   = this.dropdownBankKasSelected.Id;
                rpp.NamaAkunKas = this.dropdownBankKasSelected.DropdownBankkas;
            }
            rpp.Keterangan = txtNote.Text;
            if (this.kontakpetugasSelected != null)
            {
                rpp.IdPetugas   = this.kontakpetugasSelected.Id;
                rpp.NamaPetugas = this.kontakpetugasSelected.NamaA;
            }
            //  rpp.TotalPembayaran = double.Parse(txtTotalPaymentValue.Text);
            rpp.IdPeriodeAkuntansi = 1;
            rpp.RealRecordingTime  = DateTime.Now;
            if (RppBLL.AddRpp(rpp) > 0)
            {
                //  this.ClearForm();
                MessageBox.Show("Receivable And Payable Payment successfully added !");
            }
            else
            {
                MessageBox.Show("Receivable And Payable Payment failed to add !");
            }
            if (DGReceivablePayment.Items.Count > 0)
            {
                foreach (var item in DGReceivablePayment.Items)
                {
                    if (item is OrderTransaksiCash)
                    {
                        OrderTransaksiCash oNewData1 = (OrderTransaksiCash)item;

                        /*             oNewData1.NoReferensiTransaksi = double.Parse(txtPaymentNumber.Text);
                         *           if (this.dropdownBankKasSelected != null)
                         *           {
                         *               oNewData1.IdAkunHutangPiutangReferensi = this.dropdownBankKasSelected.Id;
                         *           }
                         *           if (this.dropdownCashActivitySelected != null)
                         *           {
                         *               oNewData1.IdDropdownPaymentCashActivity = this.dropdownCashActivitySelected.Id;
                         *               oNewData1.IdKodeTransaksi = this.dropdownCashActivitySelected.IdKodeTransaksi;
                         *               oNewData1.KodeTransaksi = this.dropdownCashActivitySelected.KodeTransaksi;
                         *           }
                         *           if (this.kontakSelected != null)
                         *           {
                         *               oNewData1.IdPelanggan = this.kontakSelected.Id;
                         *               oNewData1.NamaPelanggan = this.kontakSelected.NamaA;
                         *           }
                         *           oNewData1.Email = txtemail.Text;
                         *           oNewData1.NoHp = double.Parse(txthp.Text);
                         *           if (this.dataMataUangSelected != null)
                         *           {
                         *               oNewData1.IdMataUang = this.dataMataUangSelected.Id;
                         *               oNewData1.MataUang = this.dataMataUangSelected.NamaMataUang;
                         *               oNewData1.KursTukar = this.dataMataUangSelected.KursTukar;
                         *           }
                         *           if (this.dokumenSelected != null)
                         *           {
                         *               oNewData1.IdNoReferensiDokumen = this.dokumenSelected.Id;
                         *               oNewData1.NoReferensiDokumen = this.dokumenSelected.NoReferensiDokumen;
                         *           }
                         *           oNewData1.TanggalTransaksi = DateTime.Parse(tgl.Text);
                         *           if (this.kontakSelecteds != null)
                         *           {
                         *               oNewData1.IdPetugas = this.kontakSelecteds.Id;
                         *               oNewData1.NamaPetugas = this.kontakSelecteds.NamaA;
                         *           }
                         *           oNewData1.RealRecordingTime = DateTime.Now;
                         *           oNewData1.IdPeriodeTransaksi = cash.IdPeriodeAkuntansi;
                         *           oNewData1.Checkboxaktif = false;
                         *           if (cashBLL.Edittranscash(oNewData1, cash) == true)
                         *           {
                         *           }*/
                    }
                }
                ReceivableAndPayable v = new ReceivableAndPayable();
                Switcher.SwitchNewReceivableAndPayable(v);
            }
        }