コード例 #1
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();
            }
        }
コード例 #2
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();
        }
コード例 #3
0
        private void cmdSAVE_Click(object sender, EventArgs e)
        {
            frmHiRegisterBrowse frmCaller = (frmHiRegisterBrowse)this.Caller;

            if (Brow == enumBrow.Header)
            {
                Guid     RowID    = Guid.NewGuid();
                string   RecordID = GlobalVar.PerusahaanID + DateTime.Today.ToString();
                DateTime TglBukti = Convert.ToDateTime(dateDKN.DateValue);
                string   Cabang   = cboCabang.SelectedValue.ToString();
                using (Database db = new Database(GlobalVar.DBName))
                {
                    if (Modus == enumModus.Update)
                    {
                        RowID = _HeaderID;
                    }
                    DKN.HIInsert(db, RowID, RecordID, "D", "MAN", "B", "DKN", TglBukti, Cabang, "", RowID);
                }
                frmCaller.RefreshDkn();
            }
            else
            {
                string NoPerkiraan = txtPerkiraan.NoPerkiraan;
                string Uraian      = txtUraian.Text;
                string HRecordID   = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
                string refRecordID = GlobalVar.PerusahaanID + DateTime.Today.ToString();
                Guid   refRowID    = Guid.NewGuid();
                Double Jumlah      = Convert.ToDouble(numJumlah.Text);
                using (Database db = new Database(GlobalVar.DBName))
                {
                    if (Modus == enumModus.Update)
                    {
                        refRowID = _DetailID;
                    }

                    DKN.HIDetailInsert(db, _HeaderID, HRecordID, NoPerkiraan, Uraian, Jumlah, refRowID, refRecordID);
                }
                frmCaller.RefreshDknDetail();
            }
            this.Close();
        }
コード例 #4
0
        private void cmdHI_Click(object sender, EventArgs e)
        {
            string noPerkiraan = gridDetail.SelectedCells[0].OwningRow.Cells["dtlNoPerkiraan"].Value.ToString();
            Guid   _rowIDH     = (Guid)gridHeader.SelectedCells[0].OwningRow.Cells["hdrRowID"].Value;
            string tipe        = gridHeader.SelectedCells[0].OwningRow.Cells["hdrTipe"].Value.ToString();
            Guid   _rowIDD     = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["dtlRowID"].Value;
            Double jumlah      = Convert.ToDouble(gridDetail.SelectedCells[0].OwningRow.Cells["dtlDebet"].Value.ToString());
            Double jumlahLink  = 0;
            Double jumlahSisa  = 0;
            string _recordIDH  = gridHeader.SelectedCells[0].OwningRow.Cells["hdrRecordID"].Value.ToString();
            string _recordIDD  = gridDetail.SelectedCells[0].OwningRow.Cells["dtlRecordID"].Value.ToString();
            string namaSP      = "usp_VoucherJournalDetail_Update";
            string _noPerk;

            if (tipe.Trim() != "UM")
            {
                return;
            }

            try
            {
                //CEK PERNAH LINK?
                string _kode = gridDetail.SelectedCells[0].OwningRow.Cells["dtlLKode"].Value.ToString().Trim();
                if (_kode != "") //PERNAH LINK
                {
                    //AMBIL DATA LINK, CEK JUMLAH YG PERNAH D LINK
                    DataTable dtCek = new DataTable();
                    dtCek      = DKN.CekLinkDKNDetail(_rowIDD);
                    jumlahLink = Convert.ToDouble(dtCek.Compute("Sum(Jumlah)", ""));
                    // JIKA JUMLAH SUDAH FULL, UNLINK?
                    if (jumlahLink >= jumlah)
                    {
                        if (MessageBox.Show("Sudah di Link Full. \nHapus Link?", "Hapus Link DKN", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            //UNLINK DKN
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.BeginTransaction();
                                DKN.UnlinkDKN(db, _rowIDD);
                                DKN.UpdateKodeLink(db, _rowIDD, "", namaSP, "?");
                                db.CommitTransaction();
                            }
                            MessageBox.Show("Unlink DKN Berhasil.");
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                }

                _noPerk = Perkiraan.GetPerkiraanKoneksiDetail("HI11").Rows[0]["NoPerkiraan"].ToString();

                if (noPerkiraan != _noPerk)
                {
                    if (MessageBox.Show("No Perkiraan Bukan No Perkiraan HI.\nUbah No Perkiraan Menjadi No Perkiraan HI?\n" + _noPerk, "", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            db.Commands.Add(db.CreateCommand("usp_VoucherJournalDetail_Update"));
                            db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, _noPerk));
                            db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowIDD));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].ExecuteNonQuery();
                        }

                        RefreshDetail();
                        FindRowDetail("dtlRowID", _rowIDD.ToString());
                        noPerkiraan = _noPerk;
                    }
                    else
                    {
                        return;
                    }
                }

                DateTime tglBukti = (DateTime)gridHeader.SelectedCells[0].OwningRow.Cells["hdrTglVoucher"].Value;
                string   noBukti  = gridHeader.SelectedCells[0].OwningRow.Cells["hdrNoVoucher"].Value.ToString();
                string   uraian   = gridDetail.SelectedCells[0].OwningRow.Cells["dtlKeterangan"].Value.ToString();
                jumlahSisa = jumlah - jumlahLink;
                frmBuktiHILink frm = new frmBuktiHILink(this, "D", "VJU", "E", "IND", tglBukti, noBukti, _rowIDH, noPerkiraan, uraian, jumlahSisa, _rowIDD, "usp_VoucherJournalDetail_Update", _recordIDH, _recordIDD);
                frm.ShowDialog();
            }
            catch (SqlException ex)
            {
                Error.LogError(ex);
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
コード例 #5
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (CabangDKN.Text == "")
            {
                MessageBox.Show("Cabang belum diisi.");
                CabangDKN.Focus();
                return;
            }

            if (tbRpIdentifikasi.GetDoubleValue == 0)
            {
                MessageBox.Show("Rp Identifikasi Tidak Boleh 0.");
                tbRpIdentifikasi.Focus();
                return;
            }

            if (tbRpIdentifikasi.GetDoubleValue > jumlah)
            {
                MessageBox.Show("Rp Identifikasi Tidak Boleh lebih dari " + jumlah.ToString("#,###"));
                tbRpIdentifikasi.Focus();
                return;
            }

            cabang = CabangDKN.Text;
            double rpIdentifikasi = tbRpIdentifikasi.GetDoubleValue;

            DataTable dtCek = new DataTable();

            dtCek = DKN.CekLinkDKN(refRowIDHeader, cabang);


            Guid   _rowID    = new Guid();
            String _recordID = "";

            using (Database db = new Database(GlobalVar.DBFinance))
            {
                db.BeginTransaction();
                if (dtCek.Rows.Count == 0)
                {
                    _rowID    = Guid.NewGuid();
                    _recordID = refRecordIDHeader.Trim() + cabang.Substring(0, 2);
                    DKN.DKNInsert(db, _rowID, _recordID, DK, refTipe, CD, src, DateTime.Today, cabang, refNoBukti, refRowIDHeader);
                }
                else
                {
                    DataTable dtCekDet = new DataTable();
                    dtCekDet = dtCek.Copy();
                    dtCekDet.DefaultView.RowFilter = "RefRowID='" + refRowIDDetail.ToString() + "'";
                    if (dtCekDet.DefaultView.Count > 0)
                    {
                        MessageBox.Show("Sudah Pernah Link ke Cabang " + cabang + ".");
                        return;
                    }
                    _rowID    = (Guid)dtCek.Rows[0][0];
                    _recordID = dtCek.Rows[0][1].ToString();
                }
                DKN.DKNDetailInsert(db, _rowID, _recordID, noPerkiraan, uraian, rpIdentifikasi, refRowIDDetail, refRecordIDDetail.Trim() + cabang.Substring(0, 2));

                DKN.UpdateKodeLink(db, refRowIDDetail, "#", namaSP, "");
                db.CommitTransaction();
            }
            this.Close();
        }
コード例 #6
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();
        }
