Exemple #1
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);
                }
            }
        }
Exemple #2
0
        private void addIndenDetail(
            Database db
            )
        {
            DataTable dtCekRelasi = new DataTable();

            db.Commands.Clear();


            db.Commands.Add(db.CreateCommand("usp_IndenDetail_INSERT"));
            db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, RowID));
            db.Commands[0].Parameters.Add(new Parameter("@HeaderID", SqlDbType.UniqueIdentifier, HeaderID));
            db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, RecordID));
            db.Commands[0].Parameters.Add(new Parameter("@HRecordID", SqlDbType.VarChar, HRecordID));
            db.Commands[0].Parameters.Add(new Parameter("@TglTrf", SqlDbType.DateTime, tglRK));
            db.Commands[0].Parameters.Add(new Parameter("@BankID", SqlDbType.VarChar, bankID));
            db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, NamaBank));
            db.Commands[0].Parameters.Add(new Parameter("@Lokasi", SqlDbType.VarChar, Lokasi));
            db.Commands[0].Parameters.Add(new Parameter("@CHBG", SqlDbType.VarChar, cara));
            db.Commands[0].Parameters.Add(new Parameter("@Nomor", SqlDbType.VarChar, noBGC));
            db.Commands[0].Parameters.Add(new Parameter("@TglGiro", SqlDbType.DateTime, tglGiro));
            db.Commands[0].Parameters.Add(new Parameter("@TglJt", SqlDbType.DateTime, tglJTempo));
            db.Commands[0].Parameters.Add(new Parameter("@Ket", SqlDbType.VarChar, ket));
            db.Commands[0].Parameters.Add(new Parameter("@NoAcc", SqlDbType.VarChar, noAcc));
            db.Commands[0].Parameters.Add(new Parameter("@RpCash", SqlDbType.Money, RpCash));
            db.Commands[0].Parameters.Add(new Parameter("@RpGiro", SqlDbType.Money, RpGiro));
            db.Commands[0].Parameters.Add(new Parameter("@RpTrf", SqlDbType.Money, RpTrn));
            db.Commands[0].Parameters.Add(new Parameter("@RpCrd", SqlDbType.Money, RpCrd));
            db.Commands[0].Parameters.Add(new Parameter("@RpDbt", SqlDbType.Money, RpDbt));
            db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
            if (RowIDOrderPenjualan != Guid.Empty)
            {
                db.Commands[0].Parameters.Add(new Parameter("@RowIDOrderPenjualan", SqlDbType.UniqueIdentifier, RowIDOrderPenjualan));
            }

            db.Commands[0].ExecuteNonQuery();


            if (cara == "")
            {
                string _noPerk;
                _noPerk     = Perkiraan.GetPerkiraanKoneksiDetail("IND").Rows[0]["NoPerkiraan"].ToString();
                dtCekRelasi = Inden.CekRelasiInden("Bukti", "SrcID", HeaderID.ToString(), "", "").Copy();
                Guid _RowID = new Guid();
                if (dtCekRelasi.Rows.Count == 0)
                {
                    _RowID = HeaderID;
                    string noBKM = Numerator.BookNumerator("BKM");
                    BKM.AddHeader(db, _RowID, HeaderID, BKM.GetRecordIDBukti(HRecordID, "IND"), noBKM, "K", "IND", tglInden, namaCollector, "", noAcc, SecurityManager.UserName, "");
                }
                else
                {
                    _RowID = (Guid)dtCekRelasi.Rows[0][0];
                }
                BKM.AddDetail(db, RowID, _RowID, RecordID, BKM.GetRecordIDBukti(HRecordID, "IND"), "", "", "", noAcc, _noPerk, "PENERIMAAN BELUM IDENTIFIKASI (" + noBukti + ")", RpCash);
            }
            else if (cara == "T")
            {
                string recordIDTB = HRecordID + "I";
                string noBBK      = "";
                string _noPerk    = Perkiraan.GetPerkiraanKoneksiDetail("IND").Rows[0]["NoPerkiraan"].ToString();
                Guid   _RowID     = new Guid();



                dtCekRelasi = Inden.CekRelasiInden("TransferBank", "SrcID", HeaderID.ToString(), "", "").Copy();

                if (dtCekRelasi.Rows.Count == 0)
                {
                    _RowID = HeaderID;
                    noBBK  = Numerator.BookNumerator("BBM");
                    TransferBank.addHeader(db, _RowID, HeaderID, recordIDTB, tglInden, noBBK, "M", "", "IND. No " + noBukti, "", "", SecurityManager.UserName, "");
                }
                else
                {
                    _RowID = (Guid)dtCekRelasi.Rows[0][0];
                    noBBK  = dtCekRelasi.Rows[0][1].ToString();
                }
                TransferBank.addDetail(db, RowID, _RowID, RecordID, recordIDTB, collectorID, namaCollector, NamaBank, Lokasi, noAcc, (DateTime)tglRK, RpTrn, "", "", "", "", bankID, _noPerk, "");
                Bank.AddBankDetail(db, RowID, Guid.Empty, noBBK, noAcc, rowIDBankTujuan, "", tglInden, "BBM", "TRANSFER DARI : " + namaCollector + " (BANK TRANSFER)", "IDR", RpTrn, "0", DateTime.Today, (DateTime)tglRK, "", "", "", "", _noPerk, bankID, RecordID);
            }
            else if (cara == "G" || cara == "C" || cara == "S")
            {
                string recordIDVJ = "";
                Guid   _VJRowID   = new Guid();


                string noVoucher = Numerator.BookNumerator("VPG");
                string _noPerk   = Perkiraan.GetPerkiraanKoneksiDetail("IND").Rows[0]["NoPerkiraan"].ToString();
                dtCekRelasi = new DataTable();
                dtCekRelasi = Inden.CekRelasiInden("VoucherJournal", "RefRowID", HeaderID.ToString(), "PG", "").Copy();


                if (dtCekRelasi.Rows.Count == 0)
                {
                    recordIDVJ = HRecordID + "I";
                    _VJRowID   = Guid.NewGuid();

                    VoucherJournal.AddHeader(db, _VJRowID, HeaderID, recordIDVJ, "PG", tglInden, noVoucher,
                                             "PENERIMAAN GIRO IND. NO " + noBukti, "", "", "", "", "", "", "", 0, true);
                }
                else
                {
                    recordIDVJ = dtCekRelasi.Rows[0][1].ToString();
                    _VJRowID   = (Guid)dtCekRelasi.Rows[0][0];
                }
                //VoucherJournal.AddDetail(db, RowID, _VJRowID, RecordID, recordIDVJ, "", "", "", noBGC, _noPerk, namaCollector,
                //    Convert.ToDouble(RpGiro), 0, true);

                Giro.Add(db, RowID, _VJRowID, Guid.Empty, Guid.Empty, recordIDVJ, "", "", RecordID, "", NamaBank, Lokasi,
                         cara, noBGC, (DateTime)tglGiro, (DateTime)tglJTempo, Convert.ToDouble(RpGiro), "", SqlDateTime.Null,
                         "", "", "", "", "", "", _noPerk, SqlDateTime.Null, true, noAcc, "");
            }
            else if (cara == "R")
            {
                string recordIDVPG = "", noVoucherPG = "", noVoucherTT = "";
                string recordIDVTT = "";

                Guid _VJRowIDPG = new Guid();
                Guid _VJRowIDTT = new Guid();



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

                //VOUCHER PENERIMAAN CRD
                dtCekRelasi = Inden.CekRelasiInden("VoucherJournal", "RefRowID", HeaderID.ToString(), "CRD", "").Copy();


                if (dtCekRelasi.Rows.Count == 0)
                {
                    recordIDVPG = HRecordID + "R";
                    _VJRowIDPG  = Guid.NewGuid();
                    noVoucherPG = Numerator.BookNumerator("VPG");
                    VoucherJournal.AddHeader(db, _VJRowIDPG, HeaderID, recordIDVPG, "CC", tglInden, noVoucherPG,
                                             "PENERIMAAN CREDIT CARD IND. NO " + noBukti, "", "", "", "", "", "", "", 0, true);
                }
                else
                {
                    recordIDVPG = dtCekRelasi.Rows[0][1].ToString();
                    _VJRowIDPG  = (Guid)dtCekRelasi.Rows[0][0];
                }
                //VoucherJournal.AddDetail(db, RowID, _VJRowID, RecordID, recordIDVJ, "", "", "", noBGC, _noPerk, namaCollector,
                //    Convert.ToDouble(RpGiro), 0, true);



                //VOUCHER TITIP CRD
                dtCekRelasi = new DataTable();

                dtCekRelasi = Inden.CekRelasiInden("VoucherJournal", "RefRowID", HeaderID.ToString(), "TT", bankID).Copy();


                if (dtCekRelasi.Rows.Count == 0)
                {
                    recordIDVTT = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial).TrimEnd() + "R";
                    _VJRowIDTT  = Guid.NewGuid();
                    noVoucherTT = Numerator.BookNumerator("VTG");

                    VoucherJournal.AddHeader(db, _VJRowIDTT, HeaderID, recordIDVTT, "TT", tglInden, noVoucherTT,
                                             "OTOMATIS TITIP DR CRD", "", "", "", "", "", bankID, namaBanki, 0, true);
                }
                else
                {
                    recordIDVTT = dtCekRelasi.Rows[0][1].ToString();
                    _VJRowIDTT  = (Guid)dtCekRelasi.Rows[0][0];
                }

                //INSERT TABLE GIRO
                Giro.Add(db, RowID, _VJRowIDPG, Guid.Empty, _VJRowIDTT, recordIDVPG, "", recordIDVTT, RecordID, "", NamaBank, Lokasi,
                         cara, noBGC, (DateTime)tglGiro, (DateTime)tglJTempo, Convert.ToDouble(RpCrd), "", (DateTime)SqlDateTime.Null,
                         "", "", "", "", bankID, namaBanki, _noPerk, tglInden, true, noAcc, "");
            }
            else if (cara == "D")
            {
                string recordIDVPG = "", noVoucherPG = "", noVoucherTT = "";
                string recordIDVTT = "";

                Guid _VJRowIDPG = new Guid();
                Guid _VJRowIDTT = new Guid();



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

                //VOUCHER PENERIMAAN CRD
                dtCekRelasi = Inden.CekRelasiInden("VoucherJournal", "RefRowID", HeaderID.ToString(), "DBT", "").Copy();


                if (dtCekRelasi.Rows.Count == 0)
                {
                    recordIDVPG = HRecordID + "D";
                    _VJRowIDPG  = Guid.NewGuid();
                    noVoucherPG = Numerator.BookNumerator("VPG");
                    VoucherJournal.AddHeader(db, _VJRowIDPG, HeaderID, recordIDVPG, "DB", tglInden, noVoucherPG,
                                             "PENERIMAAN DEBIT CARD IND. NO " + noBukti, "", "", "", "", "", "", "", 0, true);
                }
                else
                {
                    recordIDVPG = dtCekRelasi.Rows[0][1].ToString();
                    _VJRowIDPG  = (Guid)dtCekRelasi.Rows[0][0];
                }
                //VoucherJournal.AddDetail(db, RowID, _VJRowID, RecordID, recordIDVJ, "", "", "", noBGC, _noPerk, namaCollector,
                //    Convert.ToDouble(RpGiro), 0, true);



                //VOUCHER TITIP CRD
                dtCekRelasi = new DataTable();

                dtCekRelasi = Inden.CekRelasiInden("VoucherJournal", "RefRowID", HeaderID.ToString(), "TT", bankID).Copy();


                if (dtCekRelasi.Rows.Count == 0)
                {
                    recordIDVTT = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial).TrimEnd() + "D";
                    _VJRowIDTT  = Guid.NewGuid();
                    noVoucherTT = Numerator.BookNumerator("VTG");

                    VoucherJournal.AddHeader(db, _VJRowIDTT, HeaderID, recordIDVTT, "TT", tglInden, noVoucherTT,
                                             "OTOMATIS TITIP DR DBT", "", "", "", "", "", bankID, namaBanki, 0, true);
                }
                else
                {
                    recordIDVTT = dtCekRelasi.Rows[0][1].ToString();
                    _VJRowIDTT  = (Guid)dtCekRelasi.Rows[0][0];
                }

                //INSERT TABLE GIRO
                Giro.Add(db, RowID, _VJRowIDPG, Guid.Empty, _VJRowIDTT, recordIDVPG, "", recordIDVTT, RecordID, "", NamaBank, Lokasi,
                         cara, noBGC, (DateTime)tglGiro, (DateTime)tglJTempo, Convert.ToDouble(RpDbt), "", (DateTime)SqlDateTime.Null,
                         "", "", "", "", bankID, namaBanki, _noPerk, tglInden, true, noAcc, "");
            }
        }
Exemple #3
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (lookupBank1.BankID == "" || lookupBank1.BankID == "[CODE]")
                {
                    MessageBox.Show(Messages.Error.InputRequired);
                    lookupBank1.Focus();
                    return;
                }
                if (formMode == enumFormMode.New)
                {
                    DateTime _Tanggal = tbTanggal.DateValue.Value;
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                    RowID = Guid.NewGuid();
                    string RecordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        VoucherJournal.AddHeader(db, RowID, Guid.Empty, RecordID, "TT", (DateTime)tbTanggal.DateValue, Numerator.BookNumerator("VTG"), tbUraian1.Text, tbUraian2.Text, tbUraian3.Text, tbDibuat.Text, tbDibukukan.Text, tbMengetahui.Text, lookupBank1.BankID, lookupBank1.NamaBank, 0, true);
                    }
                }
                else
                {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("usp_VoucherJournal_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@BankID", SqlDbType.VarChar, lookupBank1.BankID));
                        db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, lookupBank1.NamaBank));
                        db.Commands[0].Parameters.Add(new Parameter("@Uraian1", SqlDbType.VarChar, tbUraian1.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Uraian2", SqlDbType.VarChar, tbUraian2.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Uraian3", SqlDbType.VarChar, tbUraian3.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Dibukukan", SqlDbType.VarChar, tbDibukukan.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@Mengetahui", SqlDbType.VarChar, tbMengetahui.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));

                        db.Commands.Add(db.CreateCommand("usp_GIRO_Titip_UPDATE"));
                        db.Commands[1].Parameters.Add(new Parameter("@TitipID", SqlDbType.UniqueIdentifier, RowID));
                        db.Commands[1].Parameters.Add(new Parameter("@BankID", SqlDbType.VarChar, lookupBank1.BankID));
                        db.Commands[1].Parameters.Add(new Parameter("@NamaBanki", SqlDbType.VarChar, lookupBank1.NamaBank));
                        db.Commands[1].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));

                        db.BeginTransaction();
                        db.Commands[0].ExecuteNonQuery();
                        db.Commands[1].ExecuteNonQuery();
                        db.CommitTransaction();
                    }
                }

                frmVoucherGiroTitipanBrowse frm = new frmVoucherGiroTitipanBrowse();
                frm = (frmVoucherGiroTitipanBrowse)Caller;
                frm.HeaderRowRefresh(RowID);
                frm.HeaderFindRow("hdrRowID", RowID.ToString());
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }