Пример #1
0
        private void RefreshHeader()
        {
            if (Brow == enumBrow.Header && Modus == enumModus.New)
            {
                dateDKN.DateValue = DateTime.Today;
                cboCabang.Text    = "";
            }
            else
            {
                frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;
                dateDKN.DateValue       = Convert.ToDateTime(frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Tanggal"].Value);
                txtNoDKN.Text           = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["No_dkn"].Value.ToString();
                cboCabang.SelectedValue = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Cabang"].Value.ToString();
                optDebet.Checked        = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Dk"].Value.ToString() == "D";
                optKredit.Checked       = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Dk"].Value.ToString() == "K";
            }
            dateDKN.Enabled   = Brow == enumBrow.Header;
            txtNoDKN.Enabled  = Brow == enumBrow.Header;
            cboCabang.Enabled = Brow == enumBrow.Header;
            optDebet.Enabled  = Brow == enumBrow.Header;
            optKredit.Enabled = Brow == enumBrow.Header;

            txtPerkiraan.Enabled     = Brow == enumBrow.Detail;
            txtUraian.Enabled        = Brow == enumBrow.Detail;
            numJumlah.Enabled        = Brow == enumBrow.Detail;
            txtCollector.Enabled     = Brow == enumBrow.Detail;
            lookupBankAsal1.Enabled  = Brow == enumBrow.Detail;
            lookupBankTujuan.Enabled = Brow == enumBrow.Detail;
        }
Пример #2
0
        private void InsertDataDetail()
        {
            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (_IsiPin == "")
            {
                string NoPerkiraan  = txtPerkiraan.NoPerkiraan;
                string Uraian       = txtUraian.Text;
                Double Jumlah       = Convert.ToDouble(numJumlah.Text);
                string KodeKolektor = txtCollectorID.Text;
                string Kolektor     = txtCollector.Text;

                if (Modus == enumModus.New)
                {
                    _DetailID    = Guid.NewGuid();
                    _RecIDDetail = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                }

                using (Database db = new Database(GlobalVar.DBName))
                {
                    DKN.DKNDetailInsert(db, _DetailID, _HeaderID, _RecID, NoPerkiraan, Uraian, Jumlah, _DetailID, _RecIDDetail, KodeKolektor, _BankIDtujuan, _BankTujuanRowID, _BankKotaRowID, _KodeToko);
                }
                frmCaller.RefreshDknDetail();
            }
        }
Пример #3
0
        private void InsertDataHeader()
        {
            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (Modus == enumModus.New)
            {
                _HeaderID = Guid.NewGuid();
                _RecID    = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
            }
            DateTime TglBukti = Convert.ToDateTime(dateDKN.DateValue);
            string   Cabang   = txtGudang.Text;
            string   DK       = "";

            if (optDebet.Checked)
            {
                DK = "D";
            }
            else
            {
                DK = "K";
            }

            using (Database db = new Database(GlobalVar.DBName))
            {
                //if (Modus == enumModus.Update) RowIDDKN = _HeaderID;
                DKN.DKNInsert(db, _HeaderID, _RecID, DK, "MAN", "B", "DKN", TglBukti, Cabang, "", _HeaderID);
            }
            frmCaller.RefreshDkn();
        }
Пример #4
0
        private void RefreshDetail()
        {
            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (Modus == enumModus.New)
            {
                txtPerkiraan.NoPerkiraan = "";
                txtUraian.Text           = "";
                numJumlah.Text           = Convert.ToString(0);
            }
            else
            {
                txtPerkiraan.NoPerkiraan = Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["No_perk"].Value, "").ToString();
                txtUraian.Text           = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["Uraian"].Value.ToString();
                numJumlah.Text           = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["Jumlah"].Value.ToString();
                _RecIDDetail             = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["RecordIDD"].Value.ToString();
                if (txtPerkiraan.NoPerkiraan != "" && txtPerkiraan.NoPerkiraan != "[CODE]")
                {
                    dtPerkiraan = Class.Perkiraan.GetPerkiraan(txtPerkiraan.NoPerkiraan);
                    DataRow dr = dtPerkiraan.Rows[0];
                    txtPerkiraan.NamaPerkiraan = dr["NamaPerkiraan"].ToString();
                }
                else
                {
                    txtPerkiraan.NamaPerkiraan = "";
                }
                txtCollector.Text   = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["Nama"].Value.ToString();
                txtCollectorID.Text = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["KodeKolektor"].Value.ToString();

                lookupBankTujuan.NamaBank = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["NamaBankTujuan"].Value.ToString();
                lookupBankTujuan.BankID   = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["BankIDTujuan"].Value.ToString();

                lookupBankAsal1.NamaBank = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["NamaBank"].Value.ToString();
                lookupBankAsal1.Lokasi   = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["Lokasi"].Value.ToString();

                lookupToko1.NamaToko = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["NamaToko"].Value.ToString();
                lookupToko1.KodeToko = frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["KodeToko"].Value.ToString();

                _BankKotaRowID         = new Guid(Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["BankKotaRowID"].Value, Guid.Empty).ToString());
                lookupBankTujuan.RowID = new Guid(Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["BankTujuanRowID"].Value, Guid.Empty).ToString());

                if (_IsiPin == "1")
                {
                    dateDKN.ReadOnly      = true; dateDKN.TabStop = false;
                    txtNoDKN.Enabled      = true; txtNoDKN.ReadOnly = false; txtNoDKN.TabStop = true;
                    txtGudang.Enabled     = false; txtGudang.TabStop = false;
                    optDebet.Enabled      = false; optDebet.TabStop = false;
                    optKredit.Enabled     = false; optKredit.TabStop = false;
                    txtPerkiraan.Enabled  = false; txtPerkiraan.TabStop = false;
                    txtUraian.ReadOnly    = true; txtUraian.TabStop = false;
                    numJumlah.ReadOnly    = true; numJumlah.TabStop = false;
                    txtCollector.ReadOnly = true; txtCollector.TabStop = false;
                    //lookupBankAsal.Enabled = false; lookupBankAsal.TabStop = false;
                }
            }
        }
Пример #5
0
        private void UpdateDKN()
        {
            try
            {
                frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;
                //string HRecordID = Tools.isNull(frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["RecordID"].Value, "").ToString();
                string CollectorID   = Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["KodeKolektor"].Value, "").ToString();
                string NamaCollector = Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["Nama"].Value, "").ToString();
                string noBuktiKasir  = Numerator.BookNumerator("IND");
                string NomorKN       = Tools.isNull(frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["No_dkn"].Value, "").ToString();
                string NoPerkiraan   = Tools.isNull(frmCaller.gridDetail.SelectedCells[0].OwningRow.Cells["No_perk"].Value, "").ToString();

                this.Cursor = Cursors.WaitCursor;
                using (Database db = new Database(GlobalVar.DBName))
                {
                    db.Commands.Add(db.CreateCommand("psp_DKN_LINK"));
                    db.Commands[0].Parameters.Add(new Parameter("@NomorKN", SqlDbType.VarChar, txtNoDKN.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _HeaderID));
                    db.Commands[0].Parameters.Add(new Parameter("@RecID", SqlDbType.VarChar, _RecID));
                    db.Commands[0].Parameters.Add(new Parameter("@RecIDDetail", SqlDbType.VarChar, _RecIDDetail));
                    db.Commands[0].Parameters.Add(new Parameter("@TglKasir", SqlDbType.DateTime, DateTime.Now));
                    db.Commands[0].Parameters.Add(new Parameter("@Kasir", SqlDbType.VarChar, SecurityManager.UserName));
                    db.Commands[0].Parameters.Add(new Parameter("@NoBukti", SqlDbType.VarChar, noBuktiKasir));
                    db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, NoPerkiraan));
                    //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, NomorKN));
                    db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.Bit, 0));
                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserInitial));
                    db.Commands[0].ExecuteNonQuery();
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #6
0
 private void RefreshHeader()
 {
     if (Modus == enumModus.New)
     {
         dateDKN.DateValue = DateTime.Today;
         txtGudang.Text    = GlobalVar.Gudang;
     }
     else
     {
         frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;
         dateDKN.DateValue = Convert.ToDateTime(frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Tanggal"].Value);
         txtNoDKN.Text     = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["No_dkn"].Value.ToString();
         txtGudang.Text    = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Cabang"].Value.ToString();
         optDebet.Checked  = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Dk"].Value.ToString() == "D";
         optKredit.Checked = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["Dk"].Value.ToString() == "K";
         _RecID            = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
         if (Tools.isNull(_pinKey, "").ToString() != "")
         {
             txtNoDKN.Enabled  = true;
             txtNoDKN.ReadOnly = false;
         }
     }
 }
Пример #7
0
        private void cmdSAVE_Click(object sender, EventArgs e)
        {
            _BankTujuanRowID = lookupBankTujuan.RowID;
            _BankIDtujuan    = lookupBankTujuan.BankID;
            string _KodeToko = lookupToko1.KodeToko;
            string lokasi    = lookupBankAsal1.Lokasi;
            string bankID    = lookupBankTujuan.BankID;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                using (Database db = new Database(GlobalVar.DBName))
                {
                    DataTable dtBK = new DataTable();
                    db.Commands.Add(db.CreateCommand("usp_BankKota_LIST"));
                    db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, lookupBankAsal1.NamaBank));
                    db.Commands[0].Parameters.Add(new Parameter("@Lokasi", SqlDbType.VarChar, lookupBankAsal1.Lokasi));
                    dtBK = db.Commands[0].ExecuteDataTable();
                    if (dtBK.Rows.Count > 0)
                    {
                        _BankKotaRowID = new Guid(dtBK.Rows[0]["RowID"].ToString());
                    }
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }

            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (Brow == enumBrow.Header)
            {
                Guid     RowID    = Guid.NewGuid();
                string   RecordID = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                DateTime TglBukti = Convert.ToDateTime(dateDKN.DateValue);
                string   Cabang   = cboCabang.SelectedValue.ToString();
                string   DK       = "";
                if (optDebet.Checked)
                {
                    DK = "D";
                }
                else
                {
                    DK = "K";
                }

                using (Database db = new Database(GlobalVar.DBName))
                {
                    if (Modus == enumModus.Update)
                    {
                        RowID = _HeaderID;
                    }
                    DKN.DKNInsert(db, RowID, RecordID, DK, "MAN", "B", "DKN", TglBukti, Cabang, "", RowID);
                }
                frmCaller.RefreshDkn();
            }
            else
            {
                if (_IsiPin == "")
                {
                    string NoPerkiraan  = txtPerkiraan.NoPerkiraan;
                    string Uraian       = txtUraian.Text;
                    string HRecordID    = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
                    string refRecordID  = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                    Guid   refRowID     = Guid.NewGuid();
                    Double Jumlah       = Convert.ToDouble(numJumlah.Text);
                    string KodeKolektor = txtCollectorID.Text;
                    string Kolektor     = txtCollector.Text;
                    Guid   rowIDdetail;

                    if (Modus == enumModus.New)
                    {
                        rowIDdetail = Guid.NewGuid();
                    }
                    else
                    {
                        rowIDdetail = _DetailID;
                    }

                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        if (Modus == enumModus.Update)
                        {
                            refRowID = _DetailID;
                        }
                        DKN.DKNDetailInsert(db, rowIDdetail, _HeaderID, HRecordID, NoPerkiraan, Uraian, Jumlah, refRowID, refRecordID, KodeKolektor, bankID, _BankTujuanRowID, _BankKotaRowID, _KodeToko);
                    }
                    frmCaller.RefreshDknDetail();
                }
                else
                {
                    UpdateDKN();
                }
            }
            this.Close();
        }
Пример #8
0
        public void Download()
        {
            int       counter  = 0;
            DataTable dtResult = new DataTable();

            dtSdhDownload = dtDKN.Clone();
            DataTable dt     = new DataTable();
            int       result = 0;

            #region Cek IndenInput paycol
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DataTable dta = new DataTable();
                using (Database db = new Database())
                {
                    db.Commands.Add(db.CreateCommand("usp_AppSetting_LIST"));
                    db.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "identifikasi_input"));
                    dta = db.Commands[0].ExecuteDataTable();
                    if (dta.Rows.Count > 0)
                    {
                        IndenInput = Tools.isNull(dta.Rows[0]["value"], "true").ToString();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
            #endregion

            #region GetBankAsal
            ///*Getdata bank asal*/
            //string LokasiBank = lookupBankAsal1.Lokasi;
            //string NamaBankAsal = lookupBankAsal1.NamaBank;
            //try
            //{
            //    DataTable dtb = new DataTable(GlobalVar.DBName);
            //    this.Cursor = Cursors.WaitCursor;
            //    using (Database db = new Database(GlobalVar.DBName))
            //    {
            //        db.Commands.Add(db.CreateCommand("usp_BankKota_LIST"));
            //        db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, NamaBankAsal));
            //        db.Commands[0].Parameters.Add(new Parameter("@Lokasi", SqlDbType.VarChar, LokasiBank));
            //        dtb = db.Commands[0].ExecuteDataTable();
            //        if (dtb.Rows.Count > 0)
            //        {
            //            BankAsalRowID = new Guid(dtb.Rows[0]["RowID"].ToString());
            //        }
            //        else
            //        {
            //            MessageBox.Show("Bank Kota tidak ada.");
            //            return;
            //        }
            //    }
            //}
            //catch (System.Exception ex)
            //{
            //    Error.LogError(ex);
            //}
            //finally
            //{
            //    this.Cursor = Cursors.Default;
            //}
            #endregion

            #region insert dkn
            string    prevIDhead = "";
            Guid      jHeader    = Guid.NewGuid();
            string    jRecID     = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
            DataTable dtHI       = Class.Perkiraan.GetPerkiraanKoneksiDetail("HI11");
            double    sumHI      = 0;
            string    uraian     = "";
            string    InitGudang = GlobalVar.Gudang;

            progressBar1.Maximum = customGridView1.Rows.Count;

            foreach (DataGridViewRow row in customGridView1.Rows)
            {
                string GudangTujuan = Tools.isNull(row.Cells[Cabang.Name].Value, "").ToString();
                if (GudangTujuan.ToString().Trim() == InitGudang.ToString().Trim())
                {
                    string curIDhead = row.Cells[Idhead.Name].Value.ToString();
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();
                        db.Commands.Clear();
                        db.Commands.Add(db.CreateCommand("usp_DKN_Download"));
                        db.Commands[0].Parameters.Clear();
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, new Guid(row.Cells[Hrowid.Name].Value.ToString())));
                        db.Commands[0].Parameters.Add(new Parameter("@RowIDDetail", SqlDbType.UniqueIdentifier, new Guid(row.Cells[Dtrowid.Name].Value.ToString())));
                        db.Commands[0].Parameters.Add(new Parameter("@HRecordID", SqlDbType.VarChar, Tools.isNull(row.Cells[Idhead.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, Tools.isNull(row.Cells[Iddetail.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Tanggal", SqlDbType.DateTime, GlobalVar.DateOfServer));
                        db.Commands[0].Parameters.Add(new Parameter("@NoDKN", SqlDbType.VarChar, Tools.isNull(row.Cells[No_Dkn.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@DK", SqlDbType.VarChar, Tools.isNull(row.Cells[DK.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Cabang", SqlDbType.VarChar, Tools.isNull(row.Cells[Cabang.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@CD", SqlDbType.VarChar, Tools.isNull(row.Cells[Cd.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Src", SqlDbType.VarChar, Tools.isNull(row.Cells[Src.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@RefTipe", SqlDbType.Int, Tools.isNull(row.Cells[Reftipe.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@RefNoBukti", SqlDbType.Char, Tools.isNull(row.Cells[Nobuktipu.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@RefRowID", SqlDbType.UniqueIdentifier, new Guid(row.Cells[Refrowid.Name].Value.ToString())));
                        db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.Char, Tools.isNull(row.Cells[No_perk.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Uraian", SqlDbType.Char, Tools.isNull(row.Cells[Uraian.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Jumlah", SqlDbType.Money, double.Parse(Tools.isNull(row.Cells[Jumlah.Name].Value, "").ToString())));
                        db.Commands[0].Parameters.Add(new Parameter("@Tolak", SqlDbType.Bit, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@Alasan", SqlDbType.Char, Tools.isNull(row.Cells[Alasan.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Dari", SqlDbType.Char, Tools.isNull(row.Cells[Dari.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.Bit, 1));
                        db.Commands[0].Parameters.Add(new Parameter("@Nprint", SqlDbType.Int, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, Tools.isNull(row.Cells[Updateby.Name].Value, "").ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedTime", SqlDbType.Date, DateTime.Parse(Tools.isNull(row.Cells[Updatetime.Name].Value, "").ToString())));
                        db.Commands[0].ExecuteNonQuery();

                        #region jurnal
                        ///*Hapus Data Lama GL dulu*/
                        //if (prevIDhead != curIDhead)
                        //{
                        //    db.Commands.Clear();
                        //    db.Commands.Add(db.CreateCommand("psp_DKN_Download_DeleteJournal"));
                        //    db.Commands[0].Parameters.Clear();
                        //    db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, curIDhead.ToString()));
                        //    db.Commands[0].ExecuteNonQuery();
                        //}

                        //bool tolak = Convert.ToBoolean(row.Cells[Ltolak.Name].Value);
                        //if (!tolak)
                        //{
                        //    string cd = row.Cells[DK.Name].Value.ToString();
                        //    string noDKNPerk = ""; //row.Cells[No_Dkn.Name].Value.ToString().Trim();
                        //    string namaDKNPerk = "";
                        //    if (noDKNPerk != "")
                        //    {
                        //        DataTable dtPerk = Class.Perkiraan.GetPerkiraan(noDKNPerk);
                        //        if (dtPerk.Rows.Count > 0)
                        //        {
                        //            namaDKNPerk = dtPerk.Rows[0]["NamaPerkiraan"].ToString();
                        //        }
                        //    }
                        //    else
                        //    {
                        //        namaDKNPerk = "";
                        //    }

                        //    /*Header*/
                        //    if (prevIDhead != curIDhead)
                        //    {
                        //        /*create data baru*/
                        //        sumHI = 0;
                        //        jHeader = Guid.NewGuid();
                        //        jRecID = row.Cells[Idhead.Name].Value.ToString();
                        //        DateTime tglJournal = Convert.ToDateTime(row.Cells[Tanggal.Name].Value.ToString());
                        //        string noReff = Tools.isNull(row.Cells[No_Dkn.Name].Value, "").ToString();
                        //        uraian = "LINK HUTANG HI " + noReff;
                        //        Class.Journal.AddHeader(db, jHeader, jRecID, tglJournal, noReff, uraian, "DKN", GlobalVar.Gudang, false);
                        //        prevIDhead = curIDhead;
                        //    }

                        //    /*Debet*/
                        //    Guid jdRowID = Guid.NewGuid();
                        //    string jdRecID = row.Cells[Iddetail.Name].Value.ToString();
                        //    string noPerk = noDKNPerk;
                        //    string dk = "";
                        //    string jdUraian1 = Tools.isNull(row.Cells[Uraian.Name].Value, "").ToString();
                        //    double debet = 0;
                        //    double kredit = 0;
                        //    if (cd == "D")
                        //    {
                        //        dk = "D";
                        //        debet = Convert.ToDouble(row.Cells[Jumlah.Name].Value);
                        //        sumHI -= Convert.ToDouble(row.Cells[Jumlah.Name].Value); ;
                        //    }
                        //    else
                        //    {
                        //        dk = "K";
                        //        kredit = Convert.ToDouble(row.Cells[Jumlah.Name].Value);
                        //        sumHI += Convert.ToDouble(row.Cells[Jumlah.Name].Value);
                        //    }
                        //    Class.Journal.AddDetail(db, jdRowID, jHeader, jdRecID, jRecID, noPerk, jdUraian1, debet, kredit, dk);

                        //    /*INSERT LAWAN*/
                        //    Guid jdRowIDL = Guid.NewGuid();
                        //    string jdRecIDL = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                        //    string noPerkL = dtHI.Rows[0]["NoPerkiraan"].ToString();
                        //    string dkL = "";
                        //    string jdUraian1L = Tools.isNull(row.Cells[Uraian.Name].Value, "").ToString();
                        //    double debetL = 0;
                        //    double kreditL = 0;
                        //    if (sumHI > 0)
                        //    {
                        //        dkL = "D";
                        //        debetL = Convert.ToDouble(sumHI);
                        //    }
                        //    else
                        //    {
                        //        dkL = "K";
                        //        kreditL = Math.Abs(sumHI);
                        //    }
                        //    Class.Journal.AddDetail(db, jdRowIDL, jHeader, jdRecIDL, jRecID, noPerkL, jdUraian1L, debetL, kreditL, dkL);
                        //    sumHI = 0;
                        //}
                        db.CommitTransaction();
                        #endregion
                    }
                }

                #region GetBankTujuan
                /*Getdata bank tujuan*/
                NamaBankTujuan = "";
                BankIDTujuan   = "";
                noRekening     = Tools.isNull(row.Cells[Norekeningd.Name].Value, "").ToString();
                try
                {
                    DataTable dtb = new DataTable(GlobalVar.DBName);
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Clear();
                        db.Commands.Add(db.CreateCommand("usp_NoRekeningBank_LIST"));
                        db.Commands[0].Parameters.Add(new Parameter("@NoRekening", SqlDbType.VarChar, noRekening));
                        dtb = db.Commands[0].ExecuteDataTable();
                        if (dtb.Rows.Count > 0)
                        {
                            NamaBankTujuan  = Tools.isNull(dtb.Rows[0]["NamaBank"], "").ToString();
                            BankIDTujuan    = Tools.isNull(dtb.Rows[0]["BankID"], "").ToString();
                            BankTujuanRowID = new Guid(Tools.isNull(dtb.Rows[0]["RowID"], "").ToString());
                        }
                        else
                        {
                            MessageBox.Show("Bank Tujuan tidak ada.");
                            return;
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
                #endregion

                #region link data KN ditutup jika Paycoll jalan
                if (IndenInput == "true")
                {
                    try
                    {
                        frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;
                        Guid     headerRowID     = new Guid(Tools.isNull(row.Cells[Hrowid.Name].Value, Guid.Empty).ToString());
                        Guid     detailRowID     = new Guid(Tools.isNull(row.Cells[Dtrowid.Name].Value, Guid.Empty).ToString());
                        string   noDKN           = Tools.isNull(row.Cells[No_Dkn.Name].Value, "").ToString();
                        string   recordID        = Tools.isNull(row.Cells[Idhead.Name].Value, "").ToString();
                        string   recordIDD       = Tools.isNull(row.Cells[Iddetail.Name].Value, "").ToString();
                        string   updateBy        = Tools.isNull(row.Cells[Updateby.Name].Value, "").ToString();
                        string   noBukti         = Tools.isNull(row.Cells[Nobuktipu.Name].Value, "").ToString();
                        string   noPerkiraan     = Tools.isNull(row.Cells[No_perk.Name].Value, "").ToString();
                        string   namaBankAsal    = Tools.isNull(row.Cells[Bankasal.Name].Value, "").ToString();
                        string   lokasiBankAsal  = Tools.isNull(row.Cells[Lokasi.Name].Value, "").ToString();
                        double   RpTrf           = double.Parse(Tools.isNull(row.Cells[Jumlah.Name].Value, "0").ToString());
                        DateTime LastUpdatedTime = DateTime.Parse(Tools.isNull(row.Cells[Updatetime.Name].Value, DateTime.Now).ToString());

                        this.Cursor = Cursors.WaitCursor;
                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            db.Commands.Add(db.CreateCommand("psp_DKN_LINK"));
                            db.Commands[0].Parameters.Add(new Parameter("@NomorKN", SqlDbType.VarChar, noDKN));
                            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, headerRowID));
                            db.Commands[0].Parameters.Add(new Parameter("@detailRowID", SqlDbType.UniqueIdentifier, detailRowID));
                            db.Commands[0].Parameters.Add(new Parameter("@RecID", SqlDbType.VarChar, recordID));
                            db.Commands[0].Parameters.Add(new Parameter("@RecIDDetail", SqlDbType.VarChar, recordIDD));
                            db.Commands[0].Parameters.Add(new Parameter("@TglKasir", SqlDbType.DateTime, GlobalVar.DateOfServer));
                            db.Commands[0].Parameters.Add(new Parameter("@Kasir", SqlDbType.VarChar, updateBy));
                            db.Commands[0].Parameters.Add(new Parameter("@NoBukti", SqlDbType.VarChar, noBukti));
                            db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, noPerkiraan));
                            db.Commands[0].Parameters.Add(new Parameter("@Acc", SqlDbType.VarChar, noDKN));
                            db.Commands[0].Parameters.Add(new Parameter("@NamaBankAsal", SqlDbType.VarChar, namaBankAsal));
                            db.Commands[0].Parameters.Add(new Parameter("@Lokasi", SqlDbType.VarChar, lokasiBankAsal));
                            db.Commands[0].Parameters.Add(new Parameter("@BankAsalRowID", SqlDbType.UniqueIdentifier, BankAsalRowID));
                            db.Commands[0].Parameters.Add(new Parameter("@NoRekenig", SqlDbType.VarChar, noRekening));
                            db.Commands[0].Parameters.Add(new Parameter("@NamaBankTujuan", SqlDbType.VarChar, NamaBankTujuan));
                            db.Commands[0].Parameters.Add(new Parameter("@BankIDTujuan", SqlDbType.VarChar, BankIDTujuan));
                            db.Commands[0].Parameters.Add(new Parameter("@BankTujuanRowID", SqlDbType.UniqueIdentifier, BankTujuanRowID));
                            db.Commands[0].Parameters.Add(new Parameter("@RpTrf", SqlDbType.Money, RpTrf));
                            db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.Bit, 0));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, updateBy));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedTime", SqlDbType.DateTime, LastUpdatedTime));
                            db.Commands[0].ExecuteNonQuery();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        Error.LogError(ex);
                    }
                    finally
                    {
                        this.Cursor = Cursors.Default;
                    }
                    /*endlink.........*/
                }
                #endregion
            }

            /*Perkiraan HI Last Check*/
            if (sumHI != 0)
            {
                using (Database db = new Database(GlobalVar.DBName))
                {
                    Guid   jdRowID   = Guid.NewGuid();
                    string jdRecID   = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                    string noPerk    = dtHI.Rows[0]["NoPerkiraan"].ToString();
                    string dk        = "";
                    string jdUraian1 = uraian;//dtHI.Rows[0]["Uraian"].ToString();
                    double debet     = 0;
                    double kredit    = 0;
                    if (sumHI > 0)
                    {
                        dk    = "D";
                        debet = sumHI;
                    }
                    else
                    {
                        dk     = "K";
                        kredit = Math.Abs(sumHI);
                    }
                    Class.Journal.AddDetail(db, jdRowID, jHeader, jdRecID, jRecID, noPerk, jdUraian1, debet, kredit, dk);
                    sumHI = 0;
                }
            }
            MessageBox.Show(Messages.Confirm.ProcessFinished);
            #endregion
        }