コード例 #7
0
        private void cmdHI_Click(object sender, EventArgs e)
        {
            try
            {
                string noPerkiraan = dgDetailBKK.SelectedCells[0].OwningRow.Cells["noPerkiraan"].Value.ToString();
                Guid   _rowIDH     = (Guid)dgHeaderBKK.SelectedCells[0].OwningRow.Cells["rowID"].Value;
                Guid   _rowIDD     = (Guid)dgDetailBKK.SelectedCells[0].OwningRow.Cells["rowIDD"].Value;
                string _recordIDH  = dgHeaderBKK.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
                string _recordIDD  = dgDetailBKK.SelectedCells[0].OwningRow.Cells["RecordIDD"].Value.ToString();
                Double jumlah      = Convert.ToDouble(dgDetailBKK.SelectedCells[0].OwningRow.Cells["Jumlah"].Value);
                Double jumlahLink  = 0;
                Double jumlahSisa  = 0;
                string namaSP      = "usp_BuktiDetail_Update";

                //CEK PERNAH LINK?
                string _kode = dgDetailBKK.SelectedCells[0].OwningRow.Cells["Kode"].Value.ToString().Trim();
                if (_kode != "") //PERNAH LINK
                {
                    //AMBIL DATA LINK, CEK JUMLAH YG PERNAH D LINK
                    DataTable dtCek = new DataTable();
                    dtCek      = DKN.CekLinkDKNDetail(_rowIDD);
                    jumlahLink = Convert.ToDouble(dtCek.Compute("Sum(Jumlah)", ""));
                    // JIKA JUMLAH SUDAH FULL, UNLINK?
                    DialogResult dr = MessageBox.Show("Sudah di Link. \nBatalkan Link?", "Hapus Link DKN", MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.Yes)
                    {
                        //UNLINK DKN
                        using (Database db = new Database(GlobalVar.DBFinance))
                        {
                            db.BeginTransaction();
                            DKN.UnlinkDKN(db, _rowIDD);
                            DKN.UpdateKodeLink(db, _rowIDD, "", namaSP, "?");
                            db.CommitTransaction();
                        }
                        MessageBox.Show("Unlink DKN Berhasil.");
                        DetailRowRefresh(_rowIDD);
                        return;
                    }
                    else if (dr == DialogResult.No)
                    {
                        if (jumlahLink >= jumlah)
                        {
                            MessageBox.Show("Sudah Link Full. \nTidak bisa tambah link.");
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                string _noPerk;
                _noPerk = Perkiraan.GetPerkiraanKoneksiDetail("HI11").Rows[0]["NoPerkiraan"].ToString();
                if (noPerkiraan != _noPerk)
                {
                    if (MessageBox.Show("No Perkiraan Bukan No Perkiraan HI.\nUbah No Perkiraan Menjadi No Perkiraan HI?\n" + _noPerk, "", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        using (Database db = new Database(GlobalVar.DBFinance))
                        {
                            db.Commands.Add(db.CreateCommand("usp_BuktiDetail_Update"));
                            db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, _noPerk));
                            db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowIDD));
                            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                            db.Commands[0].ExecuteNonQuery();
                        }

                        DetailRowRefresh(_rowIDD);
                        noPerkiraan = _noPerk;
                    }
                    else
                    {
                        return;
                    }
                }

                DateTime tglBukti = (DateTime)dgHeaderBKK.SelectedCells[0].OwningRow.Cells["tglBukti"].Value;
                string   noBukti  = dgHeaderBKK.SelectedCells[0].OwningRow.Cells["noBukti"].Value.ToString();
                string   uraian   = dgDetailBKK.SelectedCells[0].OwningRow.Cells["Uraian"].Value.ToString();
                jumlahSisa = jumlah - jumlahLink;
                frmBuktiHILink frm = new frmBuktiHILink(this, "D", "BKK", "E", "IND", tglBukti, noBukti, _rowIDH, noPerkiraan, uraian, jumlahSisa, _rowIDD, namaSP, _recordIDH, _recordIDD);
                frm.ShowDialog();

                DetailRowRefresh(_rowIDD);
            }
            catch (SqlException ex)
            {
                Error.LogError(ex);
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }