Exemple #1
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (mode == selectMode.header)
            {
                Guid rowID            = (Guid)dgHeaderBank.SelectedCells[0].OwningRow.Cells["RowIDH"].Value;
                frmBukuBankUpdate frm = new frmBukuBankUpdate(this, rowID);
                frm.ShowDialog();
            }
            else
            {
                Guid     rowID, rowIDDetail;
                string   noBBK, noBGCH, Debet, Kredit, keterangan;
                DateTime tglBank, tglRK;
                DateTime _Tanggal = (DateTime)dgDetailBank.SelectedCells[0].OwningRow.Cells["TglBank"].Value;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
                rowID       = (Guid)dgHeaderBank.SelectedCells[0].OwningRow.Cells["RowIDH"].Value;
                rowIDDetail = (Guid)dgDetailBank.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                noBBK       = dgDetailBank.SelectedCells[0].OwningRow.Cells["NoBBKD"].Value.ToString();
                noBGCH      = dgDetailBank.SelectedCells[0].OwningRow.Cells["NoBGCH"].Value.ToString();
                Debet       = dgDetailBank.SelectedCells[0].OwningRow.Cells["Debet"].Value.ToString();
                Kredit      = dgDetailBank.SelectedCells[0].OwningRow.Cells["Kredit"].Value.ToString();
                keterangan  = dgDetailBank.SelectedCells[0].OwningRow.Cells["Keterangan"].Value.ToString();
                tglBank     = (DateTime)dgDetailBank.SelectedCells[0].OwningRow.Cells["TglBank"].Value;
                tglRK       = (DateTime)dgDetailBank.SelectedCells[0].OwningRow.Cells["TglRK"].Value;

                frmBukuBankUpdate frm = new frmBukuBankUpdate(this, rowID, rowIDDetail, noBBK, noBGCH, tglBank, tglRK, keterangan, Debet, Kredit);
                frm.ShowDialog();
            }
        }
Exemple #2
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (selectMode == enumSelectMode.Header)
            {
                if (gridHeader.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridHeader.SelectedCells[0].OwningRow.Cells["hdrTglVoucher"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    Guid      titipID = (Guid)gridHeader.SelectedCells[0].OwningRow.Cells["hdrRowID"].Value;
                    DataTable dtEdit  = new DataTable();
                    dtEdit = dtHeader.Copy();
                    dtEdit.DefaultView.RowFilter = "RowID='" + titipID + "'";
                    DataView dv = dtEdit.DefaultView;
                    dtEdit = new DataTable();
                    dtEdit = dv.ToTable();
                    frmVoucherGiroTitipUpdate frm = new frmVoucherGiroTitipUpdate(this, dtEdit);
                    frm.ShowDialog();
                }
            }
        }
Exemple #3
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:

                if (gridBBM.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }
                    Guid rowID = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    Kasir.frmGiroCairTolakBatal_Header_Update ifrmChild1 = new Kasir.frmGiroCairTolakBatal_Header_Update(this, rowID);
                    Program.MainForm.RegisterChild(ifrmChild1);
                    ifrmChild1.ShowDialog();
                }


                break;
            }
        }
Exemple #4
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKM.SelectedCells.Count > 0)
            {
                if (dgHeaderBKM.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "IN")
                {
                    return;
                }
                DateTime _Tanggal = (DateTime)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["tglBukti"].Value;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
                if (_Tanggal == DateTime.Today)
                {
                    Guid   _rowID = (Guid)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    string _RecordID, _Terima, _NoBukti, _Lampiran;

                    _RecordID = (String)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["RecordID"].Value;
                    _Terima   = (String)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["dari"].Value;
                    _NoBukti  = (String)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["noBukti"].Value;
                    _Lampiran = Convert.ToString(dgHeaderBKM.SelectedCells[0].OwningRow.Cells["lampiran"].Value);

                    frmBKMUpdate BMKUpdate = new frmBKMUpdate(this, _rowID, _RecordID, _Terima, _NoBukti, _Tanggal, _Lampiran, string.Empty, false, string.Empty);
                    BMKUpdate.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Maaf, edit transaksi hanya boleh untuk transaksi hari ini saja.");
                    return;
                }
            }
        }
Exemple #5
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            DateTime _Tanggal = (DateTime)gridBBK.SelectedCells[0].OwningRow.Cells["TglBBK"].Value;

            if (PeriodeClosing.IsKasirClosed(_Tanggal))
            {
                MessageBox.Show("Sudah Closing!");
                return;
            }
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:

                _rowIDBBK = (Guid)gridBBK.SelectedCells[0].OwningRow.Cells["RowIDBBK"].Value;
                _bankID   = gridBBK.SelectedCells[0].OwningRow.Cells["BankID"].Value.ToString();
                Kasir.frmBuktiBankKeluar ifrmChild = new Kasir.frmBuktiBankKeluar(this, _rowIDBBK, _bankID);
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.ShowDialog();
                break;

            case enumSelectedGrid.DetailSelected:
                _rowIDBBK    = (Guid)gridBBK.SelectedCells[0].OwningRow.Cells["RowIDBBK"].Value;
                _rowIDGiroIn = (Guid)gridGiroIn.SelectedCells[0].OwningRow.Cells["RowIDGiroIn"].Value;
                _GiroID      = (Guid)gridGiroIn.SelectedCells[0].OwningRow.Cells["GiroID"].Value;
                _Penerima    = gridBBK.SelectedCells[0].OwningRow.Cells["Penerima"].Value.ToString();
                _bankID      = gridBBK.SelectedCells[0].OwningRow.Cells["BankID"].Value.ToString();
                DateTime tglBBK = (DateTime)gridBBK.SelectedCells[0].OwningRow.Cells["TglBBK"].Value;
                Kasir.frmBukaGiroDetailUpdate ifrmDetail = new Kasir.frmBukaGiroDetailUpdate(this, _rowIDBBK, _rowIDGiroIn, _GiroID, _Penerima, _bankID, true, tglBBK);
                Program.MainForm.RegisterChild(ifrmDetail);
                ifrmDetail.ShowDialog();


                break;
            }
        }
Exemple #6
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                Kasir.frmGiroCairTolakBatal_Header_Update ifrmChild1 = new Kasir.frmGiroCairTolakBatal_Header_Update(this);
                Program.MainForm.RegisterChild(ifrmChild1);
                ifrmChild1.ShowDialog();

                break;

            case enumSelectedGrid.DetailSelected:
                try
                {
                    DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    Guid bbmID = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    Kasir.frmVoucherTitipanGiro ifrmChild2 = new Kasir.frmVoucherTitipanGiro(this, bbmID);
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;
            }
        }
Exemple #7
0
 private void cmdSave_Click(object sender, EventArgs e)
 {
     if (lookupBank1.BankID == "" || lookupBank1.BankID == "[CODE]")
     {
         MessageBox.Show("Bank Harus Diisi.");
         lookupBank1.Focus();
         return;
     }
     if (MessageBox.Show("Data Akan Disimpan?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (formMode == enumFormMode.New)
         {
             DateTime _Tanggal = (DateTime)txtTglBBM.DateValue;
             if (PeriodeClosing.IsKasirClosed(_Tanggal))
             {
                 MessageBox.Show("Sudah Closing!");
                 return;
             }
             AddBBMGiroCairTolakBatal();
         }
         else if (formMode == enumFormMode.Update)
         {
             UpdateBBMGiroCairTolakBatal();
         }
     }
 }
Exemple #8
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                Kasir.frmBuktiTransferKeluarUpdate ifrmChild = new Kasir.frmBuktiTransferKeluarUpdate(this, string.Empty, false, string.Empty, string.Empty, string.Empty);
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.ShowDialog();
                break;

            case enumSelectedGrid.DetailSelected:
                DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                if (GlobalVar.Gudang != "2808")
                {
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                }
                Guid   rowID  = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                string bankID = gridUtm.SelectedCells[0].OwningRow.Cells["BankID"].Value.ToString();

                Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, string.Empty, rowID, 0, false, string.Empty, string.Empty, string.Empty, string.Empty, bankID);

                Program.MainForm.RegisterChild(ifrmDetail);
                ifrmDetail.ShowDialog();


                break;
            }
        }
Exemple #9
0
 private void cmdAdd_Click(object sender, EventArgs e)
 {
     if (selectMode == enumSelectMode.Header)
     {
         frmVoucherGiroTitipUpdate frm = new frmVoucherGiroTitipUpdate(this);
         frm.ShowDialog();
     }
     else
     {
         if (gridHeader.SelectedCells.Count > 0)
         {
             DateTime _Tanggal = (DateTime)gridHeader.SelectedCells[0].OwningRow.Cells["hdrTglVoucher"].Value;
             if (PeriodeClosing.IsKasirClosed(_Tanggal))
             {
                 MessageBox.Show("Sudah Closing!");
                 return;
             }
             string bankID, namaBank, titipRecID, noVoucher, mengetahui;
             Guid   titipID = (Guid)gridHeader.SelectedCells[0].OwningRow.Cells["hdrRowID"].Value;
             bankID     = gridHeader.SelectedCells[0].OwningRow.Cells["hdrBankID"].Value.ToString();
             namaBank   = gridHeader.SelectedCells[0].OwningRow.Cells["hdrNamaBank"].Value.ToString();
             titipRecID = gridHeader.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
             noVoucher  = gridHeader.SelectedCells[0].OwningRow.Cells["hdrNoVoucher"].Value.ToString();
             mengetahui = gridHeader.SelectedCells[0].OwningRow.Cells["hdrMengetahui"].Value.ToString();
             frmLookupVoucherGiroTitipUpdate frm = new frmLookupVoucherGiroTitipUpdate(this, titipID, titipRecID, bankID, namaBank, noVoucher, mengetahui);
             frm.ShowDialog();
             HeaderRowRefresh(titipID);
         }
     }
 }
Exemple #10
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            label2.Text = "EDIT DATA TRANSAKSI";

            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:

                _nip = gridKaryawan.SelectedCells[0].OwningRow.Cells["NIP"].Value.ToString();
                Kasir.frmPiutangKaryawanHeader_Update ifrmChild1 = new Kasir.frmPiutangKaryawanHeader_Update(this, _nip);
                Program.MainForm.RegisterChild(ifrmChild1);
                ifrmChild1.ShowDialog();

                break;

            case enumSelectedGrid.DetailSelected:

                if (gridPiutang.SelectedCells.Count > 0 && gridKaryawan.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridPiutang.SelectedCells[0].OwningRow.Cells["tanggal"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    _nama       = gridKaryawan.SelectedCells[0].OwningRow.Cells["namapegawai"].Value.ToString();
                    _tanggal    = ((DateTime)gridPiutang.SelectedCells[0].OwningRow.Cells["tanggal"].Value).ToString("dd-MM-yyyy");
                    _reff       = gridPiutang.SelectedCells[0].OwningRow.Cells["reff"].Value.ToString();
                    _jenisUtang = gridPiutang.SelectedCells[0].OwningRow.Cells["jenis"].Value.ToString();
                    _nomor      = gridPiutang.SelectedCells[0].OwningRow.Cells["noref"].Value.ToString();
                    _uraian     = gridPiutang.SelectedCells[0].OwningRow.Cells["uraian"].Value.ToString();
                    //_jaminan = gridPiutang.SelectedCells[0].OwningRow.Cells["KeteranganJaminan"].Value.ToString();
                    _debet  = gridPiutang.SelectedCells[0].OwningRow.Cells["debet"].Value.ToString();
                    _kredit = gridPiutang.SelectedCells[0].OwningRow.Cells["kredit"].Value.ToString();

                    txtTanggal.Text              = _tanggal;
                    cbRef.Text                   = _reff;
                    cbRef.Enabled                = false;
                    cbJenisUtang.Text            = _jenisUtang;
                    txtNomor.Text                = _nomor;
                    txtUraian.Text               = _uraian;
                    txtDebet.Text                = _debet;
                    txtKredit.Text               = _kredit;
                    txt_jaminan.Text             = _jaminan;
                    formMode                     = enumFormMode.Update;
                    groupTambahTransaksi.Visible = true;
                }
                else
                {
                    MessageBox.Show("Belum Ada Data");
                }

                break;
            }
        }
Exemple #11
0
        private void lookupBank1_SelectData(object sender, EventArgs e)
        {
            try
            {
                if (lookupBank1.BankID == "" || lookupBank1.BankID == "[CODE]")
                {
                    MessageBox.Show("Bank Harus Diisi");
                    lookupBank1.Focus();
                    return;
                }

                if (txtKepada.Text == "")
                {
                    MessageBox.Show("Kepada Harus Diisi");
                    txtKepada.Focus();
                    return;
                }

                DateTime _Tanggal = DateTime.Now.Date;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
                if (MessageBox.Show("Data Sudah Benar ?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }

                frmBukaGiro frm = new frmBukaGiro();
                frm = (frmBukaGiro)this.Caller;
                if (formMode == enumFormMode.New)
                {
                    AddBuktiBankKeluar();
                    frm.RefreshBBK(_rowIDBBK);
                    frm.FindRowBBK("RowIDBBK", _rowIDBBK.ToString());
                    RefreshGiroInternalOnDetail();
                }
                else
                {
                    UpdateBuktiBankKeluar();
                    frm.RefreshBBK(_rowIDBBK);
                }

                lblPetunjuk.Visible = true;
                gridGiroIn.Focus();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemple #12
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            Guid     rowID    = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;
            DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;

            if (GlobalVar.Gudang != "2808")
            {
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
            }
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:

                if (gridUtm.RowCount > 0)
                {
                    Kasir.frmBuktiTransferKeluarUpdate ifrmChild = new Kasir.frmBuktiTransferKeluarUpdate(this, rowID, false, string.Empty, string.Empty, string.Empty, string.Empty);
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }


                break;

            case enumSelectedGrid.DetailSelected:

                Guid rowIDDetail = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value;

                if (gridDetail.RowCount > 0)
                {
                    Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDDetail, rowID, string.Empty, false, string.Empty, string.Empty, string.Empty);
                    Program.MainForm.RegisterChild(ifrmDetail);
                    ifrmDetail.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }



                break;
            }
        }
Exemple #13
0
        private void lookupBank1_SelectData(object sender, EventArgs e)
        {
            if (lookupBank1.BankID == "" || lookupBank1.BankID == "[CODE]")
            {
                MessageBox.Show("Bank belum diisi");
                lookupBank1.Focus();
                return;
            }

            if (txtKepada.Text == "")
            {
                MessageBox.Show("Nama Belum Diisi");
                txtKepada.Focus();
                return;
            }

            if (MessageBox.Show("Data Sudah Benar ?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }

            try
            {
                switch (formMode)
                {
                case enumFormMode.New:
                    DateTime _Tanggal = DateTime.Now.Date;
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    AddTransaksi();
                    lblPetunjuk.Visible = true;
                    break;

                case enumFormMode.Update:
                    UpdateTransaksi();
                    lblPetunjuk.Visible = true;
                    break;
                }
            }
            catch
            {
                MessageBox.Show("GAGAL");
            }
        }
Exemple #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (customGridView1.SelectedCells.Count == 0)
            {
                return;
            }
            if (GlobalVar.Gudang != "2808")
            {
                if (PeriodeClosing.IsKasirClosed(GlobalVar.DateOfServer))
                {
                    MessageBox.Show("Sudah clossing kasir!");
                    return;
                }
            }

            Guid     _RowID      = (Guid)customGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
            string   _RowidInden = Tools.isNull(customGridView1.SelectedCells[0].OwningRow.Cells["RowIDInden"].Value, "").ToString();
            string   _Pin        = customGridView1.SelectedCells[0].OwningRow.Cells["Pin"].Value.ToString();
            DateTime _tgltrm     = Convert.ToDateTime(customGridView1.SelectedCells[0].OwningRow.Cells["TanggalTerima"].Value.ToString());

            if (_RowidInden != "")
            {
                //MessageBox.Show("PIN Sudah Terisi", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show("Penerimaan Tunai sudah diLink, tidak bisa link ulang.");
                return;
            }

            //string _Collector = customGridView1.SelectedCells[0].OwningRow.Cells["Nama"].Value.ToString();
            //if (_Pin != "")
            //{
            //    MessageBox.Show("PIN Sudah Terisi", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}

            string PUBLICKEY = customGridView1.SelectedCells[0].OwningRow.Cells["PublicKey"].Value.ToString();

            Kasir.frmPenerimaanTunaiPIN ifrmChild = new Kasir.frmPenerimaanTunaiPIN(this, _RowID, PUBLICKEY, _tgltrm);
            ifrmChild.WindowState = FormWindowState.Normal;
            ifrmChild.ShowDialog();
        }
Exemple #15
0
        private void cmdIsiPin_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsKasirClosed(GlobalVar.DateOfServer))
            {
                MessageBox.Show("Sudah clossing kasir!");
                return;
            }

            Guid     _RowID  = (Guid)customGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
            string   _Pin    = customGridView1.SelectedCells[0].OwningRow.Cells["Pin"].Value.ToString();
            DateTime _tgltrm = Convert.ToDateTime(customGridView1.SelectedCells[0].OwningRow.Cells["TanggalTerima"].Value.ToString());

            //string _Collector = customGridView1.SelectedCells[0].OwningRow.Cells["Nama"].Value.ToString();
            if (_Pin != "")
            {
                MessageBox.Show("PIN Sudah Terisi", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string PUBLICKEY = customGridView1.SelectedCells[0].OwningRow.Cells["PublicKey"].Value.ToString();
            //Kasir.frmPenerimaanTunaiPIN ifrmChild = new Kasir.frmPenerimaanTunaiPIN(this, _RowID, PUBLICKEY, _tgltrm);
            //ifrmChild.WindowState = FormWindowState.Normal;
            //ifrmChild.ShowDialog();
        }
Exemple #16
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime tgl       = ((DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value).Date;
                DateTime tglServer = GlobalVar.DateOfServer.Date;

                if (tgl != tglServer)
                {
                    MessageBox.Show("Tanggal server tidak sama dengan tanggal transaksi. Tidak bisa hapus transaksi");
                    return;
                }

                switch (selectedGrid)
                {
                case enumSelectedGrid.DetailSelected:

                    if (gridGiro.SelectedCells.Count > 0)
                    {
                        DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                        if (!SecurityManager.IsManager())
                        {
                            MessageBox.Show("Hapus hanya boleh dilakukan oleh Manager");
                            return;
                        }
                        Guid rowIDBBM = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        Guid giroID   = (Guid)gridGiro.SelectedCells[0].OwningRow.Cells["RowIDGiro"].Value;

                        if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            DeleteGiroCairTolakBatal(rowIDBBM, giroID);

                            RefreshBBM(rowIDBBM);

                            #region "Tambahan"
                            int i = 0;
                            int n = 0;
                            i = gridGiro.SelectedCells[0].RowIndex;
                            n = gridGiro.SelectedCells[0].ColumnIndex;
                            DataRowView dv = (DataRowView)gridGiro.SelectedCells[0].OwningRow.DataBoundItem;

                            DataRow dr = dv.Row;

                            dr.Delete();
                            _dtDetail.AcceptChanges();
                            gridGiro.Focus();
                            gridGiro.RefreshEdit();
                            if (gridGiro.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridGiro.CurrentCell = gridGiro.Rows[0].Cells[n];
                                    gridGiro.RefreshEdit();
                                }
                                else
                                {
                                    gridGiro.CurrentCell = gridGiro.Rows[i - 1].Cells[n];
                                    gridGiro.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                    }

                    break;

                case enumSelectedGrid.HeaderSelected:
                    if (gridBBM.SelectedCells.Count > 0)
                    {
                        DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                        Guid rowIDBBM = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        //if ((int)_dtDetail.Compute("count(Nomor)", "") > 0)
                        //{
                        //    MessageBox.Show("Masih ada detail");
                        //    return;
                        //}

                        if (gridGiro.SelectedCells.Count > 0)
                        {
                            MessageBox.Show("Sudah ada record di detail, tidak bisa hapus record. Silahkan hapus record detail terlebih dahulu");
                            return;
                        }

                        if (!SecurityManager.IsManager())
                        {
                            MessageBox.Show("Hapus hanya boleh dilakukan oleh Manager");
                            return;
                        }

                        if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            try
                            {
                                using (Database db = new Database(GlobalVar.DBFinance))
                                {
                                    BBM.DeleteBBM(db, rowIDBBM);
                                }



                                #region "Tambahan"
                                int i = 0;
                                int n = 0;
                                i = gridBBM.SelectedCells[0].RowIndex;
                                n = gridBBM.SelectedCells[0].ColumnIndex;
                                DataRowView dv = (DataRowView)gridBBM.SelectedCells[0].OwningRow.DataBoundItem;

                                DataRow dr = dv.Row;

                                dr.Delete();
                                _dtHeader.AcceptChanges();
                                gridBBM.Focus();
                                gridBBM.RefreshEdit();
                                if (gridBBM.RowCount > 0)
                                {
                                    if (i == 0)
                                    {
                                        gridBBM.CurrentCell = gridBBM.Rows[0].Cells[n];
                                        gridBBM.RefreshEdit();
                                    }
                                    else
                                    {
                                        gridBBM.CurrentCell = gridBBM.Rows[i - 1].Cells[n];
                                        gridBBM.RefreshEdit();
                                    }
                                }
                                #endregion
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #17
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (!validate())
            {
                return;
            }
            if (updateMode == enumUpdateMode.Header)
            {
                string kode = "";
                if (Tools.isNull(cboPT.Text, "").ToString() != "")
                {
                    kode = cboPT.Text;
                }
                if (frmMode == enumFrmMode.New)
                {
                    try
                    {
                        Guid _RowID = Guid.NewGuid();
                        string _BankID=Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                        using(Database db=new Database(GlobalVar.DBName))
                        {
                            Bank.addBank(db
                                        ,_RowID
                                        ,_BankID
                                        ,tbJenisRek.Text
                                        ,tbNamaBank.Text
                                        ,""                         //namaaccount
                                        ,tbNoAccount.Text
                                        ,tbAlamat1.Text
                                        ,tbAlamat2.Text
                                        ,tbKota.Text
                                        ,tbTelepon.Text
                                        ,tbCusService.Text
                                        ,tbNoTerakhirBG.Text
                                        ,tbCheque.Text
                                        ,""                         //nobkk
                                        ,"IDR"
                                        ,tbSaldo.Text
                                        ,tbLimitSaldo.Text
                                        ,(DateTime)SqlDateTime.Null //tglrek
                                        ,kode                       //kode
                                        ,""                         //sub
                                        ,""                         //maintitip
                                        ,""                         //subtitip
                                        ,tbNoPerkiraan.Text
                                        ,tbPerkiraanTP.Text);
                            //Bank.addBank(db, _RowID, _BankID, tbJenisRek.Text, tbNamaBank.Text, "", tbNoAccount.Text, tbAlamat1.Text, tbAlamat2.Text, tbKota.Text, tbTelepon.Text, tbCusService.Text, tbNoTerakhirBG.Text, tbCheque.Text, "", "IDR", tbSaldo.Text, tbLimitSaldo.Text, (DateTime)SqlDateTime.Null, "", "", "", "", tbNoPerkiraan.Text, tbPerkiraanTP.Text);
                        }
                        frmBukuBankBrowse frm = new frmBukuBankBrowse();
                        frm = (frmBukuBankBrowse)Caller;
                        frm.HeaderRefresh(_RowID);
                        frm.HeaderFindRow("RowIDH", _RowID.ToString());
                        this.Close();
                        
                    }
                    catch(Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
                else
                {
                    //SAVE UPDATE HEADER
                    try
                    {
                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            db.Commands.Add(db.CreateCommand("usp_Bank_UPDATE"));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID));
                            db.Commands[0].Parameters.Add(new Parameter("@JRek", SqlDbType.VarChar, tbJenisRek.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, tbNamaBank.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@NoAccount", SqlDbType.VarChar, tbNoAccount.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@Alamat1", SqlDbType.VarChar, tbAlamat1.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@Alamat2", SqlDbType.VarChar, tbAlamat2.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@Kota", SqlDbType.VarChar, tbKota.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@Telp", SqlDbType.VarChar, tbTelepon.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@CService", SqlDbType.VarChar, tbCusService.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@NoGiro", SqlDbType.VarChar, tbNoTerakhirBG.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@NoCheck", SqlDbType.VarChar, tbCheque.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@SaldoAwal", SqlDbType.Money, tbSaldo.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@Limit", SqlDbType.Money, tbLimitSaldo.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, tbNoPerkiraan.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@MainPerkiraan", SqlDbType.VarChar, tbPerkiraanTP.Text));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].Parameters.Add(new Parameter("@Kode", SqlDbType.VarChar, kode));
                            db.Commands[0].ExecuteNonQuery();

                        }
                        frmBukuBankBrowse frm = new frmBukuBankBrowse();
                        frm = (frmBukuBankBrowse)Caller;
                        frm.HeaderRefresh(rowID);
                        frm.HeaderFindRow("RowIDH", rowID.ToString());
                        this.Close();

                    }
                    catch (Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
            }
            else
            {
                if (frmMode == enumFrmMode.New)
                {
                    //SAVE NEW DETAIL
                    DateTime _Tanggal = (DateTime)tbTglBank.DateValue;
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    rowIDDetail =Guid.NewGuid();
                    string recordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                    try
                    {
                        DateTime tglBank=(DateTime)tbTglBank.DateValue;
                        DateTime tglRK=(DateTime)tbTglRK.DateValue;
                        if (kdTransaksi == "KM1")
                        {
                            nobbk = Numerator.BookNumerator("BBK");
                            nobgch = Numerator.BookNumerator("BKM");
                            string recordIDBKM = recordID.TrimEnd() + "B";
                            string recordIDBKMDetail = recordIDBKM;
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();

                                Bank.AddBankDetail(db, rowIDDetail, Guid.Empty, nobbk, nobgch, rowID, "", tglBank, "BBK", tbKeterangan.Text, "IDR", tbDebet.Text, tbKredit.Text, tglBank, tglRK, "", "", "", "", noPerkiraan,bankID,recordID.TrimEnd()+"T");

                                BKM.AddHeader(db, rowIDDetail, rowIDDetail, recordIDBKM, nobgch, "", "BNK", tglBank, "Mutasi Dari " + namaBank, "", "", SecurityManager.UserName, "");
                                BKM.AddDetail(db, Guid.NewGuid(), rowIDDetail, recordIDBKMDetail, recordIDBKM, "", "", "", "", noPerkiraan, tbKeterangan.Text, tbKredit.Text);
                                db.CommitTransaction();
                            }

                            

                        }
                        else if (kdTransaksi == "KK1")
                        {
                            nobbk = Numerator.BookNumerator("BBM");
                            nobgch = Numerator.BookNumerator("BKK");


                            string recordIDBKK = recordID.TrimEnd() + "B";
                            string recordIDBKKDetail = recordIDBKK;
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();

                                Bank.AddBankDetail(db, rowIDDetail, Guid.Empty, nobbk, nobgch, rowID, "", tglBank, "BBM", tbKeterangan.Text, "IDR", tbDebet.Text, tbKredit.Text, tglBank, tglRK, "", "", "", "", noPerkiraan, bankID, recordID.TrimEnd() + "T");

                                BKK.AddHeader(db, rowIDDetail, rowIDDetail, recordIDBKK, nobgch, "", "BNK", tglBank, "Mutasi Ke " + namaBank, "", "", SecurityManager.UserName, "", "");
                                BKK.AddDetail(db, Guid.NewGuid(), rowIDDetail, recordIDBKKDetail, recordIDBKK, "", "", "", "", noPerkiraan, tbKeterangan.Text, tbDebet.Text);
                                db.CommitTransaction();
                            }
                        }
                        else if (kdTransaksi == "BM1")
                        {
                            nobbk = Numerator.BookNumerator("BBK");
                            nobgch = Numerator.BookNumerator("BBM");
                            string noBBKBank2, noBGCHBank2;
                            Guid LinkRowID = Guid.NewGuid() ;
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();

                                Bank.AddBankDetail(db, rowIDDetail, LinkRowID, nobbk, nobgch, rowID, "", tglBank, "BBK", tbKeterangan.Text, "IDR", tbDebet.Text, tbKredit.Text, tglBank, tglRK, "", "", "", "", noPerkiraan, bankID, recordID.TrimEnd() + "T");

                                noBBKBank2 = nobgch;
                                noBGCHBank2 = nobbk;
                                Bank.AddBankDetail(db, LinkRowID, rowIDDetail, noBBKBank2, noBGCHBank2, rowIDBank2, "", tglBank, "BBM", "Mutasi Bank, No : " + noBGCHBank2, "IDR", tbKredit.Text, tbDebet.Text, tglBank, tglRK, "", "", "", "", noPerkiraan, bankID2, recordID.TrimEnd() + "M");
                                db.CommitTransaction();
                            }
                        }
                        else if (kdTransaksi == "BK2")
                        {
                            nobbk = Numerator.BookNumerator("BBK");
                            nobgch = nobbk;

                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();

                                Bank.AddBankDetail(db, rowIDDetail, Guid.Empty, nobbk, nobgch, rowID, "", tglBank, "BBK", tbKeterangan.Text, "IDR", tbDebet.Text, tbKredit.Text, tglBank, tglRK, "", "", "", "", noPerkiraan, bankID, recordID.TrimEnd() + "T");
                                
                                db.CommitTransaction();
                            }
                        }
                        else if (kdTransaksi == "BM2" || kdTransaksi == "BBM")
                        {
                            nobbk = Numerator.BookNumerator("BBM");
                            nobgch = nobbk;

                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();

                                Bank.AddBankDetail(db, rowIDDetail, Guid.Empty, nobbk, nobgch, rowID, "", tglBank, "BBM", tbKeterangan.Text, "IDR", tbDebet.Text, tbKredit.Text, tglBank, tglRK, "", "", "", "", noPerkiraan, bankID, recordID.TrimEnd() + "T");
                                                                
                                db.CommitTransaction();
                            }
                        }

                        frmBukuBankBrowse frm = new frmBukuBankBrowse();
                        frm = (frmBukuBankBrowse)Caller;
                        //frm.HeaderRefresh(rowID);
                        frm.HeaderRefresh();
                        frm.HeaderFindRow("RowIDH", rowID.ToString());
                        //frm.DetailRefresh(rowIDDetail);
                        frm.DetailRefresh();
                        frm.DetailFindRow("RowID", rowIDDetail.ToString());
                        this.Close();

                        bool isPrinted = LookupInfoValue.CekPrintBukuBank();
                        if (isPrinted)
                        {
                            frm.cetakLaporan();
                        }

                    }
                    catch (Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
                else
                {
                    //SAVE UPDATE DETAIL
                    try
                    {
                        
                        tglRK = (DateTime)tbTglBank.DateValue;
                        keterangan = tbKeterangan.Text;
                        debet = tbDebet.Text;
                        kredit = tbKredit.Text;



                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            
                            db.Commands.Add(db.CreateCommand("usp_BankDetail_RELASI_UPDATE"));
                            db.Commands[0].Parameters.Add(new Parameter("@jenis", SqlDbType.VarChar, nobgch.Substring(0, 3)));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID2", SqlDbType.UniqueIdentifier, rowID));
                            db.Commands[0].Parameters.Add(new Parameter("@RowIDDetail", SqlDbType.UniqueIdentifier, rowIDDetail));
                            db.Commands[0].Parameters.Add(new Parameter("@NoBKK2", SqlDbType.VarChar, nobbk));
                            db.Commands[0].Parameters.Add(new Parameter("@NoBGCH2", SqlDbType.VarChar, nobgch));
                            db.Commands[0].Parameters.Add(new Parameter("@tglRK2", SqlDbType.DateTime, tglRK));
                            db.Commands[0].Parameters.Add(new Parameter("@keterangan2", SqlDbType.VarChar, keterangan));
                            db.Commands[0].Parameters.Add(new Parameter("@debet2", SqlDbType.Money, debet));
                            db.Commands[0].Parameters.Add(new Parameter("@kredit2", SqlDbType.Money, kredit));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy2", SqlDbType.VarChar, SecurityManager.UserID));
                            db.BeginTransaction();
                            db.Commands[0].ExecuteNonQuery();
                            db.CommitTransaction();

                        }

                        frmBukuBankBrowse frm = new frmBukuBankBrowse();
                        frm = (frmBukuBankBrowse)Caller;
                        frm.HeaderRefresh(rowID);
                        frm.HeaderFindRow("RowIDH", rowID.ToString());
                        frm.DetailRefresh(rowIDDetail);
                        frm.DetailFindRow("RowID", rowIDDetail.ToString());
                        this.Close();

                    }
                    catch (Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
            }
        }
Exemple #18
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (selectMode == enumSelectMode.Header)
            {
                if (gridHeader.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridHeader.SelectedCells[0].OwningRow.Cells["hdrTglVoucher"].Value;
                    if (_Tanggal.Date != GlobalVar.DateOfServer.Date)
                    {
                        KotakPesan.Warning("Tanggal server tidak sama dengan tanggal transaksi. \n Tidak bisa hapus transaksi");
                        return;
                    }
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    Guid rowID = (Guid)gridHeader.SelectedCells[0].OwningRow.Cells["hdrRowID"].Value;
                    if ((int)dtDetail.Compute("count(Nomor)", "") > 0)
                    {
                        KotakPesan.Warning("Sudah ada record di detail, tidak bisa hapus record. \n Silahkan hapus record detail terlebih dahulu.");
                        return;
                    }

                    if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (!SecurityManager.AskPasswordManager())
                        {
                            return;
                        }
                        else
                        {
                            try
                            {
                                using (Database db = new Database(GlobalVar.DBFinance))
                                {
                                    VoucherJournal.DeleteVoucherJournal(db, rowID);
                                }



                                #region "Tambahan"
                                int i = 0;
                                int n = 0;
                                i = gridHeader.SelectedCells[0].RowIndex;
                                n = gridHeader.SelectedCells[0].ColumnIndex;
                                DataRowView dv = (DataRowView)gridHeader.SelectedCells[0].OwningRow.DataBoundItem;

                                DataRow dr = dv.Row;

                                dr.Delete();
                                dtHeader.AcceptChanges();
                                gridHeader.Focus();
                                gridHeader.RefreshEdit();
                                if (gridHeader.RowCount > 0)
                                {
                                    if (i == 0)
                                    {
                                        gridHeader.CurrentCell = gridHeader.Rows[0].Cells[n];
                                        gridHeader.RefreshEdit();
                                    }
                                    else
                                    {
                                        gridHeader.CurrentCell = gridHeader.Rows[i - 1].Cells[n];
                                        gridHeader.RefreshEdit();
                                    }
                                }
                                #endregion
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                    }
                }
            }
            else
            {
                if (gridDetail.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridHeader.SelectedCells[0].OwningRow.Cells["hdrTglVoucher"].Value;
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    if (MessageBox.Show("Apakah giro ini tidak jadi dititipkan?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Guid _GiroID = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["GiroID"].Value;
                        Guid _RowID  = (Guid)gridHeader.SelectedCells[0].OwningRow.Cells["hdrRowID"].Value;
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBFinance))
                            {
                                db.Commands.Add(db.CreateCommand("usp_Giro_BatalTitip"));
                                db.Commands[0].Parameters.Add(new Parameter("@GiroID", SqlDbType.UniqueIdentifier, _GiroID));
                                db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                db.Commands[0].ExecuteNonQuery();
                            }
                            HeaderRowRefresh(_RowID);
                            #region "Tambahan"
                            int i = 0;
                            int n = 0;
                            i = gridDetail.SelectedCells[0].RowIndex;
                            n = gridDetail.SelectedCells[0].ColumnIndex;
                            DataRowView dv = (DataRowView)gridDetail.SelectedCells[0].OwningRow.DataBoundItem;

                            DataRow dr = dv.Row;

                            dr.Delete();
                            dtDetail.AcceptChanges();
                            gridDetail.Focus();
                            gridDetail.RefreshEdit();
                            if (gridDetail.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridDetail.CurrentCell = gridDetail.Rows[0].Cells[n];
                                    gridDetail.RefreshEdit();
                                }
                                else
                                {
                                    gridDetail.CurrentCell = gridDetail.Rows[i - 1].Cells[n];
                                    gridDetail.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
            }
        }
Exemple #19
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (selectedGrid == enumSelectedGrid.DetailSelected)
            {
                if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (gridPiutang.SelectedCells.Count > 0)
                    {
                        Guid     rowID     = (Guid)gridPiutang.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        string   nip       = gridKaryawan.SelectedCells[0].OwningRow.Cells["NIP"].Value.ToString();
                        string   Ref       = gridPiutang.SelectedCells[0].OwningRow.Cells["reff"].Value.ToString();
                        DateTime tglPinjam = Convert.ToDateTime(gridPiutang.SelectedCells[0].OwningRow.Cells["Tanggal"].Value);
                        if (PeriodeClosing.IsKasirClosed(tglPinjam))
                        {
                            MessageBox.Show("Tidak bisa delete, data sudah di closing");
                            return;
                        }
                        try
                        {
                            if (Ref == "BKK" || Ref == "BKM")
                            {
                                using (Database db = new Database(GlobalVar.DBFinance))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_PinjamanPegawaiBukti_DELETE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                            }
                            else if (Ref == "TRK" || Ref == "TRM")
                            {
                                using (Database db = new Database(GlobalVar.DBFinance))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_PinjamanPegawaiTransfer_DELETE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID));
                                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                        finally
                        {
                            RefreshPegawai(nip);
                            FindRowPegawsai("NIP", nip);
                            #region "Tambahan"
                            int i = 0;
                            int n = 0;
                            i = gridPiutang.SelectedCells[0].RowIndex;
                            n = gridPiutang.SelectedCells[0].ColumnIndex;
                            DataRowView dv = (DataRowView)gridPiutang.SelectedCells[0].OwningRow.DataBoundItem;

                            DataRow dr = dv.Row;

                            dr.Delete();
                            dtDetail.AcceptChanges();
                            gridPiutang.Focus();
                            gridPiutang.RefreshEdit();
                            if (gridPiutang.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridPiutang.CurrentCell = gridPiutang.Rows[0].Cells[n];
                                    gridPiutang.RefreshEdit();
                                }
                                else
                                {
                                    gridPiutang.CurrentCell = gridPiutang.Rows[i - 1].Cells[n];
                                    gridPiutang.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
        }
Exemple #20
0
        private void tbKepada_Leave(object sender, EventArgs e)
        {
            string src = "";

            if (lookupStafAdm1.Kode != "" & lookupStafAdm1.Kode != "[CODE]")
            {
                _Tanggal = (DateTime)tbTanggal.DateValue;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing! Tidak Bisa Tambah Data.");
                    return;
                }
                if (MessageBox.Show("Data Akan Disimpan?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (formMode == enumFormMode.New)
                    {
                        _recordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                        if (_isFromPiutang != true)
                        {
                            src = "OUT";
                        }
                        else
                        {
                            src = "PIK";
                        }


                        _recordID = BKK.GetRecordIDBukti(_recordID, src);

                        _rowID = Guid.NewGuid();

                        //_noBukti = Tools.AutoNumbering("NoBukti", "ISADbDepoFinance.dbo.Bukti");
                        _noBukti = Numerator.BookNumerator("BKK");
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBFinance))
                            {
                                db.BeginTransaction();
                                BKK.AddHeader(db, _rowID, _rowID, _recordID, _noBukti, "", src, _Tanggal, lookupStafAdm1.Kode, "", "", SecurityManager.UserName, "");

                                if (_isFromPiutang == true)
                                {
                                    BKK.AddPinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKK", _noBukti, "", string.Empty, totalPiutang, 0, _jp);
                                }
                                db.CommitTransaction();
                            }

                            tbNoBKK.Text        = _noBukti;
                            _Kepada             = lookupStafAdm1.Kode;
                            cmdAdd.Enabled      = true;
                            cmdEdit.Enabled     = true;
                            cmdDelete.Enabled   = true;
                            cmdPrint.Enabled    = true;
                            dgDetailBKK.Enabled = true;

                            if (linkPembelian)
                            {
                                //cmdAdd.Enabled = false;
                            }
                            else if (_isFromPiutang != true)
                            {
                                frmBKKBrowse frm = new frmBKKBrowse();
                                frm = (frmBKKBrowse)this.Caller;
                                frm.HeaderRowRefresh(_rowID);
                                frm.FindRowHeader("RowID", _rowID.ToString());
                            }
                            else
                            {
                                Kasir.frmPiutangKaryawan frmUtang = new Kasir.frmPiutangKaryawan();
                                frmUtang = (frmPiutangKaryawan)this.Caller;

                                frmUtang.RefreshPegawai(_Nip);
                                frmUtang.FindRowPegawsai("NIP", _Nip);
                                frmUtang.RefreshPiutang(_rowID);
                                frmUtang.FindRowPiutang("RowID", _rowID.ToString());
                            }

                            dtBKKDetail            = new DataTable();
                            dgDetailBKK.DataSource = dtBKKDetail.DefaultView;
                            dgDetailBKK.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                    else if (formMode == enumFormMode.Update)
                    {
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBFinance))
                            {
                                db.Commands.Add(db.CreateCommand("usp_Bukti_UPDATE"));
                                db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                                db.Commands[0].Parameters.Add(new Parameter("@Kepada", SqlDbType.VarChar, lookupStafAdm1.Kode));
                                db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                db.Commands[0].ExecuteNonQuery();
                            }
                            frmBKKBrowse frm = new frmBKKBrowse();
                            frm = (frmBKKBrowse)this.Caller;
                            frm.HeaderRowRefresh(_rowID);
                            dgDetailBKK.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                    cmdAdd.PerformClick();
                }
            }
        }
Exemple #21
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKK.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "OUT")
            {
                return;
            }

            DateTime _Tanggal = (DateTime)dgHeaderBKK.SelectedCells[0].OwningRow.Cells["tglBukti"].Value;

            if (_Tanggal.Date != GlobalVar.DateOfServer.Date)
            {
                KotakPesan.Warning("Tanggal Bukti transaksi Tidak sama dengan Tanggal server. Tidak bisa hapus record.");
                return;
            }
            if (PeriodeClosing.IsKasirClosed(_Tanggal))
            {
                MessageBox.Show("Sudah Closing!");
                return;
            }
            if (dgDetailBKK.SelectedCells.Count > 0)
            {
                MessageBox.Show("Anda tidak diperkenankan menghapus data ini");
                return;
            }
            string ques = "No Bukti : " + dgHeaderBKK.SelectedCells[0].OwningRow.Cells["noBukti"].Value.ToString() + " Akan Dihapus?";

            if ((dgHeaderBKK.SelectedCells.Count > 0) && (MessageBox.Show(ques, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
            {
                Guid _rowID = (Guid)dgHeaderBKK.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBFinance))
                    {
                        db.Commands.Add(db.CreateCommand("usp_Bukti_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    #region "Tambahan"
                    int i = 0;
                    int n = 0;
                    i = dgHeaderBKK.SelectedCells[0].RowIndex;
                    n = dgHeaderBKK.SelectedCells[0].ColumnIndex;
                    DataRowView dv = (DataRowView)dgHeaderBKK.SelectedCells[0].OwningRow.DataBoundItem;

                    DataRow dr = dv.Row;

                    dr.Delete();
                    dtBKK.AcceptChanges();
                    dgHeaderBKK.Focus();
                    dgHeaderBKK.RefreshEdit();
                    if (dgHeaderBKK.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            dgHeaderBKK.CurrentCell = dgHeaderBKK.Rows[0].Cells[n];
                            dgHeaderBKK.RefreshEdit();
                        }
                        else
                        {
                            dgHeaderBKK.CurrentCell = dgHeaderBKK.Rows[i - 1].Cells[n];
                            dgHeaderBKK.RefreshEdit();
                        }
                    }
                    #endregion
                    //di remark
                    //HeaderRefresh();
                    //DetailRefresh();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Exemple #22
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (selectedGrid == enumSelectedGrid.HeaderSelected)
            {
                if (gridUtm.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (_Tanggal.Date != GlobalVar.DateOfServer.Date)
                    {
                        KotakPesan.Warning("Tanggal server tidak sama dengan tanggal transaksi. \n Tidak bisa hapus transaksi");
                        return;
                    }
                    if (gridDetail.Rows.Count > 0)
                    {
                        KotakPesan.Warning("Sudah ada record di detail, tidak bisa hapus record. \n Silahkan hapus record detail terlebih dahulu.");
                        return;
                    }
                    else if (!SecurityManager.AskPasswordManager())
                    {
                        return;
                    }

                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    Guid headerID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;

                    if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        using (Database db = new Database(GlobalVar.DBFinance))
                        {
                            db.Commands.Clear();
                            db.Commands.Add(db.CreateCommand("usp_TransferBank_DELETE"));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, headerID));
                            db.BeginTransaction();
                            db.Commands[0].ExecuteNonQuery();
                            db.CommitTransaction();
                        }
                        //gridDetail.Rows.Remove(gridDetail.SelectedCells[0].OwningRow);

                        //RefreshRowBuktiTransfer(headerID); // ini buat apa ?

                        #region "Tambahan"
                        int i = 0;
                        int n = 0;
                        i = gridUtm.SelectedCells[0].RowIndex;
                        n = gridUtm.SelectedCells[0].ColumnIndex;
                        DataRowView dv = (DataRowView)gridUtm.SelectedCells[0].OwningRow.DataBoundItem;

                        DataRow dr = dv.Row;

                        dr.Delete();
                        dtHeader.AcceptChanges();
                        gridUtm.Focus();
                        gridUtm.RefreshEdit();
                        if (gridUtm.RowCount > 0)
                        {
                            if (i == 0)
                            {
                                gridUtm.CurrentCell = gridUtm.Rows[0].Cells[n];
                                gridUtm.RefreshEdit();
                            }
                            else
                            {
                                gridUtm.CurrentCell = gridUtm.Rows[i - 1].Cells[n];
                                gridUtm.RefreshEdit();
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                if (gridDetail.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (_Tanggal.Date != GlobalVar.DateOfServer.Date)
                    {
                        KotakPesan.Warning("Tanggal server tidak sama dengan tanggal transaksi. Tidak bisa hapus transaksi");
                        return;
                    }
                    else if (!SecurityManager.AskPasswordManager())
                    {
                        return;
                    }


                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    Guid headerID  = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    Guid rowID     = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value;
                    Guid rowIDBank = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDBank"].Value;
                    if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        using (Database db = new Database(GlobalVar.DBFinance))
                        {
                            db.BeginTransaction();
                            Class.TransferBank.DeleteDetail(db, rowID);

                            db.Commands.Clear();
                            db.Commands.Add(db.CreateCommand("usp_BankDetail_DELETE"));
                            db.Commands[0].Parameters.Add(new Parameter("@rowIDDetail", SqlDbType.UniqueIdentifier, rowID));
                            db.Commands[0].Parameters.Add(new Parameter("@headerIDBank1", SqlDbType.UniqueIdentifier, rowIDBank));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy2", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].ExecuteNonQuery();
                            db.CommitTransaction();
                        }
                        //gridDetail.Rows.Remove(gridDetail.SelectedCells[0].OwningRow);

                        RefreshRowBuktiTransfer(headerID);
                        #region "Tambahan"
                        int i = 0;
                        int n = 0;
                        i = gridDetail.SelectedCells[0].RowIndex;
                        n = gridDetail.SelectedCells[0].ColumnIndex;
                        DataRowView dv = (DataRowView)gridDetail.SelectedCells[0].OwningRow.DataBoundItem;

                        DataRow dr = dv.Row;

                        dr.Delete();
                        dtDetail.AcceptChanges();
                        gridDetail.Focus();
                        gridDetail.RefreshEdit();
                        if (gridDetail.RowCount > 0)
                        {
                            if (i == 0)
                            {
                                gridDetail.CurrentCell = gridDetail.Rows[0].Cells[n];
                                gridDetail.RefreshEdit();
                            }
                            else
                            {
                                gridDetail.CurrentCell = gridDetail.Rows[i - 1].Cells[n];
                                gridDetail.RefreshEdit();
                            }
                        }
                        #endregion
                    }
                }
                else
                {
                    MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #23
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            #region lama
            //try
            //{
            //    TglKasir = (DateTime)tbTanggal.DateValue;
            //    this.Cursor = Cursors.WaitCursor;
            //    using (Database db = new Database(GlobalVar.DBName))
            //    {
            //        db.Commands.Add(db.CreateCommand("fsp_IsClosingKasir"));
            //        db.Commands[0].Parameters.Add(new Parameter("@checkDate", SqlDbType.DateTime, TglKasir));
            //        object cek = db.Commands[0].ExecuteScalar();
            //        if (cek.ToString() == "True")
            //        {
            //            MessageBox.Show("Sudau Closing Kasir.");
            //            tbTanggal.Focus();
            //            return;
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Error.LogError(ex);
            //}
            //finally
            //{
            //    this.Cursor = Cursors.Default;
            //}
            #endregion

            try
            {
                if (tbTanggal.DateValue.ToString() != "" && tbCollector.Text != "")
                {
                    TglKasir      = (DateTime)tbTanggal.DateValue;
                    Acc           = tbMengetahui.Text;
                    NamaCollector = tbCollector.Text;
                    if (formMode == enumFormMode.New)
                    {
                        if (PeriodeClosing.IsKasirClosed(TglKasir))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                        noBukti = Numerator.BookNumerator("IND");
                        //if (_isFromPiutang)
                        //    RowIDI = _rowIDPK;
                        //else
                        //    RowIDI = Guid.NewGuid();

                        string RecordIDI;
                        RowIDI = Guid.NewGuid();
                        if (_isFromPiutang)
                        {
                            RecordIDI = _recID;
                        }
                        else
                        {
                            RecordIDI = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                        }

                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            db.Commands.Add(db.CreateCommand("usp_Inden_INSERT"));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, RowIDI));
                            db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, RecordIDI));
                            db.Commands[0].Parameters.Add(new Parameter("@TglKasir", SqlDbType.DateTime, TglKasir));
                            db.Commands[0].Parameters.Add(new Parameter("@Kasir", SqlDbType.VarChar, SecurityManager.UserName));
                            db.Commands[0].Parameters.Add(new Parameter("@NoBukti", SqlDbType.VarChar, noBukti));
                            db.Commands[0].Parameters.Add(new Parameter("@CollectorID", SqlDbType.VarChar, CollectorID));
                            db.Commands[0].Parameters.Add(new Parameter("@NamaCollector", SqlDbType.VarChar, NamaCollector));
                            db.Commands[0].Parameters.Add(new Parameter("@Acc", SqlDbType.VarChar, Acc));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].ExecuteNonQuery();
                        }

                        if (_isFromPiutang == true)
                        {
                            frmIndenDetailUpdate frm = new frmIndenDetailUpdate(this, RowIDI, RecordIDI, NamaCollector, TglKasir, noBukti, CollectorID, true, _rpsisa, _rowIDPK, _nip);
                            frm.ShowDialog();

                            this.Close();
                        }
                        else
                        {
                            frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                            frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                            frm.IndenRefresh();
                            frm.IndenFindRow("RowIDI", RowIDI.ToString());
                            this.Close();
                        }
                    }


                    else
                    {
                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            db.Commands.Add(db.CreateCommand("usp_Inden_UPDATE"));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, RowIDI));
                            db.Commands[0].Parameters.Add(new Parameter("@TglKasir", SqlDbType.DateTime, TglKasir));
                            db.Commands[0].Parameters.Add(new Parameter("@Kasir", SqlDbType.VarChar, SecurityManager.UserName));
                            db.Commands[0].Parameters.Add(new Parameter("@CollectorID", SqlDbType.VarChar, CollectorID));
                            db.Commands[0].Parameters.Add(new Parameter("@NamaCollector", SqlDbType.VarChar, NamaCollector));
                            db.Commands[0].Parameters.Add(new Parameter("@Acc", SqlDbType.VarChar, Acc));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].ExecuteNonQuery();
                        }

                        frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                        frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                        frm.IndenRefresh();
                        frm.IndenFindRow("RowIDI", RowIDI.ToString());
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show(Messages.Error.InputRequired);
                    return;
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemple #24
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.DetailSelected:

                if (gridGiro.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    Guid rowIDBBM = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    Guid giroID   = (Guid)gridGiro.SelectedCells[0].OwningRow.Cells["RowIDGiro"].Value;

                    if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        DeleteGiroCairTolakBatal(rowIDBBM, giroID);

                        RefreshBBM(rowIDBBM);

                        #region "Tambahan"
                        int i = 0;
                        int n = 0;
                        i = gridGiro.SelectedCells[0].RowIndex;
                        n = gridGiro.SelectedCells[0].ColumnIndex;
                        DataRowView dv = (DataRowView)gridGiro.SelectedCells[0].OwningRow.DataBoundItem;

                        DataRow dr = dv.Row;

                        dr.Delete();
                        _dtDetail.AcceptChanges();
                        gridGiro.Focus();
                        gridGiro.RefreshEdit();
                        if (gridGiro.RowCount > 0)
                        {
                            if (i == 0)
                            {
                                gridGiro.CurrentCell = gridGiro.Rows[0].Cells[n];
                                gridGiro.RefreshEdit();
                            }
                            else
                            {
                                gridGiro.CurrentCell = gridGiro.Rows[i - 1].Cells[n];
                                gridGiro.RefreshEdit();
                            }
                        }
                        #endregion
                    }
                }

                break;

            case enumSelectedGrid.HeaderSelected:
                if (gridBBM.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridBBM.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    Guid rowIDBBM = (Guid)gridBBM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    if ((int)_dtDetail.Compute("count(Nomor)", "") > 0)
                    {
                        MessageBox.Show("Masih ada detail");
                        return;
                    }

                    if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                BBM.DeleteBBM(db, rowIDBBM);
                            }



                            #region "Tambahan"
                            int i = 0;
                            int n = 0;
                            i = gridBBM.SelectedCells[0].RowIndex;
                            n = gridBBM.SelectedCells[0].ColumnIndex;
                            DataRowView dv = (DataRowView)gridBBM.SelectedCells[0].OwningRow.DataBoundItem;

                            DataRow dr = dv.Row;

                            dr.Delete();
                            _dtHeader.AcceptChanges();
                            gridBBM.Focus();
                            gridBBM.RefreshEdit();
                            if (gridBBM.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridBBM.CurrentCell = gridBBM.Rows[0].Cells[n];
                                    gridBBM.RefreshEdit();
                                }
                                else
                                {
                                    gridBBM.CurrentCell = gridBBM.Rows[i - 1].Cells[n];
                                    gridBBM.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
                break;
            }
        }
Exemple #25
0
        private void tbTerima_Leave(object sender, EventArgs e)
        {
            string src = "";

            if ((tbTerima.Text != "") && (tbTerima.Text != _Terima))
            {
                _Tanggal = (DateTime)tbTanggal.DateValue;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
                if (MessageBox.Show("Data Akan Disimpan?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (formMode == enumFormMode.New)
                    {
                        _recordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                        if (_isFromPiutang != true)
                        {
                            src = "IN";
                        }
                        else
                        {
                            src = "PIK";
                        }

                        _recordID = BKM.GetRecordIDBukti(_recordID, src);

                        _noBukti = Numerator.BookNumerator("BKM");
                        _rowID   = Guid.NewGuid();
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                BKM.AddHeader(db, _rowID, _rowID, _recordID, _noBukti, "", src, _Tanggal, tbTerima.Text, "", "", SecurityManager.UserName, "");

                                if (_isFromPiutang == true)
                                {
                                    BKM.AddPinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKM", _noBukti, "", string.Empty, 0, totalPiutang, _jp);
                                }
                            }

                            tbNoBKM.Text        = _noBukti;
                            _Terima             = tbTerima.Text;
                            cmdAdd.Enabled      = true;
                            cmdEdit.Enabled     = true;
                            cmdDelete.Enabled   = true;
                            cmdPrint.Enabled    = true;
                            dgDetailBKM.Enabled = true;

                            if (_isFromPiutang != true)
                            {
                                frmBKMBrowse frm = new frmBKMBrowse();
                                frm = (frmBKMBrowse)this.Caller;
                                frm.HeaderRowRefresh(_rowID);
                                frm.FindRowHeader("RowID", _rowID.ToString());
                            }
                            else
                            {
                                Kasir.frmPiutangKaryawan frmUtang = new Kasir.frmPiutangKaryawan();
                                frmUtang = (frmPiutangKaryawan)this.Caller;
                                frmUtang.RefreshPegawai(_Nip);
                                frmUtang.FindRowPegawsai("NIP", _Nip);
                                frmUtang.RefreshPiutang(_rowID);
                                frmUtang.FindRowPiutang("RowID", _rowID.ToString());
                            }

                            dtBKMDetail            = new DataTable();
                            dgDetailBKM.DataSource = dtBKMDetail.DefaultView;
                            dgDetailBKM.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                    else if (formMode == enumFormMode.Update)
                    {
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.Commands.Add(db.CreateCommand("usp_Bukti_UPDATE"));
                                db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                                db.Commands[0].Parameters.Add(new Parameter("@Kepada", SqlDbType.VarChar, tbTerima.Text));
                                db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                db.Commands[0].ExecuteNonQuery();
                            }
                            frmBKMBrowse frm = new frmBKMBrowse();
                            frm = (frmBKMBrowse)this.Caller;
                            frm.HeaderRowRefresh(_rowID);
                            frm.FindRowHeader("RowID", _rowID.ToString());
                            dgDetailBKM.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
            }
        }
Exemple #26
0
        private void cmdDelete_Click_1(object sender, EventArgs e)
        {
            DateTime _Tanggal = (DateTime)tbTanggal.DateValue;

            if (PeriodeClosing.IsKasirClosed(GlobalVar.DateOfServer))
            {
                MessageBox.Show("Sudah clossing kasir.....!");
                return;
            }

            if (_Tanggal != GlobalVar.DateOfServer)
            {
                MessageBox.Show("Hapus kas bon hanya untuk tanggal hari ini.....!");
                return;
            }

            if (dgKasbon.SelectedCells[0].OwningRow.Cells["StatusKasbon"].Value.ToString() == "C")
            {
                MessageBox.Show("Sudah Penyelesaian, Tidak Bisa di Hapus");
                return;
            }

            if (txtJv.Text != "")
            {
                MessageBox.Show("Sudah ada penyelesaian.....!");
                return;
            }

            if (MessageBox.Show("Hapus record ini?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Guid _RowID = (Guid)dgKasbon.SelectedCells[0].OwningRow.Cells["RowID"].Value;

                // Kas bon
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_Kasbon_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].ExecuteNonQuery();
                    }

                    //MessageBox.Show("Record telah dihapus");
                    //KasbonRefresh();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                // Bukti
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_Bukti_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                // Bukti detail
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_BuktiDetail_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@headerID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    MessageBox.Show("Record telah dihapus");
                    KasbonRefresh();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Exemple #27
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKM.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "IN")
            {
                return;
            }

            DateTime _Tanggal = (DateTime)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["tglBukti"].Value;

            if (PeriodeClosing.IsKasirClosed(_Tanggal))
            {
                MessageBox.Show("Sudah Closing!");
                return;
            }

            string ques = "No Bukti : " + dgHeaderBKM.SelectedCells[0].OwningRow.Cells["noBukti"].Value.ToString() + " Akan Dihapus?";

            if ((dgHeaderBKM.SelectedCells.Count > 0) && (MessageBox.Show(ques, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
            {
                Guid _rowID = (Guid)dgHeaderBKM.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                try {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("usp_Bukti_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].ExecuteNonQuery();
                    }

                    #region "Tambahan"
                    int i = 0;
                    int n = 0;
                    i = dgHeaderBKM.SelectedCells[0].RowIndex;
                    n = dgHeaderBKM.SelectedCells[0].ColumnIndex;
                    DataRowView dv = (DataRowView)dgHeaderBKM.SelectedCells[0].OwningRow.DataBoundItem;

                    DataRow dr = dv.Row;

                    dr.Delete();
                    dtBKM.AcceptChanges();
                    dgHeaderBKM.Focus();
                    dgHeaderBKM.RefreshEdit();
                    if (dgHeaderBKM.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            dgHeaderBKM.CurrentCell = dgHeaderBKM.Rows[0].Cells[n];
                            dgHeaderBKM.RefreshEdit();
                        }
                        else
                        {
                            dgHeaderBKM.CurrentCell = dgHeaderBKM.Rows[i - 1].Cells[n];
                            dgHeaderBKM.RefreshEdit();
                        }
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    //HeaderRefresh();
                    //DetailRefresh();
                }
            }
        }
Exemple #28
0
        private void tbKepada_Leave(object sender, EventArgs e)
        {
            string src = "";

            if ((tbKepada.Text != "") && (tbKepada.Text != _Kepada))
            {
                _Tanggal = (DateTime)tbTanggal.DateValue;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing! Tidak Bisa Tambah Data.");
                    return;
                }

                if (imgBase64 != null)
                {
                    if (MessageBox.Show("Data Akan Disimpan?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (formMode == enumFormMode.New)
                        {
                            ////tambahan
                            if (_isFromPiutang)
                            {
                                if (_jp == "2" || _jp == "5")
                                {
                                    try
                                    {
                                        DataTable dtc = new DataTable();
                                        using (Database db = new Database(GlobalVar.DBName))
                                        {
                                            db.Commands.Add(db.CreateCommand("usp_PinjamanPegawai_LIST"));
                                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _kpid));
                                            db.Commands[0].Parameters.Add(new Parameter("@Nip", SqlDbType.VarChar, _Nip));
                                            dtc = db.Commands[0].ExecuteDataTable();
                                        }
                                        if (dtc.Rows.Count > 0)
                                        {
                                            MessageBox.Show("Data sudah dinput.");
                                            return;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Error.LogError(ex);
                                    }
                                }
                                else
                                {
                                    _keteranganlain = "";
                                }
                            }
                            else
                            {
                                _keteranganlain = "";
                            }

                            if (_isFromPiutang != true)
                            {
                                src = "OUT";
                            }
                            else
                            {
                                src = "PIK";
                            }

                            //_recordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                            string _rcid = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                            _recordID = BKK.GetRecordIDBukti(_rcid, src);

                            if (_isFromPiutang)
                            {
                                if (_recordID.Length > 0 && !string.IsNullOrEmpty(_Nip))
                                {
                                    _recIDPiutangKaryawan = _recordID.Replace(_recordID.Substring(22, 1), _jp);
                                }
                            }

                            if (_isFromPiutang)
                            {
                                if (_jp == "2" || _jp == "5")
                                {
                                    _rowID = _kpid;
                                }
                                else
                                {
                                    _rowID = Guid.NewGuid();
                                }
                            }
                            else
                            {
                                _rowID = Guid.NewGuid();
                            }
                            //_rowID = Guid.NewGuid();

                            _noBukti = Numerator.BookNumerator("BKK");
                            try
                            {
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.BeginTransaction();
                                    BKK.AddHeader(db, _rowID, _rowID, _recordID, _noBukti, "", src, _Tanggal, tbKepada.Text, "", "", SecurityManager.UserName, " ", imgBase64);

                                    if (_isFromPiutang == true)
                                    {
                                        BKK.AddPinjamanPegawai(db, _rowID, _recIDPiutangKaryawan, _Nip, _Tanggal, "BKK", _noBukti, "", _keteranganlain, totalPiutang, 0, _jp);
                                    }
                                    //BKK.AddPinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKK", _noBukti, "", _keteranganlain, totalPiutang, 0, _jp);
                                    //BKK.AddPinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKK", _noBukti, "", string.Empty, totalPiutang, 0, _jp);
                                    db.CommitTransaction();
                                }

                                tbNoBKK.Text        = _noBukti;
                                _Kepada             = tbKepada.Text;
                                cmdAdd.Enabled      = true;
                                cmdEdit.Enabled     = true;
                                cmdDelete.Enabled   = true;
                                cmdPrint.Enabled    = true;
                                dgDetailBKK.Enabled = true;

                                if (_isFromPiutang != true)
                                {
                                    frmBKKBrowse frm = new frmBKKBrowse();
                                    frm = (frmBKKBrowse)this.Caller;
                                    frm.HeaderRowRefresh(_rowID);
                                    frm.FindRowHeader("RowID", _rowID.ToString());
                                }
                                else
                                {
                                    Kasir.frmPiutangKaryawan frmUtang = new Kasir.frmPiutangKaryawan();
                                    frmUtang = (frmPiutangKaryawan)this.Caller;

                                    frmUtang.RefreshPegawai(_Nip);
                                    frmUtang.FindRowPegawsai("NIP", _Nip);
                                    frmUtang.RefreshPiutang(_rowID);
                                    frmUtang.FindRowPiutang("RowID", _rowID.ToString());
                                }

                                dtBKKDetail            = new DataTable();
                                dgDetailBKK.DataSource = dtBKKDetail.DefaultView;
                                dgDetailBKK.Focus();
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                        else if (formMode == enumFormMode.Update)
                        {
                            try
                            {
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_Bukti_UPDATE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                                    db.Commands[0].Parameters.Add(new Parameter("@Kepada", SqlDbType.VarChar, tbKepada.Text));
                                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                                frmBKKBrowse frm = new frmBKKBrowse();
                                frm = (frmBKKBrowse)this.Caller;
                                frm.HeaderRowRefresh(_rowID);
                                dgDetailBKK.Focus();
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Attachment belum ditambahkan !!");
                    return;
                }
            }
        }
Exemple #29
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            DateTime _Tanggal = (DateTime)gridBBK.SelectedCells[0].OwningRow.Cells["TglBBK"].Value;

            if (PeriodeClosing.IsKasirClosed(_Tanggal))
            {
                MessageBox.Show("Sudah Closing!");
                return;
            }

            if (selectedGrid == enumSelectedGrid.DetailSelected)
            {
                if (gridGiroIn.SelectedCells.Count > 0)
                {
                    try
                    {
                        if (MessageBox.Show("Data Ini Akan Dihapus ?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                        {
                            return;
                        }
                        _rowIDBBK = (Guid)gridBBK.SelectedCells[0].OwningRow.Cells["RowIDBBK"].Value;
                        DeleteGiroInternal();
                        RefreshBBK(_rowIDBBK);
                        #region "Tambahan"
                        int i = 0;
                        int n = 0;
                        i = gridGiroIn.SelectedCells[0].RowIndex;
                        n = gridGiroIn.SelectedCells[0].ColumnIndex;
                        DataRowView dv = (DataRowView)gridGiroIn.SelectedCells[0].OwningRow.DataBoundItem;

                        DataRow dr = dv.Row;

                        dr.Delete();
                        _dtGiroIn.AcceptChanges();
                        gridGiroIn.Focus();
                        gridGiroIn.RefreshEdit();
                        if (gridGiroIn.RowCount > 0)
                        {
                            if (i == 0)
                            {
                                gridGiroIn.CurrentCell = gridGiroIn.Rows[0].Cells[n];
                                gridGiroIn.RefreshEdit();
                            }
                            else
                            {
                                gridGiroIn.CurrentCell = gridGiroIn.Rows[i - 1].Cells[n];
                                gridGiroIn.RefreshEdit();
                            }
                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
            }
            else
            {
                if (gridBBK.SelectedCells.Count > 0)
                {
                    Guid rowIDBBK = (Guid)gridBBK.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    if ((int)_dtGiroIn.Compute("count(Nomor)", "") > 0)
                    {
                        MessageBox.Show("Masih ada detail");
                        return;
                    }

                    if (MessageBox.Show("Data Ini Akan Dihapus?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBFinance))
                            {
                                BBK.DeleteBBK(db, rowIDBBK);
                            }



                            #region "Tambahan"
                            int i = 0;
                            int n = 0;
                            i = gridBBK.SelectedCells[0].RowIndex;
                            n = gridBBK.SelectedCells[0].ColumnIndex;
                            DataRowView dv = (DataRowView)gridBBK.SelectedCells[0].OwningRow.DataBoundItem;

                            DataRow dr = dv.Row;

                            dr.Delete();
                            _dtBBK.AcceptChanges();
                            gridBBK.Focus();
                            gridBBK.RefreshEdit();
                            if (gridBBK.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridBBK.CurrentCell = gridBBK.Rows[0].Cells[n];
                                    gridBBK.RefreshEdit();
                                }
                                else
                                {
                                    gridBBK.CurrentCell = gridBBK.Rows[i - 1].Cells[n];
                                    gridBBK.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
            }
        }
Exemple #30
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            //if (lookupPerkiraanKoneksi1.NoPerkiraan == "" || lookupPerkiraanKoneksi1.NoPerkiraan == "[CODE]")
            //{
            //    MessageBox.Show("No Perkiraan masih kosong.");
            //    return;
            //}

            bool isPrinted = LookupInfoValue.CekPrintBs();

            if (formMode == enumformMode.New)
            {
                if (txtAcc.Text == "")
                {
                    MessageBox.Show("Masih ada Kasbon yang belum diselesaikan, dan belum ada PIN dari HO.");
                    lookupPegawai1.Focus();
                    return;
                }

                if (!validate())
                {
                    return;
                }
                DateTime _Tanggal = (DateTime)tbTanggal.DateValue;
                if (PeriodeClosing.IsKasirClosed(_Tanggal))
                {
                    MessageBox.Show("Sudah Closing!");
                    return;
                }
                _RowID = Guid.NewGuid();
                string _RecordID          = ISA.Common.Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                string _RecordIDBKKDetail = ISA.Common.Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 2);
                string _NoBKK             = Numerator.BookNumerator("BKK", tbTanggal.DateValue);
                string _NoBukti           = Numerator.BookNumerator("BON", tbTanggal.DateValue);
                try
                {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("usp_Kasbon_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, _RecordID));
                        db.Commands[0].Parameters.Add(new Parameter("@NIP", SqlDbType.VarChar, lookupPegawai1.Nip));
                        db.Commands[0].Parameters.Add(new Parameter("@Nama", SqlDbType.VarChar, lookupPegawai1.Nama));
                        db.Commands[0].Parameters.Add(new Parameter("@UnitKerja", SqlDbType.VarChar, lookupPegawai1.Unitkerja));
                        db.Commands[0].Parameters.Add(new Parameter("@NoBukti", SqlDbType.VarChar, _NoBukti));
                        db.Commands[0].Parameters.Add(new Parameter("@Tgl", SqlDbType.DateTime, tbTanggal.DateValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Keperluan", SqlDbType.VarChar, tbKeperluan.Text.Trim()));
                        db.Commands[0].Parameters.Add(new Parameter("@BKKNo1", SqlDbType.VarChar, _NoBKK));
                        db.Commands[0].Parameters.Add(new Parameter("@BKKRp1", SqlDbType.Money, tbNominal.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Total1", SqlDbType.Money, tbNominal.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Kode", SqlDbType.VarChar, ""));
                        db.Commands[0].Parameters.Add(new Parameter("@Sub", SqlDbType.VarChar, ""));
                        db.Commands[0].Parameters.Add(new Parameter("@Hari", SqlDbType.VarChar, tbHari.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, lookupPerkiraanKoneksi1.NoPerkiraan));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.BeginTransaction();
                        db.Commands[0].ExecuteNonQuery();
                        BKK.AddHeader(db, _RowID, _RowID, BKK.GetRecordIDBukti(_RecordID, "BSA"), _NoBKK, "", "BSA", (DateTime)tbTanggal.DateValue, lookupPegawai1.Nama, "", "", SecurityManager.UserName, "", "TT");
                        BKK.AddDetail(db, Guid.NewGuid(), _RowID, _RecordIDBKKDetail, BKK.GetRecordIDBukti(_RecordID, "BSA"), "", "", "", "", lookupPerkiraanKoneksi1.NoPerkiraan, tbKeperluan.Text.Trim() + " (" + _NoBukti + ")", tbNominal.Text);
                        db.CommitTransaction();
                    }
                    string nominal = tbNominal.GetDoubleValue.ToString("#,###");

                    if (isPrinted)
                    {
                        cetakLaporan(_NoBKK, tbKeperluan.Text.Trim() + " (" + _NoBukti + ")", nominal, tbTanggal.DateValue.Value.ToString("dd/MM/yyyy"), "K");
                    }
                    frmKasbonBrowse frm = new frmKasbonBrowse();
                    frm = (frmKasbonBrowse)Caller;
                    //frm.KasbonRefresh(_RowID);
                    frm.KasbonRefresh();
                    frm.KasbonFindRow("RowID", _RowID.ToString());
                    this.Close();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
            }
            else
            {
                if (tbSisa.Text != "0")
                {
                    MessageBox.Show("Masih ada sisa BS, tidak boleh di update.");
                    return;
                }
                if (tbRpTrm.Text != "0" && bankID == "")
                {
                    MessageBox.Show("Detail transfer belum diisi.");
                    return;
                }

                string noVJU = "", noBKK3 = "", noBKM3 = "", noTRM3 = "";
                double rpVJU = 0, rpBKK3 = 0, rpBKM3 = 0, rpTRM3 = 0, rpTotle = 0, rpTotku = 0;

                if (dtVoucher.Rows.Count > 0)
                {
                    noVJU = Numerator.BookNumerator("VJU", tbTanggal.DateValue);
                    rpVJU = Convert.ToDouble(tbTotal.Text);
                }
                if (selisih < 0)
                {
                    rpTotku = selisih * -1;
                    rpBKK3  = Convert.ToDouble(tbBKK.Text);
                    noBKK3  = Numerator.BookNumerator("BKK", tbTanggal.DateValue);
                }
                else
                {
                    rpTotle = Convert.ToDouble(tbBKM.Text) + Convert.ToDouble(tbRpTrm.Text);
                    if (cbBkm.Checked == true)
                    {
                        rpBKM3 = Convert.ToDouble(tbBKM.Text);
                        noBKM3 = Numerator.BookNumerator("BKM", tbTanggal.DateValue);
                    }

                    if (cbTrm.Checked == true)
                    {
                        rpTRM3 = Convert.ToDouble(tbRpTrm.Text);
                        noTRM3 = Numerator.BookNumerator("BBM", tbTanggal.DateValue);
                    }
                }

                try
                {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();

                        db.Commands.Add(db.CreateCommand("usp_Kasbon_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@JVNo1", SqlDbType.VarChar, noVJU));
                        db.Commands[0].Parameters.Add(new Parameter("@BKKNo3", SqlDbType.VarChar, noBKK3));
                        db.Commands[0].Parameters.Add(new Parameter("@BKMNo3", SqlDbType.VarChar, noBKM3));
                        db.Commands[0].Parameters.Add(new Parameter("@TRNNo3", SqlDbType.VarChar, noTRM3));
                        db.Commands[0].Parameters.Add(new Parameter("@JVRp1", SqlDbType.Money, rpVJU));
                        db.Commands[0].Parameters.Add(new Parameter("@Total2", SqlDbType.Money, Convert.ToDouble(tbTotal.Text)));
                        db.Commands[0].Parameters.Add(new Parameter("@BKKRp3", SqlDbType.Money, rpBKK3));
                        db.Commands[0].Parameters.Add(new Parameter("@BKMRp3", SqlDbType.Money, rpBKM3));
                        db.Commands[0].Parameters.Add(new Parameter("@TRNRp3", SqlDbType.Money, rpTRM3));
                        db.Commands[0].Parameters.Add(new Parameter("@Totle3", SqlDbType.Money, rpTotle));
                        db.Commands[0].Parameters.Add(new Parameter("@Totku3", SqlDbType.Money, rpTotku));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        if (_biayaOperasionalRowId != Guid.Empty)
                        {
                            db.Commands[0].Parameters.Add(new Parameter("@BiayaOperasionalRowID", SqlDbType.UniqueIdentifier, _biayaOperasionalRowId));
                        }
                        db.Commands[0].ExecuteNonQuery();


                        if (dtVoucher.Rows.Count > 0)
                        {
                            string vjRecID = _RecordID + "X";

                            VoucherJournal.AddHeader(db, _RowID, _RowID, vjRecID, "UM", DateTime.Today, noVJU, tbKeperluan.Text.Trim() + " (" + TBNoKasbon.Text + ")", "", "", SecurityManager.UserName, "", "", "", "", 0, true);

                            foreach (DataRow dr in dtVoucher.Rows)
                            {
                                VoucherJournal.AddDetail(db, (Guid)dr["RowID"], _RowID, dr["RecordID"].ToString(), vjRecID, "", "", dr["NoAcc"].ToString(), "", dr["NoPerkiraan"].ToString(), dr["Keterangan"].ToString() + " (" + TBNoKasbon.Text + ")", (Double)dr["Debet"], 0, true);
                            }


                            if (isPrinted)
                            {
                                cetakLaporanVju(noVJU, String.Format("{0:dd/MM/yyyy}", DateTime.Today));
                            }
                        }

                        if (cbBkm.Checked == true)
                        {
                            Guid   rowID  = Guid.NewGuid();
                            string recIDD = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 2);
                            string uraian = "KELEBIHAN BS " + tbKeperluan.Text.Trim() + " (" + TBNoKasbon.Text + ")";
                            BKM.AddHeader(db, rowID, _RowID, BKM.GetRecordIDBukti(_RecordID, "BSL"), noBKM3, "", "BSL", DateTime.Today, lookupPegawai1.Nama, "", "", SecurityManager.UserName, "");
                            BKM.AddDetail(db, Guid.NewGuid(), rowID, recIDD, BKM.GetRecordIDBukti(_RecordID, "BSL"), "", "", "", "", "", uraian, rpBKM3.ToString());

                            if (isPrinted)
                            {
                                cetakLaporan(noBKM3, uraian, rpBKM3.ToString("#,###"), String.Format("{0:dd/MM/yyyy}", DateTime.Today), "M");
                            }
                        }

                        if (cbBkk.Checked == true)
                        {
                            Guid   rowID  = Guid.NewGuid();
                            string recIDD = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 2);
                            string uraian = "KEKURANGAN BS " + tbKeperluan.Text.Trim() + " (" + TBNoKasbon.Text + ")";
                            BKK.AddHeader(db, rowID, _RowID, BKK.GetRecordIDBukti(_RecordID, "BSK"), noBKK3, "", "BSK", DateTime.Today, lookupPegawai1.Nama, "", "", SecurityManager.UserName, "", "");
                            BKK.AddDetail(db, Guid.NewGuid(), rowID, recIDD, BKK.GetRecordIDBukti(_RecordID, "BSK"), "", "", "", "", "", uraian, rpBKK3.ToString());

                            if (isPrinted)
                            {
                                cetakLaporan(noBKK3, uraian, rpBKK3.ToString("#,###"), String.Format("{0:dd/MM/yyyy}", DateTime.Today), "K");
                            }
                        }

                        if (cbTrm.Checked == true)
                        {
                            Guid   rowID  = _RowID;
                            string uraian = "KELEBIHAN BS " + tbKeperluan.Text.Trim() + " (" + TBNoKasbon.Text + ")";

                            TransferBank.addHeader(db, rowID, _RowID, _RecordID.TrimEnd() + "8", DateTime.Today, noTRM3, "M", bankID, bankAsal, "", "", SecurityManager.UserName, lookupPegawai1.Nama);
                            TransferBank.addDetail(db, rowID, rowID, _RecordID.TrimEnd() + "8", _RecordID.TrimEnd() + "8", "", uraian, bankAsal, "", nomor, DateTime.Today, rpTRM3.ToString(), "", "", "", "", bankID, "", "");

                            Bank.AddBankDetail(db, rowID, Guid.Empty, noTRM3, "", Guid.Empty, "", DateTime.Today, "BBM", "TRANSFER DARI : " + uraian, "IDR", rpTRM3.ToString(), "0", DateTime.Today, DateTime.Today, "", "", "", "", "", bankID, _RecordID.TrimEnd() + "8");
                        }

                        db.CommitTransaction();
                    }

                    frmKasbonBrowse frm = new frmKasbonBrowse();
                    frm = (frmKasbonBrowse)Caller;
                    frm.KasbonRefresh(_RowID);
                    frm.KasbonFindRow("RowID", _RowID.ToString());
                    this.Close();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
            }
        }