private void tbTglCair_Leave(object sender, EventArgs e) { //cair slip try { string _noGiro = gridDetail.SelectedCells[0].OwningRow.Cells["Nomor"].Value.ToString(); if (MessageBox.Show("Proses Cair Slip " + _noGiro + " ??", "", MessageBoxButtons.OKCancel) == DialogResult.OK) { DataTable dtCekBukti = new DataTable(); dtCekBukti = Inden.CekRelasiInden("Bukti", "RowID", _titipID.ToString(), "", ""); string RecordIDBKM = _titipRecID.Substring(0, 22) + "S"; Guid _GiroID = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["GiroID"].Value; string _GiroRecID = gridDetail.SelectedCells[0].OwningRow.Cells["GiroRecID"].Value.ToString(); string noPerk = Perkiraan.GetPerkiraanKoneksiDetail("BGTRM").Rows[0]["NoPerkiraan"].ToString(); string uraian = "SLIP #" + _noGiro + " (" + _noVoucher + ")"; string jumlah = gridDetail.SelectedCells[0].OwningRow.Cells["Nominal"].Value.ToString(); tglCair = (DateTime)tbTglCair.DateValue; using (Database db = new Database(GlobalVar.DBName)) { db.BeginTransaction(); if (dtCekBukti.Rows.Count == 0) { noBKM = Numerator.BookNumerator("BKM"); asalGiro = gridDetail.SelectedCells[0].OwningRow.Cells["_asalgiro"].Value.ToString(); BKM.AddHeader(db, _titipID, _titipID, RecordIDBKM, noBKM, "K", "SLP", tglCair, asalGiro, "", "", SecurityManager.UserName, ""); } else { dtBKMHeader = new DataTable(); dtBKMHeader = BKM.ListHeaderperRow(_titipID); asalGiro = dtBKMHeader.Rows[0]["Kepada"].ToString(); noBKM = dtBKMHeader.Rows[0]["NoBukti"].ToString(); tglCair = (DateTime)dtBKMHeader.Rows[0]["TglBukti"]; } BKM.AddDetail(db, _GiroID, _titipID, _GiroRecID, RecordIDBKM, "", "", "", "", noPerk, uraian, jumlah); db.CommitTransaction(); dtBKMDetail = new DataTable(); dtBKMDetail = BKM.ListDetail(db, _titipID); } titipGiro(); } else { jnsSlip = ""; cmdTitip.Enabled = true; gbTglCair.Enabled = false; gbSlip.Visible = false; gbLookup.Enabled = true; return; } } catch (Exception ex) { Error.LogError(ex); } }
private void Link2BKM() { string _noPerk = Perkiraan.GetPerkiraanKoneksiDetail("IND").Rows[0]["NoPerkiraan"].ToString(); string noBKM = Numerator.BookNumerator("BKM"); String HRecordID = BKM.GetRecordIDBukti(_RecordIDInden, "IND"); using (Database db = new Database(GlobalVar.DBName)) //BKM.AddHeader(db, _RowIDInden, _RowIDInden, BKM.GetRecordIDBukti(_RecordIDInden, "IND"), noBKM, "K", "IND", GlobalVar.DateOfServer, _NamaCollector, "", "", SecurityManager.UserName, ""); BKM.AddHeader(db, _RowIDInden, _RowIDInden, HRecordID, noBKM, "K", "IND", GlobalVar.DateOfServer, _NamaCollector, "", "", SecurityManager.UserName, ""); //BKM.AddHeader(db, _RowIDInden, _RowIDInden, HRecordID, noBKM, "K", "IND", _TglTerima, _NamaCollector, "", "", SecurityManager.UserName, ""); using (Database db = new Database(GlobalVar.DBName)) // BKM.AddDetail(db, _RowIDIndenDetail, _RowIDInden, _RecordIDInden, BKM.GetRecordIDBukti(_RecordIDIndenDetail, "IND"), "", "", "", "", _noPerk, "PENERIMAAN BELUM IDENTIFIKASI (" + _NoBukti + ")", _Nominal); BKM.AddDetail(db, _RowIDIndenDetail, _RowIDInden, _RecordIDInden, HRecordID, "", "", "", "", _noPerk, "PENERIMAAN BELUM IDENTIFIKASI (" + _NoBukti + ")", _Nominal); }
private void cmdSave_Click(object sender, EventArgs e) { if (tbUraian.NoPerkiraan == "" || tbUraian.NoPerkiraan == "?") { MessageBox.Show("No Perkiraan masih kosong."); return; } totalPiutang = tbJumlah.GetDoubleValue + tbTotal.GetDoubleValue; if ((tbUraian.NamaPerkiraan != "") && (tbJumlah.Text != "")) { try { if (detailMode == enumDetailMode.New) { _recordIDDetail = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial); _rowIDDetail = Guid.NewGuid(); using (Database db = new Database(GlobalVar.DBName)) { if (_isFromPiutang == false) { //BKM.AddDetail(db, _rowIDDetail, _rowID, _recordIDDetail, _recordID, "", "", "", "", tbUraian.NoPerkiraan, tbUraian.NamaPerkiraan, tbJumlah.Text); BKM.AddDetail(db, _rowIDDetail, _rowID, _recordIDDetail, _recordID, "", "", "", "", tbUraian.NoPerkiraan, txtUraian.Text, tbJumlah.Text); frmBKMBrowse frm = new frmBKMBrowse(); frm = (frmBKMBrowse)this.Caller; frm.HeaderRowRefresh(_rowID); frm.DetailRowRefresh(_rowIDDetail); frm.FindRowDetail("RowIDD", _rowIDDetail.ToString()); } else { //BKM.AddDetail(db, _rowIDDetail, _rowID, _recordIDDetail, _recordID, "", "", "", "", tbUraian.NoPerkiraan, tbUraian.NamaPerkiraan, tbJumlah.Text); BKM.AddDetail(db, _rowIDDetail, _rowID, _recordIDDetail, _recordID, "", "", "", "", tbUraian.NoPerkiraan, txtUraian.Text, tbJumlah.Text); //BKM.UpdatePinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKM", _noBukti, tbUraian.NamaPerkiraan, string.Empty, _jp); BKM.UpdatePinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKM", _noBukti, txtUraian.Text, string.Empty, _jp); 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()); } tbUraian.NamaPerkiraan = ""; tbUraian.NoPerkiraan = "?"; tbJumlah.Text = "0"; DetailRowRefresh(_rowIDDetail); refreshTerbilang(); gbBKMUpdate.Enabled = true; gbUpdateDetailBKM.Visible = false; dgDetailBKM.Focus(); } } else if (detailMode == enumDetailMode.Update) { using (Database db = new Database(GlobalVar.DBName)) { if (_isFromPiutang == false) { BKM.UpdateBuktiDetail(db, _rowIDDetail, tbUraian.NoPerkiraan, tbUraian.NamaPerkiraan, tbJumlah.Text); frmBKMBrowse frm = new frmBKMBrowse(); frm = (frmBKMBrowse)this.Caller; frm.HeaderRowRefresh(_rowID); frm.DetailRowRefresh(_rowIDDetail); frm.FindRowDetail("RowIDD", _rowIDDetail.ToString()); } else { BKM.UpdateBuktiDetail(db, _rowIDDetail, tbUraian.NoPerkiraan, tbUraian.NamaPerkiraan, tbJumlah.Text); BKM.UpdatePinjamanPegawai(db, _rowID, _recordID, _Nip, _Tanggal, "BKM", _noBukti, tbUraian.NamaPerkiraan, string.Empty, _jp); 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()); } tbUraian.NamaPerkiraan = ""; tbUraian.NoPerkiraan = "?"; tbJumlah.Text = "0"; DetailRowRefresh(_rowIDDetail); refreshTerbilang(); gbBKMUpdate.Enabled = true; gbUpdateDetailBKM.Visible = false; } } } catch (Exception ex) { Error.LogError(ex); } } else { MessageBox.Show("Nomor Perkiraan harus diisi"); return; } }
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, ""); } }
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); } } } }
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); } } }